Home > other >  Arm of sp, lr
Arm of sp, lr

Time:10-10

(learning) from https://blog.csdn.net/allan0508/article/details/52624618
1, r13 stack pointer (SP) : abnormal each mode has its own independent r13, it usually refers to stack used by abnormal patterns, that is to say, five kinds of abnormal patterns, the anomaly model (user mode and system mode), have their own independent stack, use different stack pointer to the index, so that when the ARM into the anomaly pattern, the program can generally general-purpose registers onto the stack, return stack, ensure the integrity of the various program state mode,

2, connect r14 register (LR) : r14 each mode has its own version of group, it has two special features,

(1) save the subroutine return addresses, use the BL or BLX, jump instruction automatic put the return address in r14; Subroutine implementation returns through the r14 is copied to the PC, usually with one of the following instructions:
MOV PC, LR
BX LR

Usually subroutine writes, to ensure the subroutine also can call subroutine,
STMFD sp! , {lr}
.
LDMFD sp! }, {PC

(2) when an exception occurs, the anomaly model r14 used to save abnormal return address, and will r14 such as stack can handle nested interrupt,

CodePudding user response:

Uh, uh,,, hair wrong from here

CodePudding user response:

Lr jump back in, sp cache current state