linux psr状态,CPSR(当前程序状态寄存器)&SPSR(备份程序状态寄存器)(续)

2.4:ARM进入异常的行为

When handling an exception, the ARM720T processor behaves as follows:

当处理一个异常时,arm720T(arm9,10,11同)有下列行为:

It preserves the address of the next instruction in the appropriate LR.

保存下一条指令地址到LR(链接寄存器)。

It copies the CPSR into the appropriate SPSR.

复制CPSR到SPSR寄存器

It forces the CPSR mode bits to a value that depends on the exception.

根据当前异常模式强制CPSR 模式位设置到一个对应值

翻译整理:下家山(索漫科技培训教材 转载请注明)http://www.xiajiashan.com

4. It forces the PC to fetch the next instruction from the relevant exception vector.

迫使PC获取该异常向量的下一条要执行的指令

It can also set the interrupt disable flags to prevent otherwise unmanageable nestings of

exceptions.

它也能设置中断使能标志来预防其他未知的异常

2.4:ARM退出异常的行为

On completion, the exception handler:

在完成异常处理后:arm将做如下处理

1. Moves the LR, minus an offset where appropriate, to the PC. The offset varies

depending on the type of exception.

移动LR里面保存的地址到PC,以使代码能正常返回到发生异常的地方继续执行。

2. Copies the SPSR back to the CPSR.

拷贝SPSR到CPSR。

Clears the interrupt disable flags, if they were set on entry.

清楚中断标志位

=======================================================================================

By 下家山 Q群 75303301 上海松江文汇路928号258室 松江大学城

上海索漫科技 http://www.xiajiashan.com 专注嵌入式(ARM7,Cortex-M0,Cortex-M3,ARM9,linux)培训

三:实例讲解

3.1程序最初的模式和状态

8633765536_TIME_1343460916346.jpg

3.2设置管理模式后的状态变化

;Build the SVC stack

;设置管理模式堆栈

MSR CPSR_c, #0xd3

LDR SP, StackSvc

8633765536_TIME_1343460967939.jpg

2.3 设置IRQ中断模式后的状态变化

;Build the IRQ stack

;设置中断模式堆栈

MSR CPSR_c, #0xd2

LDR SP, StackIrq

8633765536_TIME_1343461016293.jpg

3.4 设置快速中断模式后的状态变化

;Build the FIQ stack

;设置快速中断模式堆栈

MSR CPSR_c, #0xd1

LDR SP, StackFiq

8633765536_TIME_1343461055678.jpg

3.5 设置中止模式后的状态变化

;Build the DATAABORT stack

;设置中止模式堆栈

MSR CPSR_c, #0xd7

LDR SP, StackAbt

8633765536_TIME_1343461099146.jpg

3.6 设置未定义模式后的状态变化

;Build the UDF stack

;设置未定义模式堆栈

MSR CPSR_c, #0xdb

LDR SP, StackUnd

8633765536_TIME_1343461143026.jpg

3.7 设置系统模式后的状态变化

;Build the SYS stack

;设置系统模式堆栈

MSR CPSR_c, #0xdf

LDR SP, =StackSys

8633765536_TIME_1343461191519.jpg

3.8 思考问题

在上述过程中,为什么SPSR的值一值是nzcvqift_User?????

3.9 思考问题

当设置系统模式的时候,为什么SPSR显示Unavailable?????

3.a 思考问题

上述过程中,为什么没有设置用户模式????

翻译整理:下家山(上海索漫科技培训教材 转载请注明)http://www.xiajiashan.com

2012-6-19

写于上海松江

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值