summaryrefslogtreecommitdiffstats
path: root/bsps/aarch64/shared/start/start.S
diff options
context:
space:
mode:
authorGedare Bloom <gedare@rtems.org>2021-06-22 20:01:17 -0600
committerGedare Bloom <gedare@rtems.org>2021-06-24 09:37:31 -0600
commit76c6caad52244ab9a14151620a80ff0f71035b6c (patch)
tree70f0d9a996bb38f274fd61c42aa858da3b5a84e5 /bsps/aarch64/shared/start/start.S
parent207612957e0e42a5d289aa87c93cf4140dcb990c (diff)
downloadrtems-76c6caad52244ab9a14151620a80ff0f71035b6c.tar.bz2
bsps/aarch64: add non-secure mode and versal support
Diffstat (limited to 'bsps/aarch64/shared/start/start.S')
-rw-r--r--bsps/aarch64/shared/start/start.S18
1 files changed, 16 insertions, 2 deletions
diff --git a/bsps/aarch64/shared/start/start.S b/bsps/aarch64/shared/start/start.S
index d0d9c2160a..338c51f7d0 100644
--- a/bsps/aarch64/shared/start/start.S
+++ b/bsps/aarch64/shared/start/start.S
@@ -98,7 +98,7 @@ _start:
#endif
msr SCTLR_EL1, x0
-#ifdef BSP_START_IN_MON_SUPPORT
+#ifdef BSP_START_IN_EL3_MONITOR_MODE_SUPPORT
/* Drop from EL3 to EL2 */
/* Initialize HCR_EL2 and SCTLR_EL2 */
@@ -108,21 +108,35 @@ _start:
mrs x0, SCR_EL3
/* Set EL2 to AArch64 */
orr x0, x0, #(1<<10)
+#ifdef AARCH64_IS_NONSECURE
/* Set EL1 to NS */
orr x0, x0, #1
+#endif
msr SCR_EL3, x0
/* set EL2h mode for eret */
+#ifdef AARCH64_IS_NONSECURE
mov x0, #0b01001
+#else
+ mov x0, #0b00101
+#endif
+
msr SPSR_EL3, x0
/* Set EL2 entry point */
+#ifdef AARCH64_IS_NONSECURE
adr x0, _el2_start
+#else
+ adr x0, _el1_start
+#endif
msr ELR_EL3, x0
eret
#endif
-#if defined(BSP_START_IN_HYP_SUPPORT) || defined(BSP_START_IN_MON_SUPPORT)
+#if defined(BSP_START_IN_HYP_SUPPORT) || \
+ ( defined(BSP_START_IN_EL3_MONITOR_MODE_SUPPORT) && \
+ defined(AARCH64_IS_NONSECURE) \
+ )
_el2_start:
/* Drop from EL2 to EL1 */