.text
.global _start
_start:
@满减压栈使用场景
ldr sp,=0x40000800
mov r0,#0x1
mov r1,#0x2
bl add1_func
add r0,r0,r1 @ r0 = r0 + r1 = 0x3
b stop
add1_func:
@ 压栈保存现场 r0 = 0x1 r1 = 0x2
stmfd sp!,{r0,r1,lr}
mov r0,#0x3
mov r1,#0x4
bl add2_func
add r0,r0,r1 @ r0 = r0 + r1 = 0x7
@ 出栈恢复现场 r0 = 0x1 r1 = 0x2
ldmfd sp!,{r0,r1,pc}
add2_func:
@ 压栈保存现场 r0 = 0x3 r1 = 0x4
stmfd sp!,{r0,r1}
mov r0,#0x5
mov r1,#0x6
add r0,r0,r1 @ r0 = r0 + r1 = 0xb
@ 出栈恢复现场 r0 = 0x3 r1 = 0x4
ldmfd sp!,{r0,r1}
mov pc,lr
stop:
b stop
.end
result