eret
Exception Return (A32)
ERET
Returns from an exception (A32).
Details
Returns from an exception by restoring the PC from ELR_ELx and the PSTATE from SPSR_ELx. This instruction is unconditional and is only available in A32 AArch32 execution state. It requires privilege level sufficient to execute exception-handling code (typically EL1 or higher) and is used at the end of exception handlers.
Pseudocode Operation
PC ← ELR_ELx; PSTATE ← SPSR_ELx
Example
ERET
Encoding
Binary Layout
cond
00010110
0
0
0
0
0
0
0
0
0
0
0
0
0110
1
1
1
0
Operands
Reference (Arm AArch32 ISA)
Instruction Forms
| Encoding | Instruction | ISA | Bit pattern | ||
|---|---|---|---|---|---|
| 0x0160006E | ERET{<c>}{<q>} | A32 | cond | 00010110 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0110 | 1 | 1 | 1 | 0 | ||
| 0xF3DE8F00 | ERET{<c>}{<q>} | T32 | 111100111101 | 1110 | 10 | 0 | 0 | 1 | 1 | 1 | 1 | 00000000 |
Description
Exception Return.
The PE branches to the address held in the register holding the preferred return address, and restores PSTATE from SPSR_<current_mode>.
The register holding the preferred return address is:
The PE checks SPSR_<current_mode> for an illegal return event. See Illegal return events from AArch32 state.
Exception Return is constrained unpredictable in User mode and System mode.
In Debug state, the T1 encoding of ERET executes the DRPS operation.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
if !Halted() then
if PSTATE.M IN {M32_User,M32_System} then
UNPREDICTABLE; // UNDEFINED or NOP
else
new_pc_value = if PSTATE.EL == EL2 then ELR_hyp else R[14];
AArch32.ExceptionReturn(new_pc_value, SPSR[]);
else // Perform DRPS operation in Debug state
if PSTATE.M == M32_User then
UNDEFINED;
elsif PSTATE.M == M32_System then
UNPREDICTABLE; // UNDEFINED or NOP
else
SynchronizeContext();
DebugRestorePSR();