summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2023-07-15 21:38:43 -0600
committerBin Meng <bmeng@tinylab.org>2023-07-17 17:08:44 +0800
commit67884002f48ecf9e39f9402bc3866c8674ada563 (patch)
treebd1d4d112a1e9a56fa67387a3a16ab1971d4167a
parent633af11dd65cde0c198f8548585d6610cf4d0655 (diff)
x86: Correct get_sp() implementation for 64-bit
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@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
-rw-r--r--arch/x86/lib/bootm.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/x86/lib/bootm.c b/arch/x86/lib/bootm.c
index 61cb7bc6116..3196f9ddc2c 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