From mboxrd@z Thu Jan 1 00:00:00 1970 From: Arun Sharma Subject: [PATCH] Need to save and restore MSRs for VMX domains across context switches. Date: Tue, 12 Jul 2005 16:39:52 -0700 Message-ID: <20050712233951.GA28195@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Ian Pratt , Keir Fraser Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org Need to save and restore MSRs for VMX domains across context switches. Signed-off-by: Yunhong Jiang Signed-off-by: Jun Nakajima Signed-off-by: Arun Sharma diff -r ea18bec15d36 -r f63f9aa5fff7 xen/arch/x86/domain.c --- a/xen/arch/x86/domain.c Tue Jul 12 19:40:36 2005 +++ b/xen/arch/x86/domain.c Tue Jul 12 23:26:43 2005 @@ -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); } }