# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID dd3dbd7c82e01724e563f9262f85dfccbc306046
# Parent c7f883aaedb076e26577d21ab9d262dd24eb30d6
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@xxxxxxxxx>
Signed-off-by: Arun Sharma <arun.sharma@xxxxxxxxx>
diff -r c7f883aaedb0 -r dd3dbd7c82e0 xen/arch/x86/vmx.c
--- a/xen/arch/x86/vmx.c Wed Jul 20 19:45:05 2005
+++ b/xen/arch/x86/vmx.c Thu Jul 21 13:59:08 2005
@@ -94,12 +94,16 @@
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 @@
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;
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|