Need to save and restore MSRs for VMX domains across context switches.
PATCH 1/1 Need to save and restore MSRs for VMX domains across context switches.
Need to save and restore MSRs for VMX domains across context switches.
Signed-off-by Yunhong Jiang <[email protected]>
Signed-off-by Jun Nakajima <[email protected]>
Signed-off-by Arun Sharma <[email protected]>
xen/arch/x86/domain.c +14 -0
@@ -640,9 +640,21 @@ } } +static inline void vmx_save_segments (struct vcpu *v) +{ +struct msr_state *guest_state; + + guest_state = &v->arch.arch_vmx.msr_content; +rdmsrl (MSR_SHADOW_GS_BASE , guest_state->shadow_gs); +} +static void save_segments (struct vcpu *v) {struct cpu_user_regs *regs = &v->arch.guest_context.user_regs; + +if (VMX_DOMAIN (v)) +vmx_save_segments (v); + __asm__ __volatile__ ("movl %%ds,%0" :"=m" (regs->ds) ); __asm__ __volatile__ ("movl %%es,%0" :"=m" (regs->es) ); __asm__ __volatile__ ("movl %%fs,%0" :"=m" (regs->fs) );
@@ -796,6 +808,8 @@load_LDT (next);load_segments (realprev, next);load_msrs (realprev, next); + }else { +vmx_restore_msrs (next); } }