25 files changed, 138 insertions(+), 120 deletions(-)
linux-2.6-xen-sparse/include/xen/public/privcmd.h | 2 -
tools/debugger/libxendebug/xendebug.c | 2 -
tools/ioemu/hw/cirrus_vga.c | 12 +++---
tools/ioemu/vl.c | 15 ++++----
tools/libxc/xc_core.c | 8 ++--
tools/libxc/xc_domain.c | 10 ++---
tools/libxc/xc_hvm_build.c | 6 +--
tools/libxc/xc_ia64_stubs.c | 12 +++---
tools/libxc/xc_linux.c | 2 -
tools/libxc/xc_linux_build.c | 21 +++++------
tools/libxc/xc_linux_restore.c | 14 +++----
tools/libxc/xc_linux_save.c | 28 +++++++--------
tools/libxc/xc_load_aout9.c | 4 +-
tools/libxc/xc_load_bin.c | 4 +-
tools/libxc/xc_load_elf.c | 8 ++--
tools/libxc/xc_private.c | 39 ++++++++++-----------
tools/libxc/xenctrl.h | 16 ++++----
tools/libxc/xg_private.h | 4 +-
tools/libxc/xg_save_restore.h | 12 +++---
xen/common/memory.c | 20 +++++++---
xen/include/public/arch-ia64.h | 3 +
xen/include/public/arch-x86_32.h | 3 +
xen/include/public/arch-x86_64.h | 3 +
xen/include/public/dom0_ops.h | 2 -
xen/include/public/memory.h | 8 ++--
# HG changeset patch
# User Hollis Blanchard <hollisb@xxxxxxxxxx>
# Node ID f03f168a4e2d42e85b62ba4c4e7ef349f27476bc
# Parent eee70cbfa20adcc8cdc1c9215fbea79d1386d9f9
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@xxxxxxxxxx>
diff -r eee70cbfa20a -r f03f168a4e2d
linux-2.6-xen-sparse/include/xen/public/privcmd.h
--- a/linux-2.6-xen-sparse/include/xen/public/privcmd.h Tue May 30 17:17:54
2006 -0500
+++ b/linux-2.6-xen-sparse/include/xen/public/privcmd.h Tue May 30 17:17:55
2006 -0500
@@ -59,7 +59,7 @@ typedef struct privcmd_mmapbatch {
int num; /* number of pages to populate */
domid_t dom; /* target domain */
unsigned long addr; /* virtual address */
- unsigned long __user *arr; /* array of mfns - top nibble set on err */
+ xen_pfn_t __user *arr; /* array of mfns - top nibble set on err */
} privcmd_mmapbatch_t;
/*
diff -r eee70cbfa20a -r f03f168a4e2d tools/debugger/libxendebug/xendebug.c
--- a/tools/debugger/libxendebug/xendebug.c Tue May 30 17:17:54 2006 -0500
+++ b/tools/debugger/libxendebug/xendebug.c Tue May 30 17:17:55 2006 -0500
@@ -57,7 +57,7 @@ typedef struct domain_context
vcpu_guest_context_t context[MAX_VIRT_CPUS];
long total_pages;
- unsigned long *page_array;
+ xen_pfn_t *page_array;
unsigned long cr3_phys[MAX_VIRT_CPUS];
unsigned long *cr3_virt[MAX_VIRT_CPUS];
diff -r eee70cbfa20a -r f03f168a4e2d tools/ioemu/hw/cirrus_vga.c
--- a/tools/ioemu/hw/cirrus_vga.c Tue May 30 17:17:54 2006 -0500
+++ b/tools/ioemu/hw/cirrus_vga.c Tue May 30 17:17:55 2006 -0500
@@ -2463,7 +2463,7 @@ extern FILE *logfile;
#if defined(__i386__) || defined (__x86_64__)
static void * set_vram_mapping(unsigned long begin, unsigned long end)
{
- unsigned long * extent_start = NULL;
+ xen_pfn_t *extent_start = NULL;
unsigned long nr_extents;
void *vram_pointer = NULL;
int i;
@@ -2474,14 +2474,14 @@ static void * set_vram_mapping(unsigned
end = (end + TARGET_PAGE_SIZE -1 ) & TARGET_PAGE_MASK;
nr_extents = (end - begin) >> TARGET_PAGE_BITS;
- extent_start = malloc(sizeof(unsigned long) * nr_extents );
+ extent_start = malloc(sizeof(xen_pfn_t) * nr_extents );
if (extent_start == NULL)
{
fprintf(stderr, "Failed malloc on set_vram_mapping\n");
return NULL;
}
- memset(extent_start, 0, sizeof(unsigned long) * nr_extents);
+ memset(extent_start, 0, sizeof(xen_pfn_t) * nr_extents);
for (i = 0; i < nr_extents; i++)
{
@@ -2509,7 +2509,7 @@ static void * set_vram_mapping(unsigned
static int unset_vram_mapping(unsigned long begin, unsigned long end)
{
- unsigned long * extent_start = NULL;
+ xen_pfn_t *extent_start = NULL;
unsigned long nr_extents;
int i;
@@ -2520,7 +2520,7 @@ static int unset_vram_mapping(unsigned l
end = (end + TARGET_PAGE_SIZE -1 ) & TARGET_PAGE_MASK;
nr_extents = (end - begin) >> TARGET_PAGE_BITS;
- extent_start = malloc(sizeof(unsigned long) * nr_extents );
+ extent_start = malloc(sizeof(xen_pfn_t) * nr_extents );
if (extent_start == NULL)
{
@@ -2528,7 +2528,7 @@ static int unset_vram_mapping(unsigned l
return -1;
}
- memset(extent_start, 0, sizeof(unsigned long) * nr_extents);
+ memset(extent_start, 0, sizeof(xen_pfn_t) * nr_extents);
for (i = 0; i < nr_extents; i++)
extent_start[i] = (begin + (i * TARGET_PAGE_SIZE)) >> TARGET_PAGE_BITS;
diff -r eee70cbfa20a -r f03f168a4e2d tools/ioemu/vl.c
--- a/tools/ioemu/vl.c Tue May 30 17:17:54 2006 -0500
+++ b/tools/ioemu/vl.c Tue May 30 17:17:55 2006 -0500
@@ -2457,7 +2457,7 @@ int unset_mm_mapping(int xc_handle,
uint32_t domid,
unsigned long nr_pages,
unsigned int address_bits,
- unsigned long *extent_start)
+ xen_pfn_t *extent_start)
{
int err = 0;
xc_dominfo_t info;
@@ -2490,7 +2490,7 @@ int set_mm_mapping(int xc_handle,
uint32_t domid,
unsigned long nr_pages,
unsigned int address_bits,
- unsigned long *extent_start)
+ xen_pfn_t *extent_start)
{
xc_dominfo_t info;
int err = 0;
@@ -2556,7 +2556,8 @@ int main(int argc, char **argv)
int serial_device_index;
char qemu_dm_logfilename[64];
const char *loadvm = NULL;
- unsigned long nr_pages, *page_array;
+ unsigned long nr_pages;
+ xen_pfn_t *page_array;
extern void *shared_page;
#if !defined(CONFIG_SOFTMMU)
@@ -3022,8 +3023,8 @@ int main(int argc, char **argv)
xc_handle = xc_interface_open();
- if ( (page_array = (unsigned long *)
- malloc(nr_pages * sizeof(unsigned long))) == NULL)
+ if ( (page_array = (xen_pfn_t *)
+ malloc(nr_pages * sizeof(xen_pfn_t))) == NULL)
{
fprintf(logfile, "malloc returned error %d\n", errno);
exit(-1);
@@ -3078,8 +3079,8 @@ int main(int argc, char **argv)
page_array[0]);
#endif
- fprintf(logfile, "shared page at pfn:%lx, mfn: %lx\n", (nr_pages-1),
- (page_array[nr_pages - 1]));
+ fprintf(logfile, "shared page at pfn:%lx, mfn: %"PRIx64"\n", (nr_pages-1),
+ (uint64_t)(page_array[nr_pages - 1]));
/* we always create the cdrom drive, even if no disk is there */
bdrv_init();
diff -r eee70cbfa20a -r f03f168a4e2d tools/libxc/xc_core.c
--- a/tools/libxc/xc_core.c Tue May 30 17:17:54 2006 -0500
+++ b/tools/libxc/xc_core.c Tue May 30 17:17:55 2006 -0500
@@ -28,7 +28,7 @@ xc_domain_dumpcore_via_callback(int xc_h
dumpcore_rtn_t dump_rtn)
{
unsigned long nr_pages;
- unsigned long *page_array = NULL;
+ xen_pfn_t *page_array = NULL;
xc_dominfo_t info;
int i, nr_vcpus = 0;
char *dump_mem, *dump_mem_start = NULL;
@@ -70,7 +70,7 @@ xc_domain_dumpcore_via_callback(int xc_h
sizeof(vcpu_guest_context_t)*nr_vcpus;
dummy_len = (sizeof(struct xc_core_header) +
(sizeof(vcpu_guest_context_t) * nr_vcpus) +
- (nr_pages * sizeof(unsigned long)));
+ (nr_pages * sizeof(xen_pfn_t)));
header.xch_pages_offset = round_pgup(dummy_len);
sts = dump_rtn(args, (char *)&header, sizeof(struct xc_core_header));
@@ -81,7 +81,7 @@ xc_domain_dumpcore_via_callback(int xc_h
if ( sts != 0 )
goto error_out;
- if ( (page_array = malloc(nr_pages * sizeof(unsigned long))) == NULL )
+ if ( (page_array = malloc(nr_pages * sizeof(xen_pfn_t))) == NULL )
{
printf("Could not allocate memory\n");
goto error_out;
@@ -91,7 +91,7 @@ xc_domain_dumpcore_via_callback(int xc_h
printf("Could not get the page frame list\n");
goto error_out;
}
- sts = dump_rtn(args, (char *)page_array, nr_pages * sizeof(unsigned long));
+ sts = dump_rtn(args, (char *)page_array, nr_pages * sizeof(xen_pfn_t));
if ( sts != 0 )
goto error_out;
diff -r eee70cbfa20a -r f03f168a4e2d tools/libxc/xc_domain.c
--- a/tools/libxc/xc_domain.c Tue May 30 17:17:54 2006 -0500
+++ b/tools/libxc/xc_domain.c Tue May 30 17:17:55 2006 -0500
@@ -291,7 +291,7 @@ int xc_domain_memory_increase_reservatio
unsigned long nr_extents,
unsigned int extent_order,
unsigned int address_bits,
- unsigned long *extent_start)
+ xen_pfn_t *extent_start)
{
int err;
struct xen_memory_reservation reservation = {
@@ -324,7 +324,7 @@ int xc_domain_memory_decrease_reservatio
uint32_t domid,
unsigned long nr_extents,
unsigned int extent_order,
- unsigned long *extent_start)
+ xen_pfn_t *extent_start)
{
int err;
struct xen_memory_reservation reservation = {
@@ -363,7 +363,7 @@ int xc_domain_memory_populate_physmap(in
unsigned long nr_extents,
unsigned int extent_order,
unsigned int address_bits,
- unsigned long *extent_start)
+ xen_pfn_t *extent_start)
{
int err;
struct xen_memory_reservation reservation = {
@@ -392,8 +392,8 @@ int xc_domain_translate_gpfn_list(int xc
int xc_domain_translate_gpfn_list(int xc_handle,
uint32_t domid,
unsigned long nr_gpfns,
- unsigned long *gpfn_list,
- unsigned long *mfn_list)
+ xen_pfn_t *gpfn_list,
+ xen_pfn_t *mfn_list)
{
struct xen_translate_gpfn_list op = {
.domid = domid,
diff -r eee70cbfa20a -r f03f168a4e2d tools/libxc/xc_hvm_build.c
--- a/tools/libxc/xc_hvm_build.c Tue May 30 17:17:54 2006 -0500
+++ b/tools/libxc/xc_hvm_build.c Tue May 30 17:17:55 2006 -0500
@@ -135,7 +135,7 @@ static void set_hvm_info_checksum(struct
* hvmloader will use this info to set BIOS accordingly
*/
static int set_hvm_info(int xc_handle, uint32_t dom,
- unsigned long *pfn_list, unsigned int vcpus,
+ xen_pfn_t *pfn_list, unsigned int vcpus,
unsigned int pae, unsigned int acpi, unsigned int apic)
{
char *va_map;
@@ -178,7 +178,7 @@ static int setup_guest(int xc_handle,
unsigned int store_evtchn,
unsigned long *store_mfn)
{
- unsigned long *page_array = NULL;
+ xen_pfn_t *page_array = NULL;
unsigned long count, i;
unsigned long long ptr;
xc_mmu_t *mmu = NULL;
@@ -223,7 +223,7 @@ static int setup_guest(int xc_handle,
goto error_out;
}
- if ( (page_array = malloc(nr_pages * sizeof(unsigned long))) == NULL )
+ if ( (page_array = malloc(nr_pages * sizeof(xen_pfn_t))) == NULL )
{
PERROR("Could not allocate memory.\n");
goto error_out;
diff -r eee70cbfa20a -r f03f168a4e2d tools/libxc/xc_ia64_stubs.c
--- a/tools/libxc/xc_ia64_stubs.c Tue May 30 17:17:54 2006 -0500
+++ b/tools/libxc/xc_ia64_stubs.c Tue May 30 17:17:55 2006 -0500
@@ -57,7 +57,7 @@ xc_plan9_build(int xc_handle,
int xc_ia64_get_pfn_list(int xc_handle,
uint32_t domid,
- unsigned long *pfn_buf,
+ xen_pfn_t *pfn_buf,
unsigned int start_page,
unsigned int nr_pages)
{
@@ -65,7 +65,7 @@ int xc_ia64_get_pfn_list(int xc_handle,
int num_pfns,ret;
unsigned int __start_page, __nr_pages;
unsigned long max_pfns;
- unsigned long *__pfn_buf;
+ xen_pfn_t *__pfn_buf;
__start_page = start_page;
__nr_pages = nr_pages;
@@ -80,7 +80,7 @@ int xc_ia64_get_pfn_list(int xc_handle,
set_xen_guest_handle(op.u.getmemlist.buffer, __pfn_buf);
if ( (max_pfns != -1UL)
- && mlock(__pfn_buf, __nr_pages * sizeof(unsigned long)) != 0 )
+ && mlock(__pfn_buf, __nr_pages * sizeof(xen_pfn_t)) != 0 )
{
PERROR("Could not lock pfn list buffer");
return -1;
@@ -89,7 +89,7 @@ int xc_ia64_get_pfn_list(int xc_handle,
ret = do_dom0_op(xc_handle, &op);
if (max_pfns != -1UL)
- (void)munlock(__pfn_buf, __nr_pages * sizeof(unsigned long));
+ (void)munlock(__pfn_buf, __nr_pages * sizeof(xen_pfn_t));
if (max_pfns == -1UL)
return 0;
@@ -122,10 +122,10 @@ int xc_ia64_copy_to_domain_pages(int xc_
{
// N.B. gva should be page aligned
- unsigned long *page_array = NULL;
+ xen_pfn_t *page_array = NULL;
int i;
- if ( (page_array = malloc(nr_pages * sizeof(unsigned long))) == NULL ){
+ if ( (page_array = malloc(nr_pages * sizeof(xen_pfn_t))) == NULL ){
PERROR("Could not allocate memory");
goto error_out;
}
diff -r eee70cbfa20a -r f03f168a4e2d tools/libxc/xc_linux.c
--- a/tools/libxc/xc_linux.c Tue May 30 17:17:54 2006 -0500
+++ b/tools/libxc/xc_linux.c Tue May 30 17:17:55 2006 -0500
@@ -28,7 +28,7 @@ int xc_interface_close(int xc_handle)
}
void *xc_map_foreign_batch(int xc_handle, uint32_t dom, int prot,
- unsigned long *arr, int num)
+ xen_pfn_t *arr, int num)
{
privcmd_mmapbatch_t ioctlx;
void *addr;
diff -r eee70cbfa20a -r f03f168a4e2d tools/libxc/xc_linux_build.c
--- a/tools/libxc/xc_linux_build.c Tue May 30 17:17:54 2006 -0500
+++ b/tools/libxc/xc_linux_build.c Tue May 30 17:17:55 2006 -0500
@@ -10,6 +10,7 @@
#include "xc_aout9.h"
#include <stdlib.h>
#include <unistd.h>
+#include <inttypes.h>
#include <zlib.h>
#if defined(__i386__)
@@ -136,7 +137,7 @@ int load_initrd(int xc_handle, domid_t d
int load_initrd(int xc_handle, domid_t dom,
struct initrd_info *initrd,
unsigned long physbase,
- unsigned long *phys_to_mach)
+ xen_pfn_t *phys_to_mach)
{
char page[PAGE_SIZE];
unsigned long pfn_start, pfn, nr_pages;
@@ -189,7 +190,7 @@ static int setup_pg_tables(int xc_handle
vcpu_guest_context_t *ctxt,
unsigned long dsi_v_start,
unsigned long v_end,
- unsigned long *page_array,
+ xen_pfn_t *page_array,
unsigned long vpt_start,
unsigned long vpt_end,
unsigned shadow_mode_enabled)
@@ -251,7 +252,7 @@ static int setup_pg_tables_pae(int xc_ha
vcpu_guest_context_t *ctxt,
unsigned long dsi_v_start,
unsigned long v_end,
- unsigned long *page_array,
+ xen_pfn_t *page_array,
unsigned long vpt_start,
unsigned long vpt_end,
unsigned shadow_mode_enabled)
@@ -340,7 +341,7 @@ static int setup_pg_tables_64(int xc_han
vcpu_guest_context_t *ctxt,
unsigned long dsi_v_start,
unsigned long v_end,
- unsigned long *page_array,
+ xen_pfn_t *page_array,
unsigned long vpt_start,
unsigned long vpt_end,
int shadow_mode_enabled)
@@ -451,7 +452,7 @@ static int setup_guest(int xc_handle,
unsigned int console_evtchn, unsigned long *console_mfn,
uint32_t required_features[XENFEAT_NR_SUBMAPS])
{
- unsigned long *page_array = NULL;
+ xen_pfn_t *page_array = NULL;
struct load_funcs load_funcs;
struct domain_setup_info dsi;
unsigned long vinitrd_start;
@@ -478,7 +479,7 @@ static int setup_guest(int xc_handle,
start_page = dsi.v_start >> PAGE_SHIFT;
pgnr = (v_end - dsi.v_start) >> PAGE_SHIFT;
- if ( (page_array = malloc(pgnr * sizeof(unsigned long))) == NULL )
+ if ( (page_array = malloc(pgnr * sizeof(xen_pfn_t))) == NULL )
{
PERROR("Could not allocate memory");
goto error_out;
@@ -606,7 +607,7 @@ static int setup_guest(int xc_handle,
unsigned int console_evtchn, unsigned long *console_mfn,
uint32_t required_features[XENFEAT_NR_SUBMAPS])
{
- unsigned long *page_array = NULL;
+ xen_pfn_t *page_array = NULL;
unsigned long count, i, hypercall_pfn;
start_info_t *start_info;
shared_info_t *shared_info;
@@ -617,7 +618,7 @@ static int setup_guest(int xc_handle,
unsigned long nr_pt_pages;
unsigned long physmap_pfn;
- unsigned long *physmap, *physmap_e;
+ xen_pfn_t *physmap, *physmap_e;
struct load_funcs load_funcs;
struct domain_setup_info dsi;
@@ -865,8 +866,8 @@ static int setup_guest(int xc_handle,
((uint64_t)page_array[count] << PAGE_SHIFT) | MMU_MACHPHYS_UPDATE,
count) )
{
- fprintf(stderr,"m2p update failure p=%lx m=%lx\n",
- count, page_array[count]);
+ fprintf(stderr,"m2p update failure p=%lx m=%"PRIx64"\n",
+ count, (uint64_t)page_array[count]);
munmap(physmap, PAGE_SIZE);
goto error_out;
}
diff -r eee70cbfa20a -r f03f168a4e2d tools/libxc/xc_linux_restore.c
--- a/tools/libxc/xc_linux_restore.c Tue May 30 17:17:54 2006 -0500
+++ b/tools/libxc/xc_linux_restore.c Tue May 30 17:17:55 2006 -0500
@@ -25,10 +25,10 @@ static unsigned long max_pfn;
static unsigned long max_pfn;
/* Live mapping of the table mapping each PFN to its current MFN. */
-static unsigned long *live_p2m = NULL;
+static xen_pfn_t *live_p2m = NULL;
/* A table mapping each PFN to its new MFN. */
-static unsigned long *p2m = NULL;
+static xen_pfn_t *p2m = NULL;
static ssize_t
@@ -126,7 +126,7 @@ int xc_linux_restore(int xc_handle, int
unsigned long *pfn_type = NULL;
/* A table of MFNs to map in the current region */
- unsigned long *region_mfn = NULL;
+ xen_pfn_t *region_mfn = NULL;
/* Types of the pfns in the current region */
unsigned long region_pfn_type[MAX_BATCH_SIZE];
@@ -135,7 +135,7 @@ int xc_linux_restore(int xc_handle, int
unsigned long *page = NULL;
/* A copy of the pfn-to-mfn table frame list. */
- unsigned long *p2m_frame_list = NULL;
+ xen_pfn_t *p2m_frame_list = NULL;
/* A temporary mapping of the guest's start_info page. */
start_info_t *start_info;
@@ -183,9 +183,9 @@ int xc_linux_restore(int xc_handle, int
/* We want zeroed memory so use calloc rather than malloc. */
- p2m = calloc(max_pfn, sizeof(unsigned long));
+ p2m = calloc(max_pfn, sizeof(xen_pfn_t));
pfn_type = calloc(max_pfn, sizeof(unsigned long));
- region_mfn = calloc(MAX_BATCH_SIZE, sizeof(unsigned long));
+ region_mfn = calloc(MAX_BATCH_SIZE, sizeof(xen_pfn_t));
if ((p2m == NULL) || (pfn_type == NULL) || (region_mfn == NULL)) {
ERR("memory alloc failed");
@@ -193,7 +193,7 @@ int xc_linux_restore(int xc_handle, int
goto out;
}
- if (mlock(region_mfn, sizeof(unsigned long) * MAX_BATCH_SIZE)) {
+ if (mlock(region_mfn, sizeof(xen_pfn_t) * MAX_BATCH_SIZE)) {
ERR("Could not mlock region_mfn");
goto out;
}
diff -r eee70cbfa20a -r f03f168a4e2d tools/libxc/xc_linux_save.c
--- a/tools/libxc/xc_linux_save.c Tue May 30 17:17:54 2006 -0500
+++ b/tools/libxc/xc_linux_save.c Tue May 30 17:17:55 2006 -0500
@@ -40,10 +40,10 @@ static unsigned long max_pfn;
static unsigned long max_pfn;
/* Live mapping of the table mapping each PFN to its current MFN. */
-static unsigned long *live_p2m = NULL;
+static xen_pfn_t *live_p2m = NULL;
/* Live mapping of system MFN to PFN table. */
-static unsigned long *live_m2p = NULL;
+static xen_pfn_t *live_m2p = NULL;
/* grep fodder: machine_to_phys */
@@ -501,22 +501,22 @@ void canonicalize_pagetable(unsigned lon
-static unsigned long *xc_map_m2p(int xc_handle,
+static xen_pfn_t *xc_map_m2p(int xc_handle,
unsigned long max_mfn,
int prot)
{
struct xen_machphys_mfn_list xmml;
privcmd_mmap_entry_t *entries;
unsigned long m2p_chunks, m2p_size;
- unsigned long *m2p;
- unsigned long *extent_start;
+ xen_pfn_t *m2p;
+ xen_pfn_t *extent_start;
int i, rc;
m2p_size = M2P_SIZE(max_mfn);
m2p_chunks = M2P_CHUNKS(max_mfn);
xmml.max_extents = m2p_chunks;
- if (!(extent_start = malloc(m2p_chunks * sizeof(unsigned long)))) {
+ if (!(extent_start = malloc(m2p_chunks * sizeof(xen_pfn_t)))) {
ERR("failed to allocate space for m2p mfns");
return NULL;
}
@@ -583,11 +583,11 @@ int xc_linux_save(int xc_handle, int io_
char page[PAGE_SIZE];
/* Double and single indirect references to the live P2M table */
- unsigned long *live_p2m_frame_list_list = NULL;
- unsigned long *live_p2m_frame_list = NULL;
+ xen_pfn_t *live_p2m_frame_list_list = NULL;
+ xen_pfn_t *live_p2m_frame_list = NULL;
/* A copy of the pfn-to-mfn table frame list. */
- unsigned long *p2m_frame_list = NULL;
+ xen_pfn_t *p2m_frame_list = NULL;
/* Live mapping of shared info structure */
shared_info_t *live_shinfo = NULL;
@@ -712,11 +712,11 @@ int xc_linux_save(int xc_handle, int io_
memcpy(p2m_frame_list, live_p2m_frame_list, P2M_FL_SIZE);
/* Canonicalise the pfn-to-mfn table frame-number list. */
- for (i = 0; i < max_pfn; i += ulpp) {
- if (!translate_mfn_to_pfn(&p2m_frame_list[i/ulpp])) {
+ for (i = 0; i < max_pfn; i += fpp) {
+ if (!translate_mfn_to_pfn(&p2m_frame_list[i/fpp])) {
ERR("Frame# in pfn-to-mfn frame list is not in pseudophys");
- ERR("entry %d: p2m_frame_list[%ld] is 0x%lx", i, i/ulpp,
- p2m_frame_list[i/ulpp]);
+ ERR("entry %d: p2m_frame_list[%ld] is 0x%"PRIx64, i, i/fpp,
+ (uint64_t)p2m_frame_list[i/fpp]);
goto out;
}
}
@@ -818,7 +818,7 @@ int xc_linux_save(int xc_handle, int io_
/* Start writing out the saved-domain record. */
- if(!write_exact(io_fd, &max_pfn, sizeof(unsigned long))) {
+ if(!write_exact(io_fd, &max_pfn, sizeof(xen_pfn_t))) {
ERR("write: max_pfn");
goto out;
}
diff -r eee70cbfa20a -r f03f168a4e2d tools/libxc/xc_load_aout9.c
--- a/tools/libxc/xc_load_aout9.c Tue May 30 17:17:54 2006 -0500
+++ b/tools/libxc/xc_load_aout9.c Tue May 30 17:17:55 2006 -0500
@@ -17,7 +17,7 @@
#define KOFFSET(_p) ((_p)&~KZERO)
static int parseaout9image(const char *, unsigned long, struct
domain_setup_info *);
-static int loadaout9image(const char *, unsigned long, int, uint32_t, unsigned
long *, struct domain_setup_info *);
+static int loadaout9image(const char *, unsigned long, int, uint32_t,
xen_pfn_t *, struct domain_setup_info *);
static void copyout(int, uint32_t, unsigned long *, unsigned long, const char
*, int);
struct Exec *get_header(const char *, unsigned long, struct Exec *);
@@ -79,7 +79,7 @@ loadaout9image(
const char *image,
unsigned long image_size,
int xch, uint32_t dom,
- unsigned long *parray,
+ xen_pfn_t *parray,
struct domain_setup_info *dsi)
{
struct Exec ehdr;
diff -r eee70cbfa20a -r f03f168a4e2d tools/libxc/xc_load_bin.c
--- a/tools/libxc/xc_load_bin.c Tue May 30 17:17:54 2006 -0500
+++ b/tools/libxc/xc_load_bin.c Tue May 30 17:17:55 2006 -0500
@@ -107,7 +107,7 @@ static int
static int
loadbinimage(
const char *image, unsigned long image_size, int xch, uint32_t dom,
- unsigned long *parray, struct domain_setup_info *dsi);
+ xen_pfn_t *parray, struct domain_setup_info *dsi);
int probe_bin(const char *image,
unsigned long image_size,
@@ -235,7 +235,7 @@ static int
static int
loadbinimage(
const char *image, unsigned long image_size, int xch, uint32_t dom,
- unsigned long *parray, struct domain_setup_info *dsi)
+ xen_pfn_t *parray, struct domain_setup_info *dsi)
{
unsigned long size;
char *va;
diff -r eee70cbfa20a -r f03f168a4e2d tools/libxc/xc_load_elf.c
--- a/tools/libxc/xc_load_elf.c Tue May 30 17:17:54 2006 -0500
+++ b/tools/libxc/xc_load_elf.c Tue May 30 17:17:55 2006 -0500
@@ -17,10 +17,10 @@ static int
static int
loadelfimage(
const char *image, unsigned long image_size, int xch, uint32_t dom,
- unsigned long *parray, struct domain_setup_info *dsi);
+ xen_pfn_t *parray, struct domain_setup_info *dsi);
static int
loadelfsymtab(
- const char *image, int xch, uint32_t dom, unsigned long *parray,
+ const char *image, int xch, uint32_t dom, xen_pfn_t *parray,
struct domain_setup_info *dsi);
int probe_elf(const char *image,
@@ -220,7 +220,7 @@ static int
static int
loadelfimage(
const char *image, unsigned long elfsize, int xch, uint32_t dom,
- unsigned long *parray, struct domain_setup_info *dsi)
+ xen_pfn_t *parray, struct domain_setup_info *dsi)
{
Elf_Ehdr *ehdr = (Elf_Ehdr *)image;
Elf_Phdr *phdr;
@@ -274,7 +274,7 @@ loadelfimage(
static int
loadelfsymtab(
- const char *image, int xch, uint32_t dom, unsigned long *parray,
+ const char *image, int xch, uint32_t dom, xen_pfn_t *parray,
struct domain_setup_info *dsi)
{
Elf_Ehdr *ehdr = (Elf_Ehdr *)image, *sym_ehdr;
diff -r eee70cbfa20a -r f03f168a4e2d tools/libxc/xc_private.c
--- a/tools/libxc/xc_private.c Tue May 30 17:17:54 2006 -0500
+++ b/tools/libxc/xc_private.c Tue May 30 17:17:55 2006 -0500
@@ -4,6 +4,7 @@
* Helper functions for the rest of the library.
*/
+#include <inttypes.h>
#include "xc_private.h"
/* NB: arr must be mlock'ed */
@@ -134,9 +135,9 @@ int xc_memory_op(int xc_handle,
struct xen_memory_reservation *reservation = arg;
struct xen_machphys_mfn_list *xmml = arg;
struct xen_translate_gpfn_list *trans = arg;
- unsigned long *extent_start;
- unsigned long *gpfn_list;
- unsigned long *mfn_list;
+ xen_pfn_t *extent_start;
+ xen_pfn_t *gpfn_list;
+ xen_pfn_t *mfn_list;
long ret = -EINVAL;
hypercall.op = __HYPERVISOR_memory_op;
@@ -156,7 +157,7 @@ int xc_memory_op(int xc_handle,
get_xen_guest_handle(extent_start, reservation->extent_start);
if ( (extent_start != NULL) &&
(mlock(extent_start,
- reservation->nr_extents * sizeof(unsigned long)) != 0) )
+ reservation->nr_extents * sizeof(xen_pfn_t)) != 0) )
{
PERROR("Could not mlock");
safe_munlock(reservation, sizeof(*reservation));
@@ -171,7 +172,7 @@ int xc_memory_op(int xc_handle,
}
get_xen_guest_handle(extent_start, xmml->extent_start);
if ( mlock(extent_start,
- xmml->max_extents * sizeof(unsigned long)) != 0 )
+ xmml->max_extents * sizeof(xen_pfn_t)) != 0 )
{
PERROR("Could not mlock");
safe_munlock(xmml, sizeof(*xmml));
@@ -192,17 +193,17 @@ int xc_memory_op(int xc_handle,
goto out1;
}
get_xen_guest_handle(gpfn_list, trans->gpfn_list);
- if ( mlock(gpfn_list, trans->nr_gpfns * sizeof(long)) != 0 )
+ if ( mlock(gpfn_list, trans->nr_gpfns * sizeof(xen_pfn_t)) != 0 )
{
PERROR("Could not mlock");
safe_munlock(trans, sizeof(*trans));
goto out1;
}
get_xen_guest_handle(mfn_list, trans->mfn_list);
- if ( mlock(mfn_list, trans->nr_gpfns * sizeof(long)) != 0 )
- {
- PERROR("Could not mlock");
- safe_munlock(gpfn_list, trans->nr_gpfns * sizeof(long));
+ if ( mlock(mfn_list, trans->nr_gpfns * sizeof(xen_pfn_t)) != 0 )
+ {
+ PERROR("Could not mlock");
+ safe_munlock(gpfn_list, trans->nr_gpfns * sizeof(xen_pfn_t));
safe_munlock(trans, sizeof(*trans));
goto out1;
}
@@ -220,22 +221,22 @@ int xc_memory_op(int xc_handle,
get_xen_guest_handle(extent_start, reservation->extent_start);
if ( extent_start != NULL )
safe_munlock(extent_start,
- reservation->nr_extents * sizeof(unsigned long));
+ reservation->nr_extents * sizeof(xen_pfn_t));
break;
case XENMEM_machphys_mfn_list:
safe_munlock(xmml, sizeof(*xmml));
get_xen_guest_handle(extent_start, xmml->extent_start);
safe_munlock(extent_start,
- xmml->max_extents * sizeof(unsigned long));
+ xmml->max_extents * sizeof(xen_pfn_t));
break;
case XENMEM_add_to_physmap:
safe_munlock(arg, sizeof(struct xen_add_to_physmap));
break;
case XENMEM_translate_gpfn_list:
get_xen_guest_handle(mfn_list, trans->mfn_list);
- safe_munlock(mfn_list, trans->nr_gpfns * sizeof(long));
+ safe_munlock(mfn_list, trans->nr_gpfns * sizeof(xen_pfn_t));
get_xen_guest_handle(gpfn_list, trans->gpfn_list);
- safe_munlock(gpfn_list, trans->nr_gpfns * sizeof(long));
+ safe_munlock(gpfn_list, trans->nr_gpfns * sizeof(xen_pfn_t));
safe_munlock(trans, sizeof(*trans));
break;
}
@@ -263,7 +264,7 @@ long long xc_domain_get_cpu_usage( int x
int xc_get_pfn_list(int xc_handle,
uint32_t domid,
- unsigned long *pfn_buf,
+ xen_pfn_t *pfn_buf,
unsigned long max_pfns)
{
DECLARE_DOM0_OP;
@@ -274,10 +275,10 @@ int xc_get_pfn_list(int xc_handle,
set_xen_guest_handle(op.u.getmemlist.buffer, pfn_buf);
#ifdef VALGRIND
- memset(pfn_buf, 0, max_pfns * sizeof(unsigned long));
+ memset(pfn_buf, 0, max_pfns * sizeof(xen_pfn_t));
#endif
- if ( mlock(pfn_buf, max_pfns * sizeof(unsigned long)) != 0 )
+ if ( mlock(pfn_buf, max_pfns * sizeof(xen_pfn_t)) != 0 )
{
PERROR("xc_get_pfn_list: pfn_buf mlock failed");
return -1;
@@ -285,7 +286,7 @@ int xc_get_pfn_list(int xc_handle,
ret = do_dom0_op(xc_handle, &op);
- safe_munlock(pfn_buf, max_pfns * sizeof(unsigned long));
+ safe_munlock(pfn_buf, max_pfns * sizeof(xen_pfn_t));
#if 0
#ifdef DEBUG
@@ -364,7 +365,7 @@ unsigned long xc_get_filesz(int fd)
}
void xc_map_memcpy(unsigned long dst, const char *src, unsigned long size,
- int xch, uint32_t dom, unsigned long *parray,
+ int xch, uint32_t dom, xen_pfn_t *parray,
unsigned long vstart)
{
char *va;
diff -r eee70cbfa20a -r f03f168a4e2d tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h Tue May 30 17:17:54 2006 -0500
+++ b/tools/libxc/xenctrl.h Tue May 30 17:17:55 2006 -0500
@@ -420,26 +420,26 @@ int xc_domain_memory_increase_reservatio
unsigned long nr_extents,
unsigned int extent_order,
unsigned int address_bits,
- unsigned long *extent_start);
+ xen_pfn_t *extent_start);
int xc_domain_memory_decrease_reservation(int xc_handle,
uint32_t domid,
unsigned long nr_extents,
unsigned int extent_order,
- unsigned long *extent_start);
+ xen_pfn_t *extent_start);
int xc_domain_memory_populate_physmap(int xc_handle,
uint32_t domid,
unsigned long nr_extents,
unsigned int extent_order,
unsigned int address_bits,
- unsigned long *extent_start);
+ xen_pfn_t *extent_start);
int xc_domain_translate_gpfn_list(int xc_handle,
uint32_t domid,
unsigned long nr_gpfns,
- unsigned long *gpfn_list,
- unsigned long *mfn_list);
+ xen_pfn_t *gpfn_list,
+ xen_pfn_t *mfn_list);
int xc_domain_ioport_permission(int xc_handle,
uint32_t domid,
@@ -489,7 +489,7 @@ void *xc_map_foreign_range(int xc_handle
unsigned long mfn );
void *xc_map_foreign_batch(int xc_handle, uint32_t dom, int prot,
- unsigned long *arr, int num );
+ xen_pfn_t *arr, int num );
/**
* Translates a virtual address in the context of a given domain and
@@ -504,11 +504,11 @@ unsigned long xc_translate_foreign_addre
unsigned long xc_translate_foreign_address(int xc_handle, uint32_t dom,
int vcpu, unsigned long long virt);
-int xc_get_pfn_list(int xc_handle, uint32_t domid, unsigned long *pfn_buf,
+int xc_get_pfn_list(int xc_handle, uint32_t domid, xen_pfn_t *pfn_buf,
unsigned long max_pfns);
int xc_ia64_get_pfn_list(int xc_handle, uint32_t domid,
- unsigned long *pfn_buf,
+ xen_pfn_t *pfn_buf,
unsigned int start_page, unsigned int nr_pages);
int xc_copy_to_domain_page(int xc_handle, uint32_t domid,
diff -r eee70cbfa20a -r f03f168a4e2d tools/libxc/xg_private.h
--- a/tools/libxc/xg_private.h Tue May 30 17:17:54 2006 -0500
+++ b/tools/libxc/xg_private.h Tue May 30 17:17:55 2006 -0500
@@ -162,7 +162,7 @@ typedef int (*parseimagefunc)(const char
struct domain_setup_info *dsi);
typedef int (*loadimagefunc)(const char *image, unsigned long image_size,
int xch,
- uint32_t dom, unsigned long *parray,
+ uint32_t dom, xen_pfn_t *parray,
struct domain_setup_info *dsi);
struct load_funcs
@@ -190,7 +190,7 @@ unsigned long xc_get_filesz(int fd);
unsigned long xc_get_filesz(int fd);
void xc_map_memcpy(unsigned long dst, const char *src, unsigned long size,
- int xch, uint32_t dom, unsigned long *parray,
+ int xch, uint32_t dom, xen_pfn_t *parray,
unsigned long vstart);
int pin_table(int xc_handle, unsigned int type, unsigned long mfn,
diff -r eee70cbfa20a -r f03f168a4e2d tools/libxc/xg_save_restore.h
--- a/tools/libxc/xg_save_restore.h Tue May 30 17:17:54 2006 -0500
+++ b/tools/libxc/xg_save_restore.h Tue May 30 17:17:55 2006 -0500
@@ -105,23 +105,23 @@ static int get_platform_info(int xc_hand
*/
#define M2P_SHIFT L2_PAGETABLE_SHIFT_PAE
#define M2P_CHUNK_SIZE (1 << M2P_SHIFT)
-#define M2P_SIZE(_m) ROUNDUP(((_m) * sizeof(unsigned long)), M2P_SHIFT)
+#define M2P_SIZE(_m) ROUNDUP(((_m) * sizeof(xen_pfn_t)), M2P_SHIFT)
#define M2P_CHUNKS(_m) (M2P_SIZE((_m)) >> M2P_SHIFT)
/* Size in bytes of the P2M (rounded up to the nearest PAGE_SIZE bytes) */
-#define P2M_SIZE ROUNDUP((max_pfn * sizeof(unsigned long)), PAGE_SHIFT)
+#define P2M_SIZE ROUNDUP((max_pfn * sizeof(xen_pfn_t)), PAGE_SHIFT)
-/* Number of unsigned longs in a page */
-#define ulpp (PAGE_SIZE/sizeof(unsigned long))
+/* Number of xen_pfn_t in a page */
+#define fpp (PAGE_SIZE/sizeof(xen_pfn_t))
/* Number of entries in the pfn_to_mfn_frame_list */
-#define P2M_FL_ENTRIES (((max_pfn)+ulpp-1)/ulpp)
+#define P2M_FL_ENTRIES (((max_pfn)+fpp-1)/fpp)
/* Size in bytes of the pfn_to_mfn_frame_list */
#define P2M_FL_SIZE ((P2M_FL_ENTRIES)*sizeof(unsigned long))
/* Number of entries in the pfn_to_mfn_frame_list_list */
-#define P2M_FLL_ENTRIES (((max_pfn)+(ulpp*ulpp)-1)/(ulpp*ulpp))
+#define P2M_FLL_ENTRIES (((max_pfn)+(fpp*fpp)-1)/(fpp*fpp))
/* Current guests allow 8MB 'slack' in their P2M */
#define NR_SLACK_ENTRIES ((8 * 1024 * 1024) / PAGE_SIZE)
diff -r eee70cbfa20a -r f03f168a4e2d xen/common/memory.c
--- a/xen/common/memory.c Tue May 30 17:17:54 2006 -0500
+++ b/xen/common/memory.c Tue May 30 17:17:55 2006 -0500
@@ -31,14 +31,15 @@ static long
static long
increase_reservation(
struct domain *d,
- XEN_GUEST_HANDLE(ulong) extent_list,
+ XEN_GUEST_HANDLE(xen_pfn_t) extent_list,
unsigned int nr_extents,
unsigned int extent_order,
unsigned int flags,
int *preempted)
{
struct page_info *page;
- unsigned long i, mfn;
+ unsigned long i;
+ xen_pfn_t mfn;
if ( !guest_handle_is_null(extent_list) &&
!guest_handle_okay(extent_list, nr_extents) )
@@ -80,14 +81,16 @@ static long
static long
populate_physmap(
struct domain *d,
- XEN_GUEST_HANDLE(ulong) extent_list,
+ XEN_GUEST_HANDLE(xen_pfn_t) extent_list,
unsigned int nr_extents,
unsigned int extent_order,
unsigned int flags,
int *preempted)
{
struct page_info *page;
- unsigned long i, j, gpfn, mfn;
+ unsigned long i, j;
+ xen_pfn_t gpfn;
+ xen_pfn_t mfn;
if ( !guest_handle_okay(extent_list, nr_extents) )
return 0;
@@ -177,13 +180,14 @@ static long
static long
decrease_reservation(
struct domain *d,
- XEN_GUEST_HANDLE(ulong) extent_list,
+ XEN_GUEST_HANDLE(xen_pfn_t) extent_list,
unsigned int nr_extents,
unsigned int extent_order,
unsigned int flags,
int *preempted)
{
- unsigned long i, j, gmfn;
+ unsigned long i, j;
+ xen_pfn_t gmfn;
if ( !guest_handle_okay(extent_list, nr_extents) )
return 0;
@@ -214,7 +218,9 @@ translate_gpfn_list(
XEN_GUEST_HANDLE(xen_translate_gpfn_list_t) uop, unsigned long *progress)
{
struct xen_translate_gpfn_list op;
- unsigned long i, gpfn, mfn;
+ unsigned long i;
+ xen_pfn_t gpfn;
+ xen_pfn_t mfn;
struct domain *d;
if ( copy_from_guest(&op, uop, 1) )
diff -r eee70cbfa20a -r f03f168a4e2d xen/include/public/arch-ia64.h
--- a/xen/include/public/arch-ia64.h Tue May 30 17:17:54 2006 -0500
+++ b/xen/include/public/arch-ia64.h Tue May 30 17:17:55 2006 -0500
@@ -26,6 +26,9 @@ DEFINE_XEN_GUEST_HANDLE(int);
DEFINE_XEN_GUEST_HANDLE(int);
DEFINE_XEN_GUEST_HANDLE(long);
DEFINE_XEN_GUEST_HANDLE(void);
+
+typedef unsigned long xen_pfn_t;
+DEFINE_XEN_GUEST_HANDLE(xen_pfn_t);
#endif
/* Arch specific VIRQs definition */
diff -r eee70cbfa20a -r f03f168a4e2d xen/include/public/arch-x86_32.h
--- a/xen/include/public/arch-x86_32.h Tue May 30 17:17:54 2006 -0500
+++ b/xen/include/public/arch-x86_32.h Tue May 30 17:17:55 2006 -0500
@@ -28,6 +28,9 @@ DEFINE_XEN_GUEST_HANDLE(int);
DEFINE_XEN_GUEST_HANDLE(int);
DEFINE_XEN_GUEST_HANDLE(long);
DEFINE_XEN_GUEST_HANDLE(void);
+
+typedef unsigned long xen_pfn_t;
+DEFINE_XEN_GUEST_HANDLE(xen_pfn_t);
#endif
/*
diff -r eee70cbfa20a -r f03f168a4e2d xen/include/public/arch-x86_64.h
--- a/xen/include/public/arch-x86_64.h Tue May 30 17:17:54 2006 -0500
+++ b/xen/include/public/arch-x86_64.h Tue May 30 17:17:55 2006 -0500
@@ -28,6 +28,9 @@ DEFINE_XEN_GUEST_HANDLE(int);
DEFINE_XEN_GUEST_HANDLE(int);
DEFINE_XEN_GUEST_HANDLE(long);
DEFINE_XEN_GUEST_HANDLE(void);
+
+typedef unsigned long xen_pfn_t;
+DEFINE_XEN_GUEST_HANDLE(xen_pfn_t);
#endif
/*
diff -r eee70cbfa20a -r f03f168a4e2d xen/include/public/dom0_ops.h
--- a/xen/include/public/dom0_ops.h Tue May 30 17:17:54 2006 -0500
+++ b/xen/include/public/dom0_ops.h Tue May 30 17:17:55 2006 -0500
@@ -28,7 +28,7 @@ struct dom0_getmemlist {
/* IN variables. */
domid_t domain;
unsigned long max_pfns;
- XEN_GUEST_HANDLE(ulong) buffer;
+ XEN_GUEST_HANDLE(xen_pfn_t) buffer;
/* OUT variables. */
unsigned long num_pfns;
};
diff -r eee70cbfa20a -r f03f168a4e2d xen/include/public/memory.h
--- a/xen/include/public/memory.h Tue May 30 17:17:54 2006 -0500
+++ b/xen/include/public/memory.h Tue May 30 17:17:55 2006 -0500
@@ -29,7 +29,7 @@ struct xen_memory_reservation {
* OUT: GMFN bases of extents that were allocated
* (NB. This command also updates the mach_to_phys translation table)
*/
- XEN_GUEST_HANDLE(ulong) extent_start;
+ XEN_GUEST_HANDLE(xen_pfn_t) extent_start;
/* Number of extents, and size/alignment of each (2^extent_order pages). */
unsigned long nr_extents;
@@ -87,7 +87,7 @@ struct xen_machphys_mfn_list {
* any large discontiguities in the machine address space, 2MB gaps in
* the machphys table will be represented by an MFN base of zero.
*/
- XEN_GUEST_HANDLE(ulong) extent_start;
+ XEN_GUEST_HANDLE(xen_pfn_t) extent_start;
/*
* Number of extents written to the above array. This will be smaller
@@ -135,13 +135,13 @@ struct xen_translate_gpfn_list {
unsigned long nr_gpfns;
/* List of GPFNs to translate. */
- XEN_GUEST_HANDLE(ulong) gpfn_list;
+ XEN_GUEST_HANDLE(xen_pfn_t) gpfn_list;
/*
* Output list to contain MFN translations. May be the same as the input
* list (in which case each input GPFN is overwritten with the output MFN).
*/
- XEN_GUEST_HANDLE(ulong) mfn_list;
+ XEN_GUEST_HANDLE(xen_pfn_t) mfn_list;
};
typedef struct xen_translate_gpfn_list xen_translate_gpfn_list_t;
DEFINE_XEN_GUEST_HANDLE(xen_translate_gpfn_list_t);
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|