[PATCH v5 10/46] x86: Correct get_sp() implementation for 64-bit
Simon Glass
sjg at chromium.org
Sun Jul 16 05:38:43 CEST 2023
Use an assembler implementation as is done for i386, so that the results
are equivalent for i386 and x86_64.
Signed-off-by: Simon Glass <sjg at chromium.org>
---
Changes in v5:
- Reword commit message
arch/x86/lib/bootm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/lib/bootm.c b/arch/x86/lib/bootm.c
index 61cb7bc61168..3196f9ddc2c8 100644
--- a/arch/x86/lib/bootm.c
+++ b/arch/x86/lib/bootm.c
@@ -258,7 +258,7 @@ static ulong get_sp(void)
ulong ret;
#if CONFIG_IS_ENABLED(X86_64)
- ret = gd->start_addr_sp;
+ asm("mov %%rsp, %0" : "=r"(ret) : );
#else
asm("mov %%esp, %0" : "=r"(ret) : );
#endif
--
2.41.0.455.g037347b96a-goog
More information about the U-Boot
mailing list