WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [PATCH] [PATCH] VMX world switch does not handle all cas

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [PATCH] [PATCH] VMX world switch does not handle all cases
From: BitKeeper Bot <riel@xxxxxxxxxxx>
Date: Sat, 28 May 2005 15:21:07 +0000
Delivery-date: Sat, 28 May 2005 16:02:45 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: Xen Development List <xen-devel@xxxxxxxxxxxxxxxxxxx>
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
ChangeSet 1.1585, 2005/05/28 16:21:07+01:00, leendert@xxxxxxxxxxxxxx

        [PATCH] [PATCH] VMX world switch does not handle all cases
        
        The latest world switch modification does not handle all cases. 
Specifically,
        when a partition enables CR0.PG|CR0.PE and performs a world switch at 
the
        the same time. The patch below handles this case.
        
        Signed-Off-By: Leendert van Doorn <leendert@xxxxxxxxxxxxxx>



 vmx.c |   54 ++++++++++++++++++++++++++++++------------------------
 1 files changed, 30 insertions(+), 24 deletions(-)


diff -Nru a/xen/arch/x86/vmx.c b/xen/arch/x86/vmx.c
--- a/xen/arch/x86/vmx.c        2005-05-28 12:03:24 -04:00
+++ b/xen/arch/x86/vmx.c        2005-05-28 12:03:24 -04:00
@@ -744,8 +744,8 @@
     __vmwrite(CR0_READ_SHADOW, value);
 
     VMX_DBG_LOG(DBG_LEVEL_VMMU, "Update CR0 value = %lx\n", value);
-    if ((value & X86_CR0_PE) && (value & X86_CR0_PG) 
-        && !paging_enabled) {
+
+    if ((value & X86_CR0_PE) && (value & X86_CR0_PG) && !paging_enabled) {
         /*
          * The guest CR3 must be pointing to the guest physical.
          */
@@ -775,33 +775,39 @@
          */
         VMX_DBG_LOG(DBG_LEVEL_VMMU, "Update CR3 value = %lx, mfn = %lx", 
                 d->arch.arch_vmx.cpu_cr3, mfn);
-    } else {
-        if ((value & X86_CR0_PE) == 0) {
-            __vmread(GUEST_EIP, &eip);
-            VMX_DBG_LOG(DBG_LEVEL_1, "Disabling CR0.PE at %%eip 0x%lx\n", eip);
-           if (vmx_assist(d, VMX_ASSIST_INVOKE)) {
-               set_bit(VMX_CPU_STATE_ASSIST_ENABLED,
-                                       &d->arch.arch_vmx.cpu_state);
-               __vmread(GUEST_EIP, &eip);
-               VMX_DBG_LOG(DBG_LEVEL_1,
-                   "Transfering control to vmxassist %%eip 0x%lx", eip);
-               return 0; /* do not update eip! */
-           }
-       } else if (test_bit(VMX_CPU_STATE_ASSIST_ENABLED,
-                                       &d->arch.arch_vmx.cpu_state)) {
+    }
+
+    /*
+     * VMX does not implement real-mode virtualization. We emulate
+     * real-mode by performing a world switch to VMXAssist whenever
+     * a partition disables the CR0.PE bit.
+     */
+    if ((value & X86_CR0_PE) == 0) {
+       __vmread(GUEST_EIP, &eip);
+       VMX_DBG_LOG(DBG_LEVEL_1,
+           "Disabling CR0.PE at %%eip 0x%lx\n", eip);
+       if (vmx_assist(d, VMX_ASSIST_INVOKE)) {
+           set_bit(VMX_CPU_STATE_ASSIST_ENABLED, &d->arch.arch_vmx.cpu_state);
            __vmread(GUEST_EIP, &eip);
            VMX_DBG_LOG(DBG_LEVEL_1,
-               "Enabling CR0.PE at %%eip 0x%lx", eip);
-           if (vmx_assist(d, VMX_ASSIST_RESTORE)) {
-               clear_bit(VMX_CPU_STATE_ASSIST_ENABLED,
+               "Transfering control to vmxassist %%eip 0x%lx\n", eip);
+           return 0; /* do not update eip! */
+       }
+    } else if (test_bit(VMX_CPU_STATE_ASSIST_ENABLED,
+                                       &d->arch.arch_vmx.cpu_state)) {
+       __vmread(GUEST_EIP, &eip);
+       VMX_DBG_LOG(DBG_LEVEL_1,
+           "Enabling CR0.PE at %%eip 0x%lx\n", eip);
+       if (vmx_assist(d, VMX_ASSIST_RESTORE)) {
+           clear_bit(VMX_CPU_STATE_ASSIST_ENABLED,
                                        &d->arch.arch_vmx.cpu_state);
-               __vmread(GUEST_EIP, &eip);
-               VMX_DBG_LOG(DBG_LEVEL_1,
-                   "Restoring to %%eip 0x%lx", eip);
-               return 0; /* do not update eip! */
-           }
+           __vmread(GUEST_EIP, &eip);
+           VMX_DBG_LOG(DBG_LEVEL_1,
+               "Restoring to %%eip 0x%lx\n", eip);
+           return 0; /* do not update eip! */
        }
     }
+
     return 1;
 }
 

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [PATCH] [PATCH] VMX world switch does not handle all cases, BitKeeper Bot <=