You copied the Doc URL to your clipboard.

4.6.1. Returning the processor from an exception

Exception returns occur when one of the following instructions executed in Handler mode loads a value of 0xFXXXXXXX into the PC:

  • POP that includes loading the PC

  • BX with any register.

When used in this way, the value written to the PC is intercepted and is referred to as the EXC_RETURN value. Table 4.5 lists the EXC_RETURN[3:0] values with a description of the exception return behavior.

Exception return behavior
EXC_RETURN[3:0]Description
0bXXX0Reserved.
0b0001

Return to Handler mode.

Exception return gets state from the main stack.

Execution uses SP_Main after return.

0b0011Reserved.
0b01X1Reserved.
0b1001

Return to Thread mode.

Exception return gets state from the main stack.

Execution uses SP_Main after return.

0b1101

Return to Thread mode.

Exception return gets state from the process stack.

Execution uses SP_Process after return.

0b1X11Reserved.

If an EXC_RETURN value is loaded into the PC when in Thread mode, or from the vector table, or by any other instruction, the value is treated as an address, not as a special value. This address range is defined to have Execute Never (XN) permissions and results in a Hard Fault.

Note

Exception handlers must preserve the value of EXC_RETURN[28:4] or write them as all ones (1s).