mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 00:14:22 +08:00
Revert "armv8-m: Fix EXC_RETURN for non-secure usage"
This reverts commit 2ecfddb430.
Change-Id: I9c01dc9b6eada54642787c8a3395cb32c8c4f7d4
Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
@@ -35,93 +35,66 @@
|
||||
* exception mechanism relies on this value to detect when the processor has
|
||||
* completed an exception handler.
|
||||
*
|
||||
* Bits [31:28] of an EXC_RETURN value are always 1. 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 [31:28] of an EXC_RETURN value are always 1. 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[6:0] of the EXC_RETURN value indicate the required return stack and
|
||||
* eventual processor mode.
|
||||
* The remaining bits of the EXC_RETURN value should be set to 1.
|
||||
* Bits[4:0] of the EXC_RETURN value indicate the required return stack and eventual
|
||||
* processor mode. The remaining bits of the EXC_RETURN value should be set to 1.
|
||||
*/
|
||||
|
||||
/* EXC_RETURN_BASE: Bits that are always set in an EXC_RETURN value. */
|
||||
|
||||
#define EXC_RETURN_BASE 0xffffff80
|
||||
#define EXC_RETURN_BASE 0xffffffe1
|
||||
|
||||
/* EXC_RETURN_EXC_SECURE: Exception Secure. The security domain the
|
||||
* exception was taken to. If this bit is clear non-secure, else secure.
|
||||
*/
|
||||
|
||||
#define EXC_RETURN_EXC_SECURE (1 << 0)
|
||||
|
||||
/* EXC_RETURN_PROCESS_STACK: The exception saved (and will restore) the
|
||||
* hardware context using the process stack pointer (if not set, the context
|
||||
* was saved using the main stack pointer)
|
||||
/* EXC_RETURN_PROCESS_STACK: The exception saved (and will restore) the hardware
|
||||
* context using the process stack pointer (if not set, the context was saved
|
||||
* using the main stack pointer)
|
||||
*/
|
||||
|
||||
#define EXC_RETURN_PROCESS_STACK (1 << 2)
|
||||
|
||||
/* EXC_RETURN_THREAD_MODE: The exception will return to thread mode (if not
|
||||
* set, return stays in handler mode)
|
||||
/* EXC_RETURN_THREAD_MODE: The exception will return to thread mode (if not set,
|
||||
* return stays in handler mode)
|
||||
*/
|
||||
|
||||
#define EXC_RETURN_THREAD_MODE (1 << 3)
|
||||
|
||||
/* EXC_RETURN_STD_CONTEXT: The state saved on the stack does not include the
|
||||
* volatile FP registers and FPSCR. If this bit is clear, the state does
|
||||
* include these registers.
|
||||
* volatile FP registers and FPSCR. If this bit is clear, the state does include
|
||||
* these registers.
|
||||
*/
|
||||
|
||||
#define EXC_RETURN_STD_CONTEXT (1 << 4)
|
||||
|
||||
/* EXC_RETURN_DEF_STACKING: Default callee register stacking (DCRS).
|
||||
* Indicates whether the default stacking rules apply, or whether the callee
|
||||
* registers are already on the stack. The possible values of this bit are:
|
||||
* 0 - Stacking of the callee saved registers skipped. 1 - Default rules for
|
||||
* stacking the callee registers followed.
|
||||
/* EXC_RETURN_HANDLER: Return to handler mode. Exception return gets state from
|
||||
* the main stack. Execution uses MSP after return.
|
||||
*/
|
||||
|
||||
#define EXC_RETURN_DEF_STACKING (1 << 5)
|
||||
#define EXC_RETURN_HANDLER 0xfffffff1
|
||||
|
||||
/* EXC_RETURN_SECURE_STACK: Secure or Non-secure stack. Indicates whether a
|
||||
* Secure or Non-secure stack is used to restore stack frame on exception
|
||||
* return. The possible values of this bit are: 0 - Non-secure stack used.
|
||||
* 1 - Secure stack used.
|
||||
*/
|
||||
|
||||
#define EXC_RETURN_SECURE_STACK (1 << 6)
|
||||
|
||||
/* EXC_RETURN_HANDLER: Return to handler mode. Exception return gets state
|
||||
* from the main stack. Execution uses MSP after return.
|
||||
*/
|
||||
|
||||
#define EXC_RETURN_HANDLER (EXC_RETURN_BASE | EXC_RETURN_DEF_STACKING | \
|
||||
EXC_RETURN_STD_CONTEXT)
|
||||
|
||||
/* EXC_RETURN_PRIVTHR: Return to privileged thread mode. Exception return
|
||||
* gets state from the main stack. Execution uses MSP after return.
|
||||
/* EXC_RETURN_PRIVTHR: Return to privileged thread mode. Exception return gets
|
||||
* state from the main stack. Execution uses MSP after return.
|
||||
*/
|
||||
|
||||
#if !defined(CONFIG_ARMV8M_LAZYFPU) && defined(CONFIG_ARCH_FPU)
|
||||
# define EXC_RETURN_PRIVTHR (EXC_RETURN_BASE | EXC_RETURN_THREAD_MODE | \
|
||||
EXC_RETURN_DEF_STACKING)
|
||||
# define EXC_RETURN_PRIVTHR (EXC_RETURN_BASE | EXC_RETURN_THREAD_MODE)
|
||||
#else
|
||||
# define EXC_RETURN_PRIVTHR (EXC_RETURN_BASE | EXC_RETURN_STD_CONTEXT | \
|
||||
EXC_RETURN_THREAD_MODE | EXC_RETURN_DEF_STACKING)
|
||||
EXC_RETURN_THREAD_MODE)
|
||||
#endif
|
||||
|
||||
/* EXC_RETURN_UNPRIVTHR: Return to unprivileged thread mode. Exception return
|
||||
* gets state from the process stack. Execution uses PSP after return.
|
||||
/* EXC_RETURN_UNPRIVTHR: Return to unprivileged thread mode. Exception return gets
|
||||
* state from the process stack. Execution uses PSP after return.
|
||||
*/
|
||||
|
||||
#if !defined(CONFIG_ARMV8M_LAZYFPU) && defined(CONFIG_ARCH_FPU)
|
||||
# define EXC_RETURN_UNPRIVTHR (EXC_RETURN_BASE | EXC_RETURN_THREAD_MODE | \
|
||||
EXC_RETURN_PROCESS_STACK | EXC_RETURN_DEF_STACKING)
|
||||
EXC_RETURN_PROCESS_STACK)
|
||||
#else
|
||||
# define EXC_RETURN_UNPRIVTHR (EXC_RETURN_BASE | EXC_RETURN_STD_CONTEXT | \
|
||||
EXC_RETURN_THREAD_MODE | EXC_RETURN_PROCESS_STACK | \
|
||||
EXC_RETURN_DEF_STACKING)
|
||||
EXC_RETURN_THREAD_MODE | EXC_RETURN_PROCESS_STACK)
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
Reference in New Issue
Block a user