summaryrefslogtreecommitdiffstats
path: root/bsps/arm/shared
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2020-12-21 09:40:50 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2020-12-23 09:19:28 +0100
commit46a3c0446f6a18ca1fa9e6995504bc7291d66495 (patch)
tree2433ae7c30d6374ab3a3a1e0b9a11ddb66a1e52c /bsps/arm/shared
parentbsps/arm: Invalidate branch predictors earlier (diff)
downloadrtems-46a3c0446f6a18ca1fa9e6995504bc7291d66495.tar.bz2
bsps/arm: Remove optional start hook arguments
The start hook arguments are not used by a BSP. Removing them avoids the need for a stack during the very early system initialization. Update #4202.
Diffstat (limited to 'bsps/arm/shared')
-rw-r--r--bsps/arm/shared/start/start.S63
1 files changed, 26 insertions, 37 deletions
diff --git a/bsps/arm/shared/start/start.S b/bsps/arm/shared/start/start.S
index f4880dfcf0..92b11ee45e 100644
--- a/bsps/arm/shared/start/start.S
+++ b/bsps/arm/shared/start/start.S
@@ -159,12 +159,11 @@ _start:
/*
* We do not save the context since we do not return to the boot
- * loader but preserve r1 and r2 to allow access to bootloader parameters
+ * loader. Boot loaders may pass the device tree in r2. Do not touch
+ * r2 until bsp_fdt_copy() is called.
*/
-#ifndef BSP_START_NEEDS_REGISTER_INITIALIZATION
- mov r5, r1 /* machine type number or ~0 for DT boot */
- mov r6, r2 /* physical address of ATAGs or DTB */
-#else /* BSP_START_NEEDS_REGISTER_INITIALIZATION */
+
+#ifdef BSP_START_NEEDS_REGISTER_INITIALIZATION
mov r0, #0
mov r1, #0
mov r2, #0
@@ -215,8 +214,8 @@ _start:
add r3, r7, #1
mul r1, r1, r3
#endif
- ldr r2, =_ISR_Stack_area_begin
- add r3, r1, r2
+ ldr r0, =_ISR_Stack_area_begin
+ add r3, r1, r0
/* Save original CPSR value */
mrs r4, cpsr
@@ -235,35 +234,35 @@ _start:
mov sp, r3
sub r3, r3, r1
- ldr r2, =bsp_start_hyp_vector_table_begin
- mcr p15, 4, r2, c12, c0, 0
+ ldr r0, =bsp_start_hyp_vector_table_begin
+ mcr p15, 4, r0, c12, c0, 0
- mov r2, #0
- mcr p15, 4, r2, c1, c1, 0
- mcr p15, 4, r2, c1, c1, 2
- mcr p15, 4, r2, c1, c1, 3
+ mov r0, #0
+ mcr p15, 4, r0, c1, c1, 0
+ mcr p15, 4, r0, c1, c1, 2
+ mcr p15, 4, r0, c1, c1, 3
/*
* HSCTLR.TE
* optional start of hypervisor handlers in Thumb mode
* orr r0, #(1 << 30)
*/
- mcr p15, 4, r2, c1, c0, 0 /* HSCTLR */
- mrc p15, 4, r2, c1, c1, 1 /* HDCR */
- and r2, #0x1f /* Preserve HPMN */
- mcr p15, 4, r2, c1, c1, 1 /* HDCR */
+ mcr p15, 4, r0, c1, c0, 0 /* HSCTLR */
+ mrc p15, 4, r0, c1, c1, 1 /* HDCR */
+ and r0, #0x1f /* Preserve HPMN */
+ mcr p15, 4, r0, c1, c1, 1 /* HDCR */
/* Prepare SVC mode for eret */
- mrs r2, cpsr
- bic r2, r2, #ARM_PSR_M_MASK
- orr r2, r2, #ARM_PSR_M_SVC
- msr spsr_cxsf, r2
-
- adr r2, .L_hyp_to_svc_return
- .inst 0xe12ef302 /* msr ELR_hyp, r2 */
- mov r2, sp
+ mrs r0, cpsr
+ bic r0, r0, #ARM_PSR_M_MASK
+ orr r0, r0, #ARM_PSR_M_SVC
+ msr spsr_cxsf, r0
+
+ ldr r0, =.L_hyp_to_svc_return
+ .inst 0xe12ef300 /* msr ELR_hyp, r0 */
+ mov r0, sp
.inst 0xe160006e /* eret */
.L_hyp_to_svc_return:
- mov sp, r2
+ mov sp, r0
.L_skip_hyp_svc_switch:
#endif /* BSP_START_IN_HYP_SUPPORT */
@@ -320,7 +319,7 @@ _start:
cmp r7, #0
bne 1f
#endif
- mov r0, r6
+ mov r0, r2
bl bsp_fdt_copy
1:
#endif
@@ -413,7 +412,6 @@ _start:
* instruction as a very limited address range of 2KiB. Use a bx to
* the start hook 0 address instead corrected by the address offset.
*/
-
ldr lr, =bsp_start_hook_0_done
mov r0, pc
ldr r1, =.Lget_absolute_pc
@@ -421,11 +419,6 @@ _start:
sub r1, r0
ldr r7, =bsp_start_hook_0
add r7, r1
-
- mov r0, r4 /* original CPSR value */
- mov r1, r5 /* machine type number or ~0 for DT boot */
- mov r2, r6 /* physical address of ATAGs or DTB */
-
bx r7
/* Allow bsp_start_hook_0() hooks to jump to this label */
@@ -436,8 +429,6 @@ bsp_start_hook_0_done:
* vectors and the pointers to the default exception handlers.
*/
- stmdb sp!, {r4, r5, r6}
-
ldr r0, =bsp_vector_table_begin
ldr r1, =bsp_start_vector_table_begin
cmp r0, r1
@@ -461,8 +452,6 @@ bsp_start_hook_0_done:
isb
#endif
- ldmia sp!, {r0, r1, r2}
-
SWITCH_FROM_ARM_TO_THUMB r3
/* Branch to start hook 1 */