From: Simon Glass Date: Sun, 16 Jul 2023 03:38:43 +0000 (-0600) Subject: x86: Correct get_sp() implementation for 64-bit X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=67884002f48ecf9e39f9402bc3866c8674ada563;p=u-boot.git 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 Reviewed-by: Bin Meng --- diff --git a/arch/x86/lib/bootm.c b/arch/x86/lib/bootm.c index 61cb7bc611..3196f9ddc2 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