Stack Pointer register
In AArch64 state, SP represents the 64-bit Stack Pointer. SP_EL0 is an alias for SP. Do not use SP as a general purpose register.
You can only use SP as an operand in the following instructions:
- As the base register for loads and stores. In this case it must be quadword-aligned before adding any offset, or a stack alignment exception occurs.
- As a source or destination for arithmetic instructions, but it cannot be used as the destination in instructions that set the condition flags.
- In logical instructions, for example in order to align it.
There is a separate stack pointer for each of the three exception levels, SP_EL1, SP_EL2, and SP_EL3. Within an exception level you can either use the dedicated stack pointer for that exception level or you can use SP_EL0, the stack pointer associated with EL0. You can use the SPSel register to select which stack pointer to use in the exception level.
The choice of stack pointer is indicated by the letter t or
h appended to the exception level name, for example EL0t or EL3h.
The t suffix indicates that the exception level uses SP_EL0 and
the h suffix indicates it uses SP_EL
the current exception level number. EL0 always uses SP_EL0 so cannot
have an h suffix.