| |||
| Home > Programmer’s Model > Registers > The ARM state register set | |||
In ARM state, 16 general registers, and one or two status registers are accessible at any one time. In privileged modes, mode-specific banked registers become available. Figure 2.3shows which registers are available in each mode.
The ARM state register set contains 16 directly-accessible registers, r0 to r15. An additional register, the Current Program Status Register (CPSR), contains condition code flags, and the current mode bits. Registers r0 to r13 are general-purpose registers used to hold either data or address values. Registers r14 and r15 have the following special functions:
Register 14 is used as the subroutine Link Register (LR).
r14 receives a copy of r15 when a Branch with Link (BL) instruction is executed.
At all other times you can treat r14 as a general-purpose register. The corresponding banked registers r14_svc, r14_irq, r14_fiq, r14_abt, and r14_und are similarly used to hold the return values of r15 when interrupts and exceptions arise, or when BL instructions are executed within interrupt or exception routines.
Register 15 holds the Program Counter (PC).
In ARM state, bits [1:0] of r15 are zero. Bits [31:2] contain the PC. In Thumb state, bit [0] is zero. Bits [31:1] contain the PC.
In privileged modes, another register, the Saved Program Status Register (SPSR), is accessible. This contains the condition code flags, and the mode bits saved as a result of the exception that caused entry to the current mode.
See The program status registers for a description of the program status registers.
Banked registers have a mode identifier that shows to which User mode register they are mapped. These mode identifiers are listed in Table 2‑1.
Table 2.1. Register mode identifiers
Mode | Mode identifier |
|---|---|
User | usr |
Fast interrupt | fiq |
Interrupt | irq |
Supervisor | svc |
Abort | abt |
System | sys |
Undefined | und |
FIQ mode has seven banked registers mapped to r8–r14 (r8_fiq–r14_fiq).
In ARM state, most of the FIQ handlers do not need to save any registers.
The User, IRQ, Supervisor, Abort, and undefined modes each have two banked registers mapped to r13 and r14, allowing a private stack pointer and LR for each mode
Figure 2.3 shows the ARM state registers.