Registers in AArch64 state
ARM® processors provide general-purpose and special-purpose registers. Some additional registers are available in privileged execution modes.
In AArch64 state, the following registers are available:
- Thirty-one 64-bit general-purpose registers X0-X30, the bottom halves of which are accessible as W0-W30.
- Four stack pointer registers SP_EL0, SP_EL1, SP_EL2, SP_EL3.
- Three exception link registers ELR_EL1, ELR_EL2, ELR_EL3.
- Three saved program status registers SPSR_EL1, SPSR_EL2, SPSR_EL3.
- One program counter.
All these registers are 64 bits wide except SPSR_EL1, SPSR_EL2, and SPSR_EL3, which are 32 bits wide.
Most A64 integer instructions can operate on either 32-bit
or 64-bit registers. The register width is determined by the register
identifier, where W means 32-bit and X means 64-bit. The names W
n is in the range 0-30, refer
to the same register. When you use the 32-bit form of an instruction,
the upper 32 bits of the source registers are ignored and the upper
32 bits of the destination register are set to zero.
There is no register named W31 or X31. Depending on the instruction, register 31 is either the stack pointer or the zero register. When used as the stack pointer, you refer to it as SP. When used as the zero register, you refer to it as WZR in a 32-bit context or XZR in a 64-bit context.