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>
This commit is contained in:
Simon Glass 2023-07-15 21:38:43 -06:00 committed by Bin Meng
parent 633af11dd6
commit 67884002f4

View file

@ -258,7 +258,7 @@ static ulong get_sp(void)
ulong ret; ulong ret;
#if CONFIG_IS_ENABLED(X86_64) #if CONFIG_IS_ENABLED(X86_64)
ret = gd->start_addr_sp; asm("mov %%rsp, %0" : "=r"(ret) : );
#else #else
asm("mov %%esp, %0" : "=r"(ret) : ); asm("mov %%esp, %0" : "=r"(ret) : );
#endif #endif