srs

Store Return State

SRS<c> SP{!}, #<mode>

Stores LR and SPSR to the stack of a specific mode.

Details

Stores the Link Register (LR) and Saved Program Status Register (SPSR) of the current mode to the stack pointer of a specified processor mode. If write-back is enabled, the SP of the specified mode is updated. Requires privileged execution (not User mode). A32-only system instruction; no condition flags are modified and exception generation may occur if the target mode is invalid.

Pseudocode Operation

target_sp ← SPOfMode(mode)
if (P == 0) then address ← target_sp
else address ← target_sp - 8
if (U == 1) then address ← target_sp + offset else address ← target_sp - offset
[address] ← LR
[address + 4] ← SPSR
if (W == 1) then SPOfMode(mode) ← address + 8 else SPOfMode(mode) ← address

Example

SRS SP!, #ia

Encoding

Binary Layout
11111000
P
U
1
W
0
1101
00000
mode
 
Format System
Opcode 0xF8CD0500
Extension A32 (System)

Operands

  • mode
    Mode