ia64/xen-unstable

changeset 9621:71f938468929

Make root page table sanity check on restore more generic.

Signed-off-by: Steven Hand <steven@xensource.com>
author smh22@firebug.cl.cam.ac.uk
date Thu Apr 06 17:34:54 2006 +0100 (2006-04-06)
parents 8970d080f719
children c5e80cb40c46
files tools/libxc/xc_linux_restore.c xen/include/public/dom0_ops.h
line diff
     1.1 --- a/tools/libxc/xc_linux_restore.c	Thu Apr 06 16:15:28 2006 +0100
     1.2 +++ b/tools/libxc/xc_linux_restore.c	Thu Apr 06 17:34:54 2006 +0100
     1.3 @@ -646,18 +646,14 @@ int xc_linux_restore(int xc_handle, int 
     1.4          goto out;
     1.5      }
     1.6  
     1.7 -    if ((pt_levels == 2) && ((pfn_type[pfn]&LTABTYPE_MASK) != L2TAB)) { 
     1.8 +    if ( (pfn_type[pfn] & LTABTYPE_MASK) != 
     1.9 +         ((unsigned long)pt_levels<<LTAB_SHIFT) ) {
    1.10          ERR("PT base is bad. pfn=%lu nr=%lu type=%08lx %08lx",
    1.11 -            pfn, max_pfn, pfn_type[pfn], (unsigned long)L2TAB);
    1.12 +            pfn, max_pfn, pfn_type[pfn], 
    1.13 +            (unsigned long)pt_levels<<LTAB_SHIFT); 
    1.14          goto out;
    1.15      }
    1.16  
    1.17 -    if ((pt_levels == 3) && ((pfn_type[pfn]&LTABTYPE_MASK) != L3TAB)) { 
    1.18 -        ERR("PT base is bad. pfn=%lu nr=%lu type=%08lx %08lx",
    1.19 -            pfn, max_pfn, pfn_type[pfn], (unsigned long)L3TAB);
    1.20 -        goto out;
    1.21 -    }
    1.22 -    
    1.23      ctxt.ctrlreg[3] = p2m[pfn] << PAGE_SHIFT;
    1.24  
    1.25      /* clear any pending events and the selector */
     2.1 --- a/xen/include/public/dom0_ops.h	Thu Apr 06 16:15:28 2006 +0100
     2.2 +++ b/xen/include/public/dom0_ops.h	Thu Apr 06 17:34:54 2006 +0100
     2.3 @@ -140,15 +140,16 @@ typedef struct dom0_settime {
     2.4  DEFINE_GUEST_HANDLE(dom0_settime_t);
     2.5  
     2.6  #define DOM0_GETPAGEFRAMEINFO 18
     2.7 +#define LTAB_SHIFT 28
     2.8  #define NOTAB 0         /* normal page */
     2.9 -#define L1TAB (1<<28)
    2.10 -#define L2TAB (2<<28)
    2.11 -#define L3TAB (3<<28)
    2.12 -#define L4TAB (4<<28)
    2.13 +#define L1TAB (1<<LTAB_SHIFT)
    2.14 +#define L2TAB (2<<LTAB_SHIFT)
    2.15 +#define L3TAB (3<<LTAB_SHIFT)
    2.16 +#define L4TAB (4<<LTAB_SHIFT)
    2.17  #define LPINTAB  (1<<31)
    2.18 -#define XTAB  (0xf<<28) /* invalid page */
    2.19 +#define XTAB  (0xf<<LTAB_SHIFT) /* invalid page */
    2.20  #define LTAB_MASK XTAB
    2.21 -#define LTABTYPE_MASK (0x7<<28)
    2.22 +#define LTABTYPE_MASK (0x7<<LTAB_SHIFT)
    2.23  
    2.24  typedef struct dom0_getpageframeinfo {
    2.25      /* IN variables. */