2.5.3.7.2 Exception Return

Exception return occurs when the processor is in Handler mode and execution of one of the following instructions attempts to set the PC to an EXC_RETURN value:

  • An LDM or POP instruction that loads the PC
  • An LDR instruction with PC as the destination
  • A BX instruction using any register

The processor saves an EXC_RETURN value to the LR on exception entry. The exception mechanism relies on this value to detect when the processor has completed an exception handler. Bits[31:4] of an EXC_RETURN value are 0xFFFFFFF.

When the processor loads a value matching this pattern to the PC it detects that the operation is a not a normal branch operation and, instead, that the exception is complete. Therefore, it starts the exception return sequence. Bits[3:0] of the EXC_RETURN value indicate the required return stack and processor mode, as noted in the following table.

Table 2-17. Exception Return Behavior
EXC_RETURNDescription
0xFFFFFFF1
  • Return to Handler mode
  • Exception return gets state from the main stack
  • Execution uses MSP after return
0xFFFFFFF9
  • Return to Thread mode
  • Exception Return get state from the main stack
  • Execution uses MSP after return
0xFFFFFFFD
  • Return to Thread mode
  • Exception return gets state from the process stack
  • Execution uses PSP after return
All other valuesReserved