ARM 汇编指令

LDMIA

ldmia sp,{fp,ip,pc}

/*
假设sp=4080
1.先读fp = 4080~4083的值
2.sp = 4080 + 4 = 4084
3.先读ip = 4084~4087的值
4.ip = 4084 + 4 = 4088
5.先读pc = 4087~4091的值
6.pc = 4088 + 4 = 4092
注:fp,ip,pc 高编号存放高地址(fp(R11),ip(R12),pc(R15))
SP后无感叹号,所以sp仍然为4080
*/

STMDB

stmdb sp!,{fp,ip,pc}

/*
假设sp=4096
1.先减sp = sp - 4 = 4092的值
2.再存:地址4092存pc的值
3.先减sp = sp - 4 = 4088的值
4.再存:地址4088存ip的值
5.先减sp = sp - 4 = 4084的值
6..再存:地址4084存fp的值
注:fp,ip,pc 高编号存放高地址(fp(R11),ip(R12),pc(R15))
SP后有感叹号,所以sp=4084
*/

注:ia 先存后加 db先减后存

你可能感兴趣的:(ARM 汇编指令)