ia64/xen-unstable

changeset 13149:fd1ccd818f2c

[HVM][VMX] Save GS_SHADOW MSR only on x86/64.
Bug found by Kouya Shimura <kouya@jp.fujitsu.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Thu Dec 21 11:22:39 2006 +0000 (2006-12-21)
parents 8af3df2f4b01
children 105a54bcc5c9
files xen/arch/x86/hvm/vmx/vmx.c
line diff
     1.1 --- a/xen/arch/x86/hvm/vmx/vmx.c	Thu Dec 21 11:10:43 2006 +0000
     1.2 +++ b/xen/arch/x86/hvm/vmx/vmx.c	Thu Dec 21 11:22:39 2006 +0000
     1.3 @@ -277,6 +277,12 @@ static void vmx_restore_host_msrs(void)
     1.4      }
     1.5  }
     1.6  
     1.7 +static void vmx_save_guest_msrs(struct vcpu *v)
     1.8 +{
     1.9 +    /* MSR_SHADOW_GS_BASE may have been changed by swapgs instruction. */
    1.10 +    rdmsrl(MSR_SHADOW_GS_BASE, v->arch.hvm_vmx.msr_state.shadow_gs);
    1.11 +}
    1.12 +
    1.13  static void vmx_restore_guest_msrs(struct vcpu *v)
    1.14  {
    1.15      struct vmx_msr_state *guest_msr_state, *host_msr_state;
    1.16 @@ -308,6 +314,7 @@ static void vmx_restore_guest_msrs(struc
    1.17  
    1.18  #define vmx_save_host_msrs()        ((void)0)
    1.19  #define vmx_restore_host_msrs()     ((void)0)
    1.20 +#define vmx_save_guest_msrs(v)      ((void)0)
    1.21  #define vmx_restore_guest_msrs(v)   ((void)0)
    1.22  
    1.23  static inline int long_mode_do_msr_read(struct cpu_user_regs *regs)
    1.24 @@ -373,10 +380,7 @@ static inline void vmx_restore_dr(struct
    1.25  
    1.26  static void vmx_ctxt_switch_from(struct vcpu *v)
    1.27  {
    1.28 -    /* NB. MSR_SHADOW_GS_BASE may be changed by swapgs instrucion in guest,
    1.29 -     * so we must save it. */
    1.30 -    rdmsrl(MSR_SHADOW_GS_BASE, v->arch.hvm_vmx.msr_state.shadow_gs);
    1.31 -
    1.32 +    vmx_save_guest_msrs(v);
    1.33      vmx_restore_host_msrs();
    1.34      vmx_save_dr(v);
    1.35  }