aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYork Sun <york.sun@nxp.com>2017-12-07 13:16:07 -0800
committerTom Rini <trini@konsulko.com>2017-12-07 17:00:06 -0500
commite421b646fce125ed92936628dc4b287de5f038a5 (patch)
tree2ea2b1c79e6dfafe9d0ccf083a1786efd93f62d4
parent1d0f30a8e080fd490ec4df50d5ccfc742e771ca0 (diff)
downloadu-boot-e421b646fce125ed92936628dc4b287de5f038a5.zip
u-boot-e421b646fce125ed92936628dc4b287de5f038a5.tar.gz
u-boot-e421b646fce125ed92936628dc4b287de5f038a5.tar.bz2
armv8: fix gd after relocation
Commit 21f4486faa5d ("armv8: update gd after relocate") sets x18 without checking the return value of spl_relocate_stack_gd(). Reviewed-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: York Sun <york.sun@nxp.com> CC: Kever Yang <kever.yang@rock-chips.com> CC: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
-rw-r--r--arch/arm/lib/crt0_64.S5
1 files changed, 3 insertions, 2 deletions
diff --git a/arch/arm/lib/crt0_64.S b/arch/arm/lib/crt0_64.S
index ccefce0..9cb7055 100644
--- a/arch/arm/lib/crt0_64.S
+++ b/arch/arm/lib/crt0_64.S
@@ -120,8 +120,9 @@ relocation_return:
#endif /* !CONFIG_SPL_BUILD */
#if defined(CONFIG_SPL_BUILD)
bl spl_relocate_stack_gd /* may return NULL */
- /* set up gd here, outside any C code */
- mov x18, x0
+ /* set up gd here, outside any C code, if new stack is returned */
+ cmp x0, #0
+ csel x18, x0, x18, ne
/*
* Perform 'sp = (x0 != NULL) ? x0 : sp' while working
* around the constraint that conditional moves can not