ARM. Access user R13 and R14 from Supervisor mode

后端 未结 2 1316
太阳男子
太阳男子 2021-01-05 05:42

How do I access the user R13 and R14 which are saved when supervisor mode is entered? I am using an ARM7TDMI.

I.E. I do not want to access supervisor R14 which now

2条回答
  •  生来不讨喜
    2021-01-05 06:09

    I've discovered a better way: -

    When doing a STM, if r15 isn't one of the operands then ^ gives access to user-mode registers. However, autoincrementing doesn't seem to work within the instruction, and a nop is required afterwards if you want to access the register bank.

    Something like

    stmfd r13, {r13-r14}^ ;store r13 and r14 usermode
    nop
    sub r13, r13, #8      ;update stack pointer
    

提交回复
热议问题