SPSR_EL2, Saved Program Status Register (EL2)
The SPSR_EL2 characteristics are:
Purpose
Holds the saved process state when an exception is taken to EL2.
Configuration
AArch64 System register SPSR_EL2 bits [31:0] are architecturally mapped to AArch32 System register SPSR_hyp[31:0] .
This register has no effect if EL2 is not enabled in the current Security state.
Attributes
SPSR_EL2 is a 64-bit register.
Field descriptions
The SPSR_EL2 bit assignments are:
When AArch32 is supported at any Exception level and exception taken from AArch32 state:
An exception return from EL2 using AArch64 makes SPSR_EL2 become UNKNOWN.
Bits [63:32]
Reserved, RES0.
N, bit [31]
Negative Condition flag. Set to the value of PSTATE.N on taking an exception to EL2, and copied to PSTATE.N on executing an exception return operation in EL2.
On a Warm reset, this field resets to an architecturally UNKNOWN value.
Z, bit [30]
Zero Condition flag. Set to the value of PSTATE.Z on taking an exception to EL2, and copied to PSTATE.Z on executing an exception return operation in EL2.
On a Warm reset, this field resets to an architecturally UNKNOWN value.
C, bit [29]
Carry Condition flag. Set to the value of PSTATE.C on taking an exception to EL2, and copied to PSTATE.C on executing an exception return operation in EL2.
On a Warm reset, this field resets to an architecturally UNKNOWN value.
V, bit [28]
Overflow Condition flag. Set to the value of PSTATE.V on taking an exception to EL2, and copied to PSTATE.V on executing an exception return operation in EL2.
On a Warm reset, this field resets to an architecturally UNKNOWN value.
Q, bit [27]
Overflow or saturation flag. Set to the value of PSTATE.Q on taking an exception to EL2, and copied to PSTATE.Q on executing an exception return operation in EL2.
On a Warm reset, this field resets to an architecturally UNKNOWN value.
IT[1:0], bits [26:25]
If-Then. Set to the value of PSTATE.IT[1:0] on taking an exception to EL2, and copied to PSTATE.IT[1:0] on executing an exception return operation in EL2.
On executing an exception return operation in EL2 SPSR_EL2.IT must contain a value that is valid for the instruction being returned to.
On a Warm reset, this field resets to an architecturally UNKNOWN value.
DIT, bit [24]
When FEAT_DIT is implemented:
When FEAT_DIT is implemented:
Data Independent Timing. Set to the value of PSTATE.DIT on taking an exception to EL2, and copied to PSTATE.DIT on executing an exception return operation in EL2.
On a Warm reset, this field resets to an architecturally UNKNOWN value.
Otherwise:
Otherwise:
Reserved, RES0.
SSBS, bit [23]
When FEAT_SSBS is implemented:
When FEAT_SSBS is implemented:
Speculative Store Bypass. Set to the value of PSTATE.SSBS on taking an exception to EL2, and copied to PSTATE.SSBS on executing an exception return operation in EL2.
On a Warm reset, this field resets to an architecturally UNKNOWN value.
Otherwise:
Otherwise:
Reserved, RES0.
PAN, bit [22]
When FEAT_PAN is implemented:
When FEAT_PAN is implemented:
Privileged Access Never. Set to the value of PSTATE.PAN on taking an exception to EL2, and copied to PSTATE.PAN on executing an exception return operation in EL2.
On a Warm reset, this field resets to an architecturally UNKNOWN value.
Otherwise:
Otherwise:
Reserved, RES0.
SS, bit [21]
Software Step. Set to the value of PSTATE.SS on taking an exception to EL2, and conditionally copied to PSTATE.SS on executing an exception return operation in EL2.
On a Warm reset, this field resets to an architecturally UNKNOWN value.
IL, bit [20]
Illegal Execution state. Set to the value of PSTATE.IL on taking an exception to EL2, and copied to PSTATE.IL on executing an exception return operation in EL2.
On a Warm reset, this field resets to an architecturally UNKNOWN value.
GE, bits [19:16]
Greater than or Equal flags. Set to the value of PSTATE.GE on taking an exception to EL2, and copied to PSTATE.GE on executing an exception return operation in EL2.
On a Warm reset, this field resets to an architecturally UNKNOWN value.
IT[7:2], bits [15:10]
If-Then. Set to the value of PSTATE.IT[7:2] on taking an exception to EL2, and copied to PSTATE.IT[7:2] on executing an exception return operation in EL2.
SPSR_EL2.IT must contain a value that is valid for the instruction being returned to.
On a Warm reset, this field resets to an architecturally UNKNOWN value.
E, bit [9]
Endianness. Set to the value of PSTATE.E on taking an exception to EL2, and copied to PSTATE.E on executing an exception return operation in EL2.
If the implementation does not support big-endian operation, SPSR_EL2.E is RES0. If the implementation does not support little-endian operation, SPSR_EL2.E is RES1. On executing an exception return operation in EL2, if the implementation does not support big-endian operation at the Exception level being returned to, SPSR_EL2.E is RES0, and if the implementation does not support little-endian operation at the Exception level being returned to, SPSR_EL2.E is RES1.
On a Warm reset, this field resets to an architecturally UNKNOWN value.
A, bit [8]
SError interrupt mask. Set to the value of PSTATE.A on taking an exception to EL2, and copied to PSTATE.A on executing an exception return operation in EL2.
On a Warm reset, this field resets to an architecturally UNKNOWN value.
I, bit [7]
IRQ interrupt mask. Set to the value of PSTATE.I on taking an exception to EL2, and copied to PSTATE.I on executing an exception return operation in EL2.
On a Warm reset, this field resets to an architecturally UNKNOWN value.
F, bit [6]
FIQ interrupt mask. Set to the value of PSTATE.F on taking an exception to EL2, and copied to PSTATE.F on executing an exception return operation in EL2.
On a Warm reset, this field resets to an architecturally UNKNOWN value.
T, bit [5]
T32 Instruction set state. Set to the value of PSTATE.T on taking an exception to EL2, and copied to PSTATE.T on executing an exception return operation in EL2.
On a Warm reset, this field resets to an architecturally UNKNOWN value.
M[4], bit [4]
Execution state. Set to 0b1, the value of PSTATE.nRW, on taking an exception to EL2 from AArch32 state, and copied to PSTATE.nRW on executing an exception return operation in EL2.
M[4] | Meaning |
---|---|
0b1 |
AArch32 execution state. |
On a Warm reset, this field resets to an architecturally UNKNOWN value.
M[3:0], bits [3:0]
AArch32 Mode. Set to the value of PSTATE.M[3:0] on taking an exception to EL2, and copied to PSTATE.M[3:0] on executing an exception return operation in EL2.
M[3:0] | Meaning |
---|---|
0b0000 |
User. |
0b0001 |
FIQ. |
0b0010 |
IRQ. |
0b0011 |
Supervisor. |
0b0111 |
Abort. |
0b1010 |
Hyp. |
0b1011 |
Undefined. |
0b1111 |
System. |
Other values are reserved. If SPSR_EL2.M[3:0] has a Reserved value, or a value for an unimplemented Exception level, executing an exception return operation in EL2 is an illegal return event, as described in 'Illegal return events from AArch64 state'.
On a Warm reset, this field resets to an architecturally UNKNOWN value.
When exception taken from AArch64 state:
An exception return from EL2 using AArch64 makes SPSR_EL2 become UNKNOWN.
Bits [63:33]
Reserved, RES0.
CSR, bit [32]
When FEAT_CSRE is implemented:
When FEAT_CSRE is implemented:
Call Stack Recording. Set to the value of PSTATE.CSR on taking an exception to EL2, and copied to PSTATE.CSR on executing an exception return operation in EL2.
On a Warm reset, this field resets to an architecturally UNKNOWN value.
Otherwise:
Otherwise:
Reserved, RES0.
N, bit [31]
Negative Condition flag. Set to the value of PSTATE.N on taking an exception to EL2, and copied to PSTATE.N on executing an exception return operation in EL2.
On a Warm reset, this field resets to an architecturally UNKNOWN value.
Z, bit [30]
Zero Condition flag. Set to the value of PSTATE.Z on taking an exception to EL2, and copied to PSTATE.Z on executing an exception return operation in EL2.
On a Warm reset, this field resets to an architecturally UNKNOWN value.
C, bit [29]
Carry Condition flag. Set to the value of PSTATE.C on taking an exception to EL2, and copied to PSTATE.C on executing an exception return operation in EL2.
On a Warm reset, this field resets to an architecturally UNKNOWN value.
V, bit [28]
Overflow Condition flag. Set to the value of PSTATE.V on taking an exception to EL2, and copied to PSTATE.V on executing an exception return operation in EL2.
On a Warm reset, this field resets to an architecturally UNKNOWN value.
Bits [27:26]
Reserved, RES0.
TCO, bit [25]
When FEAT_MTE is implemented:
When FEAT_MTE is implemented:
Tag Check Override. Set to the value of PSTATE.TCO on taking an exception to EL2, and copied to PSTATE.TCO on executing an exception return operation in EL2.
On a Warm reset, this field resets to an architecturally UNKNOWN value.
Otherwise:
Otherwise:
Reserved, RES0.
DIT, bit [24]
When FEAT_DIT is implemented:
When FEAT_DIT is implemented:
Data Independent Timing. Set to the value of PSTATE.DIT on taking an exception to EL2, and copied to PSTATE.DIT on executing an exception return operation in EL2.
On a Warm reset, this field resets to an architecturally UNKNOWN value.
Otherwise:
Otherwise:
Reserved, RES0.
UAO, bit [23]
When FEAT_UAO is implemented:
When FEAT_UAO is implemented:
User Access Override. Set to the value of PSTATE.UAO on taking an exception to EL2, and copied to PSTATE.UAO on executing an exception return operation in EL2.
On a Warm reset, this field resets to an architecturally UNKNOWN value.
Otherwise:
Otherwise:
Reserved, RES0.
PAN, bit [22]
When FEAT_PAN is implemented:
When FEAT_PAN is implemented:
Privileged Access Never. Set to the value of PSTATE.PAN on taking an exception to EL2, and copied to PSTATE.PAN on executing an exception return operation in EL2.
On a Warm reset, this field resets to an architecturally UNKNOWN value.
Otherwise:
Otherwise:
Reserved, RES0.
SS, bit [21]
Software Step. Set to the value of PSTATE.SS on taking an exception to EL2, and conditionally copied to PSTATE.SS on executing an exception return operation in EL2.
On a Warm reset, this field resets to an architecturally UNKNOWN value.
IL, bit [20]
Illegal Execution state. Set to the value of PSTATE.IL on taking an exception to EL2, and copied to PSTATE.IL on executing an exception return operation in EL2.
On a Warm reset, this field resets to an architecturally UNKNOWN value.
Bits [19:13]
Reserved, RES0.
SSBS, bit [12]
When FEAT_SSBS is implemented:
When FEAT_SSBS is implemented:
Speculative Store Bypass. Set to the value of PSTATE.SSBS on taking an exception to EL2, and copied to PSTATE.SSBS on executing an exception return operation in EL2.
On a Warm reset, this field resets to an architecturally UNKNOWN value.
Otherwise:
Otherwise:
Reserved, RES0.
BTYPE, bits [11:10]
When FEAT_BTI is implemented:
When FEAT_BTI is implemented:
Branch Type Indicator. Set to the value of PSTATE.BTYPE on taking an exception to EL2, and copied to PSTATE.BTYPE on executing an exception return operation in EL2.
On a Warm reset, this field resets to an architecturally UNKNOWN value.
Otherwise:
Otherwise:
Reserved, RES0.
D, bit [9]
Debug exception mask. Set to the value of PSTATE.D on taking an exception to EL2, and copied to PSTATE.D on executing an exception return operation in EL2.
On a Warm reset, this field resets to an architecturally UNKNOWN value.
A, bit [8]
SError interrupt mask. Set to the value of PSTATE.A on taking an exception to EL2, and copied to PSTATE.A on executing an exception return operation in EL2.
On a Warm reset, this field resets to an architecturally UNKNOWN value.
I, bit [7]
IRQ interrupt mask. Set to the value of PSTATE.I on taking an exception to EL2, and copied to PSTATE.I on executing an exception return operation in EL2.
On a Warm reset, this field resets to an architecturally UNKNOWN value.
F, bit [6]
FIQ interrupt mask. Set to the value of PSTATE.F on taking an exception to EL2, and copied to PSTATE.F on executing an exception return operation in EL2.
On a Warm reset, this field resets to an architecturally UNKNOWN value.
Bit [5]
Reserved, RES0.
M[4], bit [4]
Execution state. Set to 0b0, the value of PSTATE.nRW, on taking an exception to EL2 from AArch64 state, and copied to PSTATE.nRW on executing an exception return operation in EL2.
M[4] | Meaning |
---|---|
0b0 |
AArch64 execution state. |
On a Warm reset, this field resets to an architecturally UNKNOWN value.
M[3:0], bits [3:0]
AArch64 Exception level and selected Stack Pointer.
M[3:0] | Meaning |
---|---|
0b0000 |
EL0t. |
0b0100 |
EL1t. |
0b0101 |
EL1h. |
0b1000 |
EL2t. |
0b1001 |
EL2h. |
Other values are reserved. If SPSR_EL2.M[3:0] has a Reserved value, or a value for an unimplemented Exception level, executing an exception return operation in EL2 is an illegal return event, as described in 'Illegal return events from AArch64 state'.
The bits in this field are interpreted as follows:
- M[3:2] is set to the value of PSTATE.EL on taking an exception to EL2 and copied to PSTATE.EL on executing an exception return operation in EL2.
- M[1] is unused and is 0 for all non-reserved values.
- M[0] is set to the value of PSTATE.SP on taking an exception to EL2 and copied to PSTATE.SP on executing an exception return operation in EL2
On a Warm reset, this field resets to an architecturally UNKNOWN value.
Accessing the SPSR_EL2
When HCR_EL2.E2H is 1, without explicit synchronization, access from EL2 using the mnemonic SPSR_EL2 or SPSR_EL1 are not guaranteed to be ordered with respect to accesses using the other mnemonic.
Accesses to this register use the following encodings:
MRS <Xt>, SPSR_EL2
op0 | op1 | CRn | CRm | op2 |
---|---|---|---|---|
0b11 | 0b100 | 0b0100 | 0b0000 | 0b000 |
if PSTATE.EL == EL0 then UNDEFINED; elsif PSTATE.EL == EL1 then if EL2Enabled() && HCR_EL2.<NV2,NV> == '11' then return SPSR_EL1; elsif EL2Enabled() && HCR_EL2.NV == '1' then AArch64.SystemAccessTrap(EL2, 0x18); else UNDEFINED; elsif PSTATE.EL == EL2 then return SPSR_EL2; elsif PSTATE.EL == EL3 then return SPSR_EL2;
MSR SPSR_EL2, <Xt>
op0 | op1 | CRn | CRm | op2 |
---|---|---|---|---|
0b11 | 0b100 | 0b0100 | 0b0000 | 0b000 |
if PSTATE.EL == EL0 then UNDEFINED; elsif PSTATE.EL == EL1 then if EL2Enabled() && HCR_EL2.<NV2,NV> == '11' then SPSR_EL1 = X[t]; elsif EL2Enabled() && HCR_EL2.NV == '1' then AArch64.SystemAccessTrap(EL2, 0x18); else UNDEFINED; elsif PSTATE.EL == EL2 then SPSR_EL2 = X[t]; elsif PSTATE.EL == EL3 then SPSR_EL2 = X[t];
MRS <Xt>, SPSR_EL1
op0 | op1 | CRn | CRm | op2 |
---|---|---|---|---|
0b11 | 0b000 | 0b0100 | 0b0000 | 0b000 |
if PSTATE.EL == EL0 then UNDEFINED; elsif PSTATE.EL == EL1 then if EL2Enabled() && HCR_EL2.<NV2,NV1> == '01' then AArch64.SystemAccessTrap(EL2, 0x18); elsif EL2Enabled() && HCR_EL2.<NV2,NV1,NV> == '111' then return NVMem[0x160]; else return SPSR_EL1; elsif PSTATE.EL == EL2 then if HCR_EL2.E2H == '1' then return SPSR_EL2; else return SPSR_EL1; elsif PSTATE.EL == EL3 then return SPSR_EL1;
MSR SPSR_EL1, <Xt>
op0 | op1 | CRn | CRm | op2 |
---|---|---|---|---|
0b11 | 0b000 | 0b0100 | 0b0000 | 0b000 |
if PSTATE.EL == EL0 then UNDEFINED; elsif PSTATE.EL == EL1 then if EL2Enabled() && HCR_EL2.<NV2,NV1> == '01' then AArch64.SystemAccessTrap(EL2, 0x18); elsif EL2Enabled() && HCR_EL2.<NV2,NV1,NV> == '111' then NVMem[0x160] = X[t]; else SPSR_EL1 = X[t]; elsif PSTATE.EL == EL2 then if HCR_EL2.E2H == '1' then SPSR_EL2 = X[t]; else SPSR_EL1 = X[t]; elsif PSTATE.EL == EL3 then SPSR_EL1 = X[t];