What happens in the x86 architecture when an interrupt occurs?

后端 未结 2 1018
再見小時候
再見小時候 2021-01-02 15:34

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

Which steps x86 follows to handle any interrupt ?

相关标签:
2条回答
  • 2021-01-02 16:09

    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).
    0 讨论(0)
  • 2021-01-02 16:22

    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.

    0 讨论(0)
提交回复
热议问题