direct-io.hg

changeset 13967:9ffe8922414f

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@novell.com>
author kfraser@localhost.localdomain
date Thu Feb 15 14:28:01 2007 +0000 (2007-02-15)
parents 96d08345f1c5
children 8f75c7910b9c
files tools/libxc/xc_linux_restore.c tools/libxc/xc_linux_save.c tools/libxc/xc_pagetab.c tools/libxc/xg_private.h
line diff
     1.1 --- a/tools/libxc/xc_linux_restore.c	Thu Feb 15 14:25:58 2007 +0000
     1.2 +++ b/tools/libxc/xc_linux_restore.c	Thu Feb 15 14:28:01 2007 +0000
     1.3 @@ -82,7 +82,7 @@ static int uncanonicalize_pagetable(int 
     1.4          if(!(pte & _PAGE_PRESENT))
     1.5              continue; 
     1.6          
     1.7 -        pfn = (pte >> PAGE_SHIFT) & 0xffffffff;
     1.8 +        pfn = (pte >> PAGE_SHIFT) & MFN_MASK_X86;
     1.9          
    1.10          if(pfn >= max_pfn) {
    1.11              /* This "page table page" is probably not one; bail. */
    1.12 @@ -120,12 +120,12 @@ static int uncanonicalize_pagetable(int 
    1.13          if(!(pte & _PAGE_PRESENT))
    1.14              continue;
    1.15          
    1.16 -        pfn = (pte >> PAGE_SHIFT) & 0xffffffff;
    1.17 +        pfn = (pte >> PAGE_SHIFT) & MFN_MASK_X86;
    1.18          
    1.19          if(p2m[pfn] == INVALID_P2M_ENTRY)
    1.20              p2m[pfn] = p2m_batch[nr_mfns++];
    1.21  
    1.22 -        pte &= 0xffffff0000000fffULL;
    1.23 +        pte &= ~MADDR_MASK_X86;
    1.24          pte |= (uint64_t)p2m[pfn] << PAGE_SHIFT;
    1.25  
    1.26          if(pt_levels == 2)
     2.1 --- a/tools/libxc/xc_linux_save.c	Thu Feb 15 14:25:58 2007 +0000
     2.2 +++ b/tools/libxc/xc_linux_save.c	Thu Feb 15 14:28:01 2007 +0000
     2.3 @@ -495,7 +495,7 @@ static int canonicalize_pagetable(unsign
     2.4          hstart = (hvirt_start >> L2_PAGETABLE_SHIFT_PAE) & 0x1ff;
     2.5          he = ((const uint64_t *) spage)[hstart];
     2.6  
     2.7 -        if ( ((he >> PAGE_SHIFT) & 0x0fffffff) == m2p_mfn0 ) {
     2.8 +        if ( ((he >> PAGE_SHIFT) & MFN_MASK_X86) == m2p_mfn0 ) {
     2.9              /* hvirt starts with xen stuff... */
    2.10              xen_start = hstart;
    2.11          } else if ( hvirt_start != 0xf5800000 ) {
    2.12 @@ -503,7 +503,7 @@ static int canonicalize_pagetable(unsign
    2.13              hstart = (0xf5800000 >> L2_PAGETABLE_SHIFT_PAE) & 0x1ff;
    2.14              he = ((const uint64_t *) spage)[hstart];
    2.15  
    2.16 -            if( ((he >> PAGE_SHIFT) & 0x0fffffff) == m2p_mfn0 )
    2.17 +            if( ((he >> PAGE_SHIFT) & MFN_MASK_X86) == m2p_mfn0 )
    2.18                  xen_start = hstart;
    2.19          }
    2.20      }
    2.21 @@ -532,7 +532,7 @@ static int canonicalize_pagetable(unsign
    2.22  
    2.23          if (pte & _PAGE_PRESENT) {
    2.24  
    2.25 -            mfn = (pte >> PAGE_SHIFT) & 0xfffffff;
    2.26 +            mfn = (pte >> PAGE_SHIFT) & MFN_MASK_X86;
    2.27              if (!MFN_IS_IN_PSEUDOPHYS_MAP(mfn)) {
    2.28                  /* This will happen if the type info is stale which
    2.29                     is quite feasible under live migration */
    2.30 @@ -541,7 +541,7 @@ static int canonicalize_pagetable(unsign
    2.31              } else
    2.32                  pfn = mfn_to_pfn(mfn);
    2.33  
    2.34 -            pte &= 0xffffff0000000fffULL;
    2.35 +            pte &= ~MADDR_MASK_X86;
    2.36              pte |= (uint64_t)pfn << PAGE_SHIFT;
    2.37          }
    2.38  
     3.1 --- a/tools/libxc/xc_pagetab.c	Thu Feb 15 14:25:58 2007 +0000
     3.2 +++ b/tools/libxc/xc_pagetab.c	Thu Feb 15 14:28:01 2007 +0000
     3.3 @@ -14,7 +14,7 @@
     3.4  #define L1_PAGETABLE_SHIFT		12
     3.5  #define L2_PAGETABLE_SHIFT		22
     3.6  
     3.7 -#define L0_PAGETABLE_MASK_PAE	0x0000000ffffff000ULL
     3.8 +#define L0_PAGETABLE_MASK_PAE	0x00000ffffffff000ULL
     3.9  #define L1_PAGETABLE_MASK_PAE	0x1ffULL
    3.10  #define L2_PAGETABLE_MASK_PAE	0x1ffULL
    3.11  #define L3_PAGETABLE_MASK_PAE	0x3ULL
    3.12 @@ -33,7 +33,7 @@
    3.13  #define L1_PAGETABLE_SHIFT		L1_PAGETABLE_SHIFT_PAE
    3.14  #define L2_PAGETABLE_SHIFT		L2_PAGETABLE_SHIFT_PAE
    3.15  
    3.16 -#define L0_PAGETABLE_MASK_PAE	0x000000fffffff000ULL
    3.17 +#define L0_PAGETABLE_MASK_PAE	0x000ffffffffff000ULL
    3.18  #define L1_PAGETABLE_MASK_PAE	0x1ffULL
    3.19  #define L2_PAGETABLE_MASK_PAE	0x1ffULL
    3.20  #define L3_PAGETABLE_MASK_PAE	0x1ffULL
     4.1 --- a/tools/libxc/xg_private.h	Thu Feb 15 14:25:58 2007 +0000
     4.2 +++ b/tools/libxc/xg_private.h	Thu Feb 15 14:28:01 2007 +0000
     4.3 @@ -134,6 +134,13 @@ typedef l4_pgentry_64_t l4_pgentry_t;
     4.4  #define PAGE_SHIFT_X86          12
     4.5  #define PAGE_SIZE_X86           (1UL << PAGE_SHIFT_X86)
     4.6  #define PAGE_MASK_X86           (~(PAGE_SIZE_X86-1))
     4.7 +#if defined(__i386__)
     4.8 +#define MADDR_BITS_X86          44
     4.9 +#elif defined(__x86_64__)
    4.10 +#define MADDR_BITS_X86          52
    4.11 +#endif
    4.12 +#define MFN_MASK_X86            ((1ULL << (MADDR_BITS_X86 - PAGE_SHIFT_X86)) - 1)
    4.13 +#define MADDR_MASK_X86          (MFN_MASK_X86 << PAGE_SHIFT_X86)
    4.14  
    4.15  #define PAGE_SHIFT_IA64         14
    4.16  #define PAGE_SIZE_IA64          (1UL << PAGE_SHIFT_IA64)