public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] armv8: fix gd after relocation
@ 2017-12-07 21:16 York Sun
  2017-12-07 21:42 ` Stephen Warren
  2017-12-07 22:53 ` [U-Boot] " Tom Rini
  0 siblings, 2 replies; 3+ messages in thread
From: York Sun @ 2017-12-07 21:16 UTC (permalink / raw)
  To: u-boot

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@nxp.com>
CC: Kever Yang <kever.yang@rock-chips.com>
CC: Philipp Tomsich <philipp.tomsich@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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [U-Boot] [PATCH] armv8: fix gd after relocation
  2017-12-07 21:16 [U-Boot] [PATCH] armv8: fix gd after relocation York Sun
@ 2017-12-07 21:42 ` Stephen Warren
  2017-12-07 22:53 ` [U-Boot] " Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Stephen Warren @ 2017-12-07 21:42 UTC (permalink / raw)
  To: u-boot

On 12/07/2017 02:16 PM, York Sun wrote:
> 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>

This matches what the 32-bit ARM code does, so I guess it's right.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [U-Boot] armv8: fix gd after relocation
  2017-12-07 21:16 [U-Boot] [PATCH] armv8: fix gd after relocation York Sun
  2017-12-07 21:42 ` Stephen Warren
@ 2017-12-07 22:53 ` Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Tom Rini @ 2017-12-07 22:53 UTC (permalink / raw)
  To: u-boot

On Thu, Dec 07, 2017 at 01:16:07PM -0800, York Sun wrote:

> 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@nxp.com>
> CC: Kever Yang <kever.yang@rock-chips.com>
> CC: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20171207/e7e8cd04/attachment.sig>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-12-07 22:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-07 21:16 [U-Boot] [PATCH] armv8: fix gd after relocation York Sun
2017-12-07 21:42 ` Stephen Warren
2017-12-07 22:53 ` [U-Boot] " Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox