os/arch: Fix crash during boot up with Trustzone disabled
When TrustZone config is disabled, the EXC_RET values are not
set properly. Set the common value of EXC_RET_BASE for all cases.
/* EXC_RETURN_BASE: Bits that are always set in an EXC_RETURN value. */
-#ifdef CONFIG_ARMV8M_TRUSTZONE
/* In case of ARMv8 with TZ, following bits have special meaning.
* BIT 6 : Set if secure stack is used, else reset
* BIT 5 : Set if default rules used for stacking callee registers
*/
#define EXC_RETURN_BASE 0xffffffa0
-#else
-#define EXC_RETURN_BASE 0xffffffe1
-#endif
+
+/* 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
#define EXC_RETURN_STD_CONTEXT (1 << 4)
-/* EXC_RETURN_HANDLER: Return to handler mode. Exception return gets state from
- * the main stack. Execution uses MSP after return.
+/* 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.
+ */
+
+#define EXC_RETURN_DEF_STACKING (1 << 5)
+
+/* 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 0xffffffb0
+#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.
