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

[Xen-changelog] [xen-unstable] Lift physical address restriction in save/restore code.



# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1171549681 0
# Node ID 9ffe8922414f2a0c8e8471e336f21694d203d1cf
# Parent  96d08345f1c51160a6625b102907192734e47f40
Lift physical address restriction in save/restore code.
Bump this to 44 bits for x86-32 and 52 bits for x86-64.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
---
 tools/libxc/xc_linux_restore.c |    6 +++---
 tools/libxc/xc_linux_save.c    |    8 ++++----
 tools/libxc/xc_pagetab.c       |    4 ++--
 tools/libxc/xg_private.h       |    7 +++++++
 4 files changed, 16 insertions(+), 9 deletions(-)

diff -r 96d08345f1c5 -r 9ffe8922414f tools/libxc/xc_linux_restore.c
--- a/tools/libxc/xc_linux_restore.c    Thu Feb 15 14:25:58 2007 +0000
+++ b/tools/libxc/xc_linux_restore.c    Thu Feb 15 14:28:01 2007 +0000
@@ -82,7 +82,7 @@ static int uncanonicalize_pagetable(int 
         if(!(pte & _PAGE_PRESENT))
             continue; 
         
-        pfn = (pte >> PAGE_SHIFT) & 0xffffffff;
+        pfn = (pte >> PAGE_SHIFT) & MFN_MASK_X86;
         
         if(pfn >= max_pfn) {
             /* This "page table page" is probably not one; bail. */
@@ -120,12 +120,12 @@ static int uncanonicalize_pagetable(int 
         if(!(pte & _PAGE_PRESENT))
             continue;
         
-        pfn = (pte >> PAGE_SHIFT) & 0xffffffff;
+        pfn = (pte >> PAGE_SHIFT) & MFN_MASK_X86;
         
         if(p2m[pfn] == INVALID_P2M_ENTRY)
             p2m[pfn] = p2m_batch[nr_mfns++];
 
-        pte &= 0xffffff0000000fffULL;
+        pte &= ~MADDR_MASK_X86;
         pte |= (uint64_t)p2m[pfn] << PAGE_SHIFT;
 
         if(pt_levels == 2)
diff -r 96d08345f1c5 -r 9ffe8922414f tools/libxc/xc_linux_save.c
--- a/tools/libxc/xc_linux_save.c       Thu Feb 15 14:25:58 2007 +0000
+++ b/tools/libxc/xc_linux_save.c       Thu Feb 15 14:28:01 2007 +0000
@@ -495,7 +495,7 @@ static int canonicalize_pagetable(unsign
         hstart = (hvirt_start >> L2_PAGETABLE_SHIFT_PAE) & 0x1ff;
         he = ((const uint64_t *) spage)[hstart];
 
-        if ( ((he >> PAGE_SHIFT) & 0x0fffffff) == m2p_mfn0 ) {
+        if ( ((he >> PAGE_SHIFT) & MFN_MASK_X86) == m2p_mfn0 ) {
             /* hvirt starts with xen stuff... */
             xen_start = hstart;
         } else if ( hvirt_start != 0xf5800000 ) {
@@ -503,7 +503,7 @@ static int canonicalize_pagetable(unsign
             hstart = (0xf5800000 >> L2_PAGETABLE_SHIFT_PAE) & 0x1ff;
             he = ((const uint64_t *) spage)[hstart];
 
-            if( ((he >> PAGE_SHIFT) & 0x0fffffff) == m2p_mfn0 )
+            if( ((he >> PAGE_SHIFT) & MFN_MASK_X86) == m2p_mfn0 )
                 xen_start = hstart;
         }
     }
@@ -532,7 +532,7 @@ static int canonicalize_pagetable(unsign
 
         if (pte & _PAGE_PRESENT) {
 
-            mfn = (pte >> PAGE_SHIFT) & 0xfffffff;
+            mfn = (pte >> PAGE_SHIFT) & MFN_MASK_X86;
             if (!MFN_IS_IN_PSEUDOPHYS_MAP(mfn)) {
                 /* This will happen if the type info is stale which
                    is quite feasible under live migration */
@@ -541,7 +541,7 @@ static int canonicalize_pagetable(unsign
             } else
                 pfn = mfn_to_pfn(mfn);
 
-            pte &= 0xffffff0000000fffULL;
+            pte &= ~MADDR_MASK_X86;
             pte |= (uint64_t)pfn << PAGE_SHIFT;
         }
 
diff -r 96d08345f1c5 -r 9ffe8922414f tools/libxc/xc_pagetab.c
--- a/tools/libxc/xc_pagetab.c  Thu Feb 15 14:25:58 2007 +0000
+++ b/tools/libxc/xc_pagetab.c  Thu Feb 15 14:28:01 2007 +0000
@@ -14,7 +14,7 @@
 #define L1_PAGETABLE_SHIFT             12
 #define L2_PAGETABLE_SHIFT             22
 
-#define L0_PAGETABLE_MASK_PAE  0x0000000ffffff000ULL
+#define L0_PAGETABLE_MASK_PAE  0x00000ffffffff000ULL
 #define L1_PAGETABLE_MASK_PAE  0x1ffULL
 #define L2_PAGETABLE_MASK_PAE  0x1ffULL
 #define L3_PAGETABLE_MASK_PAE  0x3ULL
@@ -33,7 +33,7 @@
 #define L1_PAGETABLE_SHIFT             L1_PAGETABLE_SHIFT_PAE
 #define L2_PAGETABLE_SHIFT             L2_PAGETABLE_SHIFT_PAE
 
-#define L0_PAGETABLE_MASK_PAE  0x000000fffffff000ULL
+#define L0_PAGETABLE_MASK_PAE  0x000ffffffffff000ULL
 #define L1_PAGETABLE_MASK_PAE  0x1ffULL
 #define L2_PAGETABLE_MASK_PAE  0x1ffULL
 #define L3_PAGETABLE_MASK_PAE  0x1ffULL
diff -r 96d08345f1c5 -r 9ffe8922414f tools/libxc/xg_private.h
--- a/tools/libxc/xg_private.h  Thu Feb 15 14:25:58 2007 +0000
+++ b/tools/libxc/xg_private.h  Thu Feb 15 14:28:01 2007 +0000
@@ -134,6 +134,13 @@ typedef l4_pgentry_64_t l4_pgentry_t;
 #define PAGE_SHIFT_X86          12
 #define PAGE_SIZE_X86           (1UL << PAGE_SHIFT_X86)
 #define PAGE_MASK_X86           (~(PAGE_SIZE_X86-1))
+#if defined(__i386__)
+#define MADDR_BITS_X86          44
+#elif defined(__x86_64__)
+#define MADDR_BITS_X86          52
+#endif
+#define MFN_MASK_X86            ((1ULL << (MADDR_BITS_X86 - PAGE_SHIFT_X86)) - 
1)
+#define MADDR_MASK_X86          (MFN_MASK_X86 << PAGE_SHIFT_X86)
 
 #define PAGE_SHIFT_IA64         14
 #define PAGE_SIZE_IA64          (1UL << PAGE_SHIFT_IA64)

_______________________________________________
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®.