Propagate guest MSR writes to machine MSRs immediately

Right now, we have an exposure between the time the MSR is written
and used by an instruction such as syscall. If there is a context
switch and we do vmx_do_restore_msrs(), everything goes fine. But
if we don't, then we execute the syscall with the wrong MSR.

Signed-off-by: Yunhong Jiang <yunhong.jiang@intel.com>
Signed-off-by: Arun Sharma <arun.sharma@intel.com>
This commit is contained in:
kaf24@firebug.cl.cam.ac.uk committed 2005-07-21 13:59:08 +00:00
1 parent a63fbe2fb4
commit 88490a29fe
1 file changed
+11 -6
+11 -6
View File
@@ -94,12 +94,16 @@ static void vmx_save_init_msrs(void)
msr_content = msr->msr_items[VMX_INDEX_MSR_ ## address]; \
break
#define CASE_WRITE_MSR(address) \
case MSR_ ## address: \
msr->msr_items[VMX_INDEX_MSR_ ## address] = msr_content; \
if (!test_bit(VMX_INDEX_MSR_ ## address, &msr->flags)){ \
set_bit(VMX_INDEX_MSR_ ## address, &msr->flags); \
}\
#define CASE_WRITE_MSR(address) \
case MSR_ ## address: \
{ \
msr->msr_items[VMX_INDEX_MSR_ ## address] = msr_content; \
if (!test_bit(VMX_INDEX_MSR_ ## address, &msr->flags)) { \
set_bit(VMX_INDEX_MSR_ ## address, &msr->flags); \
} \
wrmsrl(MSR_ ## address, msr_content); \
set_bit(VMX_INDEX_MSR_ ## address, &host_state->flags); \
} \
break
#define IS_CANO_ADDRESS(add) 1
@@ -1261,6 +1265,7 @@ static void mov_from_cr(int cr, int gp, struct cpu_user_regs *regs)
CASE_SET_REG(EBP, ebp);
CASE_SET_REG(ESI, esi);
CASE_SET_REG(EDI, edi);
CASE_EXTEND_SET_REG
case REG_ESP:
__vmwrite(GUEST_RSP, value);
regs->esp = value;
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.