STMFD / LDMFD没有恢复寄存器值?

时间:2015-03-20 00:30:31

标签: assembly arm

为什么寄存器r5没有恢复到下面代码中的原始值?它被设置为#14,然后在子程序中被修改,当子程序完成时,r5中的值被设置为0。

        mov r5, #14
        bl func ; Call subroutine func so that it can execute the calculations required.

endless b endless ;End the program after the subroutine completes.

func    STMFD sp!,{r5-r7} ;Save working registers in a safe place while the subroutine uses them for calculations.
        mov r5, #66
        add r0, r0, r1 ;Subroutine code.

        LDMFD sp!,{r5-r7}
        mov pc, lr ;Return from subroutine.

0 个答案:

没有答案