ia64/xen-unstable

changeset 6698:f0d728001aaa

More tools PAE fixes to avoid loosing high-order pte bits.
Signed-off-by: ian@xensource.com
author iap10@freefall.cl.cam.ac.uk
date Wed Sep 07 23:11:44 2005 +0000 (2005-09-07)
parents a9a78ca76cd2
children 006efe128837
files tools/libxc/xc_linux_build.c tools/libxc/xc_private.c tools/libxc/xenctrl.h
line diff
     1.1 --- a/tools/libxc/xc_linux_build.c	Wed Sep 07 23:10:49 2005 +0000
     1.2 +++ b/tools/libxc/xc_linux_build.c	Wed Sep 07 23:11:44 2005 +0000
     1.3 @@ -57,7 +57,7 @@ static int probeimageformat(char *image,
     1.4  }
     1.5  
     1.6  #define alloc_pt(ltab, vltab) \
     1.7 -        ltab = page_array[ppt_alloc++] << PAGE_SHIFT; \
     1.8 +        ltab = (unsigned long long)(page_array[ppt_alloc++]) << PAGE_SHIFT; \
     1.9          if (vltab != NULL) { \
    1.10              munmap(vltab, PAGE_SIZE); \
    1.11          } \
    1.12 @@ -128,9 +128,9 @@ static int setup_pg_tables_pae(int xc_ha
    1.13      l1_pgentry_64_t *vl1tab=NULL, *vl1e=NULL;
    1.14      l2_pgentry_64_t *vl2tab=NULL, *vl2e=NULL;
    1.15      l3_pgentry_64_t *vl3tab=NULL, *vl3e=NULL;
    1.16 -    unsigned long l1tab = 0;
    1.17 -    unsigned long l2tab = 0;
    1.18 -    unsigned long l3tab = 0;
    1.19 +    unsigned long long l1tab = 0;
    1.20 +    unsigned long long l2tab = 0;
    1.21 +    unsigned long long l3tab = 0;
    1.22      unsigned long ppt_alloc;
    1.23      unsigned long count;
    1.24  
    1.25 @@ -139,7 +139,13 @@ static int setup_pg_tables_pae(int xc_ha
    1.26      alloc_pt(l3tab, vl3tab);
    1.27      vl3e = &vl3tab[l3_table_offset_pae(dsi_v_start)];
    1.28      ctxt->ctrlreg[3] = l3tab;
    1.29 -    
    1.30 +
    1.31 +    if(l3tab>0xfffff000)
    1.32 +    {
    1.33 +        fprintf(stderr,"L3TAB = %llx above 4GB!\n",l3tab);
    1.34 +        goto error_out;
    1.35 +    }
    1.36 + 
    1.37      for ( count = 0; count < ((v_end-dsi_v_start)>>PAGE_SHIFT); count++)
    1.38      {
    1.39          if ( !((unsigned long)vl1e & (PAGE_SIZE-1)) )
    1.40 @@ -525,12 +531,14 @@ static int setup_guest(int xc_handle,
    1.41      physmap = physmap_e = xc_map_foreign_range(
    1.42          xc_handle, dom, PAGE_SIZE, PROT_READ|PROT_WRITE,
    1.43          page_array[physmap_pfn++]);
    1.44 +
    1.45      for ( count = 0; count < nr_pages; count++ )
    1.46      {
    1.47          if ( xc_add_mmu_update(xc_handle, mmu,
    1.48 -			       (page_array[count] << PAGE_SHIFT) | 
    1.49 +			       ((unsigned long long)page_array[count] << PAGE_SHIFT) | 
    1.50  			       MMU_MACHPHYS_UPDATE, count) )
    1.51          {
    1.52 +            fprintf(stderr,"m2p update failure p=%lx m=%lx\n",count,page_array[count] ); 
    1.53              munmap(physmap, PAGE_SIZE);
    1.54              goto error_out;
    1.55          }
     2.1 --- a/tools/libxc/xc_private.c	Wed Sep 07 23:10:49 2005 +0000
     2.2 +++ b/tools/libxc/xc_private.c	Wed Sep 07 23:11:44 2005 +0000
     2.3 @@ -116,7 +116,7 @@ int xc_mmuext_op(
     2.4  
     2.5      if ( (ret = do_xen_hypercall(xc_handle, &hypercall)) < 0 )
     2.6      {
     2.7 -	fprintf(stderr, "Dom_mem operation failed (rc=%ld errno=%d)-- need to"
     2.8 +	fprintf(stderr, "Dom_mmuext operation failed (rc=%ld errno=%d)-- need to"
     2.9                      " rebuild the user-space tool set?\n",ret,errno);
    2.10      }
    2.11  
    2.12 @@ -172,7 +172,7 @@ xc_mmu_t *xc_init_mmu_updates(int xc_han
    2.13  }
    2.14  
    2.15  int xc_add_mmu_update(int xc_handle, xc_mmu_t *mmu, 
    2.16 -		      unsigned long ptr, unsigned long val)
    2.17 +		      unsigned long long ptr, unsigned long long val)
    2.18  {
    2.19      mmu->updates[mmu->idx].ptr = ptr;
    2.20      mmu->updates[mmu->idx].val = val;
    2.21 @@ -229,7 +229,7 @@ int xc_memory_op(int xc_handle,
    2.22  
    2.23      if ( (ret = do_xen_hypercall(xc_handle, &hypercall)) < 0 )
    2.24      {
    2.25 -	fprintf(stderr, "Dom_mem operation failed (rc=%ld errno=%d)-- need to"
    2.26 +	fprintf(stderr, "hypercall failed (rc=%ld errno=%d)-- need to"
    2.27                  " rebuild the user-space tool set?\n",ret,errno);
    2.28      }
    2.29  
     3.1 --- a/tools/libxc/xenctrl.h	Wed Sep 07 23:10:49 2005 +0000
     3.2 +++ b/tools/libxc/xenctrl.h	Wed Sep 07 23:11:44 2005 +0000
     3.3 @@ -521,7 +521,7 @@ struct xc_mmu {
     3.4  typedef struct xc_mmu xc_mmu_t;
     3.5  xc_mmu_t *xc_init_mmu_updates(int xc_handle, domid_t dom);
     3.6  int xc_add_mmu_update(int xc_handle, xc_mmu_t *mmu, 
     3.7 -                   unsigned long ptr, unsigned long val);
     3.8 +                   unsigned long long ptr, unsigned long long val);
     3.9  int xc_finish_mmu_updates(int xc_handle, xc_mmu_t *mmu);
    3.10  
    3.11  #endif