4.1.2. Stack pointer

In the ARMv8 architecture, the choice of stack pointer to use is separated to some extent from the Exception level. By default, taking an exception selects the stack pointer for the target Exception level, SP_ELn. For example, taking an exception to EL1 selects SP_EL1. Each Exception level has its own stack pointer, SP_EL0, SP_EL1, SP_EL2, and SP_EL3. When in AArch64 at an Exception level other than EL0, the processor can use either:

EL0 can only ever access SP_EL0.

Table 4.3. AArch64 Stack pointer options

Exception level Options
EL1EL1t, EL1h
EL2EL2t, EL2h
EL3EL3t, EL3h

The t suffix indicates that the SP_EL0 stack pointer is selected. The h suffix indicates that the SP_ELn stack pointer is selected.

The SP cannot be referenced by most instructions. However, some forms of arithmetic instructions, for example, the ADD instruction, can read and write to the current stack pointer to adjust the stack pointer in a function. For example:

  ADD SP, SP, #0x10      // Adjust SP to be 0x10 bytes before its current value
Copyright © 2015 ARM. All rights reserved.ARM DEN0024A