diff --git a/hypervisor/arch/x86/cpu.c b/hypervisor/arch/x86/cpu.c index 02fb4b6f4..106d434bd 100644 --- a/hypervisor/arch/x86/cpu.c +++ b/hypervisor/arch/x86/cpu.c @@ -347,7 +347,9 @@ static uint64_t get_random_value(void) asm volatile ("1: rdrand %%rax\n" "jnc 1b\n" "mov %%rax, %0\n" - : "=r"(random) :: ); + : "=r"(random) + : + :"%rax"); return random; } diff --git a/hypervisor/arch/x86/vmx.c b/hypervisor/arch/x86/vmx.c index 123087f06..9696f097a 100644 --- a/hypervisor/arch/x86/vmx.c +++ b/hypervisor/arch/x86/vmx.c @@ -82,7 +82,7 @@ static inline int exec_vmxon(void *addr) "pushfq\n" "pop %0\n":"=r" (rflags) : "r"(addr) - : "%rax"); + : "%rax", "cc", "memory"); /* if carry and zero flags are clear operation success */ if (rflags & (RFLAGS_C | RFLAGS_Z)) @@ -140,7 +140,7 @@ int exec_vmclear(void *addr) "pushfq\n" "pop %0\n":"=r" (rflags) : "r"(addr) - : "%rax"); + : "%rax", "cc", "memory"); /* if carry and zero flags are clear operation success */ if (rflags & (RFLAGS_C | RFLAGS_Z)) @@ -165,7 +165,7 @@ int exec_vmptrld(void *addr) "pop %0\n" : "=r" (rflags) : "r"(addr) - : "%rax"); + : "%rax", "cc"); /* if carry and zero flags are clear operation success */ if (rflags & (RFLAGS_C | RFLAGS_Z)) diff --git a/hypervisor/include/arch/x86/cpu.h b/hypervisor/include/arch/x86/cpu.h index dc4a41e30..9b2862239 100644 --- a/hypervisor/include/arch/x86/cpu.h +++ b/hypervisor/include/arch/x86/cpu.h @@ -379,8 +379,9 @@ void load_cpu_state_data(void); /* Macro to restore rflags register */ #define CPU_RFLAGS_RESTORE(rflags) \ { \ - asm volatile (" push %0" : : "r" (rflags)); \ - asm volatile (" popf"); \ + asm volatile (" push %0\n\t" \ + "popf \n\t": : "r" (rflags) \ + :"cc"); \ } /* This macro locks out interrupts and saves the current architecture status