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] [xen-unstable] [VMXASSIST] Fix virt-to-phys translation

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [VMXASSIST] Fix virt-to-phys translation routine.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 25 Sep 2006 18:40:18 +0000
Delivery-date: Mon, 25 Sep 2006 11:41:36 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
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-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Node ID 7de1715d185e566046a0d2c7b3754c0a6c2eb64c
# Parent  0f9908c2c5c75d787d70a13b01506d1dca49290a
[VMXASSIST] Fix virt-to-phys translation routine.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 tools/firmware/vmxassist/vm86.c |   37 +++++++++++++------------------------
 1 files changed, 13 insertions(+), 24 deletions(-)

diff -r 0f9908c2c5c7 -r 7de1715d185e tools/firmware/vmxassist/vm86.c
--- a/tools/firmware/vmxassist/vm86.c   Mon Sep 25 17:46:08 2006 +0100
+++ b/tools/firmware/vmxassist/vm86.c   Mon Sep 25 18:19:30 2006 +0100
@@ -69,28 +69,23 @@ guest_linear_to_real(uint32_t base)
 
        if (!(oldctx.cr4 & CR4_PAE)) {
                l1_mfn = ((uint32_t *)gcr3)[(base >> 22) & 0x3ff];
-
-               if (oldctx.cr4 & CR4_PSE || l1_mfn & PDE_PS) {
-                        /* 1 level page table */
-                       l0_mfn = l1_mfn;
-                       if (!(l0_mfn & PT_ENTRY_PRESENT))
-                               panic("l1 entry not present\n");
-
-                       l0_mfn &= 0xffc00000;
+               if (!(l1_mfn & PT_ENTRY_PRESENT))
+                       panic("l2 entry not present\n");
+
+               if ((oldctx.cr4 & CR4_PSE) && (l1_mfn & PDE_PS)) {
+                       l0_mfn = l1_mfn & 0xffc00000;
                        return l0_mfn + (base & 0x3fffff);
                }
 
-               if (!(l1_mfn & PT_ENTRY_PRESENT))
-                       panic("l2 entry not present\n");
-
                l1_mfn &= 0xfffff000;
+
                l0_mfn = ((uint32_t *)l1_mfn)[(base >> 12) & 0x3ff];
                if (!(l0_mfn & PT_ENTRY_PRESENT))
                        panic("l1 entry not present\n");
                l0_mfn &= 0xfffff000;
 
                return l0_mfn + (base & 0xfff);
-       } else if (oldctx.cr4 & CR4_PAE && !(oldctx.cr4 & CR4_PSE)) {
+       } else {
                l2_mfn = ((uint64_t *)gcr3)[(base >> 30) & 0x3];
                if (!(l2_mfn & PT_ENTRY_PRESENT))
                        panic("l3 entry not present\n");
@@ -99,6 +94,12 @@ guest_linear_to_real(uint32_t base)
                l1_mfn = ((uint64_t *)l2_mfn)[(base >> 21) & 0x1ff];
                if (!(l1_mfn & PT_ENTRY_PRESENT))
                        panic("l2 entry not present\n");
+
+               if ((oldctx.cr4 & CR4_PSE) && (l1_mfn & PDE_PS)) {
+                       l0_mfn = l1_mfn & 0x3ffe00000ULL;
+                       return l0_mfn + (base & 0x1fffff);
+               }
+
                l1_mfn &= 0x3fffff000ULL;
 
                l0_mfn = ((uint64_t *)l1_mfn)[(base >> 12) & 0x1ff];
@@ -107,18 +108,6 @@ guest_linear_to_real(uint32_t base)
                l0_mfn &= 0x3fffff000ULL;
 
                return l0_mfn + (base & 0xfff);
-       } else { /* oldctx.cr4 & CR4_PAE && oldctx.cr4 & CR4_PSE */
-               l1_mfn = ((uint64_t *)gcr3)[(base >> 30) & 0x3];
-               if (!(l1_mfn & PT_ENTRY_PRESENT))
-                       panic("l2 entry not present\n");
-               l1_mfn &= 0x3fffff000ULL;
-
-               l0_mfn = ((uint64_t *)l1_mfn)[(base >> 21) & 0x1ff];
-               if (!(l0_mfn & PT_ENTRY_PRESENT))
-                       panic("l1 entry not present\n");
-               l0_mfn &= 0x3ffe00000ULL;
-
-               return l0_mfn + (base & 0x1fffff);
        }
 }
 

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] [VMXASSIST] Fix virt-to-phys translation routine., Xen patchbot-unstable <=