[U-Boot] [PATCH] armv8: fix gd after relocation
York Sun
york.sun at nxp.com
Thu Dec 7 21:16:07 UTC 2017
Commit 21f4486faa5d ("armv8: update gd after relocate") sets x18
without checking the return value of spl_relocate_stack_gd().
Signed-off-by: York Sun <york.sun at nxp.com>
CC: Kever Yang <kever.yang at rock-chips.com>
CC: Philipp Tomsich <philipp.tomsich at theobroma-systems.com>
---
arch/arm/lib/crt0_64.S | 5 +++--
1 file 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
--
2.7.4
More information about the U-Boot
mailing list