嗨我想知道当程序从中断服务程序返回时程序计数器在哪里?我知道当中断事件发生时,PC被推入堆栈.但是什么地址被推入堆栈的下一个或同一个(只执行一个)?当我们有
first instruction; interrupt event here; go inside the ISR; exit ISR; second instruction;
要么
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 ...
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。