mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-08-11 13:03:15 +00:00
HV: Fix the incorrect operand-constraints for inline assembly
The RFLAGS will be touched in some inline assembly.(exec_vmxon/ RFLAGS_RESTORE). The "cc" constraint should be added. Otherwise it won't be handled under -O2 option. And "%%XXX" register should also be added into constraints. Otherwise it will be optimized incorrectly. Signed-off-by: Zhao Yakui <yakui.zhao@intel.com> Signed-off-by: Zheng Gen <gen.zheng@intel.com> Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com> Acked-by: Anthony Xu <anthony.xu@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
parent
3daff9c286
commit
52ca0fe8fc
@ -347,7 +347,9 @@ static uint64_t get_random_value(void)
|
|||||||
asm volatile ("1: rdrand %%rax\n"
|
asm volatile ("1: rdrand %%rax\n"
|
||||||
"jnc 1b\n"
|
"jnc 1b\n"
|
||||||
"mov %%rax, %0\n"
|
"mov %%rax, %0\n"
|
||||||
: "=r"(random) :: );
|
: "=r"(random)
|
||||||
|
:
|
||||||
|
:"%rax");
|
||||||
return random;
|
return random;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ static inline int exec_vmxon(void *addr)
|
|||||||
"pushfq\n"
|
"pushfq\n"
|
||||||
"pop %0\n":"=r" (rflags)
|
"pop %0\n":"=r" (rflags)
|
||||||
: "r"(addr)
|
: "r"(addr)
|
||||||
: "%rax");
|
: "%rax", "cc", "memory");
|
||||||
|
|
||||||
/* if carry and zero flags are clear operation success */
|
/* if carry and zero flags are clear operation success */
|
||||||
if (rflags & (RFLAGS_C | RFLAGS_Z))
|
if (rflags & (RFLAGS_C | RFLAGS_Z))
|
||||||
@ -140,7 +140,7 @@ int exec_vmclear(void *addr)
|
|||||||
"pushfq\n"
|
"pushfq\n"
|
||||||
"pop %0\n":"=r" (rflags)
|
"pop %0\n":"=r" (rflags)
|
||||||
: "r"(addr)
|
: "r"(addr)
|
||||||
: "%rax");
|
: "%rax", "cc", "memory");
|
||||||
|
|
||||||
/* if carry and zero flags are clear operation success */
|
/* if carry and zero flags are clear operation success */
|
||||||
if (rflags & (RFLAGS_C | RFLAGS_Z))
|
if (rflags & (RFLAGS_C | RFLAGS_Z))
|
||||||
@ -165,7 +165,7 @@ int exec_vmptrld(void *addr)
|
|||||||
"pop %0\n"
|
"pop %0\n"
|
||||||
: "=r" (rflags)
|
: "=r" (rflags)
|
||||||
: "r"(addr)
|
: "r"(addr)
|
||||||
: "%rax");
|
: "%rax", "cc");
|
||||||
|
|
||||||
/* if carry and zero flags are clear operation success */
|
/* if carry and zero flags are clear operation success */
|
||||||
if (rflags & (RFLAGS_C | RFLAGS_Z))
|
if (rflags & (RFLAGS_C | RFLAGS_Z))
|
||||||
|
@ -379,8 +379,9 @@ void load_cpu_state_data(void);
|
|||||||
/* Macro to restore rflags register */
|
/* Macro to restore rflags register */
|
||||||
#define CPU_RFLAGS_RESTORE(rflags) \
|
#define CPU_RFLAGS_RESTORE(rflags) \
|
||||||
{ \
|
{ \
|
||||||
asm volatile (" push %0" : : "r" (rflags)); \
|
asm volatile (" push %0\n\t" \
|
||||||
asm volatile (" popf"); \
|
"popf \n\t": : "r" (rflags) \
|
||||||
|
:"cc"); \
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This macro locks out interrupts and saves the current architecture status
|
/* This macro locks out interrupts and saves the current architecture status
|
||||||
|
Loading…
Reference in New Issue
Block a user