summaryrefslogtreecommitdiffstats
path: root/arch/arm/lib/crt0.S
diff options
context:
space:
mode:
authorAlbert ARIBAUD <albert.u.boot@aribaud.net>2015-11-25 17:56:33 +0100
committerTom Rini <trini@konsulko.com>2016-01-13 21:05:18 -0500
commitadc421e4cee8275cd99367b3b455ffbb5ead3990 (patch)
tree08a51a4c9a9a6d5806d9f2c329065de3a5a7586e /arch/arm/lib/crt0.S
parentecc306639e83c9019a5093b77a48685ea40eedc2 (diff)
downloadtalos-obmc-uboot-adc421e4cee8275cd99367b3b455ffbb5ead3990.tar.gz
talos-obmc-uboot-adc421e4cee8275cd99367b3b455ffbb5ead3990.zip
arm: move gd handling outside of C code
As of gcc 5.2.1 for Thumb-1, it is not possible any more to assign gd from C code, as gd is mapped to r9, and r9 may now be saved in the prolog sequence, and restored in the epilog sequence, of any C functions. Therefore arch_setup_gd(), which is supposed to set r9, may actually have no effect, causing U-Boot to use a bad address to access GD. Fix this by never calling arch_setup_gd() for ARM, and instead setting r9 in arch/arm/lib/crt0.S, to the value returned by board_init_f_alloc_reserve(). Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'arch/arm/lib/crt0.S')
-rw-r--r--arch/arm/lib/crt0.S3
1 files changed, 3 insertions, 0 deletions
diff --git a/arch/arm/lib/crt0.S b/arch/arm/lib/crt0.S
index 4f2a7121c4..2f4c14e96b 100644
--- a/arch/arm/lib/crt0.S
+++ b/arch/arm/lib/crt0.S
@@ -85,6 +85,8 @@ ENTRY(_main)
mov r0, sp
bl board_init_f_alloc_reserve
mov sp, r0
+ /* set up gd here, outside any C code */
+ mov r9, r0
bl board_init_f_init_reserve
mov r0, #0
@@ -134,6 +136,7 @@ here:
bl spl_relocate_stack_gd
cmp r0, #0
movne sp, r0
+ movne r9, r0
# endif
ldr r0, =__bss_start /* this is auto-relocated! */
OpenPOWER on IntegriCloud