[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] hvm: Fix getvcpucontext to return the correct CR3 value.



# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1172015682 0
# Node ID f65a24235f581dea2c2242f0b628d0caa6507341
# Parent  c39a6b458bd04d6136ab9facdb98747bf8208e8e
hvm: Fix getvcpucontext to return the correct CR3 value.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 xen/arch/x86/domctl.c      |   36 +++++++++++++++++++-----------------
 xen/arch/x86/hvm/vmx/vmx.c |    2 +-
 2 files changed, 20 insertions(+), 18 deletions(-)

diff -r c39a6b458bd0 -r f65a24235f58 xen/arch/x86/domctl.c
--- a/xen/arch/x86/domctl.c     Tue Feb 20 20:49:44 2007 +0000
+++ b/xen/arch/x86/domctl.c     Tue Feb 20 23:54:42 2007 +0000
@@ -441,6 +441,10 @@ void arch_get_info_guest(struct vcpu *v,
         XLAT_vcpu_guest_context(c.cmp, &v->arch.guest_context);
 #endif
 
+    c(flags &= ~(VGCF_i387_valid|VGCF_in_kernel));
+    if ( test_bit(_VCPUF_fpu_initialised, &v->vcpu_flags) )
+        c(flags |= VGCF_i387_valid);
+
     if ( is_hvm_vcpu(v) )
     {
         if ( !IS_COMPAT(v->domain) )
@@ -464,23 +468,21 @@ void arch_get_info_guest(struct vcpu *v,
         /* IOPL privileges are virtualised: merge back into returned eflags. */
         BUG_ON((c(user_regs.eflags) & EF_IOPL) != 0);
         c(user_regs.eflags |= v->arch.iopl << 12);
-    }
-
-    c(flags &= ~(VGCF_i387_valid|VGCF_in_kernel));
-    if ( test_bit(_VCPUF_fpu_initialised, &v->vcpu_flags) )
-        c(flags |= VGCF_i387_valid);
-    if ( guest_kernel_mode(v, &v->arch.guest_context.user_regs) )
-        c(flags |= VGCF_in_kernel);
-
-    if ( !IS_COMPAT(v->domain) )
-        c.nat->ctrlreg[3] = 
xen_pfn_to_cr3(pagetable_get_pfn(v->arch.guest_table));
-#ifdef CONFIG_COMPAT
-    else
-    {
-        l4_pgentry_t *l4e = __va(pagetable_get_paddr(v->arch.guest_table));
-        c.cmp->ctrlreg[3] = compat_pfn_to_cr3(l4e_get_pfn(*l4e));
-    }
-#endif
+
+        if ( !IS_COMPAT(v->domain) )
+            c.nat->ctrlreg[3] = xen_pfn_to_cr3(
+                pagetable_get_pfn(v->arch.guest_table));
+#ifdef CONFIG_COMPAT
+        else
+        {
+            l4_pgentry_t *l4e = __va(pagetable_get_paddr(v->arch.guest_table));
+            c.cmp->ctrlreg[3] = compat_pfn_to_cr3(l4e_get_pfn(*l4e));
+        }
+#endif
+
+        if ( guest_kernel_mode(v, &v->arch.guest_context.user_regs) )
+            c(flags |= VGCF_in_kernel);
+    }
 
     c(vm_assist = v->domain->vm_assist);
 #undef c
diff -r c39a6b458bd0 -r f65a24235f58 xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c        Tue Feb 20 20:49:44 2007 +0000
+++ b/xen/arch/x86/hvm/vmx/vmx.c        Tue Feb 20 23:54:42 2007 +0000
@@ -696,7 +696,7 @@ static void vmx_store_cpu_guest_regs(
     {
         crs[0] = v->arch.hvm_vmx.cpu_shadow_cr0;
         crs[2] = v->arch.hvm_vmx.cpu_cr2;
-        crs[3] = __vmread(GUEST_CR3);
+        crs[3] = v->arch.hvm_vmx.cpu_cr3;
         crs[4] = v->arch.hvm_vmx.cpu_shadow_cr4;
     }
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.