当中断发生时,x86架构中会发生什么?

发布于 2024-09-03 10:07:23 字数 59 浏览 4 评论 0原文

我正在研究x86和实时系统,我有一个问题,那就是:

x86遵循哪些步骤来处理任何中断?

I'm studying x86 and Real Time Systems, and I have a question, that is:

Which steps x86 follows to handle any interrupt ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

流殇 2024-09-10 10:07:23

当中断发生时,CPU 会执行以下操作:

  • 将当前地址(指令指针的内容)压入堆栈;另外,压入处理器标志(但不是所有其他处理器寄存器)
  • 跳转到 ISR(中断服务例程)的地址,该地址在中断描述符表中指定。

ISR 应执行以下操作:

  • 压入要更改的任何寄存器(或压入所有寄存器)
  • 处理中断
  • 重新启用中断
  • 弹出它压入的任何寄存器
  • 使用 IRET 指令,该指令从堆栈中弹出 CPU 标志和指令指针值(从而返回到中断发生时正在执行的任何操作)。

When an interrupt occurs, the CPU does the following:

  • Push the current address (contents of the Instruction Pointer) onto the stack; also, push the processor flags (but not all the other processor registers)
  • Jump to the address of the ISR (Interrupt Service Routine), which is specified in the Interrupt Descriptor Table.

The ISR should do the following:

  • Push any registers which it intends to alter (or, push all registers)
  • Handle the interrupt
  • Reenable interrupts
  • Pop any registers which it pushed
  • Use the IRET instructions, which pops the CPU flags and Instruction Pointer value from the stack (and thus returns to whatever was executing when the interrupt occured).
辞别 2024-09-10 10:07:23

中断描述符表开始。基本上,当发生中断时,流控制跳转到该表,然后跳转到该表中的任何内容。另外,我相信一旦中断发生,所有寄存器都会被推送,但我不能 100% 确定这一点,因为自从我处理这个问题以来已经很长很长一段时间了。

Start here with the Interrupt Descriptor Table. Basically, when an interrupt occurs, flow control jumps to this table and then on to whatever is in this table. Also, I believe all registers are pushed as soon as the interrupt occurs, but I'm not 100% certain of this as it's been a long, long time since I've dealt with this.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文