The exception return instruction of a handler loads the PC with the EXC_RETURN value that was present in LR on entry to an exception handler. This indicates to the processor that the exception is complete and the processor initiates the exception exit sequence. See Returning the processor from an exception for the instructions that you can use to return from an exception.
When returning from an exception, the processor is either:
returning to the last stacked exception
returning to Thread mode if there are no stacked exceptions.
Table 4.4 describes the postamble sequence.
|Select SP||Sets CONTROL based on EXC_RETURN.|
|Pop eight registers|
Pops R0, R1, R2, R3, R12, LR, PC, and xPSR from stack selected by EXC_RETURN.
The value of xPSR[5:0] loaded off the stack determines the exception number that defines the priority of the thread to be returned to.
The value of EXC_RETURN determines which mode is returned to.