ia64/xen-unstable

changeset 10314:b3d901ba705d

Represent PFNs with their own type, rather than 'unsigned long'.
('long' changes size and alignment between 32- and 64-bit ABIs.)
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
author kaf24@firebug.cl.cam.ac.uk
date Tue Jun 06 09:48:17 2006 +0100 (2006-06-06)
parents 3913a119477d
children c191c649cdb3
files linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c linux-2.6-xen-sparse/include/xen/public/privcmd.h tools/debugger/libxendebug/xendebug.c tools/ioemu/hw/cirrus_vga.c tools/ioemu/vl.c tools/libxc/xc_core.c tools/libxc/xc_domain.c tools/libxc/xc_hvm_build.c tools/libxc/xc_ia64_stubs.c tools/libxc/xc_linux.c tools/libxc/xc_linux_build.c tools/libxc/xc_linux_restore.c tools/libxc/xc_linux_save.c tools/libxc/xc_load_aout9.c tools/libxc/xc_load_bin.c tools/libxc/xc_load_elf.c tools/libxc/xc_private.c tools/libxc/xenctrl.h tools/libxc/xg_private.h tools/libxc/xg_save_restore.h xen/common/memory.c xen/include/public/arch-ia64.h xen/include/public/arch-x86_32.h xen/include/public/arch-x86_64.h xen/include/public/dom0_ops.h xen/include/public/grant_table.h xen/include/public/memory.h xen/include/public/xen.h
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c	Tue Jun 06 08:21:31 2006 +0100
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c	Tue Jun 06 09:48:17 2006 +0100
     1.3 @@ -161,7 +161,7 @@ static int privcmd_ioctl(struct inode *i
     1.4  	case IOCTL_PRIVCMD_MMAPBATCH: {
     1.5  		privcmd_mmapbatch_t m;
     1.6  		struct vm_area_struct *vma = NULL;
     1.7 -		unsigned long __user *p;
     1.8 +		xen_pfn_t __user *p;
     1.9  		unsigned long addr, mfn; 
    1.10  		int i;
    1.11  
     2.1 --- a/linux-2.6-xen-sparse/include/xen/public/privcmd.h	Tue Jun 06 08:21:31 2006 +0100
     2.2 +++ b/linux-2.6-xen-sparse/include/xen/public/privcmd.h	Tue Jun 06 09:48:17 2006 +0100
     2.3 @@ -59,7 +59,7 @@ typedef struct privcmd_mmapbatch {
     2.4  	int num;     /* number of pages to populate */
     2.5  	domid_t dom; /* target domain */
     2.6  	unsigned long addr;  /* virtual address */
     2.7 -	unsigned long __user *arr; /* array of mfns - top nibble set on err */
     2.8 +	xen_pfn_t __user *arr; /* array of mfns - top nibble set on err */
     2.9  } privcmd_mmapbatch_t; 
    2.10  
    2.11  /*
     3.1 --- a/tools/debugger/libxendebug/xendebug.c	Tue Jun 06 08:21:31 2006 +0100
     3.2 +++ b/tools/debugger/libxendebug/xendebug.c	Tue Jun 06 09:48:17 2006 +0100
     3.3 @@ -57,7 +57,7 @@ typedef struct domain_context           
     3.4      vcpu_guest_context_t context[MAX_VIRT_CPUS];
     3.5  
     3.6      long            total_pages;
     3.7 -    unsigned long  *page_array;
     3.8 +    xen_pfn_t      *page_array;
     3.9  
    3.10      unsigned long   cr3_phys[MAX_VIRT_CPUS];
    3.11      unsigned long  *cr3_virt[MAX_VIRT_CPUS];
     4.1 --- a/tools/ioemu/hw/cirrus_vga.c	Tue Jun 06 08:21:31 2006 +0100
     4.2 +++ b/tools/ioemu/hw/cirrus_vga.c	Tue Jun 06 09:48:17 2006 +0100
     4.3 @@ -2462,7 +2462,7 @@ static CPUWriteMemoryFunc *cirrus_linear
     4.4  extern FILE *logfile;
     4.5  static void * set_vram_mapping(unsigned long begin, unsigned long end)
     4.6  {
     4.7 -    unsigned long * extent_start = NULL;
     4.8 +    xen_pfn_t *extent_start = NULL;
     4.9      unsigned long nr_extents;
    4.10      void *vram_pointer = NULL;
    4.11      int i;
    4.12 @@ -2473,14 +2473,14 @@ static void * set_vram_mapping(unsigned 
    4.13      end = (end + TARGET_PAGE_SIZE -1 ) & TARGET_PAGE_MASK;
    4.14      nr_extents = (end - begin) >> TARGET_PAGE_BITS;
    4.15  
    4.16 -    extent_start = malloc(sizeof(unsigned long) * nr_extents );
    4.17 +    extent_start = malloc(sizeof(xen_pfn_t) * nr_extents );
    4.18      if (extent_start == NULL)
    4.19      {
    4.20          fprintf(stderr, "Failed malloc on set_vram_mapping\n");
    4.21          return NULL;
    4.22      }
    4.23  
    4.24 -    memset(extent_start, 0, sizeof(unsigned long) * nr_extents);
    4.25 +    memset(extent_start, 0, sizeof(xen_pfn_t) * nr_extents);
    4.26  
    4.27      for (i = 0; i < nr_extents; i++)
    4.28      {
    4.29 @@ -2508,7 +2508,7 @@ static void * set_vram_mapping(unsigned 
    4.30  
    4.31  static int unset_vram_mapping(unsigned long begin, unsigned long end)
    4.32  {
    4.33 -    unsigned long * extent_start = NULL;
    4.34 +    xen_pfn_t *extent_start = NULL;
    4.35      unsigned long nr_extents;
    4.36      int i;
    4.37  
    4.38 @@ -2519,7 +2519,7 @@ static int unset_vram_mapping(unsigned l
    4.39      end = (end + TARGET_PAGE_SIZE -1 ) & TARGET_PAGE_MASK;
    4.40      nr_extents = (end - begin) >> TARGET_PAGE_BITS;
    4.41  
    4.42 -    extent_start = malloc(sizeof(unsigned long) * nr_extents );
    4.43 +    extent_start = malloc(sizeof(xen_pfn_t) * nr_extents );
    4.44  
    4.45      if (extent_start == NULL)
    4.46      {
    4.47 @@ -2527,7 +2527,7 @@ static int unset_vram_mapping(unsigned l
    4.48          return -1;
    4.49      }
    4.50  
    4.51 -    memset(extent_start, 0, sizeof(unsigned long) * nr_extents);
    4.52 +    memset(extent_start, 0, sizeof(xen_pfn_t) * nr_extents);
    4.53  
    4.54      for (i = 0; i < nr_extents; i++)
    4.55          extent_start[i] = (begin + (i * TARGET_PAGE_SIZE)) >> TARGET_PAGE_BITS;
     5.1 --- a/tools/ioemu/vl.c	Tue Jun 06 08:21:31 2006 +0100
     5.2 +++ b/tools/ioemu/vl.c	Tue Jun 06 09:48:17 2006 +0100
     5.3 @@ -2458,7 +2458,7 @@ int unset_mm_mapping(int xc_handle,
     5.4                       uint32_t domid,
     5.5                       unsigned long nr_pages,
     5.6                       unsigned int address_bits,
     5.7 -                     unsigned long *extent_start)
     5.8 +                     xen_pfn_t *extent_start)
     5.9  {
    5.10      int err = 0;
    5.11      xc_dominfo_t info;
    5.12 @@ -2491,7 +2491,7 @@ int set_mm_mapping(int xc_handle,
    5.13                      uint32_t domid,
    5.14                      unsigned long nr_pages,
    5.15                      unsigned int address_bits,
    5.16 -                    unsigned long *extent_start)
    5.17 +                    xen_pfn_t *extent_start)
    5.18  {
    5.19      xc_dominfo_t info;
    5.20      int err = 0;
    5.21 @@ -2557,7 +2557,8 @@ int main(int argc, char **argv)
    5.22      int serial_device_index;
    5.23      char qemu_dm_logfilename[64];
    5.24      const char *loadvm = NULL;
    5.25 -    unsigned long nr_pages, *page_array;
    5.26 +    unsigned long nr_pages;
    5.27 +    xen_pfn_t *page_array;
    5.28      extern void *shared_page;
    5.29  
    5.30  #if !defined(CONFIG_SOFTMMU)
    5.31 @@ -3023,8 +3024,8 @@ int main(int argc, char **argv)
    5.32  
    5.33      xc_handle = xc_interface_open();
    5.34  
    5.35 -    if ( (page_array = (unsigned long *)
    5.36 -                        malloc(nr_pages * sizeof(unsigned long))) == NULL)
    5.37 +    if ( (page_array = (xen_pfn_t *)
    5.38 +                        malloc(nr_pages * sizeof(xen_pfn_t))) == NULL)
    5.39      {
    5.40          fprintf(logfile, "malloc returned error %d\n", errno);
    5.41          exit(-1);
    5.42 @@ -3079,8 +3080,8 @@ int main(int argc, char **argv)
    5.43                                         page_array[0]);
    5.44  #endif
    5.45  
    5.46 -    fprintf(logfile, "shared page at pfn:%lx, mfn: %lx\n", (nr_pages-1),
    5.47 -           (page_array[nr_pages - 1]));
    5.48 +    fprintf(logfile, "shared page at pfn:%lx, mfn: %"PRIx64"\n", (nr_pages-1),
    5.49 +           (uint64_t)(page_array[nr_pages - 1]));
    5.50  
    5.51      /* we always create the cdrom drive, even if no disk is there */
    5.52      bdrv_init();
     6.1 --- a/tools/libxc/xc_core.c	Tue Jun 06 08:21:31 2006 +0100
     6.2 +++ b/tools/libxc/xc_core.c	Tue Jun 06 09:48:17 2006 +0100
     6.3 @@ -28,7 +28,7 @@ xc_domain_dumpcore_via_callback(int xc_h
     6.4                                  dumpcore_rtn_t dump_rtn)
     6.5  {
     6.6      unsigned long nr_pages;
     6.7 -    unsigned long *page_array = NULL;
     6.8 +    xen_pfn_t *page_array = NULL;
     6.9      xc_dominfo_t info;
    6.10      int i, nr_vcpus = 0;
    6.11      char *dump_mem, *dump_mem_start = NULL;
    6.12 @@ -70,7 +70,7 @@ xc_domain_dumpcore_via_callback(int xc_h
    6.13          sizeof(vcpu_guest_context_t)*nr_vcpus;
    6.14      dummy_len = (sizeof(struct xc_core_header) +
    6.15                   (sizeof(vcpu_guest_context_t) * nr_vcpus) +
    6.16 -                 (nr_pages * sizeof(unsigned long)));
    6.17 +                 (nr_pages * sizeof(xen_pfn_t)));
    6.18      header.xch_pages_offset = round_pgup(dummy_len);
    6.19  
    6.20      sts = dump_rtn(args, (char *)&header, sizeof(struct xc_core_header));
    6.21 @@ -81,7 +81,7 @@ xc_domain_dumpcore_via_callback(int xc_h
    6.22      if ( sts != 0 )
    6.23          goto error_out;
    6.24  
    6.25 -    if ( (page_array = malloc(nr_pages * sizeof(unsigned long))) == NULL )
    6.26 +    if ( (page_array = malloc(nr_pages * sizeof(xen_pfn_t))) == NULL )
    6.27      {
    6.28          printf("Could not allocate memory\n");
    6.29          goto error_out;
    6.30 @@ -91,7 +91,7 @@ xc_domain_dumpcore_via_callback(int xc_h
    6.31          printf("Could not get the page frame list\n");
    6.32          goto error_out;
    6.33      }
    6.34 -    sts = dump_rtn(args, (char *)page_array, nr_pages * sizeof(unsigned long));
    6.35 +    sts = dump_rtn(args, (char *)page_array, nr_pages * sizeof(xen_pfn_t));
    6.36      if ( sts != 0 )
    6.37          goto error_out;
    6.38  
     7.1 --- a/tools/libxc/xc_domain.c	Tue Jun 06 08:21:31 2006 +0100
     7.2 +++ b/tools/libxc/xc_domain.c	Tue Jun 06 09:48:17 2006 +0100
     7.3 @@ -291,7 +291,7 @@ int xc_domain_memory_increase_reservatio
     7.4                                            unsigned long nr_extents,
     7.5                                            unsigned int extent_order,
     7.6                                            unsigned int address_bits,
     7.7 -                                          unsigned long *extent_start)
     7.8 +                                          xen_pfn_t *extent_start)
     7.9  {
    7.10      int err;
    7.11      struct xen_memory_reservation reservation = {
    7.12 @@ -324,7 +324,7 @@ int xc_domain_memory_decrease_reservatio
    7.13                                            uint32_t domid,
    7.14                                            unsigned long nr_extents,
    7.15                                            unsigned int extent_order,
    7.16 -                                          unsigned long *extent_start)
    7.17 +                                          xen_pfn_t *extent_start)
    7.18  {
    7.19      int err;
    7.20      struct xen_memory_reservation reservation = {
    7.21 @@ -363,7 +363,7 @@ int xc_domain_memory_populate_physmap(in
    7.22                                            unsigned long nr_extents,
    7.23                                            unsigned int extent_order,
    7.24                                            unsigned int address_bits,
    7.25 -                                          unsigned long *extent_start)
    7.26 +                                          xen_pfn_t *extent_start)
    7.27  {
    7.28      int err;
    7.29      struct xen_memory_reservation reservation = {
    7.30 @@ -392,8 +392,8 @@ int xc_domain_memory_populate_physmap(in
    7.31  int xc_domain_translate_gpfn_list(int xc_handle,
    7.32                                    uint32_t domid,
    7.33                                    unsigned long nr_gpfns,
    7.34 -                                  unsigned long *gpfn_list,
    7.35 -                                  unsigned long *mfn_list)
    7.36 +                                  xen_pfn_t *gpfn_list,
    7.37 +                                  xen_pfn_t *mfn_list)
    7.38  {
    7.39      struct xen_translate_gpfn_list op = {
    7.40          .domid        = domid,
     8.1 --- a/tools/libxc/xc_hvm_build.c	Tue Jun 06 08:21:31 2006 +0100
     8.2 +++ b/tools/libxc/xc_hvm_build.c	Tue Jun 06 09:48:17 2006 +0100
     8.3 @@ -135,7 +135,7 @@ static void set_hvm_info_checksum(struct
     8.4   * hvmloader will use this info to set BIOS accordingly
     8.5   */
     8.6  static int set_hvm_info(int xc_handle, uint32_t dom,
     8.7 -                        unsigned long *pfn_list, unsigned int vcpus,
     8.8 +                        xen_pfn_t *pfn_list, unsigned int vcpus,
     8.9                          unsigned int pae, unsigned int acpi, unsigned int apic)
    8.10  {
    8.11      char *va_map;
    8.12 @@ -178,7 +178,7 @@ static int setup_guest(int xc_handle,
    8.13                         unsigned int store_evtchn,
    8.14                         unsigned long *store_mfn)
    8.15  {
    8.16 -    unsigned long *page_array = NULL;
    8.17 +    xen_pfn_t *page_array = NULL;
    8.18      unsigned long count, i;
    8.19      unsigned long long ptr;
    8.20      xc_mmu_t *mmu = NULL;
    8.21 @@ -223,7 +223,7 @@ static int setup_guest(int xc_handle,
    8.22          goto error_out;
    8.23      }
    8.24  
    8.25 -    if ( (page_array = malloc(nr_pages * sizeof(unsigned long))) == NULL )
    8.26 +    if ( (page_array = malloc(nr_pages * sizeof(xen_pfn_t))) == NULL )
    8.27      {
    8.28          PERROR("Could not allocate memory.\n");
    8.29          goto error_out;
     9.1 --- a/tools/libxc/xc_ia64_stubs.c	Tue Jun 06 08:21:31 2006 +0100
     9.2 +++ b/tools/libxc/xc_ia64_stubs.c	Tue Jun 06 09:48:17 2006 +0100
     9.3 @@ -57,7 +57,7 @@ xc_plan9_build(int xc_handle,
     9.4  
     9.5  int xc_ia64_get_pfn_list(int xc_handle,
     9.6                           uint32_t domid,
     9.7 -                         unsigned long *pfn_buf,
     9.8 +                         xen_pfn_t *pfn_buf,
     9.9                           unsigned int start_page,
    9.10                           unsigned int nr_pages)
    9.11  {
    9.12 @@ -65,7 +65,7 @@ int xc_ia64_get_pfn_list(int xc_handle,
    9.13      int num_pfns,ret;
    9.14      unsigned int __start_page, __nr_pages;
    9.15      unsigned long max_pfns;
    9.16 -    unsigned long *__pfn_buf;
    9.17 +    xen_pfn_t *__pfn_buf;
    9.18  
    9.19      __start_page = start_page;
    9.20      __nr_pages = nr_pages;
    9.21 @@ -80,7 +80,7 @@ int xc_ia64_get_pfn_list(int xc_handle,
    9.22          set_xen_guest_handle(op.u.getmemlist.buffer, __pfn_buf);
    9.23  
    9.24          if ( (max_pfns != -1UL)
    9.25 -            && mlock(__pfn_buf, __nr_pages * sizeof(unsigned long)) != 0 )
    9.26 +            && mlock(__pfn_buf, __nr_pages * sizeof(xen_pfn_t)) != 0 )
    9.27          {
    9.28              PERROR("Could not lock pfn list buffer");
    9.29              return -1;
    9.30 @@ -89,7 +89,7 @@ int xc_ia64_get_pfn_list(int xc_handle,
    9.31          ret = do_dom0_op(xc_handle, &op);
    9.32  
    9.33          if (max_pfns != -1UL)
    9.34 -            (void)munlock(__pfn_buf, __nr_pages * sizeof(unsigned long));
    9.35 +            (void)munlock(__pfn_buf, __nr_pages * sizeof(xen_pfn_t));
    9.36  
    9.37          if (max_pfns == -1UL)
    9.38              return 0;
    9.39 @@ -122,10 +122,10 @@ int xc_ia64_copy_to_domain_pages(int xc_
    9.40  {
    9.41      // N.B. gva should be page aligned
    9.42  
    9.43 -    unsigned long *page_array = NULL;
    9.44 +    xen_pfn_t *page_array = NULL;
    9.45      int i;
    9.46  
    9.47 -    if ( (page_array = malloc(nr_pages * sizeof(unsigned long))) == NULL ){
    9.48 +    if ( (page_array = malloc(nr_pages * sizeof(xen_pfn_t))) == NULL ){
    9.49          PERROR("Could not allocate memory");
    9.50          goto error_out;
    9.51      }
    10.1 --- a/tools/libxc/xc_linux.c	Tue Jun 06 08:21:31 2006 +0100
    10.2 +++ b/tools/libxc/xc_linux.c	Tue Jun 06 09:48:17 2006 +0100
    10.3 @@ -28,7 +28,7 @@ int xc_interface_close(int xc_handle)
    10.4  }
    10.5  
    10.6  void *xc_map_foreign_batch(int xc_handle, uint32_t dom, int prot,
    10.7 -                           unsigned long *arr, int num)
    10.8 +                           xen_pfn_t *arr, int num)
    10.9  {
   10.10      privcmd_mmapbatch_t ioctlx;
   10.11      void *addr;
    11.1 --- a/tools/libxc/xc_linux_build.c	Tue Jun 06 08:21:31 2006 +0100
    11.2 +++ b/tools/libxc/xc_linux_build.c	Tue Jun 06 09:48:17 2006 +0100
    11.3 @@ -10,6 +10,7 @@
    11.4  #include "xc_aout9.h"
    11.5  #include <stdlib.h>
    11.6  #include <unistd.h>
    11.7 +#include <inttypes.h>
    11.8  #include <zlib.h>
    11.9  
   11.10  #if defined(__i386__)
   11.11 @@ -136,7 +137,7 @@ static int probeimageformat(const char *
   11.12  int load_initrd(int xc_handle, domid_t dom,
   11.13                  struct initrd_info *initrd,
   11.14                  unsigned long physbase,
   11.15 -                unsigned long *phys_to_mach)
   11.16 +                xen_pfn_t *phys_to_mach)
   11.17  {
   11.18      char page[PAGE_SIZE];
   11.19      unsigned long pfn_start, pfn, nr_pages;
   11.20 @@ -189,7 +190,7 @@ static int setup_pg_tables(int xc_handle
   11.21                             vcpu_guest_context_t *ctxt,
   11.22                             unsigned long dsi_v_start,
   11.23                             unsigned long v_end,
   11.24 -                           unsigned long *page_array,
   11.25 +                           xen_pfn_t *page_array,
   11.26                             unsigned long vpt_start,
   11.27                             unsigned long vpt_end,
   11.28                             unsigned shadow_mode_enabled)
   11.29 @@ -251,7 +252,7 @@ static int setup_pg_tables_pae(int xc_ha
   11.30                                 vcpu_guest_context_t *ctxt,
   11.31                                 unsigned long dsi_v_start,
   11.32                                 unsigned long v_end,
   11.33 -                               unsigned long *page_array,
   11.34 +                               xen_pfn_t *page_array,
   11.35                                 unsigned long vpt_start,
   11.36                                 unsigned long vpt_end,
   11.37                                 unsigned shadow_mode_enabled,
   11.38 @@ -356,7 +357,7 @@ static int setup_pg_tables_64(int xc_han
   11.39                                vcpu_guest_context_t *ctxt,
   11.40                                unsigned long dsi_v_start,
   11.41                                unsigned long v_end,
   11.42 -                              unsigned long *page_array,
   11.43 +                              xen_pfn_t *page_array,
   11.44                                unsigned long vpt_start,
   11.45                                unsigned long vpt_end,
   11.46                                int shadow_mode_enabled)
   11.47 @@ -467,7 +468,7 @@ static int setup_guest(int xc_handle,
   11.48                         unsigned int console_evtchn, unsigned long *console_mfn,
   11.49                         uint32_t required_features[XENFEAT_NR_SUBMAPS])
   11.50  {
   11.51 -    unsigned long *page_array = NULL;
   11.52 +    xen_pfn_t *page_array = NULL;
   11.53      struct load_funcs load_funcs;
   11.54      struct domain_setup_info dsi;
   11.55      unsigned long vinitrd_start;
   11.56 @@ -494,7 +495,7 @@ static int setup_guest(int xc_handle,
   11.57  
   11.58      start_page = dsi.v_start >> PAGE_SHIFT;
   11.59      pgnr = (v_end - dsi.v_start) >> PAGE_SHIFT;
   11.60 -    if ( (page_array = malloc(pgnr * sizeof(unsigned long))) == NULL )
   11.61 +    if ( (page_array = malloc(pgnr * sizeof(xen_pfn_t))) == NULL )
   11.62      {
   11.63          PERROR("Could not allocate memory");
   11.64          goto error_out;
   11.65 @@ -622,7 +623,7 @@ static int setup_guest(int xc_handle,
   11.66                         unsigned int console_evtchn, unsigned long *console_mfn,
   11.67                         uint32_t required_features[XENFEAT_NR_SUBMAPS])
   11.68  {
   11.69 -    unsigned long *page_array = NULL;
   11.70 +    xen_pfn_t *page_array = NULL;
   11.71      unsigned long count, i, hypercall_pfn;
   11.72      start_info_t *start_info;
   11.73      shared_info_t *shared_info;
   11.74 @@ -633,7 +634,7 @@ static int setup_guest(int xc_handle,
   11.75  
   11.76      unsigned long nr_pt_pages;
   11.77      unsigned long physmap_pfn;
   11.78 -    unsigned long *physmap, *physmap_e;
   11.79 +    xen_pfn_t *physmap, *physmap_e;
   11.80  
   11.81      struct load_funcs load_funcs;
   11.82      struct domain_setup_info dsi;
   11.83 @@ -882,8 +883,8 @@ static int setup_guest(int xc_handle,
   11.84              ((uint64_t)page_array[count] << PAGE_SHIFT) | MMU_MACHPHYS_UPDATE,
   11.85              count) )
   11.86          {
   11.87 -            fprintf(stderr,"m2p update failure p=%lx m=%lx\n",
   11.88 -                    count, page_array[count]);
   11.89 +            fprintf(stderr,"m2p update failure p=%lx m=%"PRIx64"\n",
   11.90 +                    count, (uint64_t)page_array[count]);
   11.91              munmap(physmap, PAGE_SIZE);
   11.92              goto error_out;
   11.93          }
    12.1 --- a/tools/libxc/xc_linux_restore.c	Tue Jun 06 08:21:31 2006 +0100
    12.2 +++ b/tools/libxc/xc_linux_restore.c	Tue Jun 06 09:48:17 2006 +0100
    12.3 @@ -25,10 +25,10 @@ static unsigned int pt_levels;
    12.4  static unsigned long max_pfn;
    12.5  
    12.6  /* Live mapping of the table mapping each PFN to its current MFN. */
    12.7 -static unsigned long *live_p2m = NULL;
    12.8 +static xen_pfn_t *live_p2m = NULL;
    12.9  
   12.10  /* A table mapping each PFN to its new MFN. */
   12.11 -static unsigned long *p2m = NULL;
   12.12 +static xen_pfn_t *p2m = NULL;
   12.13  
   12.14  
   12.15  static ssize_t
   12.16 @@ -126,7 +126,7 @@ int xc_linux_restore(int xc_handle, int 
   12.17      unsigned long *pfn_type = NULL;
   12.18  
   12.19      /* A table of MFNs to map in the current region */
   12.20 -    unsigned long *region_mfn = NULL;
   12.21 +    xen_pfn_t *region_mfn = NULL;
   12.22  
   12.23      /* Types of the pfns in the current region */
   12.24      unsigned long region_pfn_type[MAX_BATCH_SIZE];
   12.25 @@ -135,7 +135,7 @@ int xc_linux_restore(int xc_handle, int 
   12.26      unsigned long *page = NULL;
   12.27  
   12.28      /* A copy of the pfn-to-mfn table frame list. */
   12.29 -    unsigned long *p2m_frame_list = NULL;
   12.30 +    xen_pfn_t *p2m_frame_list = NULL;
   12.31  
   12.32      /* A temporary mapping of the guest's start_info page. */
   12.33      start_info_t *start_info;
   12.34 @@ -241,9 +241,9 @@ int xc_linux_restore(int xc_handle, int 
   12.35      }
   12.36  
   12.37      /* We want zeroed memory so use calloc rather than malloc. */
   12.38 -    p2m        = calloc(max_pfn, sizeof(unsigned long));
   12.39 +    p2m        = calloc(max_pfn, sizeof(xen_pfn_t));
   12.40      pfn_type   = calloc(max_pfn, sizeof(unsigned long));
   12.41 -    region_mfn = calloc(MAX_BATCH_SIZE, sizeof(unsigned long));
   12.42 +    region_mfn = calloc(MAX_BATCH_SIZE, sizeof(xen_pfn_t));
   12.43  
   12.44      if ((p2m == NULL) || (pfn_type == NULL) || (region_mfn == NULL)) {
   12.45          ERR("memory alloc failed");
   12.46 @@ -251,7 +251,7 @@ int xc_linux_restore(int xc_handle, int 
   12.47          goto out;
   12.48      }
   12.49  
   12.50 -    if (mlock(region_mfn, sizeof(unsigned long) * MAX_BATCH_SIZE)) {
   12.51 +    if (mlock(region_mfn, sizeof(xen_pfn_t) * MAX_BATCH_SIZE)) {
   12.52          ERR("Could not mlock region_mfn");
   12.53          goto out;
   12.54      }
    13.1 --- a/tools/libxc/xc_linux_save.c	Tue Jun 06 08:21:31 2006 +0100
    13.2 +++ b/tools/libxc/xc_linux_save.c	Tue Jun 06 09:48:17 2006 +0100
    13.3 @@ -40,10 +40,10 @@ static unsigned int pt_levels;
    13.4  static unsigned long max_pfn;
    13.5  
    13.6  /* Live mapping of the table mapping each PFN to its current MFN. */
    13.7 -static unsigned long *live_p2m = NULL;
    13.8 +static xen_pfn_t *live_p2m = NULL;
    13.9  
   13.10  /* Live mapping of system MFN to PFN table. */
   13.11 -static unsigned long *live_m2p = NULL;
   13.12 +static xen_pfn_t *live_m2p = NULL;
   13.13  
   13.14  /* grep fodder: machine_to_phys */
   13.15  
   13.16 @@ -501,22 +501,22 @@ void canonicalize_pagetable(unsigned lon
   13.17  
   13.18  
   13.19  
   13.20 -static unsigned long *xc_map_m2p(int xc_handle,
   13.21 +static xen_pfn_t *xc_map_m2p(int xc_handle,
   13.22                                   unsigned long max_mfn,
   13.23                                   int prot)
   13.24  {
   13.25      struct xen_machphys_mfn_list xmml;
   13.26      privcmd_mmap_entry_t *entries;
   13.27      unsigned long m2p_chunks, m2p_size;
   13.28 -    unsigned long *m2p;
   13.29 -    unsigned long *extent_start;
   13.30 +    xen_pfn_t *m2p;
   13.31 +    xen_pfn_t *extent_start;
   13.32      int i, rc;
   13.33  
   13.34      m2p_size   = M2P_SIZE(max_mfn);
   13.35      m2p_chunks = M2P_CHUNKS(max_mfn);
   13.36  
   13.37      xmml.max_extents = m2p_chunks;
   13.38 -    if (!(extent_start = malloc(m2p_chunks * sizeof(unsigned long)))) {
   13.39 +    if (!(extent_start = malloc(m2p_chunks * sizeof(xen_pfn_t)))) {
   13.40          ERR("failed to allocate space for m2p mfns");
   13.41          return NULL;
   13.42      }
   13.43 @@ -583,11 +583,11 @@ int xc_linux_save(int xc_handle, int io_
   13.44      char page[PAGE_SIZE];
   13.45  
   13.46      /* Double and single indirect references to the live P2M table */
   13.47 -    unsigned long *live_p2m_frame_list_list = NULL;
   13.48 -    unsigned long *live_p2m_frame_list = NULL;
   13.49 +    xen_pfn_t *live_p2m_frame_list_list = NULL;
   13.50 +    xen_pfn_t *live_p2m_frame_list = NULL;
   13.51  
   13.52      /* A copy of the pfn-to-mfn table frame list. */
   13.53 -    unsigned long *p2m_frame_list = NULL;
   13.54 +    xen_pfn_t *p2m_frame_list = NULL;
   13.55  
   13.56      /* Live mapping of shared info structure */
   13.57      shared_info_t *live_shinfo = NULL;
   13.58 @@ -712,11 +712,11 @@ int xc_linux_save(int xc_handle, int io_
   13.59      memcpy(p2m_frame_list, live_p2m_frame_list, P2M_FL_SIZE);
   13.60  
   13.61      /* Canonicalise the pfn-to-mfn table frame-number list. */
   13.62 -    for (i = 0; i < max_pfn; i += ulpp) {
   13.63 -        if (!translate_mfn_to_pfn(&p2m_frame_list[i/ulpp])) {
   13.64 +    for (i = 0; i < max_pfn; i += fpp) {
   13.65 +        if (!translate_mfn_to_pfn(&p2m_frame_list[i/fpp])) {
   13.66              ERR("Frame# in pfn-to-mfn frame list is not in pseudophys");
   13.67 -            ERR("entry %d: p2m_frame_list[%ld] is 0x%lx", i, i/ulpp,
   13.68 -                p2m_frame_list[i/ulpp]);
   13.69 +            ERR("entry %d: p2m_frame_list[%ld] is 0x%"PRIx64, i, i/fpp,
   13.70 +                (uint64_t)p2m_frame_list[i/fpp]);
   13.71              goto out;
   13.72          }
   13.73      }
    14.1 --- a/tools/libxc/xc_load_aout9.c	Tue Jun 06 08:21:31 2006 +0100
    14.2 +++ b/tools/libxc/xc_load_aout9.c	Tue Jun 06 09:48:17 2006 +0100
    14.3 @@ -17,7 +17,7 @@
    14.4  #define KOFFSET(_p)       ((_p)&~KZERO)
    14.5  
    14.6  static int parseaout9image(const char *, unsigned long, struct domain_setup_info *);
    14.7 -static int loadaout9image(const char *, unsigned long, int, uint32_t, unsigned long *, struct domain_setup_info *);
    14.8 +static int loadaout9image(const char *, unsigned long, int, uint32_t, xen_pfn_t *, struct domain_setup_info *);
    14.9  static void copyout(int, uint32_t, unsigned long *, unsigned long, const char *, int);
   14.10  struct Exec *get_header(const char *, unsigned long, struct Exec *);
   14.11  
   14.12 @@ -79,7 +79,7 @@ loadaout9image(
   14.13      const char *image,
   14.14      unsigned long image_size,
   14.15      int xch, uint32_t dom,
   14.16 -    unsigned long *parray,
   14.17 +    xen_pfn_t *parray,
   14.18      struct domain_setup_info *dsi)
   14.19  {
   14.20      struct Exec ehdr;
    15.1 --- a/tools/libxc/xc_load_bin.c	Tue Jun 06 08:21:31 2006 +0100
    15.2 +++ b/tools/libxc/xc_load_bin.c	Tue Jun 06 09:48:17 2006 +0100
    15.3 @@ -107,7 +107,7 @@ parsebinimage(
    15.4  static int
    15.5  loadbinimage(
    15.6      const char *image, unsigned long image_size, int xch, uint32_t dom,
    15.7 -    unsigned long *parray, struct domain_setup_info *dsi);
    15.8 +    xen_pfn_t *parray, struct domain_setup_info *dsi);
    15.9  
   15.10  int probe_bin(const char *image,
   15.11                unsigned long image_size,
   15.12 @@ -235,7 +235,7 @@ static int parsebinimage(const char *ima
   15.13  static int
   15.14  loadbinimage(
   15.15      const char *image, unsigned long image_size, int xch, uint32_t dom,
   15.16 -    unsigned long *parray, struct domain_setup_info *dsi)
   15.17 +    xen_pfn_t *parray, struct domain_setup_info *dsi)
   15.18  {
   15.19      unsigned long size;
   15.20      char         *va;
    16.1 --- a/tools/libxc/xc_load_elf.c	Tue Jun 06 08:21:31 2006 +0100
    16.2 +++ b/tools/libxc/xc_load_elf.c	Tue Jun 06 09:48:17 2006 +0100
    16.3 @@ -16,10 +16,10 @@ parseelfimage(
    16.4  static int
    16.5  loadelfimage(
    16.6      const char *image, unsigned long image_size, int xch, uint32_t dom,
    16.7 -    unsigned long *parray, struct domain_setup_info *dsi);
    16.8 +    xen_pfn_t *parray, struct domain_setup_info *dsi);
    16.9  static int
   16.10  loadelfsymtab(
   16.11 -    const char *image, int xch, uint32_t dom, unsigned long *parray,
   16.12 +    const char *image, int xch, uint32_t dom, xen_pfn_t *parray,
   16.13      struct domain_setup_info *dsi);
   16.14  
   16.15  int probe_elf(const char *image,
   16.16 @@ -211,7 +211,7 @@ static int parseelfimage(const char *ima
   16.17  static int
   16.18  loadelfimage(
   16.19      const char *image, unsigned long elfsize, int xch, uint32_t dom,
   16.20 -    unsigned long *parray, struct domain_setup_info *dsi)
   16.21 +    xen_pfn_t *parray, struct domain_setup_info *dsi)
   16.22  {
   16.23      Elf_Ehdr *ehdr = (Elf_Ehdr *)image;
   16.24      Elf_Phdr *phdr;
   16.25 @@ -265,7 +265,7 @@ loadelfimage(
   16.26  
   16.27  static int
   16.28  loadelfsymtab(
   16.29 -    const char *image, int xch, uint32_t dom, unsigned long *parray,
   16.30 +    const char *image, int xch, uint32_t dom, xen_pfn_t *parray,
   16.31      struct domain_setup_info *dsi)
   16.32  {
   16.33      Elf_Ehdr *ehdr = (Elf_Ehdr *)image, *sym_ehdr;
    17.1 --- a/tools/libxc/xc_private.c	Tue Jun 06 08:21:31 2006 +0100
    17.2 +++ b/tools/libxc/xc_private.c	Tue Jun 06 09:48:17 2006 +0100
    17.3 @@ -4,6 +4,7 @@
    17.4   * Helper functions for the rest of the library.
    17.5   */
    17.6  
    17.7 +#include <inttypes.h>
    17.8  #include "xc_private.h"
    17.9  
   17.10  /* NB: arr must be mlock'ed */
   17.11 @@ -134,9 +135,9 @@ int xc_memory_op(int xc_handle,
   17.12      struct xen_memory_reservation *reservation = arg;
   17.13      struct xen_machphys_mfn_list *xmml = arg;
   17.14      struct xen_translate_gpfn_list *trans = arg;
   17.15 -    unsigned long *extent_start;
   17.16 -    unsigned long *gpfn_list;
   17.17 -    unsigned long *mfn_list;
   17.18 +    xen_pfn_t *extent_start;
   17.19 +    xen_pfn_t *gpfn_list;
   17.20 +    xen_pfn_t *mfn_list;
   17.21      long ret = -EINVAL;
   17.22  
   17.23      hypercall.op     = __HYPERVISOR_memory_op;
   17.24 @@ -156,7 +157,7 @@ int xc_memory_op(int xc_handle,
   17.25          get_xen_guest_handle(extent_start, reservation->extent_start);
   17.26          if ( (extent_start != NULL) &&
   17.27               (mlock(extent_start,
   17.28 -                    reservation->nr_extents * sizeof(unsigned long)) != 0) )
   17.29 +                    reservation->nr_extents * sizeof(xen_pfn_t)) != 0) )
   17.30          {
   17.31              PERROR("Could not mlock");
   17.32              safe_munlock(reservation, sizeof(*reservation));
   17.33 @@ -171,7 +172,7 @@ int xc_memory_op(int xc_handle,
   17.34          }
   17.35          get_xen_guest_handle(extent_start, xmml->extent_start);
   17.36          if ( mlock(extent_start,
   17.37 -                   xmml->max_extents * sizeof(unsigned long)) != 0 )
   17.38 +                   xmml->max_extents * sizeof(xen_pfn_t)) != 0 )
   17.39          {
   17.40              PERROR("Could not mlock");
   17.41              safe_munlock(xmml, sizeof(*xmml));
   17.42 @@ -192,17 +193,17 @@ int xc_memory_op(int xc_handle,
   17.43              goto out1;
   17.44          }
   17.45          get_xen_guest_handle(gpfn_list, trans->gpfn_list);
   17.46 -        if ( mlock(gpfn_list, trans->nr_gpfns * sizeof(long)) != 0 )
   17.47 +        if ( mlock(gpfn_list, trans->nr_gpfns * sizeof(xen_pfn_t)) != 0 )
   17.48          {
   17.49              PERROR("Could not mlock");
   17.50              safe_munlock(trans, sizeof(*trans));
   17.51              goto out1;
   17.52          }
   17.53          get_xen_guest_handle(mfn_list, trans->mfn_list);
   17.54 -        if ( mlock(mfn_list, trans->nr_gpfns * sizeof(long)) != 0 )
   17.55 +        if ( mlock(mfn_list, trans->nr_gpfns * sizeof(xen_pfn_t)) != 0 )
   17.56          {
   17.57              PERROR("Could not mlock");
   17.58 -            safe_munlock(gpfn_list, trans->nr_gpfns * sizeof(long));
   17.59 +            safe_munlock(gpfn_list, trans->nr_gpfns * sizeof(xen_pfn_t));
   17.60              safe_munlock(trans, sizeof(*trans));
   17.61              goto out1;
   17.62          }
   17.63 @@ -220,22 +221,22 @@ int xc_memory_op(int xc_handle,
   17.64          get_xen_guest_handle(extent_start, reservation->extent_start);
   17.65          if ( extent_start != NULL )
   17.66              safe_munlock(extent_start,
   17.67 -                         reservation->nr_extents * sizeof(unsigned long));
   17.68 +                         reservation->nr_extents * sizeof(xen_pfn_t));
   17.69          break;
   17.70      case XENMEM_machphys_mfn_list:
   17.71          safe_munlock(xmml, sizeof(*xmml));
   17.72          get_xen_guest_handle(extent_start, xmml->extent_start);
   17.73          safe_munlock(extent_start,
   17.74 -                     xmml->max_extents * sizeof(unsigned long));
   17.75 +                     xmml->max_extents * sizeof(xen_pfn_t));
   17.76          break;
   17.77      case XENMEM_add_to_physmap:
   17.78          safe_munlock(arg, sizeof(struct xen_add_to_physmap));
   17.79          break;
   17.80      case XENMEM_translate_gpfn_list:
   17.81              get_xen_guest_handle(mfn_list, trans->mfn_list);
   17.82 -            safe_munlock(mfn_list, trans->nr_gpfns * sizeof(long));
   17.83 +            safe_munlock(mfn_list, trans->nr_gpfns * sizeof(xen_pfn_t));
   17.84              get_xen_guest_handle(gpfn_list, trans->gpfn_list);
   17.85 -            safe_munlock(gpfn_list, trans->nr_gpfns * sizeof(long));
   17.86 +            safe_munlock(gpfn_list, trans->nr_gpfns * sizeof(xen_pfn_t));
   17.87              safe_munlock(trans, sizeof(*trans));
   17.88          break;
   17.89      }
   17.90 @@ -263,7 +264,7 @@ long long xc_domain_get_cpu_usage( int x
   17.91  
   17.92  int xc_get_pfn_list(int xc_handle,
   17.93                      uint32_t domid,
   17.94 -                    unsigned long *pfn_buf,
   17.95 +                    xen_pfn_t *pfn_buf,
   17.96                      unsigned long max_pfns)
   17.97  {
   17.98      DECLARE_DOM0_OP;
   17.99 @@ -274,10 +275,10 @@ int xc_get_pfn_list(int xc_handle,
  17.100      set_xen_guest_handle(op.u.getmemlist.buffer, pfn_buf);
  17.101  
  17.102  #ifdef VALGRIND
  17.103 -    memset(pfn_buf, 0, max_pfns * sizeof(unsigned long));
  17.104 +    memset(pfn_buf, 0, max_pfns * sizeof(xen_pfn_t));
  17.105  #endif
  17.106  
  17.107 -    if ( mlock(pfn_buf, max_pfns * sizeof(unsigned long)) != 0 )
  17.108 +    if ( mlock(pfn_buf, max_pfns * sizeof(xen_pfn_t)) != 0 )
  17.109      {
  17.110          PERROR("xc_get_pfn_list: pfn_buf mlock failed");
  17.111          return -1;
  17.112 @@ -285,7 +286,7 @@ int xc_get_pfn_list(int xc_handle,
  17.113  
  17.114      ret = do_dom0_op(xc_handle, &op);
  17.115  
  17.116 -    safe_munlock(pfn_buf, max_pfns * sizeof(unsigned long));
  17.117 +    safe_munlock(pfn_buf, max_pfns * sizeof(xen_pfn_t));
  17.118  
  17.119  #if 0
  17.120  #ifdef DEBUG
  17.121 @@ -364,7 +365,7 @@ unsigned long xc_get_filesz(int fd)
  17.122  }
  17.123  
  17.124  void xc_map_memcpy(unsigned long dst, const char *src, unsigned long size,
  17.125 -                   int xch, uint32_t dom, unsigned long *parray,
  17.126 +                   int xch, uint32_t dom, xen_pfn_t *parray,
  17.127                     unsigned long vstart)
  17.128  {
  17.129      char *va;
  17.130 @@ -433,10 +434,11 @@ int xc_version(int xc_handle, int cmd, v
  17.131  unsigned long xc_make_page_below_4G(
  17.132      int xc_handle, uint32_t domid, unsigned long mfn)
  17.133  {
  17.134 -    unsigned long new_mfn;
  17.135 +    xen_pfn_t old_mfn = mfn;
  17.136 +    xen_pfn_t new_mfn;
  17.137  
  17.138      if ( xc_domain_memory_decrease_reservation(
  17.139 -        xc_handle, domid, 1, 0, &mfn) != 0 )
  17.140 +        xc_handle, domid, 1, 0, &old_mfn) != 0 )
  17.141      {
  17.142          fprintf(stderr,"xc_make_page_below_4G decrease failed. mfn=%lx\n",mfn);
  17.143          return 0;
    18.1 --- a/tools/libxc/xenctrl.h	Tue Jun 06 08:21:31 2006 +0100
    18.2 +++ b/tools/libxc/xenctrl.h	Tue Jun 06 09:48:17 2006 +0100
    18.3 @@ -415,26 +415,26 @@ int xc_domain_memory_increase_reservatio
    18.4                                            unsigned long nr_extents,
    18.5                                            unsigned int extent_order,
    18.6                                            unsigned int address_bits,
    18.7 -                                          unsigned long *extent_start);
    18.8 +                                          xen_pfn_t *extent_start);
    18.9  
   18.10  int xc_domain_memory_decrease_reservation(int xc_handle,
   18.11                                            uint32_t domid,
   18.12                                            unsigned long nr_extents,
   18.13                                            unsigned int extent_order,
   18.14 -                                          unsigned long *extent_start);
   18.15 +                                          xen_pfn_t *extent_start);
   18.16  
   18.17  int xc_domain_memory_populate_physmap(int xc_handle,
   18.18                                        uint32_t domid,
   18.19                                        unsigned long nr_extents,
   18.20                                        unsigned int extent_order,
   18.21                                        unsigned int address_bits,
   18.22 -                                      unsigned long *extent_start);
   18.23 +                                      xen_pfn_t *extent_start);
   18.24  
   18.25  int xc_domain_translate_gpfn_list(int xc_handle,
   18.26                                    uint32_t domid,
   18.27                                    unsigned long nr_gpfns,
   18.28 -                                  unsigned long *gpfn_list,
   18.29 -                                  unsigned long *mfn_list);
   18.30 +                                  xen_pfn_t *gpfn_list,
   18.31 +                                  xen_pfn_t *mfn_list);
   18.32  
   18.33  int xc_domain_ioport_permission(int xc_handle,
   18.34                                  uint32_t domid,
   18.35 @@ -487,7 +487,7 @@ void *xc_map_foreign_range(int xc_handle
   18.36                              unsigned long mfn );
   18.37  
   18.38  void *xc_map_foreign_batch(int xc_handle, uint32_t dom, int prot,
   18.39 -                           unsigned long *arr, int num );
   18.40 +                           xen_pfn_t *arr, int num );
   18.41  
   18.42  /**
   18.43   * Translates a virtual address in the context of a given domain and
   18.44 @@ -502,11 +502,11 @@ void *xc_map_foreign_batch(int xc_handle
   18.45  unsigned long xc_translate_foreign_address(int xc_handle, uint32_t dom,
   18.46                                             int vcpu, unsigned long long virt);
   18.47  
   18.48 -int xc_get_pfn_list(int xc_handle, uint32_t domid, unsigned long *pfn_buf,
   18.49 +int xc_get_pfn_list(int xc_handle, uint32_t domid, xen_pfn_t *pfn_buf,
   18.50                      unsigned long max_pfns);
   18.51  
   18.52  int xc_ia64_get_pfn_list(int xc_handle, uint32_t domid,
   18.53 -                         unsigned long *pfn_buf,
   18.54 +                         xen_pfn_t *pfn_buf,
   18.55                           unsigned int start_page, unsigned int nr_pages);
   18.56  
   18.57  int xc_copy_to_domain_page(int xc_handle, uint32_t domid,
    19.1 --- a/tools/libxc/xg_private.h	Tue Jun 06 08:21:31 2006 +0100
    19.2 +++ b/tools/libxc/xg_private.h	Tue Jun 06 09:48:17 2006 +0100
    19.3 @@ -173,7 +173,7 @@ typedef int (*parseimagefunc)(const char
    19.4                                struct domain_setup_info *dsi);
    19.5  typedef int (*loadimagefunc)(const char *image, unsigned long image_size,
    19.6                               int xch,
    19.7 -                             uint32_t dom, unsigned long *parray,
    19.8 +                             uint32_t dom, xen_pfn_t *parray,
    19.9                               struct domain_setup_info *dsi);
   19.10  
   19.11  struct load_funcs
   19.12 @@ -201,7 +201,7 @@ int xc_copy_to_domain_page(int xc_handle
   19.13  unsigned long xc_get_filesz(int fd);
   19.14  
   19.15  void xc_map_memcpy(unsigned long dst, const char *src, unsigned long size,
   19.16 -                   int xch, uint32_t dom, unsigned long *parray,
   19.17 +                   int xch, uint32_t dom, xen_pfn_t *parray,
   19.18                     unsigned long vstart);
   19.19  
   19.20  int pin_table(int xc_handle, unsigned int type, unsigned long mfn,
    20.1 --- a/tools/libxc/xg_save_restore.h	Tue Jun 06 08:21:31 2006 +0100
    20.2 +++ b/tools/libxc/xg_save_restore.h	Tue Jun 06 09:48:17 2006 +0100
    20.3 @@ -105,23 +105,23 @@ static int get_platform_info(int xc_hand
    20.4  */
    20.5  #define M2P_SHIFT       L2_PAGETABLE_SHIFT_PAE
    20.6  #define M2P_CHUNK_SIZE  (1 << M2P_SHIFT)
    20.7 -#define M2P_SIZE(_m)    ROUNDUP(((_m) * sizeof(unsigned long)), M2P_SHIFT)
    20.8 +#define M2P_SIZE(_m)    ROUNDUP(((_m) * sizeof(xen_pfn_t)), M2P_SHIFT)
    20.9  #define M2P_CHUNKS(_m)  (M2P_SIZE((_m)) >> M2P_SHIFT)
   20.10  
   20.11  /* Size in bytes of the P2M (rounded up to the nearest PAGE_SIZE bytes) */
   20.12 -#define P2M_SIZE        ROUNDUP((max_pfn * sizeof(unsigned long)), PAGE_SHIFT)
   20.13 +#define P2M_SIZE        ROUNDUP((max_pfn * sizeof(xen_pfn_t)), PAGE_SHIFT)
   20.14  
   20.15 -/* Number of unsigned longs in a page */
   20.16 -#define ulpp            (PAGE_SIZE/sizeof(unsigned long))
   20.17 +/* Number of xen_pfn_t in a page */
   20.18 +#define fpp             (PAGE_SIZE/sizeof(xen_pfn_t))
   20.19  
   20.20  /* Number of entries in the pfn_to_mfn_frame_list */
   20.21 -#define P2M_FL_ENTRIES  (((max_pfn)+ulpp-1)/ulpp)
   20.22 +#define P2M_FL_ENTRIES  (((max_pfn)+fpp-1)/fpp)
   20.23  
   20.24  /* Size in bytes of the pfn_to_mfn_frame_list     */
   20.25  #define P2M_FL_SIZE     ((P2M_FL_ENTRIES)*sizeof(unsigned long))
   20.26  
   20.27  /* Number of entries in the pfn_to_mfn_frame_list_list */
   20.28 -#define P2M_FLL_ENTRIES (((max_pfn)+(ulpp*ulpp)-1)/(ulpp*ulpp))
   20.29 +#define P2M_FLL_ENTRIES (((max_pfn)+(fpp*fpp)-1)/(fpp*fpp))
   20.30  
   20.31  /* Current guests allow 8MB 'slack' in their P2M */
   20.32  #define NR_SLACK_ENTRIES   ((8 * 1024 * 1024) / PAGE_SIZE)
    21.1 --- a/xen/common/memory.c	Tue Jun 06 08:21:31 2006 +0100
    21.2 +++ b/xen/common/memory.c	Tue Jun 06 09:48:17 2006 +0100
    21.3 @@ -31,14 +31,15 @@
    21.4  static long
    21.5  increase_reservation(
    21.6      struct domain *d, 
    21.7 -    XEN_GUEST_HANDLE(ulong) extent_list,
    21.8 +    XEN_GUEST_HANDLE(xen_pfn_t) extent_list,
    21.9      unsigned int   nr_extents,
   21.10      unsigned int   extent_order,
   21.11      unsigned int   flags,
   21.12      int           *preempted)
   21.13  {
   21.14      struct page_info *page;
   21.15 -    unsigned long     i, mfn;
   21.16 +    unsigned long i;
   21.17 +    xen_pfn_t mfn;
   21.18  
   21.19      if ( !guest_handle_is_null(extent_list) &&
   21.20           !guest_handle_okay(extent_list, nr_extents) )
   21.21 @@ -80,14 +81,16 @@ increase_reservation(
   21.22  static long
   21.23  populate_physmap(
   21.24      struct domain *d, 
   21.25 -    XEN_GUEST_HANDLE(ulong) extent_list,
   21.26 +    XEN_GUEST_HANDLE(xen_pfn_t) extent_list,
   21.27      unsigned int  nr_extents,
   21.28      unsigned int  extent_order,
   21.29      unsigned int  flags,
   21.30      int          *preempted)
   21.31  {
   21.32      struct page_info *page;
   21.33 -    unsigned long    i, j, gpfn, mfn;
   21.34 +    unsigned long i, j;
   21.35 +    xen_pfn_t gpfn;
   21.36 +    xen_pfn_t mfn;
   21.37  
   21.38      if ( !guest_handle_okay(extent_list, nr_extents) )
   21.39          return 0;
   21.40 @@ -177,13 +180,14 @@ guest_remove_page(
   21.41  static long
   21.42  decrease_reservation(
   21.43      struct domain *d,
   21.44 -    XEN_GUEST_HANDLE(ulong) extent_list,
   21.45 +    XEN_GUEST_HANDLE(xen_pfn_t) extent_list,
   21.46      unsigned int   nr_extents,
   21.47      unsigned int   extent_order,
   21.48      unsigned int   flags,
   21.49      int           *preempted)
   21.50  {
   21.51 -    unsigned long    i, j, gmfn;
   21.52 +    unsigned long i, j;
   21.53 +    xen_pfn_t gmfn;
   21.54  
   21.55      if ( !guest_handle_okay(extent_list, nr_extents) )
   21.56          return 0;
   21.57 @@ -214,7 +218,9 @@ translate_gpfn_list(
   21.58      XEN_GUEST_HANDLE(xen_translate_gpfn_list_t) uop, unsigned long *progress)
   21.59  {
   21.60      struct xen_translate_gpfn_list op;
   21.61 -    unsigned long i, gpfn, mfn;
   21.62 +    unsigned long i;
   21.63 +    xen_pfn_t gpfn;
   21.64 +    xen_pfn_t mfn;
   21.65      struct domain *d;
   21.66  
   21.67      if ( copy_from_guest(&op, uop, 1) )
    22.1 --- a/xen/include/public/arch-ia64.h	Tue Jun 06 08:21:31 2006 +0100
    22.2 +++ b/xen/include/public/arch-ia64.h	Tue Jun 06 09:48:17 2006 +0100
    22.3 @@ -26,6 +26,9 @@ DEFINE_XEN_GUEST_HANDLE(char);
    22.4  DEFINE_XEN_GUEST_HANDLE(int);
    22.5  DEFINE_XEN_GUEST_HANDLE(long);
    22.6  DEFINE_XEN_GUEST_HANDLE(void);
    22.7 +
    22.8 +typedef unsigned long xen_pfn_t;
    22.9 +DEFINE_XEN_GUEST_HANDLE(xen_pfn_t);
   22.10  #endif
   22.11  
   22.12  /* Arch specific VIRQs definition */
    23.1 --- a/xen/include/public/arch-x86_32.h	Tue Jun 06 08:21:31 2006 +0100
    23.2 +++ b/xen/include/public/arch-x86_32.h	Tue Jun 06 09:48:17 2006 +0100
    23.3 @@ -28,6 +28,9 @@ DEFINE_XEN_GUEST_HANDLE(char);
    23.4  DEFINE_XEN_GUEST_HANDLE(int);
    23.5  DEFINE_XEN_GUEST_HANDLE(long);
    23.6  DEFINE_XEN_GUEST_HANDLE(void);
    23.7 +
    23.8 +typedef unsigned long xen_pfn_t;
    23.9 +DEFINE_XEN_GUEST_HANDLE(xen_pfn_t);
   23.10  #endif
   23.11  
   23.12  /*
   23.13 @@ -177,7 +180,7 @@ DEFINE_XEN_GUEST_HANDLE(vcpu_guest_conte
   23.14  struct arch_shared_info {
   23.15      unsigned long max_pfn;                  /* max pfn that appears in table */
   23.16      /* Frame containing list of mfns containing list of mfns containing p2m. */
   23.17 -    unsigned long pfn_to_mfn_frame_list_list;
   23.18 +    xen_pfn_t     pfn_to_mfn_frame_list_list;
   23.19      unsigned long nmi_reason;
   23.20  };
   23.21  typedef struct arch_shared_info arch_shared_info_t;
    24.1 --- a/xen/include/public/arch-x86_64.h	Tue Jun 06 08:21:31 2006 +0100
    24.2 +++ b/xen/include/public/arch-x86_64.h	Tue Jun 06 09:48:17 2006 +0100
    24.3 @@ -28,6 +28,9 @@ DEFINE_XEN_GUEST_HANDLE(char);
    24.4  DEFINE_XEN_GUEST_HANDLE(int);
    24.5  DEFINE_XEN_GUEST_HANDLE(long);
    24.6  DEFINE_XEN_GUEST_HANDLE(void);
    24.7 +
    24.8 +typedef unsigned long xen_pfn_t;
    24.9 +DEFINE_XEN_GUEST_HANDLE(xen_pfn_t);
   24.10  #endif
   24.11  
   24.12  /*
   24.13 @@ -250,7 +253,7 @@ DEFINE_XEN_GUEST_HANDLE(vcpu_guest_conte
   24.14  struct arch_shared_info {
   24.15      unsigned long max_pfn;                  /* max pfn that appears in table */
   24.16      /* Frame containing list of mfns containing list of mfns containing p2m. */
   24.17 -    unsigned long pfn_to_mfn_frame_list_list;
   24.18 +    xen_pfn_t     pfn_to_mfn_frame_list_list;
   24.19      unsigned long nmi_reason;
   24.20  };
   24.21  typedef struct arch_shared_info arch_shared_info_t;
    25.1 --- a/xen/include/public/dom0_ops.h	Tue Jun 06 08:21:31 2006 +0100
    25.2 +++ b/xen/include/public/dom0_ops.h	Tue Jun 06 09:48:17 2006 +0100
    25.3 @@ -28,7 +28,7 @@ struct dom0_getmemlist {
    25.4      /* IN variables. */
    25.5      domid_t       domain;
    25.6      unsigned long max_pfns;
    25.7 -    XEN_GUEST_HANDLE(ulong) buffer;
    25.8 +    XEN_GUEST_HANDLE(xen_pfn_t) buffer;
    25.9      /* OUT variables. */
   25.10      unsigned long num_pfns;
   25.11  };
   25.12 @@ -98,7 +98,7 @@ struct dom0_getdomaininfo {
   25.13      uint32_t flags;
   25.14      unsigned long tot_pages;
   25.15      unsigned long max_pages;
   25.16 -    unsigned long shared_info_frame;       /* MFN of shared_info struct */
   25.17 +    xen_pfn_t shared_info_frame;  /* MFN of shared_info struct */
   25.18      uint64_t cpu_time;
   25.19      uint32_t nr_online_vcpus;     /* Number of VCPUs currently online. */
   25.20      uint32_t max_vcpu_id;         /* Maximum VCPUID in use by this domain. */
   25.21 @@ -162,7 +162,7 @@ DEFINE_XEN_GUEST_HANDLE(dom0_settime_t);
   25.22  
   25.23  struct dom0_getpageframeinfo {
   25.24      /* IN variables. */
   25.25 -    unsigned long mfn;     /* Machine page frame number to query.       */
   25.26 +    xen_pfn_t mfn;         /* Machine page frame number to query.       */
   25.27      domid_t domain;        /* To which domain does the frame belong?    */
   25.28      /* OUT variables. */
   25.29      /* Is the page PINNED to a type? */
   25.30 @@ -213,7 +213,7 @@ struct dom0_tbufcontrol {
   25.31      cpumap_t      cpu_mask;
   25.32      uint32_t      evt_mask;
   25.33      /* OUT variables */
   25.34 -    unsigned long buffer_mfn;
   25.35 +    xen_pfn_t buffer_mfn;
   25.36      uint32_t size;
   25.37  };
   25.38  typedef struct dom0_tbufcontrol dom0_tbufcontrol_t;
   25.39 @@ -313,7 +313,7 @@ DEFINE_XEN_GUEST_HANDLE(dom0_getpagefram
   25.40  #define DOM0_ADD_MEMTYPE         31
   25.41  struct dom0_add_memtype {
   25.42      /* IN variables. */
   25.43 -    unsigned long mfn;
   25.44 +    xen_pfn_t mfn;
   25.45      unsigned long nr_mfns;
   25.46      uint32_t      type;
   25.47      /* OUT variables. */
   25.48 @@ -345,7 +345,7 @@ struct dom0_read_memtype {
   25.49      /* IN variables. */
   25.50      uint32_t reg;
   25.51      /* OUT variables. */
   25.52 -    unsigned long mfn;
   25.53 +    xen_pfn_t mfn;
   25.54      unsigned long nr_mfns;
   25.55      uint32_t type;
   25.56  };
   25.57 @@ -499,7 +499,7 @@ DEFINE_XEN_GUEST_HANDLE(dom0_irq_permiss
   25.58  #define DOM0_IOMEM_PERMISSION 47
   25.59  struct dom0_iomem_permission {
   25.60      domid_t  domain;          /* domain to be affected */
   25.61 -    unsigned long first_mfn;  /* first page (physical page number) in range */
   25.62 +    xen_pfn_t first_mfn;      /* first page (physical page number) in range */
   25.63      unsigned long nr_mfns;    /* number of pages in range (>0) */
   25.64      uint8_t allow_access;     /* allow (!0) or deny (0) access to range? */
   25.65  };
   25.66 @@ -509,7 +509,7 @@ DEFINE_XEN_GUEST_HANDLE(dom0_iomem_permi
   25.67  #define DOM0_HYPERCALL_INIT   48
   25.68  struct dom0_hypercall_init {
   25.69      domid_t  domain;          /* domain to be affected */
   25.70 -    unsigned long mfn;        /* machine frame to be initialised */
   25.71 +    xen_pfn_t mfn;            /* machine frame to be initialised */
   25.72  };
   25.73  typedef struct dom0_hypercall_init dom0_hypercall_init_t;
   25.74  DEFINE_XEN_GUEST_HANDLE(dom0_hypercall_init_t);
    26.1 --- a/xen/include/public/grant_table.h	Tue Jun 06 08:21:31 2006 +0100
    26.2 +++ b/xen/include/public/grant_table.h	Tue Jun 06 09:48:17 2006 +0100
    26.3 @@ -240,7 +240,7 @@ DEFINE_XEN_GUEST_HANDLE(gnttab_dump_tabl
    26.4  #define GNTTABOP_transfer                4
    26.5  struct gnttab_transfer {
    26.6      /* IN parameters. */
    26.7 -    unsigned long mfn;
    26.8 +    xen_pfn_t     mfn;
    26.9      domid_t       domid;
   26.10      grant_ref_t   ref;
   26.11      /* OUT parameters. */
    27.1 --- a/xen/include/public/memory.h	Tue Jun 06 08:21:31 2006 +0100
    27.2 +++ b/xen/include/public/memory.h	Tue Jun 06 09:48:17 2006 +0100
    27.3 @@ -29,7 +29,7 @@ struct xen_memory_reservation {
    27.4       *   OUT: GMFN bases of extents that were allocated
    27.5       *   (NB. This command also updates the mach_to_phys translation table)
    27.6       */
    27.7 -    XEN_GUEST_HANDLE(ulong) extent_start;
    27.8 +    XEN_GUEST_HANDLE(xen_pfn_t) extent_start;
    27.9  
   27.10      /* Number of extents, and size/alignment of each (2^extent_order pages). */
   27.11      unsigned long  nr_extents;
   27.12 @@ -87,7 +87,7 @@ struct xen_machphys_mfn_list {
   27.13       * any large discontiguities in the machine address space, 2MB gaps in
   27.14       * the machphys table will be represented by an MFN base of zero.
   27.15       */
   27.16 -    XEN_GUEST_HANDLE(ulong) extent_start;
   27.17 +    XEN_GUEST_HANDLE(xen_pfn_t) extent_start;
   27.18  
   27.19      /*
   27.20       * Number of extents written to the above array. This will be smaller
   27.21 @@ -117,7 +117,7 @@ struct xen_add_to_physmap {
   27.22      unsigned long idx;
   27.23  
   27.24      /* GPFN where the source mapping page should appear. */
   27.25 -    unsigned long gpfn;
   27.26 +    xen_pfn_t     gpfn;
   27.27  };
   27.28  typedef struct xen_add_to_physmap xen_add_to_physmap_t;
   27.29  DEFINE_XEN_GUEST_HANDLE(xen_add_to_physmap_t);
   27.30 @@ -135,13 +135,13 @@ struct xen_translate_gpfn_list {
   27.31      unsigned long nr_gpfns;
   27.32  
   27.33      /* List of GPFNs to translate. */
   27.34 -    XEN_GUEST_HANDLE(ulong) gpfn_list;
   27.35 +    XEN_GUEST_HANDLE(xen_pfn_t) gpfn_list;
   27.36  
   27.37      /*
   27.38       * Output list to contain MFN translations. May be the same as the input
   27.39       * list (in which case each input GPFN is overwritten with the output MFN).
   27.40       */
   27.41 -    XEN_GUEST_HANDLE(ulong) mfn_list;
   27.42 +    XEN_GUEST_HANDLE(xen_pfn_t) mfn_list;
   27.43  };
   27.44  typedef struct xen_translate_gpfn_list xen_translate_gpfn_list_t;
   27.45  DEFINE_XEN_GUEST_HANDLE(xen_translate_gpfn_list_t);
    28.1 --- a/xen/include/public/xen.h	Tue Jun 06 08:21:31 2006 +0100
    28.2 +++ b/xen/include/public/xen.h	Tue Jun 06 09:48:17 2006 +0100
    28.3 @@ -197,7 +197,7 @@ struct mmuext_op {
    28.4      unsigned int cmd;
    28.5      union {
    28.6          /* [UN]PIN_TABLE, NEW_BASEPTR, NEW_USER_BASEPTR */
    28.7 -        unsigned long mfn;
    28.8 +        xen_pfn_t     mfn;
    28.9          /* INVLPG_LOCAL, INVLPG_ALL, SET_LDT */
   28.10          unsigned long linear_addr;
   28.11      } arg1;
   28.12 @@ -457,9 +457,9 @@ struct start_info {
   28.13      unsigned long nr_pages;     /* Total pages allocated to this domain.  */
   28.14      unsigned long shared_info;  /* MACHINE address of shared info struct. */
   28.15      uint32_t flags;             /* SIF_xxx flags.                         */
   28.16 -    unsigned long store_mfn;    /* MACHINE page number of shared page.    */
   28.17 +    xen_pfn_t store_mfn;        /* MACHINE page number of shared page.    */
   28.18      uint32_t store_evtchn;      /* Event channel for store communication. */
   28.19 -    unsigned long console_mfn;  /* MACHINE address of console page.       */
   28.20 +    xen_pfn_t console_mfn;      /* MACHINE page number of console page.   */
   28.21      uint32_t console_evtchn;    /* Event channel for console messages.    */
   28.22      /* THE FOLLOWING ARE ONLY FILLED IN ON INITIAL BOOT (NOT RESUME).     */
   28.23      unsigned long pt_base;      /* VIRTUAL address of page directory.     */