The only supported use of a local register variable is to specify registers for input and output operands when calling Extended asm. Using it to automatically collect the value in the register isn't supported as the contents of the register aren't guaranteed. Instead use inline asm to get the stack pointer explicitly. Signed-off-by: Bill Wendling <morbo@xxxxxxxxxx> --- x86/vmx_tests.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c index a7abd63..ad8c002 100644 --- a/x86/vmx_tests.c +++ b/x86/vmx_tests.c @@ -2165,8 +2165,9 @@ static void into_guest_main(void) .offset = (uintptr_t)&&into, .selector = KERNEL_CS32, }; - register uintptr_t rsp asm("rsp"); + uintptr_t rsp = 0; + asm volatile ("mov %%rsp, %0" : "=r" (rsp)); if (fp.offset != (uintptr_t)&&into) { printf("Code address too high.\n"); return; @@ -3261,8 +3262,9 @@ static void try_compat_invvpid(void *unused) .offset = (uintptr_t)&&invvpid, .selector = KERNEL_CS32, }; - register uintptr_t rsp asm("rsp"); + register uintptr_t rsp = 0; + asm volatile ("mov %%rsp, %0" : "=r" (rsp)); TEST_ASSERT_MSG(fp.offset == (uintptr_t)&&invvpid, "Code address too high."); TEST_ASSERT_MSG(rsp == (u32)rsp, "Stack address too high."); -- 2.25.1.481.gfbce0eb801-goog