@@ -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.");
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@google.com> --- x86/vmx_tests.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)