5.4. Privilege and stacks

The processor supports two separate stacks:

Process stack

You can configure Thread mode to use the process stack. Thread mode uses the main stack out of reset. SP_process is the Stack Pointer (SP) register for the process stack.

Main stack

Handler mode uses the main stack. SP_main is the SP register for the main stack.

Only one stack, the process stack or the main stack, is visible at any time. After pushing the eight registers, the ISR uses the main stack, and all subsequent interrupt pre-emptions use the main stack. The stack that saves context is as follows:

Using the process stack for the Thread mode and the main stack for exceptions supports Operating System (OS) scheduling. To reschedule, the kernel only requires to save the eight registers not pushed by hardware, r4-r11, and to copy SP_process into the Thread Control Block (TCB). If the processor saved the context on the main stack, the kernel would have to copy the 16 registers to the TCB.

Note

MSR and MRS instructions have visibility of both stacks.

Copyright © 2005, 2006 ARM Limited. All rights reserved.ARM DDI 0337E
Non-Confidential