summaryrefslogtreecommitdiffstats
path: root/bsps/arm/shared/start/start.S
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2020-12-18 10:11:51 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2020-12-23 09:19:17 +0100
commit272534eb725f2486b7a32b39d998202a101bd36e (patch)
tree1cd2ae81d871698e49093fb0ec2488d88e0593d9 /bsps/arm/shared/start/start.S
parentarm: Add support for Arm PMSAv8-32 (diff)
downloadrtems-272534eb725f2486b7a32b39d998202a101bd36e.tar.bz2
bsps/arm: Set VBAR in start.S
Set the VBAR to the vector table in the start section before bsp_start_hook_0() is called to earlier handle exceptions in RTEMS. Set the VBAR to the normal vector table in start.S for the main processor. Secondary processors set it in bsp_start_hook_0(). Update #4202.
Diffstat (limited to 'bsps/arm/shared/start/start.S')
-rw-r--r--bsps/arm/shared/start/start.S28
1 files changed, 27 insertions, 1 deletions
diff --git a/bsps/arm/shared/start/start.S b/bsps/arm/shared/start/start.S
index 93590c1c36..9ebc2818e5 100644
--- a/bsps/arm/shared/start/start.S
+++ b/bsps/arm/shared/start/start.S
@@ -377,6 +377,20 @@ _start:
#endif /* ARM_MULTILIB_VFP */
+#if (__ARM_ARCH >= 7 && __ARM_ARCH_PROFILE == 'A') || __ARM_ARCH >= 8
+ /*
+ * Set VBAR to the vector table in the start section and make sure
+ * SCTLR[V] is cleared. Afterwards, exceptions are handled by RTEMS.
+ */
+ ldr r0, =bsp_start_vector_table_begin
+ dsb
+ mcr p15, 0, r0, c12, c0, 0
+ mrc p15, 0, r0, c1, c0, 0
+ bic r1, r0, #0x2000
+ mcr p15, 0, r1, c1, c0, 0
+ isb
+#endif
+
/*
* Invoke the start hook 0.
*
@@ -414,7 +428,7 @@ bsp_start_hook_0_done:
stmdb sp!, {r4, r5, r6}
ldr r0, =bsp_vector_table_begin
- adr r1, bsp_start_vector_table_begin
+ ldr r1, =bsp_start_vector_table_begin
cmp r0, r1
beq .Lvector_table_copy_done
ldmia r1!, {r2-r9}
@@ -424,6 +438,18 @@ bsp_start_hook_0_done:
.Lvector_table_copy_done:
+#if (__ARM_ARCH >= 7 && __ARM_ARCH_PROFILE == 'A') || __ARM_ARCH >= 8
+ /*
+ * This code path is only executed by the primary processor. Set the
+ * VBAR to the normal vector table. For secondary processors, this is
+ * done by bsp_start_hook_0().
+ */
+ ldr r0, =bsp_vector_table_begin
+ dsb
+ mcr p15, 0, r0, c12, c0, 0
+ isb
+#endif
+
ldmia sp!, {r0, r1, r2}
SWITCH_FROM_ARM_TO_THUMB r3