aboutsummaryrefslogtreecommitdiff
path: root/arch/arm/lib/crt0_64.S
diff options
context:
space:
mode:
authorStephen Warren <swarren@nvidia.com>2017-12-19 18:30:36 -0700
committerTom Warren <twarren@nvidia.com>2018-01-12 09:52:11 -0700
commite6c904489a6018f44c3b00c9eacc4742887b1f83 (patch)
tree8a8cf657ab6bc2f2c705c9348cea9d8d0f6c2819 /arch/arm/lib/crt0_64.S
parent0d1bd150f041b9c5939e2e6be36f91444b10cace (diff)
downloadu-boot-e6c904489a6018f44c3b00c9eacc4742887b1f83.zip
u-boot-e6c904489a6018f44c3b00c9eacc4742887b1f83.tar.gz
u-boot-e6c904489a6018f44c3b00c9eacc4742887b1f83.tar.bz2
ARMv8: Allow dynamic early stack pointer
U-Boot typically uses a hard-coded value for the stack pointer before relocation. Implement option SYS_INIT_SP_BSS_OFFSET to instead calculate the initial SP at run-time. This is useful to avoid hard-coding addresses into U-Boot, so that can be loaded and executed at arbitrary addresses and thus avoid using arbitrary addresses at runtime. This option's value is the offset added to &_bss_start in order to calculate the stack pointer. This offset should be large enough so that the early malloc region, global data (gd), and early stack usage do not overlap any appended DTB. Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Tom Warren <twarren@nvidia.com>
Diffstat (limited to 'arch/arm/lib/crt0_64.S')
-rw-r--r--arch/arm/lib/crt0_64.S3
1 files changed, 3 insertions, 0 deletions
diff --git a/arch/arm/lib/crt0_64.S b/arch/arm/lib/crt0_64.S
index 9cb7055..a181283 100644
--- a/arch/arm/lib/crt0_64.S
+++ b/arch/arm/lib/crt0_64.S
@@ -73,6 +73,9 @@ ENTRY(_main)
ldr x0, =(CONFIG_TPL_STACK)
#elif defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_STACK)
ldr x0, =(CONFIG_SPL_STACK)
+#elif defined(CONFIG_SYS_INIT_SP_BSS_OFFSET)
+ adr x0, __bss_start
+ add x0, x0, #CONFIG_SYS_INIT_SP_BSS_OFFSET
#else
ldr x0, =(CONFIG_SYS_INIT_SP_ADDR)
#endif