ia64/xen-unstable

changeset 5835:dd3dbd7c82e0

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>
author kaf24@firebug.cl.cam.ac.uk
date Thu Jul 21 13:59:08 2005 +0000 (2005-07-21)
parents c7f883aaedb0
children 07884fe7c5ce
files xen/arch/x86/vmx.c
line diff
     1.1 --- a/xen/arch/x86/vmx.c	Wed Jul 20 19:45:05 2005 +0000
     1.2 +++ b/xen/arch/x86/vmx.c	Thu Jul 21 13:59:08 2005 +0000
     1.3 @@ -94,12 +94,16 @@ static void vmx_save_init_msrs(void)
     1.4      msr_content = msr->msr_items[VMX_INDEX_MSR_ ## address]; \
     1.5      break
     1.6  
     1.7 -#define CASE_WRITE_MSR(address)   \
     1.8 -    case MSR_ ## address:                   \
     1.9 -    msr->msr_items[VMX_INDEX_MSR_ ## address] = msr_content; \
    1.10 -    if (!test_bit(VMX_INDEX_MSR_ ## address, &msr->flags)){ \
    1.11 -    	set_bit(VMX_INDEX_MSR_ ## address, &msr->flags);   \
    1.12 -    }\
    1.13 +#define CASE_WRITE_MSR(address)                                     \
    1.14 +    case MSR_ ## address:                                           \
    1.15 +    {                                                               \
    1.16 +        msr->msr_items[VMX_INDEX_MSR_ ## address] = msr_content;    \
    1.17 +        if (!test_bit(VMX_INDEX_MSR_ ## address, &msr->flags)) {    \
    1.18 +            set_bit(VMX_INDEX_MSR_ ## address, &msr->flags);        \
    1.19 +        }                                                           \
    1.20 +        wrmsrl(MSR_ ## address, msr_content);                       \
    1.21 +        set_bit(VMX_INDEX_MSR_ ## address, &host_state->flags);     \
    1.22 +    }                                                               \
    1.23      break
    1.24  
    1.25  #define IS_CANO_ADDRESS(add) 1
    1.26 @@ -1261,6 +1265,7 @@ static void mov_from_cr(int cr, int gp, 
    1.27          CASE_SET_REG(EBP, ebp);
    1.28          CASE_SET_REG(ESI, esi);
    1.29          CASE_SET_REG(EDI, edi);
    1.30 +        CASE_EXTEND_SET_REG
    1.31      case REG_ESP:
    1.32          __vmwrite(GUEST_RSP, value);
    1.33          regs->esp = value;