]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
x86: Correct get_sp() implementation for 64-bit
authorSimon Glass <sjg@chromium.org>
Sun, 16 Jul 2023 03:38:43 +0000 (21:38 -0600)
committerBin Meng <bmeng@tinylab.org>
Mon, 17 Jul 2023 09:08:44 +0000 (17:08 +0800)
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>
arch/x86/lib/bootm.c

index 61cb7bc61168b353cd07d94463ad8199ff136fa9..3196f9ddc2c80ded8b876ae74405d4201775279e 100644 (file)
@@ -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