Where the program counter goes after returning the interrupt handler?

前端 未结 4 1088
名媛妹妹
名媛妹妹 2020-12-18 11:59

Hi I am wondering where the program counter goes when the program returns from interrupt service routine? I know when the interrupt event occurs the PC is pushed into the st

4条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-18 12:13

    When an instruction is executing then the program counter keeps the address of the next instruction to be executed. When an interrupt occurs, then processor do the following:

    • Suspends the execution of the program being executed and save its context. This means it saves the address of the next instruction to be executed, i.e, the value of the program counter and other relevant data.

    • Update the program counter with the starting address of that interrupt handler routine.

    When the interrupt handler routine is completed, CPU can resume execution of the program at the point of interruption.

    enter image description here

    Interrupt is occurred at instruction i and after completion user program resumes its execution from i+1 instruction.

提交回复
热议问题