What happens in the x86 architecture when an interrupt occurs?

后端 未结 2 1039
再見小時候
再見小時候 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).

提交回复
热议问题