ARM处理器模式切换(含MRS,MSR指令)

stack_init                                                            ; 栈指针初始化函数

    @ undefine_stack                                       

    msr cpsr_c #0xdb                                   ; 切换到未定义异常

    ldr        sp =0x34000000                        ; 栈指针为内存最高地址栈为倒生的栈

                                                                            ; 栈空间的最后1M 0x34000000~0x33f00000

    @ abort_stack                                                      

    msr cpsr_c #0xd7                                   ; 切换到终止异常模式

    ldr        sp =0x33f00000                         ; 栈空间为1M0x33f00000~0x33e00000

    @ irq_stack                                                

    msr      cpsr_c    #0xd2                           ; 切换到中断模式

    ldr        sp =0x33e00000                        ; 栈空间为1M0x33e00000~0x33d00000

    @ sys_stack                                               

    msr      cpsr_c    #0xdf                                     ; 切换到系统模式

    ldr        sp =0x33d00000                        ; 栈空间为1M0x33d00000~0x33c00000

    msr      cpsr_c    #0xd3                            ; 切换回管理模式

    mov pc lr

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wwgjpf.html