加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Java > 正文

程序集 – 返回中断处理程序后程序计数器的位置?

发布时间:2020-12-15 04:25:56 所属栏目:Java 来源:网络整理
导读:嗨我想知道当程序从中断服务程序返回时程序计数器在哪里?我知道当中断事件发生时,PC被推入堆栈.但是什么地址被推入堆栈的下一个或同一个(只执行一个)?当我们有 first instruction;interrupt event here;go inside the ISR;exit ISR;second instruction; 要
嗨我想知道当程序从中断服务程序返回时程序计数器在哪里?我知道当中断事件发生时,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 
...

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读