您好,我想知道当程序从中断服务程序返回时程序计数器去哪里?我知道当中断事件发生时PC被压入堆栈。但是下一个或同一个(刚刚执行的一个)被压入堆栈的地址是什么?当我们有
first instruction;
interrupt event here;
go inside the ISR;
exit ISR;
second instruction;
OR
first instruction;
interrupt event here;
go inside the ISR
exit ISR;
first instruction;
我的意思是,PC 是指向 ISR 入口之前执行的指令,还是指向下一条指令(从 ISR 返回后)?
我希望你能明白。
由于只有在 CPU 处于精确的固定状态时才能处理中断,因此如果在指令中间引发中断,则在指令执行后将跳转到中断向量程序。
因此,当从中断过程返回时,PC 将指向第一条指令之后的指令。
first instruction fetch (PC is updated meanwhile)
first instruction decode
interrupt is raised
first instruction execution
** now and only now the CPU checks for a possible interrupt **
interrupt is present, pushing PC on stack and other things
jump to interrupt address
execution of interrupt
return from interrupt (pop of PC and other things)
second instruction fetch
...
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)