【发布时间】:2014-12-30 03:34:24
【问题描述】:
在启动玩具内核时,我使用此代码切换到用户模式:
mrs r1, CPSR @ Switch to System mode
orr r1, r1, #0xc
msr CPSR, r1
ldr sp, =gUsrStackBase @ Setup USR stack (shared with System mode)
mov r1, #0x10 @ Get user-mode CPSR into SPSR
msr SPSR, r1
movs pc, r0 @ Switch to USR mode and branch
但是在movs 指令之后,CPSR 中出现了随机垃圾,而不是我设置的用户模式 CPSR 值 (0x10)。为什么会这样?
【问题讨论】:
标签: assembly embedded arm kernel