9.2.2. Returning from an exception handler

The method used to return from an exception depends on whether the exception handler uses stack operations or not.

In both cases, to return execution to the place where the exception occurred an exception handler must:

For a simple return that does not require the destination mode registers to be restored from the stack, the exception handler carries out these two operations by performing a data processing instruction with:

The return instruction required depends on the type of exception. Refer to the following section for instructions on how to return from each exception type.

Note

You do not need to return from the reset handler because the reset handler should execute your main code directly.

If the exception handler entry code uses the stack to store registers that must be preserved while it handles the exception, it must return using a load multiple instruction with the ^ qualifier. For example, if an exception handler stores:

onto a full descending stack, it can return in one instruction using:

	LDMFD sp!,{r0-r12,pc}^

The ^ qualifier specifies that the CPSR is restored from the SPSR. It must be used only from a privileged mode. Refer to Implementing stacks with LDM and STM for more general information on stack operations.

Copyright © 1997, 1998 ARM Limited. All rights reserved.ARM DUI 0040D
Non-Confidential