Jan Beulich
2007-Feb-12 13:09 UTC
[Xen-devel] [PATCH] lift physical address restriction in svae/restore code
Bump this to 44 bits for x86-32 and 52 bits for x86-64. Signed-off-by: Jan Beulich <jbeulich@novell.com> Index: 2007-02-07/tools/libxc/xc_linux_restore.c ==================================================================--- 2007-02-07.orig/tools/libxc/xc_linux_restore.c 2007-01-17 11:16:20.000000000 +0100 +++ 2007-02-07/tools/libxc/xc_linux_restore.c 2007-02-12 09:06:05.000000000 +0100 @@ -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) Index: 2007-02-07/tools/libxc/xc_linux_save.c ==================================================================--- 2007-02-07.orig/tools/libxc/xc_linux_save.c 2007-02-01 17:41:07.000000000 +0100 +++ 2007-02-07/tools/libxc/xc_linux_save.c 2007-02-12 09:05:24.000000000 +0100 @@ -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; } Index: 2007-02-07/tools/libxc/xc_pagetab.c ==================================================================--- 2007-02-07.orig/tools/libxc/xc_pagetab.c 2006-06-09 08:30:05.000000000 +0200 +++ 2007-02-07/tools/libxc/xc_pagetab.c 2007-02-12 09:10:01.000000000 +0100 @@ -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 Index: 2007-02-07/tools/libxc/xg_private.h ==================================================================--- 2007-02-07.orig/tools/libxc/xg_private.h 2007-01-30 10:23:29.000000000 +0100 +++ 2007-02-07/tools/libxc/xg_private.h 2007-02-12 09:04:01.000000000 +0100 @@ -134,6 +134,9 @@ 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)) +#define MADDR_BITS_X86 52 +#define MFN_MASK_X86 ((1ULL << MADDR_BITS_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-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel