aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>2004-06-03 11:45:16 +0000
committerkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>2004-06-03 11:45:16 +0000
commit1f83b68652a9a1b532d2204c07846a75c14d8937 (patch)
tree8b0b278f1a404e087d40197e24226dfacc876548
parent96278e6472cd5a17d8cbd03fa72565026a982e9c (diff)
downloadxen-1f83b68652a9a1b532d2204c07846a75c14d8937.tar.gz
xen-1f83b68652a9a1b532d2204c07846a75c14d8937.tar.bz2
xen-1f83b68652a9a1b532d2204c07846a75c14d8937.zip
bitkeeper revision 1.930 (40bf0f4cD6X2TCNUTUzQPA_qDsagoQ)
Reduce domid to 32 bits only -- more than enough.
-rwxr-xr-xtools/examples/xc_dom_control.py2
-rw-r--r--tools/xc/lib/xc.h78
-rw-r--r--tools/xc/lib/xc_atropos.c4
-rw-r--r--tools/xc/lib/xc_bvtsched.c10
-rw-r--r--tools/xc/lib/xc_domain.c59
-rw-r--r--tools/xc/lib/xc_evtchn.c10
-rw-r--r--tools/xc/lib/xc_linux_build.c12
-rw-r--r--tools/xc/lib/xc_linux_restore.c382
-rw-r--r--tools/xc/lib/xc_linux_save.c793
-rw-r--r--tools/xc/lib/xc_misc.c4
-rw-r--r--tools/xc/lib/xc_netbsd_build.c12
-rw-r--r--tools/xc/lib/xc_physdev.c2
-rw-r--r--tools/xc/lib/xc_private.c115
-rw-r--r--tools/xc/lib/xc_vbd.c16
-rw-r--r--tools/xc/lib/xc_vif.c6
-rw-r--r--tools/xc/py/Xc.c731
-rw-r--r--tools/xend/lib/blkif.py14
-rw-r--r--tools/xend/lib/netif.py8
-rw-r--r--tools/xend/lib/utils.c15
-rw-r--r--xen/common/dom0_ops.c337
-rw-r--r--xen/common/dom_mem_ops.c4
-rw-r--r--xen/common/domain.c78
-rw-r--r--xen/common/keyhandler.c26
-rw-r--r--xen/common/memory.c48
-rw-r--r--xen/common/network.c7
-rw-r--r--xen/common/physdev.c14
-rw-r--r--xen/common/sched_atropos.c2
-rw-r--r--xen/common/sched_bvt.c15
-rw-r--r--xen/common/schedule.c6
-rw-r--r--xen/drivers/block/xen_block.c2
-rw-r--r--xen/drivers/block/xen_vbd.c16
-rw-r--r--xen/drivers/char/console.c10
-rw-r--r--xen/include/hypervisor-ifs/dom0_ops.h101
-rw-r--r--xen/include/hypervisor-ifs/event_channel.h30
-rw-r--r--xen/include/hypervisor-ifs/hypervisor-if.h26
-rw-r--r--xen/include/hypervisor-ifs/network.h2
-rw-r--r--xen/include/hypervisor-ifs/sched_ctl.h5
-rw-r--r--xen/include/hypervisor-ifs/vbd.h2
-rw-r--r--xen/include/xen/mm.h7
-rw-r--r--xen/include/xen/sched.h2
-rw-r--r--xen/include/xen/shadow.h427
-rw-r--r--xen/net/dev.c27
-rw-r--r--xenolinux-2.4.26-sparse/arch/xen/drivers/blkif/backend/interface.c7
-rw-r--r--xenolinux-2.4.26-sparse/arch/xen/drivers/blkif/backend/main.c3
-rw-r--r--xenolinux-2.4.26-sparse/arch/xen/drivers/blkif/backend/vbd.c14
-rw-r--r--xenolinux-2.4.26-sparse/arch/xen/drivers/dom0/core.c193
-rw-r--r--xenolinux-2.4.26-sparse/arch/xen/drivers/netif/backend/interface.c7
-rw-r--r--xenolinux-2.4.26-sparse/arch/xen/drivers/netif/backend/main.c23
-rw-r--r--xenolinux-2.4.26-sparse/arch/xen/mm/ioremap.c8
-rw-r--r--xenolinux-2.4.26-sparse/drivers/char/mem.c17
-rw-r--r--xenolinux-2.4.26-sparse/include/asm-xen/hypervisor.h3
51 files changed, 1847 insertions, 1895 deletions
diff --git a/tools/examples/xc_dom_control.py b/tools/examples/xc_dom_control.py
index 9feab009e3..9a73d4533f 100755
--- a/tools/examples/xc_dom_control.py
+++ b/tools/examples/xc_dom_control.py
@@ -50,7 +50,7 @@ dom = None
if len( sys.argv ) > 2 and re.match('\d+$', sys.argv[2]):
- dom = long(sys.argv[2])
+ dom = int(sys.argv[2])
if cmd == 'stop':
rc = xc.domain_stop( dom=dom )
diff --git a/tools/xc/lib/xc.h b/tools/xc/lib/xc.h
index 3423c4ec46..1523e2c84a 100644
--- a/tools/xc/lib/xc.h
+++ b/tools/xc/lib/xc.h
@@ -23,7 +23,7 @@ int xc_interface_open(void);
int xc_interface_close(int xc_handle);
typedef struct {
- u64 domid;
+ u32 domid;
unsigned int cpu;
int has_cpu;
int stopped;
@@ -39,24 +39,24 @@ int xc_domain_create(int xc_handle,
unsigned int mem_kb,
const char *name,
int cpu,
- u64 *pdomid);
+ u32 *pdomid);
int xc_domain_start(int xc_handle,
- u64 domid);
+ u32 domid);
int xc_domain_stop(int xc_handle,
- u64 domid);
+ u32 domid);
int xc_domain_destroy(int xc_handle,
- u64 domid,
+ u32 domid,
int force);
int xc_domain_pincpu(int xc_handle,
- u64 domid,
+ u32 domid,
int cpu);
int xc_domain_getinfo(int xc_handle,
- u64 first_domid,
+ u32 first_domid,
unsigned int max_doms,
xc_dominfo_t *info);
int xc_shadow_control(int xc_handle,
- u64 domid,
+ u32 domid,
unsigned int sop,
unsigned long *dirty_bitmap,
unsigned long pages,
@@ -69,27 +69,27 @@ int xc_shadow_control(int xc_handle,
#define XCFLAGS_DEBUG 4
int xc_linux_save(int xc_handle,
- u64 domid,
+ u32 domid,
unsigned int flags,
int (*writerfn)(void *, const void *, size_t),
void *writerst );
int xc_linux_restore(int xc_handle,
- u64 domid,
+ u32 domid,
unsigned int flags,
int (*readerfn)(void *, void *, size_t),
void *readerst,
- u64 *pdomid);
+ u32 *pdomid);
int xc_linux_build(int xc_handle,
- u64 domid,
+ u32 domid,
const char *image_name,
const char *ramdisk_name,
const char *cmdline,
unsigned int control_evtchn);
int xc_netbsd_build(int xc_handle,
- u64 domid,
+ u32 domid,
const char *image_name,
const char *cmdline,
unsigned int control_evtchn);
@@ -98,7 +98,7 @@ int xc_bvtsched_global_set(int xc_handle,
unsigned long ctx_allow);
int xc_bvtsched_domain_set(int xc_handle,
- u64 domid,
+ u32 domid,
unsigned long mcuadv,
unsigned long warp,
unsigned long warpl,
@@ -108,19 +108,19 @@ int xc_bvtsched_global_get(int xc_handle,
unsigned long *ctx_allow);
int xc_bvtsched_domain_get(int xc_handle,
- u64 domid,
+ u32 domid,
unsigned long *mcuadv,
unsigned long *warp,
unsigned long *warpl,
unsigned long *warpu);
int xc_atropos_domain_set(int xc_handle,
- u64 domid,
+ u32 domid,
u64 period, u64 slice, u64 latency,
int xtratime);
int xc_atropos_domain_get(int xc_handle,
- u64 domid,
+ u32 domid,
u64* period, u64 *slice, u64 *latency,
int *xtratime);
@@ -139,21 +139,21 @@ typedef struct {
} xc_vif_stats_t;
int xc_vif_scheduler_set(int xc_handle,
- u64 domid,
+ u32 domid,
unsigned int vifid,
xc_vif_sched_params_t *params);
int xc_vif_scheduler_get(int xc_handle,
- u64 domid,
+ u32 domid,
unsigned int vifid,
xc_vif_sched_params_t *params);
int xc_vif_stats_get(int xc_handle,
- u64 domid,
+ u32 domid,
unsigned int vifid,
xc_vif_stats_t *stats);
typedef struct {
-#define XC_VBDDOM_PROBE_ALL (~0ULL)
- u64 domid;
+#define XC_VBDDOM_PROBE_ALL (0x7FFFFFFFU)
+ u32 domid;
unsigned short vbdid;
#define XC_VBDF_WRITEABLE (1<<0)
unsigned long flags;
@@ -175,36 +175,36 @@ typedef struct {
} xc_physinfo_t;
int xc_vbd_create(int xc_handle,
- u64 domid,
+ u32 domid,
unsigned short vbdid,
int writeable);
int xc_vbd_destroy(int xc_handle,
- u64 domid,
+ u32 domid,
unsigned short vbdid);
int xc_vbd_grow(int xc_handle,
- u64 domid,
+ u32 domid,
unsigned short vbdid,
xc_vbdextent_t *extent);
int xc_vbd_shrink(int xc_handle,
- u64 domid,
+ u32 domid,
unsigned short vbdid);
int xc_vbd_setextents(int xc_handle,
- u64 domid,
+ u32 domid,
unsigned short vbdid,
unsigned int nr_extents,
xc_vbdextent_t *extents);
int xc_vbd_getextents(int xc_handle,
- u64 domid,
+ u32 domid,
unsigned short vbdid,
unsigned int max_extents,
xc_vbdextent_t *extents,
int *writeable);
int xc_vbd_probe(int xc_handle,
- u64 domid,
+ u32 domid,
unsigned int max_vbds,
xc_vbd_t *vbds);
-#define DOMID_SELF (~1ULL)
+#define DOMID_SELF (0x7FFFFFFEU)
typedef struct {
#define EVTCHNSTAT_closed 0 /* Chennel is not in use. */
@@ -215,7 +215,7 @@ typedef struct {
int status;
union {
struct {
- u64 dom;
+ u32 dom;
int port;
} interdomain;
int pirq;
@@ -224,22 +224,22 @@ typedef struct {
} xc_evtchn_status_t;
int xc_evtchn_bind_interdomain(int xc_handle,
- u64 dom1, /* may be DOMID_SELF */
- u64 dom2, /* may be DOMID_SELF */
+ u32 dom1, /* may be DOMID_SELF */
+ u32 dom2, /* may be DOMID_SELF */
int *port1,
int *port2);
int xc_evtchn_close(int xc_handle,
- u64 dom, /* may be DOMID_SELF */
+ u32 dom, /* may be DOMID_SELF */
int port);
int xc_evtchn_send(int xc_handle,
int local_port);
int xc_evtchn_status(int xc_handle,
- u64 dom, /* may be DOMID_SELF */
+ u32 dom, /* may be DOMID_SELF */
int port,
xc_evtchn_status_t *status);
int xc_physdev_pci_access_modify(int xc_handle,
- u64 domid,
+ u32 domid,
int bus,
int dev,
int func,
@@ -254,15 +254,15 @@ int xc_physinfo(int xc_handle,
xc_physinfo_t *info);
int xc_domain_setname(int xc_handle,
- u64 domid,
+ u32 domid,
char *name);
int xc_domain_setinitialmem(int xc_handle,
- u64 domid,
+ u32 domid,
unsigned int initial_memkb);
int xc_domain_setmaxmem(int xc_handle,
- u64 domid,
+ u32 domid,
unsigned int max_memkb);
diff --git a/tools/xc/lib/xc_atropos.c b/tools/xc/lib/xc_atropos.c
index 279324854c..13d07ca440 100644
--- a/tools/xc/lib/xc_atropos.c
+++ b/tools/xc/lib/xc_atropos.c
@@ -9,7 +9,7 @@
#include "xc_private.h"
int xc_atropos_domain_set(int xc_handle,
- u64 domid, u64 period, u64 slice, u64 latency,
+ u32 domid, u64 period, u64 slice, u64 latency,
int xtratime)
{
dom0_op_t op;
@@ -28,7 +28,7 @@ int xc_atropos_domain_set(int xc_handle,
return do_dom0_op(xc_handle, &op);
}
-int xc_atropos_domain_get(int xc_handle, u64 domid, u64 *period,
+int xc_atropos_domain_get(int xc_handle, u32 domid, u64 *period,
u64 *slice, u64 *latency, int *xtratime)
{
dom0_op_t op;
diff --git a/tools/xc/lib/xc_bvtsched.c b/tools/xc/lib/xc_bvtsched.c
index e5106b561b..aeaddcfb04 100644
--- a/tools/xc/lib/xc_bvtsched.c
+++ b/tools/xc/lib/xc_bvtsched.c
@@ -22,7 +22,7 @@ int xc_bvtsched_global_set(int xc_handle,
}
int xc_bvtsched_global_get(int xc_handle,
- unsigned long *ctx_allow)
+ unsigned long *ctx_allow)
{
dom0_op_t op;
int ret;
@@ -39,7 +39,7 @@ int xc_bvtsched_global_get(int xc_handle,
}
int xc_bvtsched_domain_set(int xc_handle,
- u64 domid,
+ u32 domid,
unsigned long mcuadv,
unsigned long warp,
unsigned long warpl,
@@ -62,9 +62,9 @@ int xc_bvtsched_domain_set(int xc_handle,
int xc_bvtsched_domain_get(int xc_handle,
- u64 domid,
- unsigned long *mcuadv,
- unsigned long *warp,
+ u32 domid,
+ unsigned long *mcuadv,
+ unsigned long *warp,
unsigned long *warpl,
unsigned long *warpu)
{
diff --git a/tools/xc/lib/xc_domain.c b/tools/xc/lib/xc_domain.c
index dd8b4ec35f..97a919f8d6 100644
--- a/tools/xc/lib/xc_domain.c
+++ b/tools/xc/lib/xc_domain.c
@@ -11,8 +11,8 @@
int xc_domain_create(int xc_handle,
unsigned int mem_kb,
const char *name,
- int cpu,
- u64 *pdomid)
+ int cpu,
+ u32 *pdomid)
{
int err;
dom0_op_t op;
@@ -24,14 +24,14 @@ int xc_domain_create(int xc_handle,
op.u.createdomain.cpu = cpu;
if ( (err = do_dom0_op(xc_handle, &op)) == 0 )
- *pdomid = (u64)op.u.createdomain.domain;
+ *pdomid = (u32)op.u.createdomain.domain;
return err;
}
int xc_domain_start(int xc_handle,
- u64 domid)
+ u32 domid)
{
dom0_op_t op;
op.cmd = DOM0_STARTDOMAIN;
@@ -41,18 +41,18 @@ int xc_domain_start(int xc_handle,
int xc_domain_stop(int xc_handle,
- u64 domid)
+ u32 domid)
{
dom0_op_t op;
op.cmd = DOM0_STOPDOMAIN;
op.u.stopdomain.domain = (domid_t)domid;
- op.u.stopdomain.sync = 0; // async
+ op.u.stopdomain.sync = 0; /* async */
return do_dom0_op(xc_handle, &op);
}
int xc_domain_destroy(int xc_handle,
- u64 domid,
+ u32 domid,
int force)
{
dom0_op_t op;
@@ -63,7 +63,7 @@ int xc_domain_destroy(int xc_handle,
}
int xc_domain_pincpu(int xc_handle,
- u64 domid,
+ u32 domid,
int cpu)
{
dom0_op_t op;
@@ -75,22 +75,22 @@ int xc_domain_pincpu(int xc_handle,
int xc_domain_getinfo(int xc_handle,
- u64 first_domid,
+ u32 first_domid,
unsigned int max_doms,
xc_dominfo_t *info)
{
unsigned int nr_doms;
- u64 next_domid = first_domid;
+ u32 next_domid = first_domid;
dom0_op_t op;
for ( nr_doms = 0; nr_doms < max_doms; nr_doms++ )
{
op.cmd = DOM0_GETDOMAININFO;
op.u.getdomaininfo.domain = (domid_t)next_domid;
- op.u.getdomaininfo.ctxt = NULL; // no exec context info, thanks.
+ op.u.getdomaininfo.ctxt = NULL; /* no exec context info, thanks. */
if ( do_dom0_op(xc_handle, &op) < 0 )
break;
- info->domid = (u64)op.u.getdomaininfo.domain;
+ info->domid = (u32)op.u.getdomaininfo.domain;
info->cpu = op.u.getdomaininfo.processor;
info->has_cpu = op.u.getdomaininfo.has_cpu;
info->stopped = (op.u.getdomaininfo.state == DOMSTATE_STOPPED);
@@ -101,7 +101,7 @@ int xc_domain_getinfo(int xc_handle,
strncpy(info->name, op.u.getdomaininfo.name, XC_DOMINFO_MAXNAME);
info->name[XC_DOMINFO_MAXNAME-1] = '\0';
- next_domid = (u64)op.u.getdomaininfo.domain + 1;
+ next_domid = (u32)op.u.getdomaininfo.domain + 1;
info++;
}
@@ -109,12 +109,12 @@ int xc_domain_getinfo(int xc_handle,
}
int xc_shadow_control(int xc_handle,
- u64 domid,
+ u32 domid,
unsigned int sop,
- unsigned long *dirty_bitmap,
- unsigned long pages,
- unsigned long *fault_count,
- unsigned long *dirty_count)
+ unsigned long *dirty_bitmap,
+ unsigned long pages,
+ unsigned long *fault_count,
+ unsigned long *dirty_count)
{
int rc;
dom0_op_t op;
@@ -126,18 +126,17 @@ int xc_shadow_control(int xc_handle,
rc = do_dom0_op(xc_handle, &op);
- if(fault_count) *fault_count = op.u.shadow_control.fault_count;
- if(dirty_count) *dirty_count = op.u.shadow_control.dirty_count;
+ if ( fault_count )
+ *fault_count = op.u.shadow_control.fault_count;
+ if ( dirty_count )
+ *dirty_count = op.u.shadow_control.dirty_count;
- if ( rc == 0 )
- return op.u.shadow_control.pages;
- else
- return rc;
+ return (rc == 0) ? op.u.shadow_control.pages : rc;
}
int xc_domain_setname(int xc_handle,
- u64 domid,
- char *name)
+ u32 domid,
+ char *name)
{
dom0_op_t op;
op.cmd = DOM0_SETDOMAINNAME;
@@ -147,8 +146,8 @@ int xc_domain_setname(int xc_handle,
}
int xc_domain_setinitialmem(int xc_handle,
- u64 domid,
- unsigned int initial_memkb)
+ u32 domid,
+ unsigned int initial_memkb)
{
dom0_op_t op;
op.cmd = DOM0_SETDOMAININITIALMEM;
@@ -158,8 +157,8 @@ int xc_domain_setinitialmem(int xc_handle,
}
int xc_domain_setmaxmem(int xc_handle,
- u64 domid,
- unsigned int max_memkb)
+ u32 domid,
+ unsigned int max_memkb)
{
dom0_op_t op;
op.cmd = DOM0_SETDOMAINMAXMEM;
diff --git a/tools/xc/lib/xc_evtchn.c b/tools/xc/lib/xc_evtchn.c
index a92cc5b903..22654be515 100644
--- a/tools/xc/lib/xc_evtchn.c
+++ b/tools/xc/lib/xc_evtchn.c
@@ -30,8 +30,8 @@ static int do_evtchn_op(int xc_handle, evtchn_op_t *op)
}
int xc_evtchn_bind_interdomain(int xc_handle,
- u64 dom1,
- u64 dom2,
+ u32 dom1,
+ u32 dom2,
int *port1,
int *port2)
{
@@ -55,7 +55,7 @@ int xc_evtchn_bind_interdomain(int xc_handle,
int xc_evtchn_close(int xc_handle,
- u64 dom,
+ u32 dom,
int port)
{
evtchn_op_t op;
@@ -77,7 +77,7 @@ int xc_evtchn_send(int xc_handle,
int xc_evtchn_status(int xc_handle,
- u64 dom,
+ u32 dom,
int port,
xc_evtchn_status_t *status)
{
@@ -93,7 +93,7 @@ int xc_evtchn_status(int xc_handle,
switch ( status->status = op.u.status.status )
{
case EVTCHNSTAT_interdomain:
- status->u.interdomain.dom = (u64)op.u.status.u.interdomain.dom;
+ status->u.interdomain.dom = (u32)op.u.status.u.interdomain.dom;
status->u.interdomain.port = op.u.status.u.interdomain.port;
break;
case EVTCHNSTAT_pirq:
diff --git a/tools/xc/lib/xc_linux_build.c b/tools/xc/lib/xc_linux_build.c
index 98a3fb6a60..e5b1c01bbc 100644
--- a/tools/xc/lib/xc_linux_build.c
+++ b/tools/xc/lib/xc_linux_build.c
@@ -21,7 +21,7 @@ static int readelfimage_base_and_size(char *elfbase,
static int loadelfimage(char *elfbase, int pmh, unsigned long *parray,
unsigned long vstart);
-static long get_tot_pages(int xc_handle, u64 domid)
+static long get_tot_pages(int xc_handle, u32 domid)
{
dom0_op_t op;
op.cmd = DOM0_GETDOMAININFO;
@@ -32,7 +32,7 @@ static long get_tot_pages(int xc_handle, u64 domid)
}
static int get_pfn_list(int xc_handle,
- u64 domid,
+ u32 domid,
unsigned long *pfn_buf,
unsigned long max_pfns)
{
@@ -66,12 +66,12 @@ static int copy_to_domain_page(int pm_handle,
}
static int setup_guestos(int xc_handle,
- u64 dom,
+ u32 dom,
char *image, unsigned long image_size,
gzFile initrd_gfd, unsigned long initrd_len,
unsigned long nr_pages,
unsigned long *pvsi, unsigned long *pvke,
- full_execution_context_t *ctxt,
+ full_execution_context_t *ctxt,
const char *cmdline,
unsigned long shared_info_frame,
unsigned int control_evtchn)
@@ -377,7 +377,7 @@ static char *read_kernel_image(const char *filename, unsigned long *size)
}
int xc_linux_build(int xc_handle,
- u64 domid,
+ u32 domid,
const char *image_name,
const char *ramdisk_name,
const char *cmdline,
@@ -429,7 +429,7 @@ int xc_linux_build(int xc_handle,
op.u.getdomaininfo.domain = (domid_t)domid;
op.u.getdomaininfo.ctxt = ctxt;
if ( (do_dom0_op(xc_handle, &op) < 0) ||
- ((u64)op.u.getdomaininfo.domain != domid) )
+ ((u32)op.u.getdomaininfo.domain != domid) )
{
PERROR("Could not get info on domain");
goto error_out;
diff --git a/tools/xc/lib/xc_linux_restore.c b/tools/xc/lib/xc_linux_restore.c
index e756ad6ffd..42a158e127 100644
--- a/tools/xc/lib/xc_linux_restore.c
+++ b/tools/xc/lib/xc_linux_restore.c
@@ -30,7 +30,7 @@
} while ( 0 )
static int get_pfn_list(int xc_handle,
- u64 domain_id,
+ u32 domain_id,
unsigned long *pfn_buf,
unsigned long max_pfns)
{
@@ -56,11 +56,11 @@ static int get_pfn_list(int xc_handle,
int xc_linux_restore(int xc_handle,
- u64 dom,
+ u32 dom,
unsigned int flags,
- int (*readerfn)(void *, void *, size_t),
- void *readerst,
- u64 *pdomid)
+ int (*readerfn)(void *, void *, size_t),
+ void *readerst,
+ u32 *pdomid)
{
dom0_op_t op;
int rc = 1, i, j, n, k;
@@ -118,7 +118,7 @@ int xc_linux_restore(int xc_handle,
if ( mlock(&ctxt, sizeof(ctxt) ) )
{
/* needed for when we do the build dom0 op,
- but might as well do early */
+ but might as well do early */
PERROR("Unable to mlock ctxt");
return 1;
}
@@ -162,7 +162,7 @@ int xc_linux_restore(int xc_handle,
region_mfn = calloc(1, 4 * MAX_BATCH_SIZE);
if ( (pfn_to_mfn_table == NULL) || (pfn_type == NULL) ||
- (region_mfn == NULL) )
+ (region_mfn == NULL) )
{
errno = ENOMEM;
goto out;
@@ -184,7 +184,8 @@ int xc_linux_restore(int xc_handle,
/* Set the domain's initial memory allocation
to that from the restore file */
- if ( xc_domain_setinitialmem( xc_handle, dom, nr_pfns * (PAGE_SIZE / 1024)) )
+ if ( xc_domain_setinitialmem(xc_handle, dom,
+ nr_pfns * (PAGE_SIZE / 1024)) )
{
ERROR("Could not set domain initial memory");
goto out;
@@ -230,8 +231,8 @@ int xc_linux_restore(int xc_handle,
n=0;
while(1)
{
- int j;
- unsigned long region_pfn_type[MAX_BATCH_SIZE];
+ int j;
+ unsigned long region_pfn_type[MAX_BATCH_SIZE];
this_pc = (n * 100) / nr_pfns;
if ( (this_pc - prev_pc) >= 5 )
@@ -246,168 +247,180 @@ int xc_linux_restore(int xc_handle,
goto out;
}
- DPRINTF("batch %d\n",j);
-
- if (j == -1)
- {
- verify = 1;
- printf("Entering page verify mode\n");
- continue;
- }
-
- if (j == 0)
- {
- break; // our work here is done
- }
-
- if( j > MAX_BATCH_SIZE )
- {
- ERROR("Max batch size exceeded. Giving up.");
- goto out;
- }
-
+ DPRINTF("batch %d\n",j);
+
+ if ( j == -1 )
+ {
+ verify = 1;
+ printf("Entering page verify mode\n");
+ continue;
+ }
+
+ if ( j == 0 )
+ break; /* our work here is done */
+
+ if( j > MAX_BATCH_SIZE )
+ {
+ ERROR("Max batch size exceeded. Giving up.");
+ goto out;
+ }
+
if ( (*readerfn)(readerst, region_pfn_type, j*sizeof(unsigned long)) )
{
ERROR("Error when reading from state file");
goto out;
}
- for(i=0;i<j;i++)
- {
+ for(i=0;i<j;i++)
+ {
if ( (region_pfn_type[i] & LTAB_MASK) == XTAB)
- region_mfn[i] = 0; // we know map will fail, but don't care
- else
- {
- pfn = region_pfn_type[i] & ~LTAB_MASK;
- region_mfn[i] = pfn_to_mfn_table[pfn];
- }
- }
-
- if ( (region_base = mfn_mapper_map_batch( xc_handle, dom,
- PROT_WRITE,
- region_mfn,
- j )) == 0)
- {
- PERROR("map batch failed");
- goto out;
- }
-
- for(i=0;i<j;i++)
- {
- unsigned long *ppage;
-
- pfn = region_pfn_type[i] & ~LTAB_MASK;
+ {
+ region_mfn[i] = 0; /* we know map will fail, but don't care */
+ }
+ else
+ {
+ pfn = region_pfn_type[i] & ~LTAB_MASK;
+ region_mfn[i] = pfn_to_mfn_table[pfn];
+ }
+ }
+
+ if ( (region_base = mfn_mapper_map_batch( xc_handle, dom,
+ PROT_WRITE,
+ region_mfn,
+ j )) == 0)
+ {
+ PERROR("map batch failed");
+ goto out;
+ }
+
+ for(i=0;i<j;i++)
+ {
+ unsigned long *ppage;
+
+ pfn = region_pfn_type[i] & ~LTAB_MASK;
if ( (region_pfn_type[i] & LTAB_MASK) == XTAB)
- continue;
+ continue;
if (pfn>nr_pfns)
- {
- ERROR("pfn out of range");
- goto out;
- }
-
- region_pfn_type[i] &= LTAB_MASK;
-
- pfn_type[pfn] = region_pfn_type[i];
-
- mfn = pfn_to_mfn_table[pfn];
-
- if ( verify )
- ppage = (unsigned long*) buf; // debug case
- else
- ppage = (unsigned long*) (region_base + i*PAGE_SIZE);
-
- if ( (*readerfn)(readerst, ppage, PAGE_SIZE) )
- {
- ERROR("Error when reading from state file");
- goto out;
- }
-
- switch( region_pfn_type[i] )
- {
- case 0:
- break;
-
- case L1TAB:
- {
- for ( k = 0; k < 1024; k++ )
- {
- if ( ppage[k] & _PAGE_PRESENT )
- {
- xpfn = ppage[k] >> PAGE_SHIFT;
-
- if ( xpfn >= nr_pfns )
- {
- ERROR("Frame number in type %d page table is out of range. i=%d k=%d pfn=0x%x nr_pfns=%d",region_pfn_type[i]>>28,i,k,xpfn,nr_pfns);
- goto out;
- }
-
- ppage[k] &= (PAGE_SIZE - 1) & ~(_PAGE_GLOBAL | _PAGE_PAT);
- ppage[k] |= pfn_to_mfn_table[xpfn] << PAGE_SHIFT;
- }
- }
- }
- break;
-
- case L2TAB:
- {
- for ( k = 0; k < (HYPERVISOR_VIRT_START>>L2_PAGETABLE_SHIFT); k++ )
- {
- if ( ppage[k] & _PAGE_PRESENT )
- {
- xpfn = ppage[k] >> PAGE_SHIFT;
-
- if ( xpfn >= nr_pfns )
- {
- ERROR("Frame number in type %d page table is out of range. i=%d k=%d pfn=%d nr_pfns=%d",region_pfn_type[i]>>28,i,k,xpfn,nr_pfns);
-
- goto out;
- }
-
- ppage[k] &= (PAGE_SIZE - 1) & ~(_PAGE_GLOBAL | _PAGE_PSE);
- ppage[k] |= pfn_to_mfn_table[xpfn] << PAGE_SHIFT;
- }
- }
- }
- break;
-
- default:
- ERROR("Bogus page type %x page table is out of range. i=%d nr_pfns=%d",region_pfn_type[i],i,nr_pfns);
- goto out;
-
- } // end of page type switch statement
-
- if ( verify )
- {
- int res = memcmp(buf, (region_base + i*PAGE_SIZE), PAGE_SIZE );
- if (res)
- {
- int v;
- printf("************** pfn=%x type=%x gotcs=%08lx actualcs=%08lx\n",pfn,pfn_type[pfn],csum_page(region_base + i*PAGE_SIZE),csum_page(buf));
- for(v=0;v<4;v++)
- {
- unsigned long * p = (unsigned long *) (region_base + i*PAGE_SIZE);
- if ( buf[v] != p[v] )
- printf(" %d: %08lx %08lx\n",
- v, buf[v], p[v] );
- }
-
- }
- }
-
- if ( add_mmu_update(xc_handle, mmu,
- (mfn<<PAGE_SHIFT) | MMU_MACHPHYS_UPDATE, pfn) )
- {
- printf("machpys mfn=%ld pfn=%ld\n",mfn,pfn);
- goto out;
- }
-
- } // end of 'batch' for loop
-
- munmap( region_base, j*PAGE_SIZE );
- n+=j; // crude stats
+ {
+ ERROR("pfn out of range");
+ goto out;
+ }
+
+ region_pfn_type[i] &= LTAB_MASK;
+
+ pfn_type[pfn] = region_pfn_type[i];
+
+ mfn = pfn_to_mfn_table[pfn];
+
+ if ( verify )
+ ppage = (unsigned long*) buf; /* debug case */
+ else
+ ppage = (unsigned long*) (region_base + i*PAGE_SIZE);
+
+ if ( (*readerfn)(readerst, ppage, PAGE_SIZE) )
+ {
+ ERROR("Error when reading from state file");
+ goto out;
+ }
+
+ switch( region_pfn_type[i] )
+ {
+ case 0:
+ break;
+
+ case L1TAB:
+ {
+ for ( k = 0; k < 1024; k++ )
+ {
+ if ( ppage[k] & _PAGE_PRESENT )
+ {
+ xpfn = ppage[k] >> PAGE_SHIFT;
+
+ if ( xpfn >= nr_pfns )
+ {
+ ERROR("Frame number in type %d page table is "
+ "out of range. i=%d k=%d pfn=0x%x "
+ "nr_pfns=%d", region_pfn_type[i]>>28, i,
+ k, xpfn,nr_pfns);
+ goto out;
+ }
+
+ ppage[k] &= (PAGE_SIZE - 1) &
+ ~(_PAGE_GLOBAL | _PAGE_PAT);
+ ppage[k] |= pfn_to_mfn_table[xpfn] << PAGE_SHIFT;
+ }
+ }
+ }
+ break;
+
+ case L2TAB:
+ {
+ for ( k = 0;
+ k < (HYPERVISOR_VIRT_START>>L2_PAGETABLE_SHIFT);
+ k++ )
+ {
+ if ( ppage[k] & _PAGE_PRESENT )
+ {
+ xpfn = ppage[k] >> PAGE_SHIFT;
+
+ if ( xpfn >= nr_pfns )
+ {
+ ERROR("Frame number in type %d page table is "
+ "out of range. i=%d k=%d pfn=%d nr_pfns=%d",
+ region_pfn_type[i]>>28, i, k, xpfn, nr_pfns);
+
+ goto out;
+ }
+
+ ppage[k] &= (PAGE_SIZE - 1) &
+ ~(_PAGE_GLOBAL | _PAGE_PSE);
+ ppage[k] |= pfn_to_mfn_table[xpfn] << PAGE_SHIFT;
+ }
+ }
+ }
+ break;
+
+ default:
+ ERROR("Bogus page type %x page table is out of range."
+ " i=%d nr_pfns=%d", region_pfn_type[i], i, nr_pfns);
+ goto out;
+
+ } /* end of page type switch statement */
+
+ if ( verify )
+ {
+ int res = memcmp(buf, (region_base + i*PAGE_SIZE), PAGE_SIZE );
+ if (res)
+ {
+ int v;
+ printf("************** pfn=%x type=%x gotcs=%08lx "
+ "actualcs=%08lx\n", pfn, pfn_type[pfn],
+ csum_page(region_base + i*PAGE_SIZE),
+ csum_page(buf));
+ for ( v = 0; v < 4; v++ )
+ {
+ unsigned long *p = (unsigned long *)
+ (region_base + i*PAGE_SIZE);
+ if ( buf[v] != p[v] )
+ printf(" %d: %08lx %08lx\n",
+ v, buf[v], p[v] );
+ }
+ }
+ }
+
+ if ( add_mmu_update(xc_handle, mmu,
+ (mfn<<PAGE_SHIFT) | MMU_MACHPHYS_UPDATE, pfn) )
+ {
+ printf("machpys mfn=%ld pfn=%ld\n",mfn,pfn);
+ goto out;
+ }
+
+ } /* end of 'batch' for loop */
+ munmap( region_base, j*PAGE_SIZE );
+ n+=j; /* crude stats */
}
printf("Received all pages\n");
@@ -426,11 +439,11 @@ int xc_linux_restore(int xc_handle,
(pfn_to_mfn_table[i]<<PAGE_SHIFT) |
MMU_EXTENDED_COMMAND,
MMUEXT_PIN_L1_TABLE) )
- {
- printf("ERR pin L1 pfn=%lx mfn=%lx\n",
- i, pfn_to_mfn_table[i]);
+ {
+ printf("ERR pin L1 pfn=%lx mfn=%lx\n",
+ i, pfn_to_mfn_table[i]);
goto out;
- }
+ }
}
else if ( pfn_type[i] == L2TAB )
{
@@ -438,11 +451,11 @@ int xc_linux_restore(int xc_handle,
(pfn_to_mfn_table[i]<<PAGE_SHIFT) |
MMU_EXTENDED_COMMAND,
MMUEXT_PIN_L2_TABLE) )
- {
- printf("ERR pin L2 pfn=%lx mfn=%lx\n",
- i, pfn_to_mfn_table[i]);
+ {
+ printf("ERR pin L2 pfn=%lx mfn=%lx\n",
+ i, pfn_to_mfn_table[i]);
goto out;
- }
+ }
}
}
@@ -495,7 +508,7 @@ int xc_linux_restore(int xc_handle,
if ( (pfn >= nr_pfns) || (pfn_type[pfn] != L2TAB) )
{
printf("PT base is bad. pfn=%d nr=%d type=%08lx %08lx\n",
- pfn, nr_pfns, pfn_type[pfn], L2TAB);
+ pfn, nr_pfns, pfn_type[pfn], L2TAB);
ERROR("PT base is bad.");
goto out;
}
@@ -504,8 +517,8 @@ int xc_linux_restore(int xc_handle,
/* clear any pending events and the selector */
memset( &(((shared_info_t *)shared_info)->evtchn_pending[0]),
- 0, sizeof (((shared_info_t *)shared_info)->evtchn_pending)+
- sizeof(((shared_info_t *)shared_info)->evtchn_pending_sel) );
+ 0, sizeof (((shared_info_t *)shared_info)->evtchn_pending)+
+ sizeof(((shared_info_t *)shared_info)->evtchn_pending_sel) );
/* Copy saved contents of shared-info page. No checking needed. */
ppage = map_pfn_writeable(pm_handle, shared_info_frame);
@@ -516,7 +529,7 @@ int xc_linux_restore(int xc_handle,
/* Uncanonicalise the pfn-to-mfn table frame-number list. */
for ( i = 0; i < (nr_pfns+1023)/1024; i++ )
{
- unsigned long pfn, mfn;
+ unsigned long pfn, mfn;
pfn = pfn_to_mfn_frame_list[i];
if ( (pfn >= nr_pfns) || (pfn_type[pfn] != NOTAB) )
@@ -524,21 +537,22 @@ int xc_linux_restore(int xc_handle,
ERROR("PFN-to-MFN frame number is bad");
goto out;
}
- mfn = pfn_to_mfn_table[pfn];
- pfn_to_mfn_frame_list[i] = mfn;
+ mfn = pfn_to_mfn_table[pfn];
+ pfn_to_mfn_frame_list[i] = mfn;
}
- if ( (live_pfn_to_mfn_table = mfn_mapper_map_batch( xc_handle, dom,
- PROT_WRITE,
- pfn_to_mfn_frame_list,
- (nr_pfns+1023)/1024 )) == 0 )
+ if ( (live_pfn_to_mfn_table =
+ mfn_mapper_map_batch(xc_handle, dom,
+ PROT_WRITE,
+ pfn_to_mfn_frame_list,
+ (nr_pfns+1023)/1024 )) == 0 )
{
ERROR("Couldn't map pfn_to_mfn table");
goto out;
}
memcpy( live_pfn_to_mfn_table, pfn_to_mfn_table,
- nr_pfns*sizeof(unsigned long) );
+ nr_pfns*sizeof(unsigned long) );
munmap( live_pfn_to_mfn_table, ((nr_pfns+1023)/1024)*PAGE_SIZE );
@@ -586,18 +600,18 @@ int xc_linux_restore(int xc_handle,
if( rc == 0 )
{
- /* Success: print the domain id. */
- verbose_printf("DOM=%llu\n", dom);
- return 0;
+ /* Success: print the domain id. */
+ verbose_printf("DOM=%u\n", dom);
+ return 0;
}
out:
- if ( rc != 0 ) // destroy if something went wrong
+ if ( rc != 0 )
{
if ( dom != 0 )
{
- xc_domain_destroy( xc_handle, dom, 1 );
+ xc_domain_destroy( xc_handle, dom, 1 );
}
}
diff --git a/tools/xc/lib/xc_linux_save.c b/tools/xc/lib/xc_linux_save.c
index 4913a8527f..35fe92f32d 100644
--- a/tools/xc/lib/xc_linux_save.c
+++ b/tools/xc/lib/xc_linux_save.c
@@ -47,8 +47,8 @@
(live_pfn_to_mfn_table[live_mfn_to_pfn_table[_mfn]] == (_mfn)) ) || \
\
(live_mfn_to_pfn_table[_mfn] >= 0x80000000 && \
- live_mfn_to_pfn_table[_mfn] <= 0x80000003 ) || \
- live_pfn_to_mfn_table[live_mfn_to_pfn_table[_mfn]] == 0x80000004 ) )
+ live_mfn_to_pfn_table[_mfn] <= 0x80000003 ) || \
+ live_pfn_to_mfn_table[live_mfn_to_pfn_table[_mfn]] == 0x80000004 ) )
/* Returns TRUE if MFN is successfully converted to a PFN. */
#define translate_mfn_to_pfn(_pmfn) \
@@ -67,19 +67,19 @@
static inline int test_bit ( int nr, volatile void * addr)
{
return ( ((unsigned long*)addr)[nr/(sizeof(unsigned long)*8)] >>
- (nr % (sizeof(unsigned long)*8) ) ) & 1;
+ (nr % (sizeof(unsigned long)*8) ) ) & 1;
}
static inline void clear_bit ( int nr, volatile void * addr)
{
((unsigned long*)addr)[nr/(sizeof(unsigned long)*8)] &=
- ~(1 << (nr % (sizeof(unsigned long)*8) ) );
+ ~(1 << (nr % (sizeof(unsigned long)*8) ) );
}
static inline void set_bit ( int nr, volatile void * addr)
{
((unsigned long*)addr)[nr/(sizeof(unsigned long)*8)] |=
- (1 << (nr % (sizeof(unsigned long)*8) ) );
+ (1 << (nr % (sizeof(unsigned long)*8) ) );
}
/*
* hweightN: returns the hamming weight (i.e. the number
@@ -88,20 +88,20 @@ static inline void set_bit ( int nr, volatile void * addr)
static inline unsigned int hweight32(unsigned int w)
{
- unsigned int res = (w & 0x55555555) + ((w >> 1) & 0x55555555);
- res = (res & 0x33333333) + ((res >> 2) & 0x33333333);
- res = (res & 0x0F0F0F0F) + ((res >> 4) & 0x0F0F0F0F);
- res = (res & 0x00FF00FF) + ((res >> 8) & 0x00FF00FF);
- return (res & 0x0000FFFF) + ((res >> 16) & 0x0000FFFF);
+ unsigned int res = (w & 0x55555555) + ((w >> 1) & 0x55555555);
+ res = (res & 0x33333333) + ((res >> 2) & 0x33333333);
+ res = (res & 0x0F0F0F0F) + ((res >> 4) & 0x0F0F0F0F);
+ res = (res & 0x00FF00FF) + ((res >> 8) & 0x00FF00FF);
+ return (res & 0x0000FFFF) + ((res >> 16) & 0x0000FFFF);
}
static inline int count_bits ( int nr, volatile void *addr)
{
int i, count = 0;
unsigned long *p = (unsigned long *)addr;
- // we know the array is padded to unsigned long
+ /* we know the array is padded to unsigned long */
for(i=0;i<nr/(sizeof(unsigned long)*8);i++,p++)
- count += hweight32( *p );
+ count += hweight32( *p );
return count;
}
@@ -131,10 +131,10 @@ static inline int permute( int i, int nr, int order_nr )
do
{
- i = ( ( i>>(order_nr-10)) | ( i<<10 ) ) &
- ((1<<order_nr)-1);
+ i = ( ( i>>(order_nr-10)) | ( i<<10 ) ) &
+ ((1<<order_nr)-1);
}
- while ( i >= nr ); // this won't ever loop if nr is a power of 2
+ while ( i >= nr ); /* this won't ever loop if nr is a power of 2 */
return i;
}
@@ -147,11 +147,11 @@ static long long tv_to_us( struct timeval *new )
static long long tvdelta( struct timeval *new, struct timeval *old )
{
return ((new->tv_sec - old->tv_sec)*1000000 ) +
- (new->tv_usec - old->tv_usec);
+ (new->tv_usec - old->tv_usec);
}
-static int track_cpu_usage( int xc_handle, u64 domid, int faults,
- int pages_sent, int pages_dirtied, int print )
+static int track_cpu_usage( int xc_handle, u32 domid, int faults,
+ int pages_sent, int pages_dirtied, int print )
{
static struct timeval wall_last;
static long long d0_cpu_last;
@@ -168,9 +168,9 @@ static int track_cpu_usage( int xc_handle, u64 domid, int faults,
d0_cpu_now = xc_domain_get_cpu_usage( xc_handle, 0 )/1000;
d1_cpu_now = xc_domain_get_cpu_usage( xc_handle, domid )/1000;
- if ( d0_cpu_now == -1 || d1_cpu_now == -1 )
+ if ( d0_cpu_now == -1 || d1_cpu_now == -1 )
{
- printf("ARRHHH!!\n");
+ printf("ARRHHH!!\n");
}
wall_delta = tvdelta(&wall_now,&wall_last)/1000;
@@ -181,27 +181,28 @@ static int track_cpu_usage( int xc_handle, u64 domid, int faults,
d1_cpu_delta = (d1_cpu_now - d1_cpu_last)/1000;
if(print)
- printf("delta %lldms, dom0 %d%%, target %d%%, sent %dMb/s, dirtied %dMb/s\n",
- wall_delta,
- (int)((d0_cpu_delta*100)/wall_delta),
- (int)((d1_cpu_delta*100)/wall_delta),
- (int)((pages_sent*PAGE_SIZE*8)/(wall_delta*1000)),
- (int)((pages_dirtied*PAGE_SIZE*8)/(wall_delta*1000))
- );
+ printf("delta %lldms, dom0 %d%%, target %d%%, "
+ "sent %dMb/s, dirtied %dMb/s\n",
+ wall_delta,
+ (int)((d0_cpu_delta*100)/wall_delta),
+ (int)((d1_cpu_delta*100)/wall_delta),
+ (int)((pages_sent*PAGE_SIZE*8)/(wall_delta*1000)),
+ (int)((pages_dirtied*PAGE_SIZE*8)/(wall_delta*1000))
+ );
d0_cpu_last = d0_cpu_now;
d1_cpu_last = d1_cpu_now;
- wall_last = wall_now;
+ wall_last = wall_now;
return 0;
}
int xc_linux_save(int xc_handle,
- u64 domid,
- unsigned int flags,
- int (*writerfn)(void *, const void *, size_t),
- void *writerst )
+ u32 domid,
+ unsigned int flags,
+ int (*writerfn)(void *, const void *, size_t),
+ void *writerst )
{
dom0_op_t op;
int rc = 1, i, j, k, last_iter, iter = 0;
@@ -213,8 +214,8 @@ int xc_linux_save(int xc_handle,
unsigned long dirtied_this_iter, faults_this_iter;
/* Important tuning parameters */
- int max_iters = 29; // limit us to 30 times round loop
- int max_factor = 3; // never send more than 3x nr_pfns
+ int max_iters = 29; /* limit us to 30 times round loop */
+ int max_factor = 3; /* never send more than 3x nr_pfns */
/* The new domain's shared-info frame number. */
unsigned long shared_info_frame;
@@ -275,8 +276,8 @@ int xc_linux_save(int xc_handle,
if ( xc_domain_stop_sync( xc_handle, domid, &op, &ctxt ) )
{
- PERROR("Could not sync stop domain");
- goto out;
+ PERROR("Could not sync stop domain");
+ goto out;
}
memcpy(name, op.u.getdomaininfo.name, sizeof(name));
@@ -292,8 +293,8 @@ int xc_linux_save(int xc_handle,
/* Map the suspend-record MFN to pin it. The page must be owned by
domid for this to succeed. */
p_srec = mfn_mapper_map_single(xc_handle, domid,
- sizeof(*p_srec), PROT_READ,
- ctxt.cpu_ctxt.esi );
+ sizeof(*p_srec), PROT_READ,
+ ctxt.cpu_ctxt.esi );
if (!p_srec)
{
@@ -312,9 +313,9 @@ int xc_linux_save(int xc_handle,
/* the pfn_to_mfn_frame_list fits in a single page */
live_pfn_to_mfn_frame_list =
- mfn_mapper_map_single(xc_handle, domid,
- PAGE_SIZE, PROT_READ,
- p_srec->pfn_to_mfn_frame_list );
+ mfn_mapper_map_single(xc_handle, domid,
+ PAGE_SIZE, PROT_READ,
+ p_srec->pfn_to_mfn_frame_list );
if (!live_pfn_to_mfn_frame_list)
{
@@ -324,20 +325,20 @@ int xc_linux_save(int xc_handle,
/* Track the mfn_to_pfn table down from the domains PT */
{
- unsigned long *pgd;
- unsigned long mfn_to_pfn_table_start_mfn;
+ unsigned long *pgd;
+ unsigned long mfn_to_pfn_table_start_mfn;
- pgd = mfn_mapper_map_single(xc_handle, domid,
- PAGE_SIZE, PROT_READ,
- ctxt.pt_base>>PAGE_SHIFT);
+ pgd = mfn_mapper_map_single(xc_handle, domid,
+ PAGE_SIZE, PROT_READ,
+ ctxt.pt_base>>PAGE_SHIFT);
- mfn_to_pfn_table_start_mfn =
- pgd[HYPERVISOR_VIRT_START>>L2_PAGETABLE_SHIFT]>>PAGE_SHIFT;
+ mfn_to_pfn_table_start_mfn =
+ pgd[HYPERVISOR_VIRT_START>>L2_PAGETABLE_SHIFT]>>PAGE_SHIFT;
- live_mfn_to_pfn_table =
- mfn_mapper_map_single(xc_handle, ~0ULL,
- PAGE_SIZE*1024, PROT_READ,
- mfn_to_pfn_table_start_mfn );
+ live_mfn_to_pfn_table =
+ mfn_mapper_map_single(xc_handle, DOMID_SELF,
+ PAGE_SIZE*1024, PROT_READ,
+ mfn_to_pfn_table_start_mfn );
}
/* Map all the frames of the pfn->mfn table. For migrate to succeed,
@@ -346,9 +347,9 @@ int xc_linux_save(int xc_handle,
from a safety POV anyhow. */
live_pfn_to_mfn_table = mfn_mapper_map_batch( xc_handle, domid,
- PROT_READ,
- live_pfn_to_mfn_frame_list,
- (nr_pfns+1023)/1024 );
+ PROT_READ,
+ live_pfn_to_mfn_frame_list,
+ (nr_pfns+1023)/1024 );
if( !live_pfn_to_mfn_table )
{
PERROR("Couldn't map pfn_to_mfn table");
@@ -372,64 +373,64 @@ int xc_linux_save(int xc_handle,
if( live )
{
- if ( xc_shadow_control( xc_handle, domid,
- DOM0_SHADOW_CONTROL_OP_ENABLE_LOGDIRTY,
- NULL, 0, NULL, NULL ) < 0 )
- {
- ERROR("Couldn't enable shadow mode");
- goto out;
- }
-
- if ( xc_domain_start( xc_handle, domid ) < 0 )
- {
- ERROR("Couldn't restart domain");
- goto out;
- }
-
- last_iter = 0;
- sent_last_iter = 1<<20; // 4GB's worth of pages
+ if ( xc_shadow_control( xc_handle, domid,
+ DOM0_SHADOW_CONTROL_OP_ENABLE_LOGDIRTY,
+ NULL, 0, NULL, NULL ) < 0 )
+ {
+ ERROR("Couldn't enable shadow mode");
+ goto out;
+ }
+
+ if ( xc_domain_start( xc_handle, domid ) < 0 )
+ {
+ ERROR("Couldn't restart domain");
+ goto out;
+ }
+
+ last_iter = 0;
+ sent_last_iter = 1<<20; /* 4GB's worth of pages */
}
else
- last_iter = 1;
+ last_iter = 1;
/* Setup to_send bitmap */
{
- int sz = (nr_pfns/8) + 8; // includes slop at end of array
-
- to_send = malloc( sz );
- to_fix = calloc( 1, sz );
- to_skip = malloc( sz );
-
- if (!to_send || !to_fix || !to_skip)
- {
- ERROR("Couldn't allocate to_send array");
- goto out;
- }
-
- memset( to_send, 0xff, sz );
-
- if ( mlock( to_send, sz ) )
- {
- PERROR("Unable to mlock to_send");
- return 1;
- }
-
- /* (to fix is local only) */
-
- if ( mlock( to_skip, sz ) )
- {
- PERROR("Unable to mlock to_skip");
- return 1;
- }
+ int sz = (nr_pfns/8) + 8; /* includes slop at end of array */
+
+ to_send = malloc( sz );
+ to_fix = calloc( 1, sz );
+ to_skip = malloc( sz );
+
+ if (!to_send || !to_fix || !to_skip)
+ {
+ ERROR("Couldn't allocate to_send array");
+ goto out;
+ }
+
+ memset( to_send, 0xff, sz );
+
+ if ( mlock( to_send, sz ) )
+ {
+ PERROR("Unable to mlock to_send");
+ return 1;
+ }
+
+ /* (to fix is local only) */
+
+ if ( mlock( to_skip, sz ) )
+ {
+ PERROR("Unable to mlock to_skip");
+ return 1;
+ }
}
/* calculate the power of 2 order of nr_pfns, e.g.
- 15->4 16->4 17->5 */
+ 15->4 16->4 17->5 */
for( i=nr_pfns-1, order_nr=0; i ; i>>=1, order_nr++ );
-printf("nr_pfns=%d order_nr=%d\n",nr_pfns, order_nr);
+ printf("nr_pfns=%d order_nr=%d\n",nr_pfns, order_nr);
/* We want zeroed memory so use calloc rather than malloc. */
pfn_type = calloc(BATCH_SIZE, sizeof(unsigned long));
@@ -443,8 +444,8 @@ printf("nr_pfns=%d order_nr=%d\n",nr_pfns, order_nr);
if ( mlock( pfn_type, BATCH_SIZE * sizeof(unsigned long) ) )
{
- ERROR("Unable to mlock");
- goto out;
+ ERROR("Unable to mlock");
+ goto out;
}
@@ -456,16 +457,16 @@ printf("nr_pfns=%d order_nr=%d\n",nr_pfns, order_nr);
{
mfn = live_pfn_to_mfn_table[i];
- if( (live_mfn_to_pfn_table[mfn] != i) && (mfn != 0x80000004) )
- printf("i=0x%x mfn=%x live_mfn_to_pfn_table=%x\n",
- i,mfn,live_mfn_to_pfn_table[mfn]);
+ if( (live_mfn_to_pfn_table[mfn] != i) && (mfn != 0x80000004) )
+ printf("i=0x%x mfn=%x live_mfn_to_pfn_table=%x\n",
+ i,mfn,live_mfn_to_pfn_table[mfn]);
}
#endif
/* Map the shared info frame */
live_shinfo = mfn_mapper_map_single(xc_handle, domid,
- PAGE_SIZE, PROT_READ,
- shared_info_frame);
+ PAGE_SIZE, PROT_READ,
+ shared_info_frame);
if (!live_shinfo)
{
@@ -490,297 +491,289 @@ printf("nr_pfns=%d order_nr=%d\n",nr_pfns, order_nr);
while(1)
{
- unsigned int prev_pc, sent_this_iter, N, batch;
-
- iter++;
- sent_this_iter = 0;
- skip_this_iter = 0;
- prev_pc = 0;
- N=0;
-
- verbose_printf("Saving memory pages: iter %d 0%%", iter);
-
- while( N < nr_pfns )
- {
- unsigned int this_pc = (N * 100) / nr_pfns;
-
- if ( (this_pc - prev_pc) >= 5 )
- {
- verbose_printf("\b\b\b\b%3d%%", this_pc);
- prev_pc = this_pc;
- }
-
- /* slightly wasteful to peek the whole array evey time,
- but this is fast enough for the moment. */
-
- if ( !last_iter &&
- xc_shadow_control(xc_handle, domid,
- DOM0_SHADOW_CONTROL_OP_PEEK,
- to_skip, nr_pfns, NULL, NULL) != nr_pfns )
- {
- ERROR("Error peeking shadow bitmap");
- goto out;
- }
-
-
- /* load pfn_type[] with the mfn of all the pages we're doing in
- this batch. */
-
- for( batch = 0; batch < BATCH_SIZE && N < nr_pfns ; N++ )
- {
- int n = permute(N, nr_pfns, order_nr );
-
- if(0 && debug)
- fprintf(stderr,"%d pfn= %08lx mfn= %08lx %d [mfn]= %08lx\n",
- iter, n, live_pfn_to_mfn_table[n],
- test_bit(n,to_send),
- live_mfn_to_pfn_table[live_pfn_to_mfn_table[n]&0xFFFFF]);
-
- if (!last_iter && test_bit(n, to_send) && test_bit(n, to_skip))
- skip_this_iter++; // stats keeping
-
- if (! ( (test_bit(n, to_send) && !test_bit(n, to_skip)) ||
- (test_bit(n, to_send) && last_iter) ||
- (test_bit(n, to_fix) && last_iter) ) )
- continue;
-
- /* we get here if:
- 1. page is marked to_send & hasn't already been re-dirtied
- 2. (ignore to_skip in last iteration)
- 3. add in pages that still need fixup (net bufs)
- */
-
- pfn_batch[batch] = n;
- pfn_type[batch] = live_pfn_to_mfn_table[n];
-
- if( pfn_type[batch] == 0x80000004 )
- {
- /* not currently in pusedo-physical map -- set bit
- in to_fix that we must send this page in last_iter
- unless its sent sooner anyhow */
-
- set_bit( n, to_fix );
- if( iter>1 )
- DDPRINTF("Urk! netbuf race: iter %d, pfn %lx. mfn %lx\n",
- iter,n,pfn_type[batch]);
- continue;
- }
-
- if ( last_iter && test_bit(n, to_fix ) && !test_bit(n, to_send ))
- {
- needed_to_fix++;
- DPRINTF("Fix! iter %d, pfn %lx. mfn %lx\n",
- iter,n,pfn_type[batch]);
- }
-
- clear_bit( n, to_fix );
-
- batch++;
- }
-
- DDPRINTF("batch %d:%d (n=%d)\n",iter,batch,n);
-
- if(batch == 0) goto skip; // vanishingly unlikely...
-
- if ( (region_base = mfn_mapper_map_batch( xc_handle, domid,
- PROT_READ,
- pfn_type,
- batch )) == 0)
- {
- PERROR("map batch failed");
- goto out;
- }
-
- if ( get_pfn_type_batch(xc_handle, domid, batch, pfn_type) )
- {
- ERROR("get_pfn_type_batch failed");
- goto out;
- }
-
- for( j = 0; j < batch; j++ )
- {
- if( (pfn_type[j] & LTAB_MASK) == XTAB)
- {
- DDPRINTF("type fail: page %i mfn %08lx\n",j,pfn_type[j]);
- continue;
- }
-
- if(0 && debug)
- fprintf(stderr,"%d pfn= %08lx mfn= %08lx [mfn]= %08lx sum= %08lx\n",
- iter,
- (pfn_type[j] & LTAB_MASK) | pfn_batch[j],
- pfn_type[j],
- live_mfn_to_pfn_table[pfn_type[j]&(~LTAB_MASK)],
- csum_page(region_base + (PAGE_SIZE*j))
- );
-
- /* canonicalise mfn->pfn */
- pfn_type[j] = (pfn_type[j] & LTAB_MASK) |
- pfn_batch[j];
- //live_mfn_to_pfn_table[pfn_type[j]&~LTAB_MASK];
-
- }
-
-
- if ( (*writerfn)(writerst, &batch, sizeof(int) ) )
- {
- ERROR("Error when writing to state file (2)");
- goto out;
- }
-
- if ( (*writerfn)(writerst, pfn_type, sizeof(unsigned long)*j ) )
- {
- ERROR("Error when writing to state file (3)");
- goto out;
- }
-
- /* entering this loop, pfn_type is now in pfns (Not mfns) */
- for( j = 0; j < batch; j++ )
- {
- /* write out pages in batch */
-
- if( (pfn_type[j] & LTAB_MASK) == XTAB)
- {
- DDPRINTF("SKIP BOGUS page %i mfn %08lx\n",j,pfn_type[j]);
- continue;
- }
-
- if ( ((pfn_type[j] & LTAB_MASK) == L1TAB) ||
- ((pfn_type[j] & LTAB_MASK) == L2TAB) )
- {
-
- memcpy(page, region_base + (PAGE_SIZE*j), PAGE_SIZE);
-
- for ( k = 0;
- k < (((pfn_type[j] & LTAB_MASK) == L2TAB) ?
- (HYPERVISOR_VIRT_START >> L2_PAGETABLE_SHIFT) : 1024);
- k++ )
- {
- unsigned long pfn;
-
- if ( !(page[k] & _PAGE_PRESENT) ) continue;
- mfn = page[k] >> PAGE_SHIFT;
- pfn = live_mfn_to_pfn_table[mfn];
-
- if ( !MFN_IS_IN_PSEUDOPHYS_MAP(mfn) )
- {
- // I don't think this should ever happen
-
- printf("FNI %d : [%08lx,%d] pte=%08lx, mfn=%08lx, pfn=%08lx [mfn]=%08lx\n",
- j, pfn_type[j], k,
- page[k], mfn, live_mfn_to_pfn_table[mfn],
- (live_mfn_to_pfn_table[mfn]<nr_pfns)?
- live_pfn_to_mfn_table[live_mfn_to_pfn_table[mfn]]: 0xdeadbeef);
-
- pfn = 0; // be suspicious, very suspicious
-
- //goto out; // let's try our luck
-
-
- }
- page[k] &= PAGE_SIZE - 1;
- page[k] |= pfn << PAGE_SHIFT;
-
-#if 0
- printf("L%d i=%d pfn=%d mfn=%d k=%d pte=%08lx xpfn=%d\n",
- pfn_type[j]>>28,
- j,i,mfn,k,page[k],page[k]>>PAGE_SHIFT);
-#endif
-
- } /* end of page table rewrite for loop */
-
- if ( (*writerfn)(writerst, page, PAGE_SIZE) )
- {
- ERROR("Error when writing to state file (4)");
- goto out;
- }
-
- } /* end of it's a PT page */
- else
- { /* normal page */
-
- if ( (*writerfn)(writerst, region_base + (PAGE_SIZE*j), PAGE_SIZE) )
- {
- ERROR("Error when writing to state file (5)");
- goto out;
- }
- }
- } /* end of the write out for this batch */
-
- sent_this_iter += batch;
-
- } /* end of this while loop for this iteration */
-
- munmap(region_base, batch*PAGE_SIZE);
+ unsigned int prev_pc, sent_this_iter, N, batch;
+
+ iter++;
+ sent_this_iter = 0;
+ skip_this_iter = 0;
+ prev_pc = 0;
+ N=0;
+
+ verbose_printf("Saving memory pages: iter %d 0%%", iter);
+
+ while( N < nr_pfns )
+ {
+ unsigned int this_pc = (N * 100) / nr_pfns;
+
+ if ( (this_pc - prev_pc) >= 5 )
+ {
+ verbose_printf("\b\b\b\b%3d%%", this_pc);
+ prev_pc = this_pc;
+ }
+
+ /* slightly wasteful to peek the whole array evey time,
+ but this is fast enough for the moment. */
+
+ if ( !last_iter &&
+ xc_shadow_control(xc_handle, domid,
+ DOM0_SHADOW_CONTROL_OP_PEEK,
+ to_skip, nr_pfns, NULL, NULL) != nr_pfns )
+ {
+ ERROR("Error peeking shadow bitmap");
+ goto out;
+ }
+
+
+ /* load pfn_type[] with the mfn of all the pages we're doing in
+ this batch. */
+
+ for( batch = 0; batch < BATCH_SIZE && N < nr_pfns ; N++ )
+ {
+ int n = permute(N, nr_pfns, order_nr );
+
+ if(0 && debug)
+ fprintf(stderr,"%d pfn= %08lx mfn= %08lx %d "
+ "[mfn]= %08lx\n",
+ iter, n, live_pfn_to_mfn_table[n],
+ test_bit(n,to_send),
+ live_mfn_to_pfn_table[
+ live_pfn_to_mfn_table[n]&0xFFFFF]);
+
+ if (!last_iter && test_bit(n, to_send) && test_bit(n, to_skip))
+ skip_this_iter++; /* stats keeping */
+
+ if (! ( (test_bit(n, to_send) && !test_bit(n, to_skip)) ||
+ (test_bit(n, to_send) && last_iter) ||
+ (test_bit(n, to_fix) && last_iter) ) )
+ continue;
+
+ /* we get here if:
+ 1. page is marked to_send & hasn't already been re-dirtied
+ 2. (ignore to_skip in last iteration)
+ 3. add in pages that still need fixup (net bufs)
+ */
+
+ pfn_batch[batch] = n;
+ pfn_type[batch] = live_pfn_to_mfn_table[n];
+
+ if( pfn_type[batch] == 0x80000004 )
+ {
+ /* not currently in pusedo-physical map -- set bit
+ in to_fix that we must send this page in last_iter
+ unless its sent sooner anyhow */
+
+ set_bit( n, to_fix );
+ if( iter>1 )
+ DDPRINTF("Urk! netbuf race: iter %d, pfn %lx."
+ " mfn %lx\n",
+ iter,n,pfn_type[batch]);
+ continue;
+ }
+
+ if ( last_iter && test_bit(n, to_fix) &&
+ !test_bit(n, to_send) )
+ {
+ needed_to_fix++;
+ DPRINTF("Fix! iter %d, pfn %lx. mfn %lx\n",
+ iter,n,pfn_type[batch]);
+ }
+
+ clear_bit( n, to_fix );
+
+ batch++;
+ }
+
+ DDPRINTF("batch %d:%d (n=%d)\n",iter,batch,n);
+
+ if ( batch == 0 )
+ goto skip; /* very unlikely */
+
+ if ( (region_base = mfn_mapper_map_batch(xc_handle, domid,
+ PROT_READ,
+ pfn_type,
+ batch)) == 0 )
+ {
+ PERROR("map batch failed");
+ goto out;
+ }
+
+ if ( get_pfn_type_batch(xc_handle, domid, batch, pfn_type) )
+ {
+ ERROR("get_pfn_type_batch failed");
+ goto out;
+ }
+
+ for ( j = 0; j < batch; j++ )
+ {
+ if ( (pfn_type[j] & LTAB_MASK) == XTAB )
+ {
+ DDPRINTF("type fail: page %i mfn %08lx\n",j,pfn_type[j]);
+ continue;
+ }
+
+ if ( 0 && debug )
+ fprintf(stderr,"%d pfn= %08lx mfn= %08lx "
+ "[mfn]= %08lx sum= %08lx\n",
+ iter,
+ (pfn_type[j] & LTAB_MASK) | pfn_batch[j],
+ pfn_type[j],
+ live_mfn_to_pfn_table[pfn_type[j]&(~LTAB_MASK)],
+ csum_page(region_base + (PAGE_SIZE*j))
+ );
+
+ /* canonicalise mfn->pfn */
+ pfn_type[j] = (pfn_type[j] & LTAB_MASK) |
+ pfn_batch[j];
+ }
+
+
+ if ( (*writerfn)(writerst, &batch, sizeof(int) ) )
+ {
+ ERROR("Error when writing to state file (2)");
+ goto out;
+ }
+
+ if ( (*writerfn)(writerst, pfn_type, sizeof(unsigned long)*j ) )
+ {
+ ERROR("Error when writing to state file (3)");
+ goto out;
+ }
+
+ /* entering this loop, pfn_type is now in pfns (Not mfns) */
+ for( j = 0; j < batch; j++ )
+ {
+ /* write out pages in batch */
+
+ if( (pfn_type[j] & LTAB_MASK) == XTAB)
+ {
+ DDPRINTF("SKIP BOGUS page %i mfn %08lx\n",j,pfn_type[j]);
+ continue;
+ }
+
+ if ( ((pfn_type[j] & LTAB_MASK) == L1TAB) ||
+ ((pfn_type[j] & LTAB_MASK) == L2TAB) )
+ {
+
+ memcpy(page, region_base + (PAGE_SIZE*j), PAGE_SIZE);
+
+ for ( k = 0;
+ k < (((pfn_type[j] & LTAB_MASK) == L2TAB) ?
+ (HYPERVISOR_VIRT_START >> L2_PAGETABLE_SHIFT) :
+ 1024);
+ k++ )
+ {
+ unsigned long pfn;
+
+ if ( !(page[k] & _PAGE_PRESENT) ) continue;
+ mfn = page[k] >> PAGE_SHIFT;
+ pfn = live_mfn_to_pfn_table[mfn];
+
+ if ( !MFN_IS_IN_PSEUDOPHYS_MAP(mfn) )
+ {
+ /* I don't think this should ever happen */
+ printf("FNI %d : [%08lx,%d] pte=%08lx, "
+ "mfn=%08lx, pfn=%08lx [mfn]=%08lx\n",
+ j, pfn_type[j], k,
+ page[k], mfn, live_mfn_to_pfn_table[mfn],
+ (live_mfn_to_pfn_table[mfn]<nr_pfns)?
+ live_pfn_to_mfn_table[
+ live_mfn_to_pfn_table[mfn]]:0xdeadbeef);
+ pfn = 0; /* be suspicious, very suspicious */
+ }
+ page[k] &= PAGE_SIZE - 1;
+ page[k] |= pfn << PAGE_SHIFT;
+ } /* end of page table rewrite for loop */
+
+ if ( (*writerfn)(writerst, page, PAGE_SIZE) )
+ {
+ ERROR("Error when writing to state file (4)");
+ goto out;
+ }
+
+ } /* end of it's a PT page */
+ else
+ { /* normal page */
+
+ if ( (*writerfn)(writerst, region_base + (PAGE_SIZE*j),
+ PAGE_SIZE) )
+ {
+ ERROR("Error when writing to state file (5)");
+ goto out;
+ }
+ }
+ } /* end of the write out for this batch */
+
+ sent_this_iter += batch;
+
+ } /* end of this while loop for this iteration */
+
+ munmap(region_base, batch*PAGE_SIZE);
skip:
- total_sent += sent_this_iter;
+ total_sent += sent_this_iter;
- verbose_printf("\r %d: sent %d, skipped %d, ",
- iter, sent_this_iter, skip_this_iter );
+ verbose_printf("\r %d: sent %d, skipped %d, ",
+ iter, sent_this_iter, skip_this_iter );
- if ( last_iter )
- {
- track_cpu_usage( xc_handle, domid, 0, sent_this_iter, 0, 1);
+ if ( last_iter )
+ {
+ track_cpu_usage( xc_handle, domid, 0, sent_this_iter, 0, 1);
- verbose_printf("Total pages sent= %d (%.2fx)\n",
- total_sent, ((float)total_sent)/nr_pfns );
- verbose_printf("(of which %d were fixups)\n", needed_to_fix );
- }
+ verbose_printf("Total pages sent= %d (%.2fx)\n",
+ total_sent, ((float)total_sent)/nr_pfns );
+ verbose_printf("(of which %d were fixups)\n", needed_to_fix );
+ }
- if ( debug && last_iter )
- {
- int minusone = -1;
- memset( to_send, 0xff, nr_pfns/8 );
- debug = 0;
- printf("Entering debug resend-all mode\n");
+ if ( debug && last_iter )
+ {
+ int minusone = -1;
+ memset( to_send, 0xff, nr_pfns/8 );
+ debug = 0;
+ printf("Entering debug resend-all mode\n");
- /* send "-1" to put receiver into debug mode */
- if ( (*writerfn)(writerst, &minusone, sizeof(int)) )
- {
- ERROR("Error when writing to state file (6)");
- goto out;
- }
-
- continue;
- }
-
- if ( last_iter )
- break;
-
- if ( live )
- {
- if (
- // ( sent_this_iter > (sent_last_iter * 0.95) ) ||
- (iter >= max_iters) ||
- (sent_this_iter+skip_this_iter < 50) ||
- (total_sent > nr_pfns*max_factor) )
- {
- DPRINTF("Start last iteration\n");
- last_iter = 1;
-
- xc_domain_stop_sync( xc_handle, domid, &op, NULL );
-
- }
-
- if ( xc_shadow_control( xc_handle, domid,
- DOM0_SHADOW_CONTROL_OP_CLEAN2,
- to_send, nr_pfns, &faults_this_iter,
- &dirtied_this_iter) != nr_pfns )
- {
- ERROR("Error flushing shadow PT");
- goto out;
- }
-
- sent_last_iter = sent_this_iter;
-
- //dirtied_this_iter = count_bits( nr_pfns, to_send );
- track_cpu_usage( xc_handle, domid, faults_this_iter,
- sent_this_iter, dirtied_this_iter, 1);
-
- }
+ /* send "-1" to put receiver into debug mode */
+ if ( (*writerfn)(writerst, &minusone, sizeof(int)) )
+ {
+ ERROR("Error when writing to state file (6)");
+ goto out;
+ }
+
+ continue;
+ }
+ if ( last_iter )
+ break;
+
+ if ( live )
+ {
+ if ( (iter >= max_iters) ||
+ (sent_this_iter+skip_this_iter < 50) ||
+ (total_sent > nr_pfns*max_factor) )
+ {
+ DPRINTF("Start last iteration\n");
+ last_iter = 1;
+
+ xc_domain_stop_sync( xc_handle, domid, &op, NULL );
+
+ }
+
+ if ( xc_shadow_control( xc_handle, domid,
+ DOM0_SHADOW_CONTROL_OP_CLEAN2,
+ to_send, nr_pfns, &faults_this_iter,
+ &dirtied_this_iter) != nr_pfns )
+ {
+ ERROR("Error flushing shadow PT");
+ goto out;
+ }
+
+ sent_last_iter = sent_this_iter;
+
+ /* dirtied_this_iter = count_bits( nr_pfns, to_send ); */
+ track_cpu_usage( xc_handle, domid, faults_this_iter,
+ sent_this_iter, dirtied_this_iter, 1);
+
+ }
} /* end of while 1 */
@@ -792,8 +785,8 @@ printf("nr_pfns=%d order_nr=%d\n",nr_pfns, order_nr);
/* Zero terminate */
if ( (*writerfn)(writerst, &rc, sizeof(int)) )
{
- ERROR("Error when writing to state file (6)");
- goto out;
+ ERROR("Error when writing to state file (6)");
+ goto out;
}
/* Get the final execution context */
@@ -801,10 +794,10 @@ printf("nr_pfns=%d order_nr=%d\n",nr_pfns, order_nr);
op.u.getdomaininfo.domain = (domid_t)domid;
op.u.getdomaininfo.ctxt = &ctxt;
if ( (do_dom0_op(xc_handle, &op) < 0) ||
- ((u64)op.u.getdomaininfo.domain != domid) )
+ ((u32)op.u.getdomaininfo.domain != domid) )
{
- PERROR("Could not get info on domain");
- goto out;
+ PERROR("Could not get info on domain");
+ goto out;
}
/* Canonicalise the suspend-record frame number. */
@@ -830,18 +823,18 @@ printf("nr_pfns=%d order_nr=%d\n",nr_pfns, order_nr);
ERROR("PT base is not in range of pseudophys map");
goto out;
}
- ctxt.pt_base = live_mfn_to_pfn_table[ctxt.pt_base >> PAGE_SHIFT] << PAGE_SHIFT;
+ ctxt.pt_base = live_mfn_to_pfn_table[ctxt.pt_base >> PAGE_SHIFT] <<
+ PAGE_SHIFT;
- if ( (*writerfn)(writerst, &ctxt, sizeof(ctxt)) ||
- (*writerfn)(writerst, live_shinfo, PAGE_SIZE) )
+ if ( (*writerfn)(writerst, &ctxt, sizeof(ctxt)) ||
+ (*writerfn)(writerst, live_shinfo, PAGE_SIZE) )
{
ERROR("Error when writing to state file (1)");
goto out;
}
munmap(live_shinfo, PAGE_SIZE);
-out:
-
+ out:
if ( pfn_type != NULL )
free(pfn_type);
diff --git a/tools/xc/lib/xc_misc.c b/tools/xc/lib/xc_misc.c
index 9f087d56fb..0019ffe96b 100644
--- a/tools/xc/lib/xc_misc.c
+++ b/tools/xc/lib/xc_misc.c
@@ -20,7 +20,7 @@ int xc_interface_close(int xc_handle)
}
-#define CONSOLE_RING_CLEAR 1
+#define CONSOLE_RING_CLEAR 1
int xc_readconsolering(int xc_handle,
char *str,
@@ -48,7 +48,7 @@ int xc_readconsolering(int xc_handle,
int xc_physinfo(int xc_handle,
- xc_physinfo_t *put_info)
+ xc_physinfo_t *put_info)
{
int ret;
dom0_op_t op;
diff --git a/tools/xc/lib/xc_netbsd_build.c b/tools/xc/lib/xc_netbsd_build.c
index 7c67d57d71..b3dfcc7314 100644
--- a/tools/xc/lib/xc_netbsd_build.c
+++ b/tools/xc/lib/xc_netbsd_build.c
@@ -22,7 +22,7 @@ static int loadelfimage(gzFile, int, unsigned long *, unsigned long,
#define L1_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED)
#define L2_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_DIRTY|_PAGE_USER)
-static long get_tot_pages(int xc_handle, u64 domid)
+static long get_tot_pages(int xc_handle, u32 domid)
{
dom0_op_t op;
op.cmd = DOM0_GETDOMAININFO;
@@ -33,7 +33,7 @@ static long get_tot_pages(int xc_handle, u64 domid)
}
static int get_pfn_list(int xc_handle,
- u64 domid,
+ u32 domid,
unsigned long *pfn_buf,
unsigned long max_pfns)
{
@@ -55,12 +55,12 @@ static int get_pfn_list(int xc_handle,
}
static int setup_guestos(int xc_handle,
- u64 dom,
+ u32 dom,
gzFile kernel_gfd,
unsigned long tot_pages,
unsigned long *virt_startinfo_addr,
unsigned long *virt_load_addr,
- full_execution_context_t *ctxt,
+ full_execution_context_t *ctxt,
const char *cmdline,
unsigned long shared_info_frame,
unsigned int control_evtchn)
@@ -209,7 +209,7 @@ static int setup_guestos(int xc_handle,
}
int xc_netbsd_build(int xc_handle,
- u64 domid,
+ u32 domid,
const char *image_name,
const char *cmdline,
unsigned int control_evtchn)
@@ -253,7 +253,7 @@ int xc_netbsd_build(int xc_handle,
op.u.getdomaininfo.domain = (domid_t)domid;
op.u.getdomaininfo.ctxt = ctxt;
if ( (do_dom0_op(xc_handle, &op) < 0) ||
- ((u64)op.u.getdomaininfo.domain != domid) )
+ ((u32)op.u.getdomaininfo.domain != domid) )
{
PERROR("Could not get info on domain");
goto error_out;
diff --git a/tools/xc/lib/xc_physdev.c b/tools/xc/lib/xc_physdev.c
index fb35843586..ba5dd9ccdc 100644
--- a/tools/xc/lib/xc_physdev.c
+++ b/tools/xc/lib/xc_physdev.c
@@ -10,7 +10,7 @@
#include "xc_private.h"
int xc_physdev_pci_access_modify(int xc_handle,
- u64 domid,
+ u32 domid,
int bus,
int dev,
int func,
diff --git a/tools/xc/lib/xc_private.c b/tools/xc/lib/xc_private.c
index 32cc908d40..c602a56630 100644
--- a/tools/xc/lib/xc_private.c
+++ b/tools/xc/lib/xc_private.c
@@ -10,10 +10,7 @@ int init_pfn_mapper(domid_t domid)
{
int fd = open("/dev/mem", O_RDWR);
if ( fd >= 0 )
- {
- (void)ioctl(fd, _IO('M', 1), (unsigned long)(domid>> 0)); /* low */
- (void)ioctl(fd, _IO('M', 2), (unsigned long)(domid>>32)); /* high */
- }
+ (void)ioctl(fd, _IO('M', 1), (unsigned long)domid);
return fd;
}
@@ -48,23 +45,23 @@ void unmap_pfn(int pm_handle, void *vaddr)
/*******************/
void * mfn_mapper_map_batch(int xc_handle, domid_t dom, int prot,
- unsigned long *arr, int num )
+ unsigned long *arr, int num )
{
privcmd_mmapbatch_t ioctlx;
void *addr;
addr = mmap( NULL, num*PAGE_SIZE, prot, MAP_SHARED, xc_handle, 0 );
if (addr)
{
- ioctlx.num=num;
- ioctlx.dom=dom;
- ioctlx.addr=(unsigned long)addr;
- ioctlx.arr=arr;
- if ( ioctl( xc_handle, IOCTL_PRIVCMD_MMAPBATCH, &ioctlx ) <0 )
- {
- perror("XXXXXXXX");
- munmap(addr, num*PAGE_SIZE);
- return 0;
- }
+ ioctlx.num=num;
+ ioctlx.dom=dom;
+ ioctlx.addr=(unsigned long)addr;
+ ioctlx.arr=arr;
+ if ( ioctl( xc_handle, IOCTL_PRIVCMD_MMAPBATCH, &ioctlx ) < 0 )
+ {
+ perror("XXXXXXXX");
+ munmap(addr, num*PAGE_SIZE);
+ return 0;
+ }
}
return addr;
@@ -73,8 +70,8 @@ void * mfn_mapper_map_batch(int xc_handle, domid_t dom, int prot,
/*******************/
void * mfn_mapper_map_single(int xc_handle, domid_t dom,
- int size, int prot,
- unsigned long mfn )
+ int size, int prot,
+ unsigned long mfn )
{
privcmd_mmap_t ioctlx;
privcmd_mmap_entry_t entry;
@@ -82,17 +79,17 @@ void * mfn_mapper_map_single(int xc_handle, domid_t dom,
addr = mmap( NULL, size, prot, MAP_SHARED, xc_handle, 0 );
if (addr)
{
- ioctlx.num=1;
- ioctlx.dom=dom;
- ioctlx.entry=&entry;
- entry.va=(unsigned long) addr;
- entry.mfn=mfn;
- entry.npages=(size+PAGE_SIZE-1)>>PAGE_SHIFT;
- if ( ioctl( xc_handle, IOCTL_PRIVCMD_MMAP, &ioctlx ) <0 )
- {
- munmap(addr, size);
- return 0;
- }
+ ioctlx.num=1;
+ ioctlx.dom=dom;
+ ioctlx.entry=&entry;
+ entry.va=(unsigned long) addr;
+ entry.mfn=mfn;
+ entry.npages=(size+PAGE_SIZE-1)>>PAGE_SHIFT;
+ if ( ioctl( xc_handle, IOCTL_PRIVCMD_MMAP, &ioctlx ) <0 )
+ {
+ munmap(addr, size);
+ return 0;
+ }
}
return addr;
}
@@ -101,7 +98,7 @@ void * mfn_mapper_map_single(int xc_handle, domid_t dom,
/* NB: arr must be mlock'ed */
int get_pfn_type_batch(int xc_handle,
- u64 dom, int num, unsigned long *arr)
+ u32 dom, int num, unsigned long *arr)
{
dom0_op_t op;
op.cmd = DOM0_GETPAGEFRAMEINFO2;
@@ -113,8 +110,8 @@ int get_pfn_type_batch(int xc_handle,
#define GETPFN_ERR (~0U)
unsigned int get_pfn_type(int xc_handle,
- unsigned long mfn,
- u64 dom)
+ unsigned long mfn,
+ u32 dom)
{
dom0_op_t op;
op.cmd = DOM0_GETPAGEFRAMEINFO;
@@ -132,7 +129,7 @@ unsigned int get_pfn_type(int xc_handle,
/*******************/
-#define FIRST_MMU_UPDATE 2
+#define FIRST_MMU_UPDATE 1
static int flush_mmu_updates(int xc_handle, mmu_t *mmu)
{
@@ -145,12 +142,8 @@ static int flush_mmu_updates(int xc_handle, mmu_t *mmu)
/* The first two requests set the correct subject domain (PTS and GPS). */
mmu->updates[0].val = (unsigned long)(mmu->subject<<16) & ~0xFFFFUL;
mmu->updates[0].ptr = (unsigned long)(mmu->subject<< 0) & ~0xFFFFUL;
- mmu->updates[1].val = (unsigned long)(mmu->subject>>16) & ~0xFFFFUL;
- mmu->updates[1].ptr = (unsigned long)(mmu->subject>>32) & ~0xFFFFUL;
mmu->updates[0].ptr |= MMU_EXTENDED_COMMAND;
- mmu->updates[0].val |= MMUEXT_SET_SUBJECTDOM_L;
- mmu->updates[1].ptr |= MMU_EXTENDED_COMMAND;
- mmu->updates[1].val |= MMUEXT_SET_SUBJECTDOM_H | SET_PAGETABLE_SUBJECTDOM;
+ mmu->updates[0].val |= MMUEXT_SET_SUBJECTDOM | SET_PAGETABLE_SUBJECTDOM;
hypercall.op = __HYPERVISOR_mmu_update;
hypercall.arg[0] = (unsigned long)mmu->updates;
@@ -211,46 +204,43 @@ int finish_mmu_updates(int xc_handle, mmu_t *mmu)
/* this function is a hack until we get proper synchronous domain stop */
int xc_domain_stop_sync( int xc_handle, domid_t domid,
- dom0_op_t *op, full_execution_context_t *ctxt)
+ dom0_op_t *op, full_execution_context_t *ctxt)
{
int i;
printf("Sleep:");
- for(i=0;;i++)
+ for( i = 0; ; i++ )
{
- op->cmd = DOM0_STOPDOMAIN;
- op->u.stopdomain.domain = (domid_t)domid;
- op->u.stopdomain.sync = 1;
- do_dom0_op(xc_handle, op);
- /* can't trust return code due to sync stop hack :-(( */
+ op->cmd = DOM0_STOPDOMAIN;
+ op->u.stopdomain.domain = (domid_t)domid;
+ op->u.stopdomain.sync = 1;
+ do_dom0_op(xc_handle, op);
+ /* can't trust return code due to sync stop hack :-(( */
-
op->cmd = DOM0_GETDOMAININFO;
op->u.getdomaininfo.domain = (domid_t)domid;
op->u.getdomaininfo.ctxt = ctxt;
if ( (do_dom0_op(xc_handle, op) < 0) ||
- ((u64)op->u.getdomaininfo.domain != domid) )
+ ((u32)op->u.getdomaininfo.domain != domid) )
{
PERROR("Could not get info on domain");
goto out;
}
if ( op->u.getdomaininfo.state == DOMSTATE_STOPPED )
- {
- printf("Domain %lld stopped\n",domid);
+ {
+ printf("Domain %u stopped\n",domid);
return 0;
- }
-
- printf(".");
-
- //usleep(1000);
+ }
+
+ printf(".");
}
printf("\n");
-out:
+ out:
return -1;
}
@@ -262,10 +252,10 @@ long long xc_domain_get_cpu_usage( int xc_handle, domid_t domid )
op.u.getdomaininfo.domain = (domid_t)domid;
op.u.getdomaininfo.ctxt = NULL;
if ( (do_dom0_op(xc_handle, &op) < 0) ||
- ((u64)op.u.getdomaininfo.domain != domid) )
+ ((u32)op.u.getdomaininfo.domain != domid) )
{
- PERROR("Could not get info on domain");
- return -1;
+ PERROR("Could not get info on domain");
+ return -1;
}
return op.u.getdomaininfo.cpu_time;
}
@@ -273,18 +263,15 @@ long long xc_domain_get_cpu_usage( int xc_handle, domid_t domid )
/**********************************************************************/
-// this is shared between save and restore, and may be useful.
-
-unsigned long csum_page ( void * page )
+/* This is shared between save and restore, and may generally be useful. */
+unsigned long csum_page (void * page)
{
int i;
unsigned long *p = page;
unsigned long long sum=0;
- for (i=0;i<PAGE_SIZE/sizeof(unsigned long);i++)
- {
- sum += p[i];
- }
+ for ( i = 0; i < (PAGE_SIZE/sizeof(unsigned long)); i++ )
+ sum += p[i];
return sum ^ (sum>>32);
}
diff --git a/tools/xc/lib/xc_vbd.c b/tools/xc/lib/xc_vbd.c
index 00d166d03d..a23e0b0603 100644
--- a/tools/xc/lib/xc_vbd.c
+++ b/tools/xc/lib/xc_vbd.c
@@ -10,7 +10,7 @@
#include "xc_private.h"
int xc_vbd_create(int xc_handle,
- u64 domid,
+ u32 domid,
unsigned short vbdid,
int writeable)
{
@@ -24,7 +24,7 @@ int xc_vbd_create(int xc_handle,
int xc_vbd_destroy(int xc_handle,
- u64 domid,
+ u32 domid,
unsigned short vbdid)
{
block_io_op_t op;
@@ -36,7 +36,7 @@ int xc_vbd_destroy(int xc_handle,
int xc_vbd_grow(int xc_handle,
- u64 domid,
+ u32 domid,
unsigned short vbdid,
xc_vbdextent_t *extent)
{
@@ -52,7 +52,7 @@ int xc_vbd_grow(int xc_handle,
int xc_vbd_shrink(int xc_handle,
- u64 domid,
+ u32 domid,
unsigned short vbdid)
{
block_io_op_t op;
@@ -64,7 +64,7 @@ int xc_vbd_shrink(int xc_handle,
int xc_vbd_setextents(int xc_handle,
- u64 domid,
+ u32 domid,
unsigned short vbdid,
unsigned int nr_extents,
xc_vbdextent_t *extents)
@@ -112,7 +112,7 @@ int xc_vbd_setextents(int xc_handle,
int xc_vbd_getextents(int xc_handle,
- u64 domid,
+ u32 domid,
unsigned short vbdid,
unsigned int max_extents,
xc_vbdextent_t *extents,
@@ -161,7 +161,7 @@ int xc_vbd_getextents(int xc_handle,
int xc_vbd_probe(int xc_handle,
- u64 domid,
+ u32 domid,
unsigned int max_vbds,
xc_vbd_t *vbds)
{
@@ -194,7 +194,7 @@ int xc_vbd_probe(int xc_handle,
if ( !(xdi->disks[i].info & XD_FLAG_VIRT) )
continue;
- vbds[j].domid = (u64)xdi->disks[i].domain;
+ vbds[j].domid = (u32)xdi->disks[i].domain;
vbds[j].vbdid = xdi->disks[i].device;
vbds[j].flags = (xdi->disks[i].info & XD_FLAG_RO) ?
0 : XC_VBDF_WRITEABLE;
diff --git a/tools/xc/lib/xc_vif.c b/tools/xc/lib/xc_vif.c
index 518abfa0e3..cae5e3438c 100644
--- a/tools/xc/lib/xc_vif.c
+++ b/tools/xc/lib/xc_vif.c
@@ -9,7 +9,7 @@
#include "xc_private.h"
int xc_vif_scheduler_set(int xc_handle,
- u64 domid,
+ u32 domid,
unsigned int vifid,
xc_vif_sched_params_t *params)
{
@@ -24,7 +24,7 @@ int xc_vif_scheduler_set(int xc_handle,
int xc_vif_scheduler_get(int xc_handle,
- u64 domid,
+ u32 domid,
unsigned int vifid,
xc_vif_sched_params_t *params)
{
@@ -46,7 +46,7 @@ int xc_vif_scheduler_get(int xc_handle,
int xc_vif_stats_get(int xc_handle,
- u64 domid,
+ u32 domid,
unsigned int vifid,
xc_vif_stats_t *stats)
{
diff --git a/tools/xc/py/Xc.c b/tools/xc/py/Xc.c
index d2a291e4c8..eadb14f146 100644
--- a/tools/xc/py/Xc.c
+++ b/tools/xc/py/Xc.c
@@ -40,7 +40,7 @@ static PyObject *pyxc_domain_create(PyObject *self,
unsigned int mem_kb = 0;
char *name = "(anon)";
int cpu = -1;
- u64 dom;
+ u32 dom;
int ret;
static char *kwd_list[] = { "mem_kb", "name", "cpu", NULL };
@@ -52,7 +52,7 @@ static PyObject *pyxc_domain_create(PyObject *self,
if ( (ret = xc_domain_create(xc->xc_handle, mem_kb, name, cpu, &dom)) < 0 )
return PyErr_SetFromErrno(xc_error);
- return PyLong_FromUnsignedLongLong(dom);
+ return PyInt_FromLong(dom);
}
static PyObject *pyxc_domain_start(PyObject *self,
@@ -61,11 +61,11 @@ static PyObject *pyxc_domain_start(PyObject *self,
{
XcObject *xc = (XcObject *)self;
- u64 dom;
+ u32 dom;
static char *kwd_list[] = { "dom", NULL };
- if ( !PyArg_ParseTupleAndKeywords(args, kwds, "L", kwd_list, &dom) )
+ if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i", kwd_list, &dom) )
return NULL;
if ( xc_domain_start(xc->xc_handle, dom) != 0 )
@@ -81,11 +81,11 @@ static PyObject *pyxc_domain_stop(PyObject *self,
{
XcObject *xc = (XcObject *)self;
- u64 dom;
+ u32 dom;
static char *kwd_list[] = { "dom", NULL };
- if ( !PyArg_ParseTupleAndKeywords(args, kwds, "L", kwd_list, &dom) )
+ if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i", kwd_list, &dom) )
return NULL;
if ( xc_domain_stop(xc->xc_handle, dom) != 0 )
@@ -101,12 +101,12 @@ static PyObject *pyxc_domain_destroy(PyObject *self,
{
XcObject *xc = (XcObject *)self;
- u64 dom;
+ u32 dom;
int force = 0;
static char *kwd_list[] = { "dom", "force", NULL };
- if ( !PyArg_ParseTupleAndKeywords(args, kwds, "L|i", kwd_list,
+ if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i|i", kwd_list,
&dom, &force) )
return NULL;
@@ -118,17 +118,17 @@ static PyObject *pyxc_domain_destroy(PyObject *self,
}
static PyObject *pyxc_domain_pincpu(PyObject *self,
- PyObject *args,
- PyObject *kwds)
+ PyObject *args,
+ PyObject *kwds)
{
XcObject *xc = (XcObject *)self;
- u64 dom;
+ u32 dom;
int cpu = -1;
static char *kwd_list[] = { "dom", "cpu", NULL };
- if ( !PyArg_ParseTupleAndKeywords(args, kwds, "L|i", kwd_list,
+ if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i|i", kwd_list,
&dom, &cpu) )
return NULL;
@@ -146,13 +146,13 @@ static PyObject *pyxc_domain_getinfo(PyObject *self,
XcObject *xc = (XcObject *)self;
PyObject *list;
- u64 first_dom = 0;
+ u32 first_dom = 0;
int max_doms = 1024, nr_doms, i;
xc_dominfo_t *info;
static char *kwd_list[] = { "first_dom", "max_doms", NULL };
- if ( !PyArg_ParseTupleAndKeywords(args, kwds, "|Li", kwd_list,
+ if ( !PyArg_ParseTupleAndKeywords(args, kwds, "|ii", kwd_list,
&first_dom, &max_doms) )
return NULL;
@@ -166,7 +166,7 @@ static PyObject *pyxc_domain_getinfo(PyObject *self,
{
PyList_SetItem(
list, i,
- Py_BuildValue("{s:L,s:i,s:i,s:i,s:l,s:L,s:s,s:l}",
+ Py_BuildValue("{s:i,s:i,s:i,s:i,s:l,s:L,s:s,s:l}",
"dom", info[i].domid,
"cpu", info[i].cpu,
"running", info[i].has_cpu,
@@ -175,7 +175,7 @@ static PyObject *pyxc_domain_getinfo(PyObject *self,
"cpu_time", info[i].cpu_time,
"name", info[i].name,
"maxmem_kb",info[i].max_memkb
- ));
+ ));
}
free(info);
@@ -189,15 +189,17 @@ static PyObject *pyxc_linux_save(PyObject *self,
{
XcObject *xc = (XcObject *)self;
- u64 dom;
+ u32 dom;
char *state_file;
int progress = 1, live = -1, debug = 0;
unsigned int flags = 0;
- static char *kwd_list[] = { "dom", "state_file", "progress", "live", "debug", NULL };
+ static char *kwd_list[] = { "dom", "state_file", "progress",
+ "live", "debug", NULL };
- if ( !PyArg_ParseTupleAndKeywords(args, kwds, "Ls|iii", kwd_list,
- &dom, &state_file, &progress, &live, &debug) )
+ if ( !PyArg_ParseTupleAndKeywords(args, kwds, "is|iii", kwd_list,
+ &dom, &state_file, &progress,
+ &live, &debug) )
return NULL;
if (progress) flags |= XCFLAGS_VERBOSE;
@@ -207,136 +209,136 @@ static PyObject *pyxc_linux_save(PyObject *self,
if ( strncmp(state_file,"tcp:", strlen("tcp:")) == 0 )
{
#define max_namelen 64
- char server[max_namelen];
- char *port_s;
- int port=777;
- int sd = -1;
- struct hostent *h;
- struct sockaddr_in s;
- int sockbufsize;
- int rc = -1;
-
- int writerfn(void *fd, const void *buf, size_t count)
- {
- int tot = 0, rc;
- do {
- rc = write( (int) fd, ((char*)buf)+tot, count-tot );
- if ( rc < 0 ) { perror("WRITE"); return rc; };
- tot += rc;
- }
- while ( tot < count );
- return 0;
- }
-
- if (live == -1) flags |= XCFLAGS_LIVE; // default to live for tcp
-
- strncpy( server, state_file+strlen("tcp://"), max_namelen);
- server[max_namelen-1]='\0';
- if ( (port_s = strchr(server,':')) != NULL )
- {
- *port_s = '\0';
- port = atoi(port_s+1);
- }
-
- printf("X server=%s port=%d\n",server,port);
-
- h = gethostbyname(server);
- sd = socket (AF_INET,SOCK_STREAM,0);
- if ( sd < 0 )
+ char server[max_namelen];
+ char *port_s;
+ int port=777;
+ int sd = -1;
+ struct hostent *h;
+ struct sockaddr_in s;
+ int sockbufsize;
+ int rc = -1;
+
+ int writerfn(void *fd, const void *buf, size_t count)
+ {
+ int tot = 0, rc;
+ do {
+ rc = write( (int) fd, ((char*)buf)+tot, count-tot );
+ if ( rc < 0 ) { perror("WRITE"); return rc; };
+ tot += rc;
+ }
+ while ( tot < count );
+ return 0;
+ }
+
+ if (live == -1) flags |= XCFLAGS_LIVE; /* default to live for tcp */
+
+ strncpy( server, state_file+strlen("tcp://"), max_namelen);
+ server[max_namelen-1]='\0';
+ if ( (port_s = strchr(server,':')) != NULL )
+ {
+ *port_s = '\0';
+ port = atoi(port_s+1);
+ }
+
+ printf("X server=%s port=%d\n",server,port);
+
+ h = gethostbyname(server);
+ sd = socket (AF_INET,SOCK_STREAM,0);
+ if ( sd < 0 )
+ goto serr;
+ s.sin_family = AF_INET;
+ bcopy ( h->h_addr, &(s.sin_addr.s_addr), h->h_length);
+ s.sin_port = htons(port);
+ if ( connect(sd, (struct sockaddr *) &s, sizeof(s)) )
goto serr;
- s.sin_family = AF_INET;
- bcopy ( h->h_addr, &(s.sin_addr.s_addr), h->h_length);
- s.sin_port = htons(port);
- if ( connect(sd, (struct sockaddr *) &s, sizeof(s)) )
- goto serr;
-
- sockbufsize=128*1024;
- if ( setsockopt(sd, SOL_SOCKET, SO_SNDBUF,
+
+ sockbufsize=128*1024;
+ if ( setsockopt(sd, SOL_SOCKET, SO_SNDBUF,
&sockbufsize, sizeof sockbufsize) < 0 )
- goto serr;
+ goto serr;
- if ( xc_linux_save(xc->xc_handle, dom, flags,
+ if ( xc_linux_save(xc->xc_handle, dom, flags,
writerfn, (void*)sd) == 0 )
- {
- if ( read( sd, &rc, sizeof(int) ) != sizeof(int) )
- goto serr;
-
- if ( rc == 0 )
- {
- printf("Migration succesful -- destroy local copy\n");
- xc_domain_destroy( xc->xc_handle, dom, 1 );
- close(sd);
- Py_INCREF(zero);
- return zero;
- }
- else
- errno = rc;
- }
+ {
+ if ( read( sd, &rc, sizeof(int) ) != sizeof(int) )
+ goto serr;
+
+ if ( rc == 0 )
+ {
+ printf("Migration succesful -- destroy local copy\n");
+ xc_domain_destroy( xc->xc_handle, dom, 1 );
+ close(sd);
+ Py_INCREF(zero);
+ return zero;
+ }
+ else
+ errno = rc;
+ }
serr:
- printf("Migration failed -- restart local copy\n");
- xc_domain_start( xc->xc_handle, dom );
- PyErr_SetFromErrno(xc_error);
- if ( sd >= 0 ) close(sd);
- return NULL;
+ printf("Migration failed -- restart local copy\n");
+ xc_domain_start( xc->xc_handle, dom );
+ PyErr_SetFromErrno(xc_error);
+ if ( sd >= 0 ) close(sd);
+ return NULL;
}
else
{
- int fd = -1;
- gzFile gfd = NULL;
-
- int writerfn(void *fd, const void *buf, size_t count)
- {
- int rc;
- while ( ((rc = gzwrite( (gzFile*)fd, (void*)buf, count)) == -1) &&
- (errno = EINTR) )
- continue;
- return ! (rc == count);
- }
-
- if (strncmp(state_file,"file:",strlen("file:")) == 0)
- state_file += strlen("file:");
-
- if ( (fd = open(state_file, O_CREAT|O_EXCL|O_WRONLY, 0644)) == -1 )
- {
- perror("Could not open file for writing");
- goto err;
- }
-
- /*
- * Compression rate 1: we want speed over compression.
- * We're mainly going for those zero pages, after all.
- */
-
- if ( (gfd = gzdopen(fd, "wb1")) == NULL )
- {
- perror("Could not allocate compression state for state file");
- close(fd);
- goto err;
- }
-
-
- if ( xc_linux_save(xc->xc_handle, dom, flags, writerfn, gfd) == 0 )
- {
- /* kill domain. We don't want to do this for checkpointing, but
- if we don't do it here I think people will hurt themselves
- by accident... */
- xc_domain_destroy( xc->xc_handle, dom, 1 );
- gzclose(gfd);
- close(fd);
-
- Py_INCREF(zero);
- return zero;
- }
+ int fd = -1;
+ gzFile gfd = NULL;
+
+ int writerfn(void *fd, const void *buf, size_t count)
+ {
+ int rc;
+ while ( ((rc = gzwrite( (gzFile*)fd, (void*)buf, count)) == -1) &&
+ (errno = EINTR) )
+ continue;
+ return ! (rc == count);
+ }
+
+ if (strncmp(state_file,"file:",strlen("file:")) == 0)
+ state_file += strlen("file:");
+
+ if ( (fd = open(state_file, O_CREAT|O_EXCL|O_WRONLY, 0644)) == -1 )
+ {
+ perror("Could not open file for writing");
+ goto err;
+ }
+
+ /*
+ * Compression rate 1: we want speed over compression.
+ * We're mainly going for those zero pages, after all.
+ */
+
+ if ( (gfd = gzdopen(fd, "wb1")) == NULL )
+ {
+ perror("Could not allocate compression state for state file");
+ close(fd);
+ goto err;
+ }
+
+
+ if ( xc_linux_save(xc->xc_handle, dom, flags, writerfn, gfd) == 0 )
+ {
+ /* kill domain. We don't want to do this for checkpointing, but
+ if we don't do it here I think people will hurt themselves
+ by accident... */
+ xc_domain_destroy( xc->xc_handle, dom, 1 );
+ gzclose(gfd);
+ close(fd);
+
+ Py_INCREF(zero);
+ return zero;
+ }
err:
- PyErr_SetFromErrno(xc_error);
- if ( gfd != NULL )
+ PyErr_SetFromErrno(xc_error);
+ if ( gfd != NULL )
gzclose(gfd);
- if ( fd >= 0 )
+ if ( fd >= 0 )
close(fd);
- unlink(state_file);
- return NULL;
+ unlink(state_file);
+ return NULL;
}
}
@@ -349,12 +351,12 @@ static PyObject *pyxc_linux_restore(PyObject *self,
char *state_file;
int progress = 1;
- u64 dom;
+ u32 dom;
unsigned int flags = 0;
static char *kwd_list[] = { "dom", "state_file", "progress", NULL };
- if ( !PyArg_ParseTupleAndKeywords(args, kwds, "Ls|i", kwd_list,
+ if ( !PyArg_ParseTupleAndKeywords(args, kwds, "is|i", kwd_list,
&dom, &state_file, &progress) )
return NULL;
@@ -364,142 +366,141 @@ static PyObject *pyxc_linux_restore(PyObject *self,
if ( strncmp(state_file,"tcp:", strlen("tcp:")) == 0 )
{
#define max_namelen 64
- char server[max_namelen];
- char *port_s;
- int port=777;
- int ld = -1, sd = -1;
- struct hostent *h;
- struct sockaddr_in s, d, p;
- socklen_t dlen, plen;
- int sockbufsize;
- int on = 1, rc = -1;
-
- int readerfn(void *fd, void *buf, size_t count)
- {
- int rc, tot = 0;
- do {
- rc = read( (int) fd, ((char*)buf)+tot, count-tot );
- if ( rc < 0 ) { perror("READ"); return rc; }
- if ( rc == 0 ) { printf("read: need %d, tot=%d got zero\n",count-tot,tot); return -1; }
- tot += rc;
- }
+ char server[max_namelen];
+ char *port_s;
+ int port=777;
+ int ld = -1, sd = -1;
+ struct hostent *h;
+ struct sockaddr_in s, d, p;
+ socklen_t dlen, plen;
+ int sockbufsize;
+ int on = 1, rc = -1;
+
+ int readerfn(void *fd, void *buf, size_t count)
+ {
+ int rc, tot = 0;
+ do {
+ rc = read( (int) fd, ((char*)buf)+tot, count-tot );
+ if ( rc < 0 ) { perror("READ"); return rc; }
+ if ( rc == 0 ) { printf("read: need %d, tot=%d got zero\n",
+ count-tot, tot); return -1; }
+ tot += rc;
+ }
while ( tot < count );
- return 0;
- }
-
- strncpy( server, state_file+strlen("tcp://"), max_namelen);
- server[max_namelen-1]='\0';
- if ( (port_s = strchr(server,':')) != NULL )
- {
- *port_s = '\0';
- port = atoi(port_s+1);
- }
-
- printf("X server=%s port=%d\n",server,port);
-
- h = gethostbyname(server);
- ld = socket (AF_INET,SOCK_STREAM,0);
- if ( ld < 0 ) goto serr;
- s.sin_family = AF_INET;
- //bcopy ( h->h_addr, &(s.sin_addr.s_addr), h->h_length);
- s.sin_addr.s_addr = htonl(INADDR_ANY);
- s.sin_port = htons(port);
-
- if ( setsockopt(ld, SOL_SOCKET, SO_REUSEADDR, &on, sizeof (on)) < 0 )
- goto serr;
-
- if ( bind(ld, (struct sockaddr *) &s, sizeof(s)) )
- goto serr;
-
- if ( listen(ld, 1) )
- goto serr;
-
- dlen=sizeof(struct sockaddr);
- if ( (sd = accept(ld, (struct sockaddr *) &d, &dlen )) < 0 )
- goto serr;
+ return 0;
+ }
+
+ strncpy( server, state_file+strlen("tcp://"), max_namelen);
+ server[max_namelen-1]='\0';
+ if ( (port_s = strchr(server,':')) != NULL )
+ {
+ *port_s = '\0';
+ port = atoi(port_s+1);
+ }
+
+ printf("X server=%s port=%d\n",server,port);
+
+ h = gethostbyname(server);
+ ld = socket (AF_INET,SOCK_STREAM,0);
+ if ( ld < 0 ) goto serr;
+ s.sin_family = AF_INET;
+ s.sin_addr.s_addr = htonl(INADDR_ANY);
+ s.sin_port = htons(port);
+
+ if ( setsockopt(ld, SOL_SOCKET, SO_REUSEADDR, &on, sizeof (on)) < 0 )
+ goto serr;
+
+ if ( bind(ld, (struct sockaddr *) &s, sizeof(s)) )
+ goto serr;
+
+ if ( listen(ld, 1) )
+ goto serr;
+
+ dlen=sizeof(struct sockaddr);
+ if ( (sd = accept(ld, (struct sockaddr *) &d, &dlen )) < 0 )
+ goto serr;
plen = sizeof(p);
- if ( getpeername(sd, (struct sockaddr_in *) &p,
+ if ( getpeername(sd, (struct sockaddr_in *) &p,
&plen) < 0 )
- goto serr;
+ goto serr;
- printf("Accepted connection from %s\n", inet_ntoa(p.sin_addr));
-
- sockbufsize=128*1024;
- if ( setsockopt(sd, SOL_SOCKET, SO_SNDBUF, &sockbufsize,
+ printf("Accepted connection from %s\n", inet_ntoa(p.sin_addr));
+
+ sockbufsize=128*1024;
+ if ( setsockopt(sd, SOL_SOCKET, SO_SNDBUF, &sockbufsize,
sizeof sockbufsize) < 0 )
- goto serr;
+ goto serr;
- rc = xc_linux_restore(xc->xc_handle, dom, flags,
+ rc = xc_linux_restore(xc->xc_handle, dom, flags,
readerfn, (void*)sd, &dom);
- write( sd, &rc, sizeof(int) );
+ write( sd, &rc, sizeof(int) );
- if (rc == 0)
- {
- close(sd);
- Py_INCREF(zero);
- return zero;
- }
- errno = rc;
+ if (rc == 0)
+ {
+ close(sd);
+ Py_INCREF(zero);
+ return zero;
+ }
+ errno = rc;
serr:
- PyErr_SetFromErrno(xc_error);
- if ( ld >= 0 ) close(ld);
- if ( sd >= 0 ) close(sd);
- return NULL;
+ PyErr_SetFromErrno(xc_error);
+ if ( ld >= 0 ) close(ld);
+ if ( sd >= 0 ) close(sd);
+ return NULL;
}
else
{
- int fd = -1;
- gzFile gfd = NULL;
-
- int readerfn(void *fd, void *buf, size_t count)
- {
- int rc;
- while ( ((rc = gzread( (gzFile*)fd, (void*)buf, count)) == -1) &&
- (errno = EINTR) )
- continue;
- return ! (rc == count);
- }
-
- if ( strncmp(state_file,"file:",strlen("file:")) == 0 )
- state_file += strlen("file:");
-
- if ( (fd = open(state_file, O_RDONLY)) == -1 )
- {
- perror("Could not open file for writing");
- goto err;
- }
-
- /*
- * Compression rate 1: we want speed over compression.
- * We're mainly going for those zero pages, after all.
- */
-
- if ( (gfd = gzdopen(fd, "rb")) == NULL )
- {
- perror("Could not allocate compression state for state file");
- close(fd);
- goto err;
- }
-
-
- if ( xc_linux_restore(xc->xc_handle, dom, flags,
+ int fd = -1;
+ gzFile gfd = NULL;
+
+ int readerfn(void *fd, void *buf, size_t count)
+ {
+ int rc;
+ while ( ((rc = gzread( (gzFile*)fd, (void*)buf, count)) == -1) &&
+ (errno = EINTR) )
+ continue;
+ return ! (rc == count);
+ }
+
+ if ( strncmp(state_file,"file:",strlen("file:")) == 0 )
+ state_file += strlen("file:");
+
+ if ( (fd = open(state_file, O_RDONLY)) == -1 )
+ {
+ perror("Could not open file for writing");
+ goto err;
+ }
+
+ /*
+ * Compression rate 1: we want speed over compression.
+ * We're mainly going for those zero pages, after all.
+ */
+ if ( (gfd = gzdopen(fd, "rb")) == NULL )
+ {
+ perror("Could not allocate compression state for state file");
+ close(fd);
+ goto err;
+ }
+
+
+ if ( xc_linux_restore(xc->xc_handle, dom, flags,
readerfn, gfd, &dom) == 0 )
- {
- gzclose(gfd);
- close(fd);
+ {
+ gzclose(gfd);
+ close(fd);
- Py_INCREF(zero);
- return zero;
- }
+ Py_INCREF(zero);
+ return zero;
+ }
err:
- PyErr_SetFromErrno(xc_error);
- if ( gfd != NULL ) gzclose(gfd);
- if ( fd >= 0 ) close(fd);
- return NULL;
+ PyErr_SetFromErrno(xc_error);
+ if ( gfd != NULL ) gzclose(gfd);
+ if ( fd >= 0 ) close(fd);
+ return NULL;
}
}
@@ -510,14 +511,14 @@ static PyObject *pyxc_linux_build(PyObject *self,
{
XcObject *xc = (XcObject *)self;
- u64 dom;
+ u32 dom;
char *image, *ramdisk = NULL, *cmdline = "";
int control_evtchn;
static char *kwd_list[] = { "dom", "control_evtchn",
"image", "ramdisk", "cmdline", NULL };
- if ( !PyArg_ParseTupleAndKeywords(args, kwds, "Lis|ss", kwd_list,
+ if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iis|ss", kwd_list,
&dom, &control_evtchn,
&image, &ramdisk, &cmdline) )
return NULL;
@@ -536,14 +537,14 @@ static PyObject *pyxc_netbsd_build(PyObject *self,
{
XcObject *xc = (XcObject *)self;
- u64 dom;
+ u32 dom;
char *image, *ramdisk = NULL, *cmdline = "";
int control_evtchn;
static char *kwd_list[] = { "dom", "control_evtchn",
"image", "ramdisk", "cmdline", NULL };
- if ( !PyArg_ParseTupleAndKeywords(args, kwds, "Lis|ssi", kwd_list,
+ if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iis|ssi", kwd_list,
&dom, &control_evtchn,
&image, &ramdisk, &cmdline) )
return NULL;
@@ -577,8 +578,8 @@ static PyObject *pyxc_bvtsched_global_set(PyObject *self,
}
static PyObject *pyxc_bvtsched_global_get(PyObject *self,
- PyObject *args,
- PyObject *kwds)
+ PyObject *args,
+ PyObject *kwds)
{
XcObject *xc = (XcObject *)self;
@@ -599,13 +600,13 @@ static PyObject *pyxc_bvtsched_domain_set(PyObject *self,
{
XcObject *xc = (XcObject *)self;
- u64 dom;
+ u32 dom;
unsigned long mcuadv, warp, warpl, warpu;
static char *kwd_list[] = { "dom", "mcuadv", "warp", "warpl",
"warpu", NULL };
- if ( !PyArg_ParseTupleAndKeywords(args, kwds, "Lllll", kwd_list,
+ if ( !PyArg_ParseTupleAndKeywords(args, kwds, "illll", kwd_list,
&dom, &mcuadv, &warp, &warpl, &warpu) )
return NULL;
@@ -622,19 +623,19 @@ static PyObject *pyxc_bvtsched_domain_get(PyObject *self,
PyObject *kwds)
{
XcObject *xc = (XcObject *)self;
- u64 dom;
+ u32 dom;
unsigned long mcuadv, warp, warpl, warpu;
static char *kwd_list[] = { "dom", NULL };
- if ( !PyArg_ParseTupleAndKeywords(args, kwds, "L", kwd_list, &dom) )
+ if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i", kwd_list, &dom) )
return NULL;
if ( xc_bvtsched_domain_get(xc->xc_handle, dom, &mcuadv, &warp,
&warpl, &warpu) != 0 )
return PyErr_SetFromErrno(xc_error);
- return Py_BuildValue("{s:L,s:l,s:l,s:l,s:l}",
+ return Py_BuildValue("{s:i,s:l,s:l,s:l,s:l}",
"domain", dom,
"mcuadv", mcuadv,
"warp", warp,
@@ -648,14 +649,14 @@ static PyObject *pyxc_vif_scheduler_set(PyObject *self,
{
XcObject *xc = (XcObject *)self;
- u64 dom;
+ u32 dom;
unsigned int vif;
xc_vif_sched_params_t sched = { 0, 0 };
static char *kwd_list[] = { "dom", "vif", "credit_bytes",
"credit_usecs", NULL };
- if ( !PyArg_ParseTupleAndKeywords(args, kwds, "Li|ll", kwd_list,
+ if ( !PyArg_ParseTupleAndKeywords(args, kwds, "ii|ll", kwd_list,
&dom, &vif,
&sched.credit_bytes,
&sched.credit_usec) )
@@ -674,13 +675,13 @@ static PyObject *pyxc_vif_scheduler_get(PyObject *self,
{
XcObject *xc = (XcObject *)self;
- u64 dom;
+ u32 dom;
unsigned int vif;
xc_vif_sched_params_t sched;
static char *kwd_list[] = { "dom", "vif", NULL };
- if ( !PyArg_ParseTupleAndKeywords(args, kwds, "Li", kwd_list,
+ if ( !PyArg_ParseTupleAndKeywords(args, kwds, "ii", kwd_list,
&dom, &vif) )
return NULL;
@@ -698,13 +699,13 @@ static PyObject *pyxc_vif_stats_get(PyObject *self,
{
XcObject *xc = (XcObject *)self;
- u64 dom;
+ u32 dom;
unsigned int vif;
xc_vif_stats_t stats;
static char *kwd_list[] = { "dom", "vif", NULL };
- if ( !PyArg_ParseTupleAndKeywords(args, kwds, "Li", kwd_list,
+ if ( !PyArg_ParseTupleAndKeywords(args, kwds, "ii", kwd_list,
&dom, &vif) )
return NULL;
@@ -724,13 +725,13 @@ static PyObject *pyxc_vbd_create(PyObject *self,
{
XcObject *xc = (XcObject *)self;
- u64 dom;
+ u32 dom;
unsigned int vbd;
int writeable;
static char *kwd_list[] = { "dom", "vbd", "writeable", NULL };
- if ( !PyArg_ParseTupleAndKeywords(args, kwds, "Lii", kwd_list,
+ if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iii", kwd_list,
&dom, &vbd, &writeable) )
return NULL;
@@ -747,12 +748,12 @@ static PyObject *pyxc_vbd_destroy(PyObject *self,
{
XcObject *xc = (XcObject *)self;
- u64 dom;
+ u32 dom;
unsigned int vbd;
static char *kwd_list[] = { "dom", "vbd", NULL };
- if ( !PyArg_ParseTupleAndKeywords(args, kwds, "Li", kwd_list,
+ if ( !PyArg_ParseTupleAndKeywords(args, kwds, "ii", kwd_list,
&dom, &vbd) )
return NULL;
@@ -769,14 +770,14 @@ static PyObject *pyxc_vbd_grow(PyObject *self,
{
XcObject *xc = (XcObject *)self;
- u64 dom;
+ u32 dom;
unsigned int vbd;
xc_vbdextent_t extent;
static char *kwd_list[] = { "dom", "vbd", "device",
"start_sector", "nr_sectors", NULL };
- if ( !PyArg_ParseTupleAndKeywords(args, kwds, "LiiLL", kwd_list,
+ if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiiLL", kwd_list,
&dom, &vbd,
&extent.real_device,
&extent.start_sector,
@@ -796,12 +797,12 @@ static PyObject *pyxc_vbd_shrink(PyObject *self,
{
XcObject *xc = (XcObject *)self;
- u64 dom;
+ u32 dom;
unsigned int vbd;
static char *kwd_list[] = { "dom", "vbd", NULL };
- if ( !PyArg_ParseTupleAndKeywords(args, kwds, "Li", kwd_list,
+ if ( !PyArg_ParseTupleAndKeywords(args, kwds, "ii", kwd_list,
&dom, &vbd) )
return NULL;
@@ -819,14 +820,14 @@ static PyObject *pyxc_vbd_setextents(PyObject *self,
XcObject *xc = (XcObject *)self;
PyObject *list, *dict, *obj;
- u64 dom;
+ u32 dom;
unsigned int vbd;
xc_vbdextent_t *extents = NULL;
int i, nr_extents;
static char *kwd_list[] = { "dom", "vbd", "extents", NULL };
- if ( !PyArg_ParseTupleAndKeywords(args, kwds, "LiO", kwd_list,
+ if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiO", kwd_list,
&dom, &vbd, &list) )
return NULL;
@@ -941,14 +942,14 @@ static PyObject *pyxc_vbd_getextents(PyObject *self,
XcObject *xc = (XcObject *)self;
PyObject *list;
- u64 dom;
+ u32 dom;
unsigned int vbd;
xc_vbdextent_t *extents;
int i, nr_extents;
static char *kwd_list[] = { "dom", "vbd", NULL };
- if ( !PyArg_ParseTupleAndKeywords(args, kwds, "Li", kwd_list,
+ if ( !PyArg_ParseTupleAndKeywords(args, kwds, "ii", kwd_list,
&dom, &vbd) )
return NULL;
@@ -987,14 +988,14 @@ static PyObject *pyxc_vbd_probe(PyObject *self,
XcObject *xc = (XcObject *)self;
PyObject *list;
- u64 dom = XC_VBDDOM_PROBE_ALL;
+ u32 dom = XC_VBDDOM_PROBE_ALL;
unsigned int max_vbds = 1024;
xc_vbd_t *info;
int nr_vbds, i;
static char *kwd_list[] = { "dom", "max_vbds", NULL };
- if ( !PyArg_ParseTupleAndKeywords(args, kwds, "|Li", kwd_list,
+ if ( !PyArg_ParseTupleAndKeywords(args, kwds, "|ii", kwd_list,
&dom, &max_vbds) )
return NULL;
@@ -1012,7 +1013,7 @@ static PyObject *pyxc_vbd_probe(PyObject *self,
{
PyList_SetItem(
list, i,
- Py_BuildValue("{s:L,s:i,s:i,s:L}",
+ Py_BuildValue("{s:i,s:i,s:i,s:L}",
"dom", info[i].domid,
"vbd", info[i].vbdid,
"writeable", !!(info[i].flags & XC_VBDF_WRITEABLE),
@@ -1030,12 +1031,12 @@ static PyObject *pyxc_evtchn_bind_interdomain(PyObject *self,
{
XcObject *xc = (XcObject *)self;
- u64 dom1 = DOMID_SELF, dom2 = DOMID_SELF;
+ u32 dom1 = DOMID_SELF, dom2 = DOMID_SELF;
int port1, port2;
static char *kwd_list[] = { "dom1", "dom2", NULL };
- if ( !PyArg_ParseTupleAndKeywords(args, kwds, "|LL", kwd_list,
+ if ( !PyArg_ParseTupleAndKeywords(args, kwds, "|ii", kwd_list,
&dom1, &dom2) )
return NULL;
@@ -1054,12 +1055,12 @@ static PyObject *pyxc_evtchn_close(PyObject *self,
{
XcObject *xc = (XcObject *)self;
- u64 dom = DOMID_SELF;
+ u32 dom = DOMID_SELF;
int port;
static char *kwd_list[] = { "port", "dom", NULL };
- if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i|L", kwd_list,
+ if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i|i", kwd_list,
&port, &dom) )
return NULL;
@@ -1097,13 +1098,13 @@ static PyObject *pyxc_evtchn_status(PyObject *self,
XcObject *xc = (XcObject *)self;
PyObject *dict;
- u64 dom = DOMID_SELF;
+ u32 dom = DOMID_SELF;
int port, ret;
xc_evtchn_status_t status;
static char *kwd_list[] = { "port", "dom", NULL };
- if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i|L", kwd_list,
+ if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i|i", kwd_list,
&port, &dom) )
return NULL;
@@ -1122,7 +1123,7 @@ static PyObject *pyxc_evtchn_status(PyObject *self,
"status", "unbound");
break;
case EVTCHNSTAT_interdomain:
- dict = Py_BuildValue("{s:s,s:L,s:i}",
+ dict = Py_BuildValue("{s:s,s:i,s:i}",
"status", "interdomain",
"dom", status.u.interdomain.dom,
"port", status.u.interdomain.port);
@@ -1150,12 +1151,12 @@ static PyObject *pyxc_physdev_pci_access_modify(PyObject *self,
PyObject *kwds)
{
XcObject *xc = (XcObject *)self;
- u64 dom;
+ u32 dom;
int bus, dev, func, enable, ret;
static char *kwd_list[] = { "dom", "bus", "dev", "func", "enable", NULL };
- if ( !PyArg_ParseTupleAndKeywords(args, kwds, "Liiii", kwd_list,
+ if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiiii", kwd_list,
&dom, &bus, &dev, &func, &enable) )
return NULL;
@@ -1191,8 +1192,8 @@ static PyObject *pyxc_readconsolering(PyObject *self,
}
static PyObject *pyxc_physinfo(PyObject *self,
- PyObject *args,
- PyObject *kwds)
+ PyObject *args,
+ PyObject *kwds)
{
XcObject *xc = (XcObject *)self;
xc_physinfo_t info;
@@ -1216,19 +1217,19 @@ static PyObject *pyxc_atropos_domain_set(PyObject *self,
PyObject *kwds)
{
XcObject *xc = (XcObject *)self;
- u64 domid;
+ u32 domid;
u64 period, slice, latency;
int xtratime;
static char *kwd_list[] = { "dom", "period", "slice", "latency",
- "xtratime", NULL };
+ "xtratime", NULL };
- if( !PyArg_ParseTupleAndKeywords(args, kwds, "LLLLi", kwd_list, &domid,
+ if( !PyArg_ParseTupleAndKeywords(args, kwds, "iLLLi", kwd_list, &domid,
&period, &slice, &latency, &xtratime) )
return NULL;
if ( xc_atropos_domain_set(xc->xc_handle, domid, period, slice,
- latency, xtratime) != 0 )
+ latency, xtratime) != 0 )
return PyErr_SetFromErrno(xc_error);
Py_INCREF(zero);
@@ -1240,20 +1241,20 @@ static PyObject *pyxc_atropos_domain_get(PyObject *self,
PyObject *kwds)
{
XcObject *xc = (XcObject *)self;
- u64 domid;
+ u32 domid;
u64 period, slice, latency;
int xtratime;
static char *kwd_list[] = { "dom", NULL };
- if( !PyArg_ParseTupleAndKeywords(args, kwds, "L", kwd_list, &domid) )
+ if( !PyArg_ParseTupleAndKeywords(args, kwds, "i", kwd_list, &domid) )
return NULL;
if ( xc_atropos_domain_get( xc->xc_handle, domid, &period,
&slice, &latency, &xtratime ) )
return PyErr_SetFromErrno(xc_error);
- return Py_BuildValue("{s:L,s:L,s:L,s:L,s:i}",
+ return Py_BuildValue("{s:i,s:L,s:L,s:L,s:i}",
"domain", domid,
"period", period,
"slice", slice,
@@ -1287,12 +1288,12 @@ static PyObject *pyxc_shadow_control(PyObject *self,
{
XcObject *xc = (XcObject *)self;
- u64 dom;
+ u32 dom;
int op=0;
static char *kwd_list[] = { "dom", "op", NULL };
- if ( !PyArg_ParseTupleAndKeywords(args, kwds, "L|i", kwd_list,
+ if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i|i", kwd_list,
&dom, &op) )
return NULL;
@@ -1324,12 +1325,12 @@ static PyObject *pyxc_domain_setname(PyObject *self,
PyObject *kwds)
{
XcObject *xc = (XcObject *)self;
- u64 dom;
+ u32 dom;
char *name;
static char *kwd_list[] = { "dom", "name", NULL };
- if ( !PyArg_ParseTupleAndKeywords(args, kwds, "Ls", kwd_list,
+ if ( !PyArg_ParseTupleAndKeywords(args, kwds, "is", kwd_list,
&dom, &name) )
return NULL;
@@ -1341,17 +1342,17 @@ static PyObject *pyxc_domain_setname(PyObject *self,
}
static PyObject *pyxc_domain_setmaxmem(PyObject *self,
- PyObject *args,
- PyObject *kwds)
+ PyObject *args,
+ PyObject *kwds)
{
XcObject *xc = (XcObject *)self;
- u64 dom;
+ u32 dom;
unsigned long max_memkb;
static char *kwd_list[] = { "dom", "max_memkb", NULL };
- if ( !PyArg_ParseTupleAndKeywords(args, kwds, "Li", kwd_list,
+ if ( !PyArg_ParseTupleAndKeywords(args, kwds, "ii", kwd_list,
&dom, &max_memkb) )
return NULL;
@@ -1370,27 +1371,27 @@ static PyMethodDef pyxc_methods[] = {
"Create a new domain.\n"
" mem_kb [int, 65536]: Memory allocation, in kilobytes.\n"
" name [str, '(anon)']: Informative textual name.\n\n"
- "Returns: [long] new domain identifier; -1 on error.\n" },
+ "Returns: [int] new domain identifier; -1 on error.\n" },
{ "domain_start",
(PyCFunction)pyxc_domain_start,
METH_VARARGS | METH_KEYWORDS, "\n"
"Start execution of a domain.\n"
- " dom [long]: Identifier of domain to be started.\n\n"
+ " dom [int]: Identifier of domain to be started.\n\n"
"Returns: [int] 0 on success; -1 on error.\n" },
{ "domain_stop",
(PyCFunction)pyxc_domain_stop,
METH_VARARGS | METH_KEYWORDS, "\n"
"Stop execution of a domain.\n"
- " dom [long]: Identifier of domain to be stopped.\n\n"
+ " dom [int]: Identifier of domain to be stopped.\n\n"
"Returns: [int] 0 on success; -1 on error.\n" },
{ "domain_destroy",
(PyCFunction)pyxc_domain_destroy,
METH_VARARGS | METH_KEYWORDS, "\n"
"Destroy a domain.\n"
- " dom [long]: Identifier of domain to be destroyed.\n"
+ " dom [int]: Identifier of domain to be destroyed.\n"
" force [int, 0]: Bool - force immediate destruction?\n\n"
"Returns: [int] 0 on success; -1 on error.\n" },
@@ -1398,7 +1399,7 @@ static PyMethodDef pyxc_methods[] = {
(PyCFunction)pyxc_domain_pincpu,
METH_VARARGS | METH_KEYWORDS, "\n"
"Pin a domain to a specified CPU.\n"
- " dom [long]: Identifier of domain to be pinned.\n"
+ " dom [int]: Identifier of domain to be pinned.\n"
" cpu [int, -1]: CPU to pin to, or -1 to unpin\n\n"
"Returns: [int] 0 on success; -1 on error.\n" },
@@ -1406,13 +1407,13 @@ static PyMethodDef pyxc_methods[] = {
(PyCFunction)pyxc_domain_getinfo,
METH_VARARGS | METH_KEYWORDS, "\n"
"Get information regarding a set of domains, in increasing id order.\n"
- " first_dom [long, 0]: First domain to retrieve info about.\n"
+ " first_dom [int, 0]: First domain to retrieve info about.\n"
" max_doms [int, 1024]: Maximum number of domains to retrieve info"
" about.\n\n"
"Returns: [list of dicts] if list length is less than 'max_doms'\n"
" parameter then there was an error, or the end of the\n"
" domain-id space was reached.\n"
- " dom [long]: Identifier of domain to which this info pertains\n"
+ " dom [int]: Identifier of domain to which this info pertains\n"
" cpu [int]: CPU to which this domain is bound\n"
" running [int]: Bool - is the domain currently running?\n"
" stopped [int]: Bool - is the domain suspended?\n"
@@ -1424,7 +1425,7 @@ static PyMethodDef pyxc_methods[] = {
(PyCFunction)pyxc_linux_save,
METH_VARARGS | METH_KEYWORDS, "\n"
"Save the CPU and memory state of a Linux guest OS.\n"
- " dom [long]: Identifier of domain to be saved.\n"
+ " dom [int]: Identifier of domain to be saved.\n"
" state_file [str]: Name of state file. Must not currently exist.\n"
" progress [int, 1]: Bool - display a running progress indication?\n\n"
"Returns: [int] 0 on success; -1 on error.\n" },
@@ -1435,13 +1436,13 @@ static PyMethodDef pyxc_methods[] = {
"Restore the CPU and memory state of a Linux guest OS.\n"
" state_file [str]: Name of state file. Must not currently exist.\n"
" progress [int, 1]: Bool - display a running progress indication?\n\n"
- "Returns: [long] new domain identifier on success; -1 on error.\n" },
+ "Returns: [int] new domain identifier on success; -1 on error.\n" },
{ "linux_build",
(PyCFunction)pyxc_linux_build,
METH_VARARGS | METH_KEYWORDS, "\n"
"Build a new Linux guest OS.\n"
- " dom [long]: Identifier of domain to build into.\n"
+ " dom [int]: Identifier of domain to build into.\n"
" image [str]: Name of kernel image file. May be gzipped.\n"
" ramdisk [str, n/a]: Name of ramdisk file, if any.\n"
" cmdline [str, n/a]: Kernel parameters, if any.\n\n"
@@ -1451,7 +1452,7 @@ static PyMethodDef pyxc_methods[] = {
(PyCFunction)pyxc_netbsd_build,
METH_VARARGS | METH_KEYWORDS, "\n"
"Build a new NetBSD guest OS.\n"
- " dom [long]: Identifier of domain to build into.\n"
+ " dom [int]: Identifier of domain to build into.\n"
" image [str]: Name of kernel image file. May be gzipped.\n"
" cmdline [str, n/a]: Kernel parameters, if any.\n\n"
"Returns: [int] 0 on success; -1 on error.\n" },
@@ -1474,20 +1475,20 @@ static PyMethodDef pyxc_methods[] = {
(PyCFunction)pyxc_bvtsched_domain_set,
METH_VARARGS | METH_KEYWORDS, "\n"
"Set per-domain tuning parameters for Borrowed Virtual Time scheduler.\n"
- " dom [long]: Identifier of domain to be tuned.\n"
- " mcuadv [int]: Proportional to the inverse of the domain's weight.\n"
- " warp [int]: How far to warp domain's EVT on unblock.\n"
- " warpl [int]: How long the domain can run warped.\n"
- " warpu [int]: How long before the domain can warp again.\n\n"
+ " dom [int]: Identifier of domain to be tuned.\n"
+ " mcuadv [int]: Proportional to the inverse of the domain's weight.\n"
+ " warp [int]: How far to warp domain's EVT on unblock.\n"
+ " warpl [int]: How long the domain can run warped.\n"
+ " warpu [int]: How long before the domain can warp again.\n\n"
"Returns: [int] 0 on success; -1 on error.\n" },
{ "bvtsched_domain_get",
(PyCFunction)pyxc_bvtsched_domain_get,
METH_KEYWORDS, "\n"
"Get per-domain tuning parameters under the BVT scheduler.\n"
- " dom [long]: Identifier of domain to be queried.\n"
+ " dom [int]: Identifier of domain to be queried.\n"
"Returns [dict]:\n"
- " domain [long]: Domain ID.\n"
+ " domain [int]: Domain ID.\n"
" mcuadv [long]: MCU Advance.\n"
" warp [long]: Warp.\n"
" warpu [long]: Unwarp requirement.\n"
@@ -1498,7 +1499,7 @@ static PyMethodDef pyxc_methods[] = {
(PyCFunction)pyxc_atropos_domain_set,
METH_KEYWORDS, "\n"
"Set the scheduling parameters for a domain when running with Atropos.\n"
- " dom [long]: domain to set\n"
+ " dom [int]: domain to set\n"
" period [long]: domain's scheduling period\n"
" slice [long]: domain's slice per period\n"
" latency [long]: wakeup latency hint\n"
@@ -1510,9 +1511,9 @@ static PyMethodDef pyxc_methods[] = {
METH_KEYWORDS, "\n"
"Get the current scheduling parameters for a domain when running with\n"
"the Atropos scheduler."
- " dom [long]: domain to query\n"
+ " dom [int]: domain to query\n"
"Returns: [dict]\n"
- " domain [long]: domain ID\n"
+ " domain [int]: domain ID\n"
" period [long]: scheduler period\n"
" slice [long]: CPU reservation per period\n"
" latency [long]: unblocking latency hint\n"
@@ -1536,7 +1537,7 @@ static PyMethodDef pyxc_methods[] = {
(PyCFunction)pyxc_vif_scheduler_set,
METH_VARARGS | METH_KEYWORDS, "\n"
"Set per-network-interface scheduling parameters.\n"
- " dom [long]: Identifier of domain to be adjusted.\n"
+ " dom [int]: Identifier of domain to be adjusted.\n"
" vif [int]: Identifier of VIF to be adjusted.\n"
" credit_bytes [int, 0]: Tx bytes permitted each interval.\n"
" credit_usecs [int, 0]: Interval, in usecs. 0 == no scheduling.\n\n"
@@ -1546,8 +1547,8 @@ static PyMethodDef pyxc_methods[] = {
(PyCFunction)pyxc_vif_scheduler_get,
METH_VARARGS | METH_KEYWORDS, "\n"
"Query the per-network-interface scheduling parameters.\n"
- " dom [long]: Identifier of domain to be queried.\n"
- " vif [int]: Identifier of VIF to be queried.\n\n"
+ " dom [int]: Identifier of domain to be queried.\n"
+ " vif [int]: Identifier of VIF to be queried.\n\n"
"Returns: [dict] dictionary is empty on failure.\n"
" credit_bytes [int]: Tx bytes permitted each interval.\n"
" credit_usecs [int]: Interval, in usecs. 0 == no scheduling.\n" },
@@ -1556,7 +1557,7 @@ static PyMethodDef pyxc_methods[] = {
(PyCFunction)pyxc_vif_stats_get,
METH_VARARGS | METH_KEYWORDS, "\n"
"Query the per-network-interface statistics.\n"
- " dom [long]: Identifier of domain to be queried.\n"
+ " dom [int]: Identifier of domain to be queried.\n"
" vif [int]: Identifier of VIF to be queried.\n\n"
"Returns: [dict] dictionary is empty on failure.\n"
" tx_bytes [long]: Bytes transmitted.\n"
@@ -1568,7 +1569,7 @@ static PyMethodDef pyxc_methods[] = {
(PyCFunction)pyxc_vbd_create,
METH_VARARGS | METH_KEYWORDS, "\n"
"Create a new virtual block device associated with a given domain.\n"
- " dom [long]: Identifier of domain to get a new VBD.\n"
+ " dom [int]: Identifier of domain to get a new VBD.\n"
" vbd [int]: Identifier for new VBD.\n"
" writeable [int]: Bool - is the new VBD writeable?\n\n"
"Returns: [int] 0 on success; -1 on error.\n" },
@@ -1577,7 +1578,7 @@ static PyMethodDef pyxc_methods[] = {
(PyCFunction)pyxc_vbd_destroy,
METH_VARARGS | METH_KEYWORDS, "\n"
"Destroy a virtual block device.\n"
- " dom [long]: Identifier of domain containing the VBD.\n"
+ " dom [int]: Identifier of domain containing the VBD.\n"
" vbd [int]: Identifier of the VBD.\n\n"
"Returns: [int] 0 on success; -1 on error.\n" },
@@ -1585,7 +1586,7 @@ static PyMethodDef pyxc_methods[] = {
(PyCFunction)pyxc_vbd_grow,
METH_VARARGS | METH_KEYWORDS, "\n"
"Grow a virtual block device by appending a new extent.\n"
- " dom [long]: Identifier of domain containing the VBD.\n"
+ " dom [int]: Identifier of domain containing the VBD.\n"
" vbd [int]: Identifier of the VBD.\n"
" device [int]: Identifier of the real underlying block device.\n"
" start_sector [long]: Real start sector of this extent.\n"
@@ -1596,7 +1597,7 @@ static PyMethodDef pyxc_methods[] = {
(PyCFunction)pyxc_vbd_shrink,
METH_VARARGS | METH_KEYWORDS, "\n"
"Shrink a virtual block device by deleting its final extent.\n"
- " dom [long]: Identifier of domain containing the VBD.\n"
+ " dom [int]: Identifier of domain containing the VBD.\n"
" vbd [int]: Identifier of the VBD.\n\n"
"Returns: [int] 0 on success; -1 on error.\n" },
@@ -1604,7 +1605,7 @@ static PyMethodDef pyxc_methods[] = {
(PyCFunction)pyxc_vbd_setextents,
METH_VARARGS | METH_KEYWORDS, "\n"
"Set all the extent information for a virtual block device.\n"
- " dom [long]: Identifier of domain containing the VBD.\n"
+ " dom [int]: Identifier of domain containing the VBD.\n"
" vbd [int]: Identifier of the VBD.\n"
" extents [list of dicts]: Per-extent information.\n"
" device [int]: Id of the real underlying block device.\n"
@@ -1616,7 +1617,7 @@ static PyMethodDef pyxc_methods[] = {
(PyCFunction)pyxc_vbd_getextents,
METH_VARARGS | METH_KEYWORDS, "\n"
"Get info on all the extents in a virtual block device.\n"
- " dom [long]: Identifier of domain containing the VBD.\n"
+ " dom [int]: Identifier of domain containing the VBD.\n"
" vbd [int]: Identifier of the VBD.\n\n"
"Returns: [list of dicts] per-extent information; empty on error.\n"
" device [int]: Identifier of the real underlying block device.\n"
@@ -1627,11 +1628,11 @@ static PyMethodDef pyxc_methods[] = {
(PyCFunction)pyxc_vbd_probe,
METH_VARARGS | METH_KEYWORDS, "\n"
"Get information regarding extant virtual block devices.\n"
- " dom [long, ALL]: Domain to query (default is to query all).\n"
+ " dom [int, ALL]: Domain to query (default is to query all).\n"
" max_vbds [int, 1024]: Maximum VBDs to query.\n\n"
"Returns: [list of dicts] if list length is less than 'max_vbds'\n"
" parameter then there was an error, or there were fewer vbds.\n"
- " dom [long]: Domain containing this VBD.\n"
+ " dom [int]: Domain containing this VBD.\n"
" vbd [int]: Domain-specific identifier of this VBD.\n"
" writeable [int]: Bool - is this VBD writeable?\n"
" nr_sectors [long]: Size of this VBD, in 512-byte sectors.\n" },
@@ -1640,8 +1641,8 @@ static PyMethodDef pyxc_methods[] = {
(PyCFunction)pyxc_evtchn_bind_interdomain,
METH_VARARGS | METH_KEYWORDS, "\n"
"Open an event channel between two domains.\n"
- " dom1 [long, SELF]: First domain to be connected.\n"
- " dom2 [long, SELF]: Second domain to be connected.\n\n"
+ " dom1 [int, SELF]: First domain to be connected.\n"
+ " dom2 [int, SELF]: Second domain to be connected.\n\n"
"Returns: [dict] dictionary is empty on failure.\n"
" port1 [int]: Port-id for endpoint at dom1.\n"
" port2 [int]: Port-id for endpoint at dom2.\n" },
@@ -1650,8 +1651,8 @@ static PyMethodDef pyxc_methods[] = {
(PyCFunction)pyxc_evtchn_close,
METH_VARARGS | METH_KEYWORDS, "\n"
"Close an event channel.\n"
- " dom [long, SELF]: Dom-id of one endpoint of the channel.\n"
- " port [int]: Port-id of one endpoint of the channel.\n\n"
+ " dom [int, SELF]: Dom-id of one endpoint of the channel.\n"
+ " port [int]: Port-id of one endpoint of the channel.\n\n"
"Returns: [int] 0 on success; -1 on error.\n" },
{ "evtchn_send",
@@ -1665,26 +1666,26 @@ static PyMethodDef pyxc_methods[] = {
(PyCFunction)pyxc_evtchn_status,
METH_VARARGS | METH_KEYWORDS, "\n"
"Query the status of an event channel.\n"
- " dom [long, SELF]: Dom-id of one endpoint of the channel.\n"
- " port [int]: Port-id of one endpoint of the channel.\n\n"
+ " dom [int, SELF]: Dom-id of one endpoint of the channel.\n"
+ " port [int]: Port-id of one endpoint of the channel.\n\n"
"Returns: [dict] dictionary is empty on failure.\n"
" status [str]: 'closed', 'unbound', 'interdomain', 'pirq',"
" or 'virq'.\n"
"The following are returned if 'status' is 'interdomain':\n"
- " dom [long]: Dom-id of remote endpoint.\n"
- " port [int]: Port-id of remote endpoint.\n"
+ " dom [int]: Dom-id of remote endpoint.\n"
+ " port [int]: Port-id of remote endpoint.\n"
"The following are returned if 'status' is 'pirq' or 'virq':\n"
- " irq [int]: IRQ number.\n" },
+ " irq [int]: IRQ number.\n" },
{ "physdev_pci_access_modify",
(PyCFunction)pyxc_physdev_pci_access_modify,
METH_VARARGS | METH_KEYWORDS, "\n"
"Allow a domain access to a PCI device\n"
- " dom [long]: Identifier of domain to be allowed access.\n"
- " bus [int]: PCI bus\n"
- " dev [int]: PCI slot\n"
- " func [int]: PCI function\n"
- " enable [int]: Non-zero means enable access; else disable access\n\n"
+ " dom [int]: Identifier of domain to be allowed access.\n"
+ " bus [int]: PCI bus\n"
+ " dev [int]: PCI slot\n"
+ " func [int]: PCI function\n"
+ " enable [int]: Non-zero means enable access; else disable access\n\n"
"Returns: [int] 0 on success; -1 on error.\n" },
{ "readconsolering",
@@ -1705,7 +1706,7 @@ static PyMethodDef pyxc_methods[] = {
(PyCFunction)pyxc_shadow_control,
METH_VARARGS | METH_KEYWORDS, "\n"
"Set parameter for shadow pagetable interface\n"
- " dom [long]: Identifier of domain.\n"
+ " dom [int]: Identifier of domain.\n"
" op [int, 0]: operation\n\n"
"Returns: [int] 0 on success; -1 on error.\n" },
@@ -1713,7 +1714,7 @@ static PyMethodDef pyxc_methods[] = {
(PyCFunction)pyxc_domain_setname,
METH_VARARGS | METH_KEYWORDS, "\n"
"Set domain informative textual name\n"
- " dom [long]: Identifier of domain.\n"
+ " dom [int]: Identifier of domain.\n"
" name [str]: Text string.\n\n"
"Returns: [int] 0 on success; -1 on error.\n" },
@@ -1721,7 +1722,7 @@ static PyMethodDef pyxc_methods[] = {
(PyCFunction)pyxc_domain_setname,
METH_VARARGS | METH_KEYWORDS, "\n"
"Set a domain's memory limit\n"
- " dom [long]: Identifier of domain.\n"
+ " dom [int]: Identifier of domain.\n"
" max_memkb [long]: .\n"
"Returns: [int] 0 on success; -1 on error.\n" },
@@ -1747,7 +1748,7 @@ static PyObject *PyXc_new(PyObject *self, PyObject *args)
if ( (xc->xc_handle = xc_interface_open()) == -1 )
{
PyObject_Del((PyObject *)xc);
- return PyErr_SetFromErrno(xc_error);
+ return PyErr_SetFromErrno(xc_error);
}
return (PyObject *)xc;
diff --git a/tools/xend/lib/blkif.py b/tools/xend/lib/blkif.py
index 94e058f7ce..c0f4784e68 100644
--- a/tools/xend/lib/blkif.py
+++ b/tools/xend/lib/blkif.py
@@ -43,18 +43,18 @@ def backend_rx_rsp(port, msg):
rsp = { 'success': True }
xend.main.send_management_response(rsp, xend.blkif.pendaddr)
elif subtype == CMSG_BLKIF_BE_CONNECT:
- (dom,hnd,evtchn,frame,st) = struct.unpack("QIILI", msg.get_payload())
+ (dom,hnd,evtchn,frame,st) = struct.unpack("IIILI", msg.get_payload())
blkif = interface.list[xend.main.port_from_dom(dom).local_port]
msg = xend.utils.message(CMSG_BLKIF_FE, \
CMSG_BLKIF_FE_INTERFACE_STATUS_CHANGED, 0)
msg.append_payload(struct.pack("III",0,2,blkif.evtchn['port2']))
blkif.ctrlif_tx_req(xend.main.port_list[blkif.key], msg)
elif subtype == CMSG_BLKIF_BE_VBD_CREATE:
- (dom,hnd,vdev,ro,st) = struct.unpack("QIHII", msg.get_payload())
+ (dom,hnd,vdev,ro,st) = struct.unpack("IIHII", msg.get_payload())
blkif = interface.list[xend.main.port_from_dom(dom).local_port]
(pdev, start_sect, nr_sect, readonly) = blkif.devices[vdev]
msg = xend.utils.message(CMSG_BLKIF_BE, CMSG_BLKIF_BE_VBD_GROW, 0)
- msg.append_payload(struct.pack("QIHHHQQI",dom,0,vdev,0, \
+ msg.append_payload(struct.pack("IIHHHQQI",dom,0,vdev,0, \
pdev,start_sect,nr_sect,0))
backend_tx_req(msg)
elif subtype == CMSG_BLKIF_BE_VBD_GROW:
@@ -84,7 +84,7 @@ class interface:
self.pendmsg = None
interface.list[key] = self
msg = xend.utils.message(CMSG_BLKIF_BE, CMSG_BLKIF_BE_CREATE, 0)
- msg.append_payload(struct.pack("QII",dom,0,0))
+ msg.append_payload(struct.pack("III",dom,0,0))
xend.blkif.pendaddr = xend.main.mgmt_req_addr
backend_tx_req(msg)
@@ -94,7 +94,7 @@ class interface:
return False
self.devices[vdev] = (pdev, start_sect, nr_sect, readonly)
msg = xend.utils.message(CMSG_BLKIF_BE, CMSG_BLKIF_BE_VBD_CREATE, 0)
- msg.append_payload(struct.pack("QIHII",self.dom,0,vdev,readonly,0))
+ msg.append_payload(struct.pack("IIHII",self.dom,0,vdev,readonly,0))
xend.blkif.pendaddr = xend.main.mgmt_req_addr
backend_tx_req(msg)
return True
@@ -104,7 +104,7 @@ class interface:
def destroy(self):
del interface.list[self.key]
msg = xend.utils.message(CMSG_BLKIF_BE, CMSG_BLKIF_BE_DESTROY, 0)
- msg.append_payload(struct.pack("QII",self.dom,0,0))
+ msg.append_payload(struct.pack("III",self.dom,0,0))
backend_tx_req(msg)
@@ -138,6 +138,6 @@ class interface:
self.evtchn = xc.evtchn_bind_interdomain(dom1=0,dom2=self.dom)
msg = xend.utils.message(CMSG_BLKIF_BE, \
CMSG_BLKIF_BE_CONNECT, 0)
- msg.append_payload(struct.pack("QIILI",self.dom,0, \
+ msg.append_payload(struct.pack("IIILI",self.dom,0, \
self.evtchn['port1'],frame,0))
backend_tx_req(msg)
diff --git a/tools/xend/lib/netif.py b/tools/xend/lib/netif.py
index 11756c5e56..525baa6585 100644
--- a/tools/xend/lib/netif.py
+++ b/tools/xend/lib/netif.py
@@ -40,7 +40,7 @@ def backend_rx_rsp(port, msg):
xend.main.send_management_response(rsp, xend.netif.pendaddr)
elif subtype == CMSG_NETIF_BE_CONNECT:
(dom,hnd,evtchn,tx_frame,rx_frame,st) = \
- struct.unpack("QIILLI", msg.get_payload())
+ struct.unpack("IIILLI", msg.get_payload())
netif = interface.list[xend.main.port_from_dom(dom).local_port]
msg = xend.utils.message(CMSG_NETIF_FE, \
CMSG_NETIF_FE_INTERFACE_STATUS_CHANGED, 0)
@@ -88,7 +88,7 @@ class interface:
interface.list[key] = self
msg = xend.utils.message(CMSG_NETIF_BE, CMSG_NETIF_BE_CREATE, 0)
- msg.append_payload(struct.pack("QIBBBBBBBBI",dom,0, \
+ msg.append_payload(struct.pack("IIBBBBBBBBI",dom,0, \
self.mac[0],self.mac[1], \
self.mac[2],self.mac[3], \
self.mac[4],self.mac[5], \
@@ -101,7 +101,7 @@ class interface:
def destroy(self):
del interface.list[self.key]
msg = xend.utils.message(CMSG_NETIF_BE, CMSG_NETIF_BE_DESTROY, 0)
- msg.append_payload(struct.pack("QII",self.dom,0,0))
+ msg.append_payload(struct.pack("III",self.dom,0,0))
backend_tx_req(msg)
@@ -138,7 +138,7 @@ class interface:
self.evtchn = xc.evtchn_bind_interdomain(dom1=0,dom2=self.dom)
msg = xend.utils.message(CMSG_NETIF_BE, \
CMSG_NETIF_BE_CONNECT, 0)
- msg.append_payload(struct.pack("QIILLI",self.dom,0, \
+ msg.append_payload(struct.pack("IIILLI",self.dom,0, \
self.evtchn['port1'],tx_frame, \
rx_frame,0))
backend_tx_req(msg)
diff --git a/tools/xend/lib/utils.c b/tools/xend/lib/utils.c
index 441b62f153..56d0b4899d 100644
--- a/tools/xend/lib/utils.c
+++ b/tools/xend/lib/utils.c
@@ -408,7 +408,7 @@ typedef struct {
PyObject_HEAD;
int mem_fd;
int xc_handle;
- u64 remote_dom;
+ u32 remote_dom;
int local_port, remote_port;
control_if_t *interface;
CONTROL_RING_IDX tx_req_cons, tx_resp_prod;
@@ -661,11 +661,11 @@ staticforward PyTypeObject xu_port_type;
static PyObject *xu_port_new(PyObject *self, PyObject *args)
{
xu_port_object *xup;
- u64 dom;
+ u32 dom;
int port1, port2;
xc_dominfo_t info;
- if ( !PyArg_ParseTuple(args, "L", &dom) )
+ if ( !PyArg_ParseTuple(args, "i", &dom) )
return NULL;
xup = PyObject_New(xu_port_object, &xu_port_type);
@@ -677,8 +677,7 @@ static PyObject *xu_port_new(PyObject *self, PyObject *args)
}
/* Set the General-Purpose Subject whose page frame will be mapped. */
- (void)ioctl(xup->mem_fd, _IO('M', 1), (unsigned long)(dom>> 0)); /* low */
- (void)ioctl(xup->mem_fd, _IO('M', 2), (unsigned long)(dom>>32)); /* high */
+ (void)ioctl(xup->mem_fd, _IO('M', 1), (unsigned long)dom);
if ( (xup->xc_handle = xc_interface_open()) == -1 )
{
@@ -686,7 +685,7 @@ static PyObject *xu_port_new(PyObject *self, PyObject *args)
goto fail2;
}
- if ( dom == 0ULL )
+ if ( dom == 0 )
{
/*
* The control-interface event channel for DOM0 is already set up.
@@ -758,7 +757,7 @@ static PyObject *xu_port_getattr(PyObject *obj, char *name)
if ( strcmp(name, "remote_port") == 0 )
return PyInt_FromLong(xup->remote_port);
if ( strcmp(name, "remote_dom") == 0 )
- return PyLong_FromUnsignedLongLong(xup->remote_dom);
+ return PyInt_FromLong(xup->remote_dom);
return Py_FindMethod(xu_port_methods, obj, name);
}
@@ -766,7 +765,7 @@ static void xu_port_dealloc(PyObject *self)
{
xu_port_object *xup = (xu_port_object *)self;
unmap_control_interface(xup->mem_fd, xup->interface);
- if ( xup->remote_dom != 0ULL )
+ if ( xup->remote_dom != 0 )
(void)xc_evtchn_close(xup->xc_handle, DOMID_SELF, xup->local_port);
(void)xc_interface_close(xup->xc_handle);
(void)close(xup->mem_fd);
diff --git a/xen/common/dom0_ops.c b/xen/common/dom0_ops.c
index b4baf6c141..76d8afd437 100644
--- a/xen/common/dom0_ops.c
+++ b/xen/common/dom0_ops.c
@@ -42,7 +42,7 @@ static void write_msr_for(void *unused)
static void read_msr_for(void *unused)
{
if (((1 << current->processor) & msr_cpu_mask))
- rdmsr(msr_addr, msr_lo, msr_hi);
+ rdmsr(msr_addr, msr_lo, msr_hi);
}
@@ -64,8 +64,9 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
return -EACCES;
}
- TRACE_5D( TRC_DOM0OP_ENTER_BASE + op->cmd,
- 0, op->u.dummy[0], op->u.dummy[1], op->u.dummy[2], op->u.dummy[3] );
+ TRACE_5D(TRC_DOM0OP_ENTER_BASE + op->cmd,
+ 0, op->u.dummy[0], op->u.dummy[1],
+ op->u.dummy[2], op->u.dummy[3] );
switch ( op->cmd )
{
@@ -102,19 +103,20 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
case DOM0_STOPDOMAIN:
{
ret = stop_other_domain(op->u.stopdomain.domain);
-
- /* This is grim, but helps for live migrate. It's also unsafe
- in the strict sense as we're not explicitly setting a
- timeout, but dom0 is bound to have other timers going off to
- wake us back up.
- We go to sleep so that the other domain can stop quicker, hence
- we have less total down time in a migrate.
- */
- if( ret == 0 && op->u.stopdomain.sync == 1 )
- {
- extern long do_block( void );
- do_block(); // Yuk...
- }
+
+ /*
+ * This is grim, but helps for live migrate. It's also unsafe
+ * in the strict sense as we're not explicitly setting a
+ * timeout, but dom0 is bound to have other timers going off to
+ * wake us back up.
+ * We go to sleep so that the other domain can stop quicker, hence
+ * we have less total down time in a migrate.
+ */
+ if( ret == 0 && op->u.stopdomain.sync == 1 )
+ {
+ extern long do_block( void );
+ do_block(); /* Yuk... */
+ }
}
break;
@@ -127,24 +129,34 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
domid_t dom;
ret = -ENOMEM;
- spin_lock(&domnr_lock);
- dom = ++domnr;
- spin_unlock(&domnr_lock);
+ /* Search for an unused domain identifier. */
+ for ( ; ; )
+ {
+ spin_lock(&domnr_lock);
+ /* Wrap the roving counter when we reach first special value. */
+ if ( (dom = ++domnr) == DOMID_SELF )
+ dom = domnr = 1;
+ spin_unlock(&domnr_lock);
+
+ if ( (p = find_domain_by_id(dom)) == NULL )
+ break;
+ put_task_struct(p);
+ }
- if (op->u.createdomain.cpu == -1 )
- pro = (unsigned int)dom % smp_num_cpus;
- else
- pro = op->u.createdomain.cpu % smp_num_cpus;
+ if (op->u.createdomain.cpu == -1 )
+ pro = (unsigned int)dom % smp_num_cpus;
+ else
+ pro = op->u.createdomain.cpu % smp_num_cpus;
p = do_createdomain(dom, pro);
if ( p == NULL )
break;
- if ( op->u.createdomain.name[0] )
+ if ( op->u.createdomain.name[0] )
{
strncpy(p->name, op->u.createdomain.name, MAX_DOMAIN_NAME);
p->name[MAX_DOMAIN_NAME - 1] = '\0';
- }
+ }
ret = alloc_new_dom_mem(p, op->u.createdomain.memory_kb);
if ( ret != 0 )
@@ -192,7 +204,8 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
else
{
/* Pause domain if necessary. */
- if( !(p->state & TASK_STOPPED) && !(p->state & TASK_PAUSED) )
+ if( !(p->state & TASK_STOPPED) &&
+ !(p->state & TASK_PAUSED) )
{
sched_pause_sync(p);
we_paused = 1;
@@ -210,7 +223,7 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
ret = 0;
}
put_task_struct(p);
- }
+ }
}
}
break;
@@ -278,13 +291,13 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
for_each_domain ( p )
{
if ( p->domain >= op->u.getdomaininfo.domain )
- break;
+ break;
}
if ( p == NULL )
{
ret = -ESRCH;
- goto gdi_out;
+ goto gdi_out;
}
else
{
@@ -304,13 +317,13 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
if ( p->state == TASK_STOPPED && op->u.getdomaininfo.ctxt )
{
- full_execution_context_t *c=NULL;
+ full_execution_context_t *c=NULL;
- if ( (c = kmalloc(sizeof(*c), GFP_KERNEL)) == NULL )
- {
- ret= -ENOMEM;
- goto gdi_out;
- }
+ if ( (c = kmalloc(sizeof(*c), GFP_KERNEL)) == NULL )
+ {
+ ret= -ENOMEM;
+ goto gdi_out;
+ }
rmb(); /* Ensure that we see saved register state. */
c->flags = 0;
@@ -360,17 +373,17 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
c->failsafe_callback_eip =
p->failsafe_address;
- if( copy_to_user(op->u.getdomaininfo.ctxt, c, sizeof(*c)) )
- {
- ret = -EINVAL;
- }
+ if( copy_to_user(op->u.getdomaininfo.ctxt, c, sizeof(*c)) )
+ {
+ ret = -EINVAL;
+ }
- if (c) kfree(c);
+ if (c) kfree(c);
}
}
- if ( copy_to_user(u_dom0_op, op, sizeof(*op)) )
- ret = -EINVAL;
+ if ( copy_to_user(u_dom0_op, op, sizeof(*op)) )
+ ret = -EINVAL;
gdi_out:
read_unlock_irqrestore(&tasklist_lock, flags);
@@ -437,16 +450,16 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
case DOM0_MSR:
{
if ( op->u.msr.write )
- {
+ {
msr_cpu_mask = op->u.msr.cpu_mask;
msr_addr = op->u.msr.msr;
msr_lo = op->u.msr.in1;
msr_hi = op->u.msr.in2;
smp_call_function(write_msr_for, NULL, 1, 1);
write_msr_for(NULL);
- }
+ }
else
- {
+ {
msr_cpu_mask = op->u.msr.cpu_mask;
msr_addr = op->u.msr.msr;
smp_call_function(read_msr_for, NULL, 1, 1);
@@ -455,7 +468,7 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
op->u.msr.out1 = msr_lo;
op->u.msr.out2 = msr_hi;
copy_to_user(u_dom0_op, op, sizeof(*op));
- }
+ }
ret = 0;
}
break;
@@ -481,7 +494,7 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
case DOM0_GETTBUFS:
{
ret = get_tb_info(&op->u.gettbufs);
- copy_to_user(u_dom0_op, op, sizeof(*op));
+ copy_to_user(u_dom0_op, op, sizeof(*op));
}
break;
#endif
@@ -489,8 +502,8 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
case DOM0_READCONSOLE:
{
ret = read_console_ring(op->u.readconsole.str,
- op->u.readconsole.count,
- op->u.readconsole.cmd);
+ op->u.readconsole.count,
+ op->u.readconsole.cmd);
}
break;
@@ -530,15 +543,15 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
case DOM0_SHADOW_CONTROL:
{
- struct task_struct *p;
- ret = -ESRCH;
- p = find_domain_by_id( op->u.shadow_control.domain );
- if ( p )
- {
+ struct task_struct *p;
+ ret = -ESRCH;
+ p = find_domain_by_id( op->u.shadow_control.domain );
+ if ( p )
+ {
ret = shadow_mode_control(p, &op->u.shadow_control );
- put_task_struct(p);
- copy_to_user(u_dom0_op, op, sizeof(*op));
- }
+ put_task_struct(p);
+ copy_to_user(u_dom0_op, op, sizeof(*op));
+ }
}
break;
@@ -553,131 +566,131 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
case DOM0_SETDOMAINNAME:
{
- struct task_struct *p;
- p = find_domain_by_id( op->u.setdomainname.domain );
- if ( p )
- {
- strncpy(p->name, op->u.setdomainname.name, MAX_DOMAIN_NAME);
- put_task_struct(p);
- }
- else
- ret = -ESRCH;
+ struct task_struct *p;
+ p = find_domain_by_id( op->u.setdomainname.domain );
+ if ( p )
+ {
+ strncpy(p->name, op->u.setdomainname.name, MAX_DOMAIN_NAME);
+ put_task_struct(p);
+ }
+ else
+ ret = -ESRCH;
}
break;
case DOM0_SETDOMAININITIALMEM:
{
- struct task_struct *p;
- ret = -ESRCH;
- p = find_domain_by_id( op->u.setdomaininitialmem.domain );
- if ( p )
- {
- /* should only be used *before* domain is built. */
+ struct task_struct *p;
+ ret = -ESRCH;
+ p = find_domain_by_id( op->u.setdomaininitialmem.domain );
+ if ( p )
+ {
+ /* should only be used *before* domain is built. */
if ( ! test_bit(PF_CONSTRUCTED, &p->flags) )
- ret = alloc_new_dom_mem(
- p, op->u.setdomaininitialmem.initial_memkb );
- else
- ret = -EINVAL;
- put_task_struct(p);
- }
+ ret = alloc_new_dom_mem(
+ p, op->u.setdomaininitialmem.initial_memkb );
+ else
+ ret = -EINVAL;
+ put_task_struct(p);
+ }
}
break;
case DOM0_SETDOMAINMAXMEM:
{
- struct task_struct *p;
- p = find_domain_by_id( op->u.setdomainmaxmem.domain );
- if ( p )
- {
- p->max_pages =
- (op->u.setdomainmaxmem.max_memkb+PAGE_SIZE-1)>> PAGE_SHIFT;
- put_task_struct(p);
- }
- else
- ret = -ESRCH;
+ struct task_struct *p;
+ p = find_domain_by_id( op->u.setdomainmaxmem.domain );
+ if ( p )
+ {
+ p->max_pages =
+ (op->u.setdomainmaxmem.max_memkb+PAGE_SIZE-1)>> PAGE_SHIFT;
+ put_task_struct(p);
+ }
+ else
+ ret = -ESRCH;
}
break;
case DOM0_GETPAGEFRAMEINFO2:
{
#define GPF2_BATCH 128
- int n,j;
+ int n,j;
int num = op->u.getpageframeinfo2.num;
domid_t dom = op->u.getpageframeinfo2.domain;
- unsigned long *s_ptr = (unsigned long*) op->u.getpageframeinfo2.array;
+ unsigned long *s_ptr = (unsigned long*) op->u.getpageframeinfo2.array;
struct task_struct *p;
- unsigned long l_arr[GPF2_BATCH];
+ unsigned long l_arr[GPF2_BATCH];
ret = -ESRCH;
- if ( unlikely((p = find_domain_by_id(dom)) == NULL) )
- break;
-
- if ( unlikely(num>1024) )
- {
- ret = -E2BIG;
- break;
- }
-
- ret = 0;
- for(n=0;n<num;)
- {
- int k = ((num-n)>GPF2_BATCH)?GPF2_BATCH:(num-n);
-
- if( copy_from_user( l_arr, &s_ptr[n], k*sizeof(unsigned long) ) )
- {
- ret = -EINVAL;
- break;
- }
-
- for(j=0;j<k;j++)
- {
- struct pfn_info *page;
- unsigned long mfn = l_arr[j];
-
- if ( unlikely(mfn >= max_page) )
- goto e2_err;
-
- page = &frame_table[mfn];
-
- if ( likely(get_page(page, p)) )
- {
- unsigned long type = 0;
- switch( page->type_and_flags & PGT_type_mask )
- {
- case PGT_l1_page_table:
- type = L1TAB;
- break;
- case PGT_l2_page_table:
- type = L2TAB;
- break;
- case PGT_l3_page_table:
- type = L3TAB;
- break;
- case PGT_l4_page_table:
- type = L4TAB;
- break;
- }
- l_arr[j] |= type;
- put_page(page);
- }
- else
- {
- e2_err:
- l_arr[j] |= XTAB;
- }
-
- }
-
- if( copy_to_user( &s_ptr[n], l_arr, k*sizeof(unsigned long) ) )
- {
- ret = -EINVAL;
- break;
- }
-
- n+=j;
- }
-
- put_task_struct(p);
+ if ( unlikely((p = find_domain_by_id(dom)) == NULL) )
+ break;
+
+ if ( unlikely(num>1024) )
+ {
+ ret = -E2BIG;
+ break;
+ }
+
+ ret = 0;
+ for(n=0;n<num;)
+ {
+ int k = ((num-n)>GPF2_BATCH)?GPF2_BATCH:(num-n);
+
+ if( copy_from_user( l_arr, &s_ptr[n], k*sizeof(unsigned long) ) )
+ {
+ ret = -EINVAL;
+ break;
+ }
+
+ for(j=0;j<k;j++)
+ {
+ struct pfn_info *page;
+ unsigned long mfn = l_arr[j];
+
+ if ( unlikely(mfn >= max_page) )
+ goto e2_err;
+
+ page = &frame_table[mfn];
+
+ if ( likely(get_page(page, p)) )
+ {
+ unsigned long type = 0;
+ switch( page->type_and_flags & PGT_type_mask )
+ {
+ case PGT_l1_page_table:
+ type = L1TAB;
+ break;
+ case PGT_l2_page_table:
+ type = L2TAB;
+ break;
+ case PGT_l3_page_table:
+ type = L3TAB;
+ break;
+ case PGT_l4_page_table:
+ type = L4TAB;
+ break;
+ }
+ l_arr[j] |= type;
+ put_page(page);
+ }
+ else
+ {
+ e2_err:
+ l_arr[j] |= XTAB;
+ }
+
+ }
+
+ if( copy_to_user( &s_ptr[n], l_arr, k*sizeof(unsigned long) ) )
+ {
+ ret = -EINVAL;
+ break;
+ }
+
+ n+=j;
+ }
+
+ put_task_struct(p);
}
break;
@@ -687,8 +700,8 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
}
- TRACE_5D( TRC_DOM0OP_LEAVE_BASE + op->cmd, ret,
- op->u.dummy[0], op->u.dummy[1], op->u.dummy[2], op->u.dummy[3] );
+ TRACE_5D(TRC_DOM0OP_LEAVE_BASE + op->cmd, ret,
+ op->u.dummy[0], op->u.dummy[1], op->u.dummy[2], op->u.dummy[3]);
return ret;
diff --git a/xen/common/dom_mem_ops.c b/xen/common/dom_mem_ops.c
index 97b2ffc0f1..ef8aaeb4d5 100644
--- a/xen/common/dom_mem_ops.c
+++ b/xen/common/dom_mem_ops.c
@@ -64,7 +64,7 @@ static long free_dom_mem(struct task_struct *p,
if ( unlikely(mpfn >= max_page) )
{
- DPRINTK("Domain %llu page number out of range (%08lx>=%08lx)\n",
+ DPRINTK("Domain %u page number out of range (%08lx>=%08lx)\n",
p->domain, mpfn, max_page);
rc = -EINVAL;
break;
@@ -73,7 +73,7 @@ static long free_dom_mem(struct task_struct *p,
page = &frame_table[mpfn];
if ( unlikely(!get_page(page, p)) )
{
- DPRINTK("Bad page free for domain %llu\n", p->domain);
+ DPRINTK("Bad page free for domain %u\n", p->domain);
rc = -EINVAL;
break;
}
diff --git a/xen/common/domain.c b/xen/common/domain.c
index 894bb7ba05..c152d6532b 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -75,7 +75,7 @@ struct task_struct *do_createdomain(domid_t dom_id, unsigned int cpu)
}
/* We use a large intermediate to avoid overflow in sprintf. */
- sprintf(buf, "Domain-%llu", dom_id);
+ sprintf(buf, "Domain-%u", dom_id);
strncpy(p->name, buf, MAX_DOMAIN_NAME);
p->name[MAX_DOMAIN_NAME-1] = '\0';
@@ -90,15 +90,13 @@ struct task_struct *do_createdomain(domid_t dom_id, unsigned int cpu)
p->shared_info = (void *)get_free_page(GFP_KERNEL);
memset(p->shared_info, 0, PAGE_SIZE);
SHARE_PFN_WITH_DOMAIN(virt_to_page(p->shared_info), p);
-
- machine_to_phys_mapping[virt_to_phys(p->shared_info) >> PAGE_SHIFT] =
- 0x80000000UL; // set m2p table to magic marker (helps debug)
+ machine_to_phys_mapping[virt_to_phys(p->shared_info) >>
+ PAGE_SHIFT] = 0x80000000UL; /* debug */
p->mm.perdomain_pt = (l1_pgentry_t *)get_free_page(GFP_KERNEL);
memset(p->mm.perdomain_pt, 0, PAGE_SIZE);
-
- machine_to_phys_mapping[virt_to_phys(p->mm.perdomain_pt) >> PAGE_SHIFT] =
- 0x0fffdeadUL; // set m2p table to magic marker (helps debug)
+ machine_to_phys_mapping[virt_to_phys(p->mm.perdomain_pt) >>
+ PAGE_SHIFT] = 0x0fffdeadUL; /* debug */
init_blkdev_info(p);
@@ -161,8 +159,8 @@ struct task_struct *find_last_domain(void)
p = plast->next_list;
while ( p != NULL )
{
- if ( p->create_time > plast->create_time )
- plast = p;
+ if ( p->create_time > plast->create_time )
+ plast = p;
p = p->next_list;
}
get_task_struct(plast);
@@ -174,7 +172,7 @@ struct task_struct *find_last_domain(void)
void kill_domain_with_errmsg(const char *err)
{
- printk("DOM%llu FATAL ERROR: %s\n", current->domain, err);
+ printk("DOM%u FATAL ERROR: %s\n", current->domain, err);
kill_domain();
}
@@ -196,7 +194,7 @@ void __kill_domain(struct task_struct *p)
if ( !sched_rem_domain(p) )
return;
- DPRINTK("Killing domain %llu\n", p->domain);
+ DPRINTK("Killing domain %u\n", p->domain);
unlink_blkdev_info(p);
@@ -270,9 +268,9 @@ void stop_domain(void)
/* OK, this is grim, but helps speed up live migrate. When a domain stops,
kick Dom0 */
{
- struct task_struct *p;
- guest_schedule_to_run( p = find_domain_by_id(0ULL) );
- put_task_struct(p);
+ struct task_struct *p;
+ guest_schedule_to_run( p = find_domain_by_id(0ULL) );
+ put_task_struct(p);
}
__enter_scheduler();
@@ -355,7 +353,7 @@ struct pfn_info *alloc_domain_page(struct task_struct *p)
spin_lock(&p->page_list_lock);
if ( unlikely(p->tot_pages >= p->max_pages) )
{
- DPRINTK("Over-allocation for domain %llu: %u >= %u\n",
+ DPRINTK("Over-allocation for domain %u: %u >= %u\n",
p->domain, p->tot_pages, p->max_pages);
spin_unlock(&p->page_list_lock);
goto free_and_exit;
@@ -393,14 +391,14 @@ void free_domain_page(struct pfn_info *page)
if ( !(page->count_and_flags & PGC_zombie) )
{
page->tlbflush_timestamp = tlbflush_clock;
- if ( likely(p != NULL) )
- {
+ if ( likely(p != NULL) )
+ {
page->u.cpu_mask = 1 << p->processor;
spin_lock(&p->page_list_lock);
- list_del(&page->list);
- p->tot_pages--;
- spin_unlock(&p->page_list_lock);
- }
+ list_del(&page->list);
+ p->tot_pages--;
+ spin_unlock(&p->page_list_lock);
+ }
}
page->count_and_flags = 0;
@@ -533,16 +531,16 @@ unsigned int alloc_new_dom_mem(struct task_struct *p, unsigned int kbytes)
return -ENOMEM;
}
- /* initialise to machine_to_phys_mapping table to likely pfn */
- machine_to_phys_mapping[page-frame_table] = alloc_pfns;
+ /* initialise to machine_to_phys_mapping table to likely pfn */
+ machine_to_phys_mapping[page-frame_table] = alloc_pfns;
#ifndef NDEBUG
- {
- // initialise with magic marker if in DEBUG mode
- void * a = map_domain_mem( (page-frame_table)<<PAGE_SHIFT );
- memset( a, 0x80 | (char) p->domain, PAGE_SIZE );
- unmap_domain_mem( a );
- }
+ {
+ /* Initialise with magic marker if in DEBUG mode. */
+ void * a = map_domain_mem( (page-frame_table)<<PAGE_SHIFT );
+ memset( a, 0x80 | (char) p->domain, PAGE_SIZE );
+ unmap_domain_mem( a );
+ }
#endif
}
@@ -559,7 +557,7 @@ void release_task(struct task_struct *p)
ASSERT(p->state == TASK_DYING);
ASSERT(!p->has_cpu);
- DPRINTK("Releasing task %llu\n", p->domain);
+ DPRINTK("Releasing task %u\n", p->domain);
/*
* This frees up blkdev rings and vbd-access lists. Totally safe since
@@ -588,12 +586,12 @@ int final_setup_guestos(struct task_struct *p, dom0_builddomain_t *builddomain)
full_execution_context_t *c;
if ( (c = kmalloc(sizeof(*c), GFP_KERNEL)) == NULL )
- return -ENOMEM;
+ return -ENOMEM;
if ( test_bit(PF_CONSTRUCTED, &p->flags) )
{
rc = -EINVAL;
- goto out;
+ goto out;
}
if ( copy_from_user(c, builddomain->ctxt, sizeof(*c)) )
@@ -649,7 +647,7 @@ int final_setup_guestos(struct task_struct *p, dom0_builddomain_t *builddomain)
set_bit(PF_CONSTRUCTED, &p->flags);
-out:
+ out:
if (c) kfree(c);
return rc;
@@ -682,13 +680,13 @@ static int readelfimage_base_and_size(char *elfbase,
if ( (ehdr->e_phoff + (ehdr->e_phnum * ehdr->e_phentsize)) > elfsize )
{
- printk("ELF program headers extend beyond end of image.\n");
+ printk("ELF program headers extend beyond end of image.\n");
return -EINVAL;
}
if ( (ehdr->e_shoff + (ehdr->e_shnum * ehdr->e_shentsize)) > elfsize )
{
- printk("ELF section headers extend beyond end of image.\n");
+ printk("ELF section headers extend beyond end of image.\n");
return -EINVAL;
}
@@ -760,7 +758,7 @@ static int loadelfimage(char *elfbase)
{
phdr = (Elf_Phdr *)(elfbase + ehdr->e_phoff + (h*ehdr->e_phentsize));
if ( !is_loadable_phdr(phdr) )
- continue;
+ continue;
if ( phdr->p_filesz != 0 )
memcpy((char *)phdr->p_vaddr, elfbase + phdr->p_offset,
phdr->p_filesz);
@@ -1045,10 +1043,10 @@ int construct_dom0(struct task_struct *p,
if ( initrd_len != 0 )
{
- si->mod_start = vinitrd_start;
- si->mod_len = initrd_len;
- printk("Initrd len 0x%lx, start at 0x%08lx\n",
- si->mod_len, si->mod_start);
+ si->mod_start = vinitrd_start;
+ si->mod_len = initrd_len;
+ printk("Initrd len 0x%lx, start at 0x%08lx\n",
+ si->mod_len, si->mod_start);
}
dst = si->cmd_line;
diff --git a/xen/common/keyhandler.c b/xen/common/keyhandler.c
index 92248bcca6..7cd60e439f 100644
--- a/xen/common/keyhandler.c
+++ b/xen/common/keyhandler.c
@@ -22,20 +22,20 @@ void add_key_handler(u_char key, key_handler *handler, char *desc)
char *str;
if ( key_table[key].handler != NULL )
- printk("Warning: overwriting handler for key 0x%x\n", key);
+ printk("Warning: overwriting handler for key 0x%x\n", key);
key_table[key].handler = handler;
str = key_table[key].desc;
for ( i = 0; i < STR_MAX; i++ )
{
- if ( *desc != '\0' )
- *str++ = *desc++;
- else
+ if ( *desc != '\0' )
+ *str++ = *desc++;
+ else
break;
}
if ( i == STR_MAX )
- key_table[key].desc[STR_MAX-1] = '\0';
+ key_table[key].desc[STR_MAX-1] = '\0';
}
key_handler *get_key_handler(u_char key)
@@ -49,10 +49,10 @@ static void show_handlers(u_char key, void *dev_id, struct pt_regs *regs)
printk("'%c' pressed -> showing installed handlers\n", key);
for ( i = 0; i < KEY_MAX; i++ )
- if ( key_table[i].handler != NULL )
- printk(" key '%c' (ascii '%02x') => %s\n",
- (i<33 || i>126)?(' '):(i),i,
- key_table[i].desc);
+ if ( key_table[i].handler != NULL )
+ printk(" key '%c' (ascii '%02x') => %s\n",
+ (i<33 || i>126)?(' '):(i),i,
+ key_table[i].desc);
}
@@ -89,10 +89,10 @@ void do_task_queues(u_char key, void *dev_id, struct pt_regs *regs)
for_each_domain ( p )
{
- printk("Xen: DOM %llu, CPU %d [has=%c], state = ",
+ printk("Xen: DOM %u, CPU %d [has=%c], state = ",
p->domain, p->processor, p->has_cpu ? 'T':'F');
sched_prn_state(p ->state);
- printk(", hyp_events = %08x\n", p->hyp_events);
+ printk(", hyp_events = %08x\n", p->hyp_events);
s = p->shared_info;
printk("Guest: upcall_pend = %02x, upcall_mask = %02x\n",
s->vcpu_data[0].evtchn_upcall_pending,
@@ -123,8 +123,8 @@ void initialize_keytable(void)
/* first initialize key handler table */
for ( i = 0; i < KEY_MAX; i++ )
- key_table[i].handler = (key_handler *)NULL;
-
+ key_table[i].handler = (key_handler *)NULL;
+
/* setup own handlers */
add_key_handler('d', dump_registers, "dump registers");
add_key_handler('h', show_handlers, "show this message");
diff --git a/xen/common/memory.c b/xen/common/memory.c
index 5b03588b2c..e1ca785968 100644
--- a/xen/common/memory.c
+++ b/xen/common/memory.c
@@ -142,8 +142,8 @@
#include <asm/ldt.h>
#ifndef NDEBUG
-#define MEM_LOG(_f, _a...) \
- printk("DOM%llu: (file=memory.c, line=%d) " _f "\n", \
+#define MEM_LOG(_f, _a...) \
+ printk("DOM%u: (file=memory.c, line=%d) " _f "\n", \
current->domain , __LINE__ , ## _a )
#else
#define MEM_LOG(_f, _a...) ((void)0)
@@ -177,7 +177,6 @@ static struct {
#define DOP_RELOAD_LDT (1<<1) /* Reload the LDT shadow mapping. */
unsigned long deferred_ops;
unsigned long cr0;
- domid_t subject_id;
/* General-Purpose Subject, Page-Table Subject */
struct task_struct *gps, *pts;
} percpu_info[NR_CPUS] __cacheline_aligned;
@@ -219,9 +218,9 @@ void __init init_frametable(unsigned long nr_pages)
mfn < virt_to_phys((void *)RDWR_MPT_VIRT_END)>>PAGE_SHIFT;
mfn++ )
{
- frame_table[mfn].count_and_flags = 1 | PGC_allocated;
- frame_table[mfn].type_and_flags = 1 | PGT_gdt_page; /* non-RW type */
- frame_table[mfn].u.domain = &idle0_task;
+ frame_table[mfn].count_and_flags = 1 | PGC_allocated;
+ frame_table[mfn].type_and_flags = 1 | PGT_gdt_page; /* non-RW type */
+ frame_table[mfn].u.domain = &idle0_task;
}
}
@@ -427,9 +426,9 @@ static int get_page_from_l1e(l1_pgentry_t l1e)
if ( unlikely(!pfn_is_ram(pfn)) )
{
if ( IS_PRIV(current) )
- return 1;
+ return 1;
- if ( IS_CAPABLE_PHYSDEV(current) )
+ if ( IS_CAPABLE_PHYSDEV(current) )
return domain_iomem_in_pfn(current, pfn);
MEM_LOG("Non-privileged attempt to map I/O space %08lx", pfn);
@@ -805,6 +804,7 @@ static int do_extended_command(unsigned long ptr, unsigned long val)
unsigned long old_base_pfn;
struct pfn_info *page = &frame_table[pfn];
struct task_struct *p = current, *q;
+ domid_t domid;
switch ( cmd )
{
@@ -914,17 +914,12 @@ static int do_extended_command(unsigned long ptr, unsigned long val)
break;
}
- case MMUEXT_SET_SUBJECTDOM_L:
- percpu_info[cpu].subject_id = (domid_t)((ptr&~0xFFFF)|(val>>16));
- break;
-
- case MMUEXT_SET_SUBJECTDOM_H:
- percpu_info[cpu].subject_id |=
- ((domid_t)((ptr&~0xFFFF)|(val>>16)))<<32;
+ case MMUEXT_SET_SUBJECTDOM:
+ domid = ((domid_t)((ptr&~0xFFFF)|(val>>16)));
if ( !IS_PRIV(p) )
{
- MEM_LOG("Dom %llu has no privilege to set subject domain",
+ MEM_LOG("Dom %u has no privilege to set subject domain",
p->domain);
okay = 0;
}
@@ -932,13 +927,12 @@ static int do_extended_command(unsigned long ptr, unsigned long val)
{
if ( percpu_info[cpu].gps != NULL )
put_task_struct(percpu_info[cpu].gps);
- percpu_info[cpu].gps = find_domain_by_id(
- percpu_info[cpu].subject_id);
+ percpu_info[cpu].gps = find_domain_by_id(domid);
percpu_info[cpu].pts = (val & SET_PAGETABLE_SUBJECTDOM) ?
percpu_info[cpu].gps : NULL;
if ( percpu_info[cpu].gps == NULL )
{
- MEM_LOG("Unknown domain '%llu'", percpu_info[cpu].subject_id);
+ MEM_LOG("Unknown domain '%u'", domid);
okay = 0;
}
}
@@ -947,7 +941,7 @@ static int do_extended_command(unsigned long ptr, unsigned long val)
case MMUEXT_REASSIGN_PAGE:
if ( unlikely(!IS_PRIV(p)) )
{
- MEM_LOG("Dom %llu has no privilege to reassign page ownership",
+ MEM_LOG("Dom %u has no privilege to reassign page ownership",
p->domain);
okay = 0;
}
@@ -1102,10 +1096,12 @@ int do_mmu_update(mmu_update_t *ureqs, int count, int *success_count)
machine_to_phys_mapping[pfn] = req.val;
okay = 1;
- /* if in log dirty shadow mode, mark the corresponding
- psuedo-physical page as dirty */
- if( unlikely(current->mm.shadow_mode == SHM_logdirty) )
- mark_dirty( &current->mm, pfn );
+ /*
+ * If in log-dirty mode, mark the corresponding pseudo-physical
+ * page as dirty.
+ */
+ if( unlikely(current->mm.shadow_mode == SHM_logdirty) )
+ mark_dirty( &current->mm, pfn );
put_page(&frame_table[pfn]);
break;
@@ -1155,7 +1151,7 @@ int do_mmu_update(mmu_update_t *ureqs, int count, int *success_count)
}
if ( unlikely(success_count != NULL) )
- put_user(count, success_count);
+ put_user(count, success_count);
return rc;
}
@@ -1241,7 +1237,7 @@ int do_update_va_mapping_otherdomain(unsigned long page_nr,
percpu_info[cpu].gps = p = find_domain_by_id(domid);
if ( unlikely(p == NULL) )
{
- MEM_LOG("Unknown domain '%llu'", domid);
+ MEM_LOG("Unknown domain '%u'", domid);
return -ESRCH;
}
diff --git a/xen/common/network.c b/xen/common/network.c
index befc929474..255feae2af 100644
--- a/xen/common/network.c
+++ b/xen/common/network.c
@@ -370,12 +370,12 @@ void print_net_rule(net_rule_t *r)
if ( r->src_dom == VIF_SPECIAL )
printk("=] src_dom/idx : %s\n", idx_to_name(r->src_idx));
else
- printk("=] src_dom/idx : %llu/%u\n", r->src_dom, r->src_idx);
+ printk("=] src_dom/idx : %u/%u\n", r->src_dom, r->src_idx);
if ( r->dst_dom == VIF_SPECIAL )
printk("=] dst_dom/idx : %s\n", idx_to_name(r->dst_idx));
else
- printk("=] dst_dom/idx : %llu/%u\n", r->dst_dom, r->dst_idx);
+ printk("=] dst_dom/idx : %u/%u\n", r->dst_dom, r->dst_idx);
printk("=] action : %u\n", r->action);
}
@@ -530,8 +530,7 @@ net_vif_t *net_get_target_vif(u8 *data, unsigned int len, net_vif_t *src_vif)
return target;
drop:
- printk("VIF%llu/%u: pkt to drop!\n",
- src_dom, src_idx);
+ DPRINTK("VIF%u/%u: pkt to drop!\n", src_dom, src_idx);
return VIF_DROP;
}
diff --git a/xen/common/physdev.c b/xen/common/physdev.c
index 61b7b22cb2..d7e8c7cb93 100644
--- a/xen/common/physdev.c
+++ b/xen/common/physdev.c
@@ -189,7 +189,7 @@ int physdev_pci_access_modify(
* this will allow all processes in that domain access to those
* ports as well. This will do for now, since driver domains don't
* run untrusted processes! */
- INFO("Giving domain %llu IO resources (%lx - %lx) "
+ INFO("Giving domain %u IO resources (%lx - %lx) "
"for device %s\n", dom, r->start, r->end, pdev->slot_name);
for ( j = r->start; j < r->end + 1; j++ )
{
@@ -204,7 +204,7 @@ int physdev_pci_access_modify(
}
/* rights to IO memory regions are checked when the domain maps them */
- }
+ }
out:
put_task_struct(p);
return rc;
@@ -217,7 +217,7 @@ int domain_iomem_in_pfn(struct task_struct *p, unsigned long pfn)
int ret = 0;
struct list_head *l;
- VERBOSE_INFO("Checking if physdev-capable domain %llu needs access to "
+ VERBOSE_INFO("Checking if physdev-capable domain %u needs access to "
"pfn %08lx\n", p->domain, pfn);
spin_lock(&p->pcidev_lock);
@@ -245,7 +245,7 @@ int domain_iomem_in_pfn(struct task_struct *p, unsigned long pfn)
spin_unlock(&p->pcidev_lock);
- VERBOSE_INFO("Domain %llu %s mapping of pfn %08lx\n",
+ VERBOSE_INFO("Domain %u %s mapping of pfn %08lx\n",
p->domain, ret ? "allowed" : "disallowed", pfn);
return ret;
@@ -300,8 +300,8 @@ inline static int check_dev_acc (struct task_struct *p,
* to work out the length of the io region a device probe typically does:
* 1) a = read_base_addr_reg()
* 2) write_base_addr_reg(0xffffffff)
- * 3) b = read_base_addr_reg() // device zeros lower bits
- * 4) write_base_addr_reg(a) // restore original value
+ * 3) b = read_base_addr_reg() [device zeros lower bits]
+ * 4) write_base_addr_reg(a) [restore original value]
* this function fakes out step 2-4. *no* writes are made to the device.
*
* phys_dev_t contains a bit field (a bit for each base address register).
@@ -328,7 +328,7 @@ static int do_base_address_access(phys_dev_t *pdev, int acc, int idx,
/* We could set *val to some value but the guest may well be in trouble
* anyway if this write fails. Hopefully the printk will give us a
* clue what went wrong. */
- printk("Guest %llu attempting sub-dword %s to BASE_ADDRESS %d\n",
+ printk("Guest %u attempting sub-dword %s to BASE_ADDRESS %d\n",
pdev->owner->domain, (acc == ACC_READ) ? "read" : "write", idx);
return -EPERM;
diff --git a/xen/common/sched_atropos.c b/xen/common/sched_atropos.c
index d01e4ecd4b..dfa923da3b 100644
--- a/xen/common/sched_atropos.c
+++ b/xen/common/sched_atropos.c
@@ -513,7 +513,7 @@ task_slice_t ksched_scheduler(s_time_t time)
cur_sdom->min_slice = newtime - time;
DOM_INFO(cur_sdom)->reason = reason;
- TRACE_2D(0, (cur_sdom->domain >> 32), ((u32)cur_sdom->domain));
+ TRACE_1D(0, cur_sdom->domain);
return ret;
}
diff --git a/xen/common/sched_bvt.c b/xen/common/sched_bvt.c
index a4b76b42f5..dd8e70db59 100644
--- a/xen/common/sched_bvt.c
+++ b/xen/common/sched_bvt.c
@@ -205,10 +205,10 @@ int bvt_adjdom(struct task_struct *p,
struct bvt_dom_info *inf = BVT_INFO(p);
-
- printk("Get domain %lld bvt mcu_adv=%ld, warp=%ld, warpl=%ld, warpu=%ld\n",
- p->domain, inf->mcu_advance, inf->warp,
- inf->warpl, inf->warpu );
+ DPRINTK("Get domain %u bvt mcu_adv=%ld, warp=%ld, "
+ "warpl=%ld, warpu=%ld\n",
+ p->domain, inf->mcu_advance, inf->warp,
+ inf->warpl, inf->warpu );
/* Sanity -- this can avoid divide-by-zero. */
if ( mcu_adv == 0 )
@@ -220,9 +220,10 @@ int bvt_adjdom(struct task_struct *p,
inf->warpl = warpl;
inf->warpu = warpu;
- printk("Set domain %lld bvt mcu_adv=%ld, warp=%ld, warpl=%ld, warpu=%ld\n",
- p->domain, inf->mcu_advance, inf->warp,
- inf->warpl, inf->warpu );
+ DPRINTK("Set domain %u bvt mcu_adv=%ld, warp=%ld, "
+ "warpl=%ld, warpu=%ld\n",
+ p->domain, inf->mcu_advance, inf->warp,
+ inf->warpl, inf->warpu );
spin_unlock_irqrestore(&schedule_lock[p->processor], flags);
}
diff --git a/xen/common/schedule.c b/xen/common/schedule.c
index b5e4219d6c..f3f6ad89e1 100644
--- a/xen/common/schedule.c
+++ b/xen/common/schedule.c
@@ -264,7 +264,7 @@ long do_sched_op(unsigned long op)
case SCHEDOP_exit:
{
- DPRINTK("DOM%llu killed itself!\n", current->domain);
+ DPRINTK("DOM%u killed itself!\n", current->domain);
DPRINTK(" EIP == %08lx\n", get_execution_context()->eip);
kill_domain();
break;
@@ -272,7 +272,7 @@ long do_sched_op(unsigned long op)
case SCHEDOP_stop:
{
- DPRINTK("DOM%llu stopped itself!\n", current->domain);
+ DPRINTK("DOM%u stopped itself!\n", current->domain);
DPRINTK(" EIP == %08lx\n", get_execution_context()->eip);
stop_domain();
break;
@@ -673,7 +673,7 @@ static void dump_rqueue(struct list_head *queue, char *name)
(unsigned long) queue->next, (unsigned long) queue->prev);
list_for_each (list, queue) {
p = list_entry(list, struct task_struct, run_list);
- printk("%3d: %llu has=%c ", loop++, p->domain, p->has_cpu ? 'T':'F');
+ printk("%3d: %u has=%c ", loop++, p->domain, p->has_cpu ? 'T':'F');
SCHED_OP(dump_runq_el, p);
printk("c=0x%X%08X\n", (u32)(p->cpu_time>>32), (u32)p->cpu_time);
printk(" l: %lx n: %lx p: %lx\n",
diff --git a/xen/drivers/block/xen_block.c b/xen/drivers/block/xen_block.c
index 6901262cb8..781bca177b 100644
--- a/xen/drivers/block/xen_block.c
+++ b/xen/drivers/block/xen_block.c
@@ -579,7 +579,7 @@ static void dump_blockq(u_char key, void *dev_id, struct pt_regs *regs)
read_lock_irqsave(&tasklist_lock, flags);
for_each_domain ( p )
{
- printk("Domain: %llu\n", p->domain);
+ printk("Domain: %u\n", p->domain);
blk_ring = p->blk_ring_base;
printk(" req_prod:0x%08x, req_cons:0x%08x resp_prod:0x%08x/"
"0x%08x on_list=%d\n",
diff --git a/xen/drivers/block/xen_vbd.c b/xen/drivers/block/xen_vbd.c
index 8d150f5872..dc1154a2f9 100644
--- a/xen/drivers/block/xen_vbd.c
+++ b/xen/drivers/block/xen_vbd.c
@@ -86,7 +86,7 @@ long vbd_create(vbd_create_t *create)
if ( unlikely((p = find_domain_by_id(create->domain)) == NULL) )
{
- DPRINTK("vbd_create attempted for non-existent domain %llu\n",
+ DPRINTK("vbd_create attempted for non-existent domain %u\n",
create->domain);
return -EINVAL;
}
@@ -166,7 +166,7 @@ long vbd_grow(vbd_grow_t *grow)
if ( unlikely((p = find_domain_by_id(grow->domain)) == NULL) )
{
- DPRINTK("vbd_grow: attempted for non-existent domain %llu\n",
+ DPRINTK("vbd_grow: attempted for non-existent domain %u\n",
grow->domain);
return -EINVAL;
}
@@ -192,7 +192,7 @@ long vbd_shrink(vbd_shrink_t *shrink)
if ( (p = find_domain_by_id(shrink->domain)) == NULL )
{
- DPRINTK("vbd_shrink attempted for non-existent domain %llu\n",
+ DPRINTK("vbd_shrink attempted for non-existent domain %u\n",
shrink->domain);
return -EINVAL;
}
@@ -252,7 +252,7 @@ long vbd_setextents(vbd_setextents_t *setextents)
if ( (p = find_domain_by_id(setextents->domain)) == NULL )
{
- DPRINTK("vbd_setextents attempted for non-existent domain %llu\n",
+ DPRINTK("vbd_setextents attempted for non-existent domain %u\n",
setextents->domain);
return -EINVAL;
}
@@ -346,7 +346,7 @@ long vbd_delete(vbd_delete_t *delete)
if ( (p = find_domain_by_id(delete->domain)) == NULL )
{
- DPRINTK("vbd_delete attempted for non-existent domain %llu\n",
+ DPRINTK("vbd_delete attempted for non-existent domain %u\n",
delete->domain);
return -EINVAL;
}
@@ -530,7 +530,7 @@ long vbd_probe(vbd_probe_t *probe)
if ( (probe->domain != VBD_PROBE_ALL) &&
((p = find_domain_by_id(probe->domain)) == NULL) )
{
- DPRINTK("vbd_probe attempted for non-existent domain %llu\n",
+ DPRINTK("vbd_probe attempted for non-existent domain %u\n",
probe->domain);
return -EINVAL;
}
@@ -581,7 +581,7 @@ long vbd_info(vbd_info_t *info)
if ( (p = find_domain_by_id(info->domain)) == NULL )
{
- DPRINTK("vbd_info attempted for non-existent domain %llu\n",
+ DPRINTK("vbd_info attempted for non-existent domain %u\n",
info->domain);
return -EINVAL;
}
@@ -654,7 +654,7 @@ int vbd_translate(phys_seg_t *pseg, struct task_struct *p, int operation)
goto found;
}
- DPRINTK("vbd_translate; domain %llu attempted to access "
+ DPRINTK("vbd_translate; domain %u attempted to access "
"non-existent VBD.\n", p->domain);
spin_unlock(&p->vbd_lock);
diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c
index 2744ed0c75..4844b626a5 100644
--- a/xen/drivers/char/console.c
+++ b/xen/drivers/char/console.c
@@ -43,8 +43,8 @@ spinlock_t console_lock = SPIN_LOCK_UNLOCKED;
*/
/* VGA text (mode 3) definitions. */
-#define COLUMNS 80
-#define LINES 25
+#define COLUMNS 80
+#define LINES 25
#define ATTRIBUTE 7
/* Clear the screen and initialize VIDEO, XPOS and YPOS. */
@@ -209,7 +209,7 @@ long read_console_ring(unsigned long str, unsigned int count, unsigned cmd)
return -EFAULT;
if ( cmd & CONSOLE_RING_CLEAR )
- console_ring.len = 0;
+ console_ring.len = 0;
return len;
}
@@ -418,7 +418,7 @@ long do_console_write(char *str, unsigned int count)
return -EFAULT;
safe_str[count] = '\0';
- sprintf(line_header, "DOM%llu: ", current->domain);
+ sprintf(line_header, "DOM%u: ", current->domain);
p = safe_str;
while ( *p != '\0' )
@@ -447,7 +447,7 @@ long do_console_write(char *str, unsigned int count)
#else
if ( !test_and_set_bit(PF_CONSOLEWRITEBUG, &current->flags) )
{
- printk("DOM%llu is attempting to use the deprecated "
+ printk("DOM%u is attempting to use the deprecated "
"HYPERVISOR_console_write() interface.\n", current->domain);
printk(" - For testing, create a debug build of Xen\n");
printk(" - For production, your OS must use the new console model\n");
diff --git a/xen/include/hypervisor-ifs/dom0_ops.h b/xen/include/hypervisor-ifs/dom0_ops.h
index d5de8a8a85..cb16d58afa 100644
--- a/xen/include/hypervisor-ifs/dom0_ops.h
+++ b/xen/include/hypervisor-ifs/dom0_ops.h
@@ -19,7 +19,7 @@
* This makes sure that old versions of dom0 tools will stop working in a
* well-defined way (rather than crashing the machine, for instance).
*/
-#define DOM0_INTERFACE_VERSION 0xAAAA000D
+#define DOM0_INTERFACE_VERSION 0xAAAA000E
#define MAX_DOMAIN_NAME 16
@@ -29,6 +29,7 @@
typedef struct {
/* IN variables. */
domid_t domain; /* 0 */
+ u32 __pad;
memory_t max_pfns; /* 8 */
MEMORY_PADDING;
void *buffer; /* 16 */
@@ -56,20 +57,20 @@ typedef struct {
u32 __pad; /* 28 */
/* OUT parameters. */
domid_t domain; /* 32 */
-} PACKED dom0_createdomain_t; /* 40 bytes */
+} PACKED dom0_createdomain_t; /* 36 bytes */
#define DOM0_DESTROYDOMAIN 9
typedef struct {
/* IN variables. */
domid_t domain; /* 0 */
- u32 force; /* 8 */
-} PACKED dom0_destroydomain_t; /* 12 bytes */
+ u32 force; /* 4 */
+} PACKED dom0_destroydomain_t; /* 8 bytes */
#define DOM0_STARTDOMAIN 10
typedef struct {
/* IN parameters. */
domid_t domain; /* 0 */
-} PACKED dom0_startdomain_t; /* 8 bytes */
+} PACKED dom0_startdomain_t; /* 4 bytes */
#define DOM0_STOPDOMAIN 11
typedef struct {
@@ -77,26 +78,27 @@ typedef struct {
domid_t domain; /* 0 */
/* hack to indicate that you want to wait for other domain -- replace
with proper sychronous stop soon! */
- u32 sync; /* 8 */
-} PACKED dom0_stopdomain_t; /* 12 bytes */
+ u32 sync; /* 4 */
+} PACKED dom0_stopdomain_t; /* 8 bytes */
#define DOM0_GETDOMAININFO 12
typedef struct {
/* IN variables. */
domid_t domain; /* 0 */
+ u32 __pad;
full_execution_context_t *ctxt; /* 8 */
MEMORY_PADDING;
/* OUT variables. */
- char name[MAX_DOMAIN_NAME]; /* 16 */
- u32 processor; /* 32 */
- u32 has_cpu; /* 36 */
+ u8 name[MAX_DOMAIN_NAME]; /* 16 */
+ u32 processor; /* 32 */
+ u32 has_cpu; /* 36 */
#define DOMSTATE_ACTIVE 0
#define DOMSTATE_STOPPED 1
- u32 state; /* 40 */
- u32 hyp_events; /* 44 */
- u32 tot_pages; /* 48 */
- u32 max_pages; /* 52 */
- u64 cpu_time; /* 56 */
+ u32 state; /* 40 */
+ u32 hyp_events; /* 44 */
+ u32 tot_pages; /* 48 */
+ u32 max_pages; /* 52 */
+ u64 cpu_time; /* 56 */
memory_t shared_info_frame; /* 64: MFN of shared_info struct */
MEMORY_PADDING;
} PACKED dom0_getdomaininfo_t; /* 72 bytes */
@@ -104,19 +106,18 @@ typedef struct {
#define DOM0_BUILDDOMAIN 13
typedef struct {
/* IN variables. */
- domid_t domain; /* 0 */
- u32 num_vifs;/* 8 */
- u32 __pad; /* 12 */
+ domid_t domain; /* 0 */
+ u32 num_vifs; /* 4 */
/* IN/OUT parameters */
- full_execution_context_t *ctxt; /* 16 */
+ full_execution_context_t *ctxt; /* 8 */
MEMORY_PADDING;
-} PACKED dom0_builddomain_t; /* 24 bytes */
+} PACKED dom0_builddomain_t; /* 16 bytes */
#define DOM0_IOPL 14
typedef struct {
domid_t domain; /* 0 */
- u32 iopl; /* 8 */
-} PACKED dom0_iopl_t; /* 12 bytes */
+ u32 iopl; /* 4 */
+} PACKED dom0_iopl_t; /* 8 bytes */
#define DOM0_MSR 15
typedef struct {
@@ -135,17 +136,17 @@ typedef struct {
typedef struct {
/* IN variables. */
domid_t domain; /* 0 */
- u8 opcode; /* 8 */
+ u8 opcode; /* 4 */
u8 __pad0, __pad1, __pad2;
- u32 in1; /* 12 */
- u32 in2; /* 16 */
- u32 in3; /* 20 */
- u32 in4; /* 24 */
+ u32 in1; /* 8 */
+ u32 in2; /* 12 */
+ u32 in3; /* 16 */
+ u32 in4; /* 20 */
/* OUT variables. */
- u32 status; /* 28 */
- u32 out1; /* 32 */
- u32 out2; /* 36 */
-} PACKED dom0_debug_t; /* 40 bytes */
+ u32 status; /* 24 */
+ u32 out1; /* 28 */
+ u32 out2; /* 32 */
+} PACKED dom0_debug_t; /* 36 bytes */
/*
* Set clock such that it would read <secs,usecs> after 00:00:00 UTC,
@@ -174,8 +175,8 @@ typedef struct {
domid_t domain; /* 8: To which domain does the frame belong? */
/* OUT variables. */
/* Is the page PINNED to a type? */
- u32 type; /* 16: see above type defs */
-} PACKED dom0_getpageframeinfo_t; /* 20 bytes */
+ u32 type; /* 12: see above type defs */
+} PACKED dom0_getpageframeinfo_t; /* 16 bytes */
/*
* Read console content from Xen buffer ring.
@@ -195,8 +196,8 @@ typedef struct {
typedef struct {
/* IN variables. */
domid_t domain; /* 0 */
- s32 cpu; /* 8: -1 implies unpin */
-} PACKED dom0_pincpudomain_t; /* 12 bytes */
+ s32 cpu; /* 4: -1 implies unpin */
+} PACKED dom0_pincpudomain_t; /* 8 bytes */
/* Get trace buffers physical base pointer */
#define DOM0_GETTBUFS 21
@@ -229,11 +230,11 @@ typedef struct {
typedef struct {
/* IN variables. */
domid_t domain; /* 0 */
- u32 bus; /* 8 */
- u32 dev; /* 12 */
- u32 func; /* 16 */
- u32 enable; /* 20 */
-} PACKED dom0_pcidev_access_t; /* 24 bytes */
+ u32 bus; /* 4 */
+ u32 dev; /* 8 */
+ u32 func; /* 12 */
+ u32 enable; /* 16 */
+} PACKED dom0_pcidev_access_t; /* 20 bytes */
/*
* Get the ID of the current scheduler.
@@ -259,31 +260,31 @@ typedef struct {
typedef struct {
/* IN variables. */
domid_t domain; /* 0 */
- u32 op; /* 8 */
- u32 __pad; /* 12 */
- unsigned long *dirty_bitmap; /* 16: pointer to locked buffer */
+ u32 op; /* 4 */
+ unsigned long *dirty_bitmap; /* 8: pointer to locked buffer */
MEMORY_PADDING;
/* IN/OUT variables. */
- memory_t pages; /* 24: size of buffer, updated with actual size */
+ memory_t pages; /* 16: size of buffer, updated with actual size */
MEMORY_PADDING;
/* OUT variables. */
- memory_t fault_count; /* 32 */
+ memory_t fault_count; /* 24 */
MEMORY_PADDING;
- memory_t dirty_count; /* 40 */
+ memory_t dirty_count; /* 32 */
MEMORY_PADDING;
-} PACKED dom0_shadow_control_t; /* 48 bytes */
+} PACKED dom0_shadow_control_t; /* 40 bytes */
#define DOM0_SETDOMAINNAME 26
typedef struct {
/* IN variables. */
domid_t domain; /* 0 */
- char name[MAX_DOMAIN_NAME]; /* 8 */
-} PACKED dom0_setdomainname_t; /* 24 bytes */
+ u8 name[MAX_DOMAIN_NAME]; /* 4 */
+} PACKED dom0_setdomainname_t; /* 20 bytes */
#define DOM0_SETDOMAININITIALMEM 27
typedef struct {
/* IN variables. */
domid_t domain; /* 0 */
+ u32 __pad;
memory_t initial_memkb; /* 8 */
MEMORY_PADDING;
} PACKED dom0_setdomaininitialmem_t; /* 16 bytes */
@@ -292,6 +293,7 @@ typedef struct {
typedef struct {
/* IN variables. */
domid_t domain; /* 0 */
+ u32 __pad;
memory_t max_memkb; /* 8 */
MEMORY_PADDING;
} PACKED dom0_setdomainmaxmem_t; /* 16 bytes */
@@ -300,6 +302,7 @@ typedef struct {
typedef struct {
/* IN variables. */
domid_t domain; /* 0 */
+ u32 __pad;
memory_t num; /* 8 */
MEMORY_PADDING;
/* IN/OUT variables. */
diff --git a/xen/include/hypervisor-ifs/event_channel.h b/xen/include/hypervisor-ifs/event_channel.h
index 1c84fb3c22..5868cab6fd 100644
--- a/xen/include/hypervisor-ifs/event_channel.h
+++ b/xen/include/hypervisor-ifs/event_channel.h
@@ -19,10 +19,10 @@
#define EVTCHNOP_bind_interdomain 0
typedef struct {
/* IN parameters. */
- domid_t dom1, dom2; /* 0, 8 */
+ domid_t dom1, dom2; /* 0, 4 */
/* OUT parameters. */
- u32 port1, port2; /* 16, 20 */
-} PACKED evtchn_bind_interdomain_t; /* 24 bytes */
+ u32 port1, port2; /* 8, 12 */
+} PACKED evtchn_bind_interdomain_t; /* 16 bytes */
/*
* EVTCHNOP_bind_virq: Bind a local event channel to IRQ <irq>.
@@ -65,9 +65,9 @@ typedef struct {
typedef struct {
/* IN parameters. */
domid_t dom; /* 0 */
- u32 port; /* 8 */
+ u32 port; /* 4 */
/* No OUT parameters. */
-} PACKED evtchn_close_t; /* 12 bytes */
+} PACKED evtchn_close_t; /* 8 bytes */
/*
* EVTCHNOP_send: Send an event to the remote end of the channel whose local
@@ -92,23 +92,23 @@ typedef struct {
typedef struct {
/* IN parameters */
domid_t dom; /* 0 */
- u32 port; /* 8 */
+ u32 port; /* 4 */
/* OUT parameters */
#define EVTCHNSTAT_closed 0 /* Chennel is not in use. */
#define EVTCHNSTAT_unbound 1 /* Channel is not bound to a source. */
#define EVTCHNSTAT_interdomain 2 /* Channel is connected to remote domain. */
#define EVTCHNSTAT_pirq 3 /* Channel is bound to a phys IRQ line. */
#define EVTCHNSTAT_virq 4 /* Channel is bound to a virtual IRQ line */
- u32 status; /* 12 */
- union {
+ u32 status; /* 8 */
+ union { /* 12 */
struct {
- domid_t dom; /* 16 */
- u32 port; /* 24 */
+ domid_t dom; /* 12 */
+ u32 port; /* 16 */
} PACKED interdomain; /* EVTCHNSTAT_interdomain */
- u32 pirq; /* EVTCHNSTAT_pirq */ /* 16 */
- u32 virq; /* EVTCHNSTAT_virq */ /* 16 */
+ u32 pirq; /* EVTCHNSTAT_pirq */ /* 12 */
+ u32 virq; /* EVTCHNSTAT_virq */ /* 12 */
} PACKED u;
-} PACKED evtchn_status_t; /* 28 bytes */
+} PACKED evtchn_status_t; /* 20 bytes */
typedef struct {
u32 cmd; /* EVTCHNOP_* */ /* 0 */
@@ -120,8 +120,8 @@ typedef struct {
evtchn_close_t close;
evtchn_send_t send;
evtchn_status_t status;
- u8 __dummy[32];
+ u8 __dummy[24];
} PACKED u;
-} PACKED evtchn_op_t; /* 40 bytes */
+} PACKED evtchn_op_t; /* 32 bytes */
#endif /* __HYPERVISOR_IFS__EVENT_CHANNEL_H__ */
diff --git a/xen/include/hypervisor-ifs/hypervisor-if.h b/xen/include/hypervisor-ifs/hypervisor-if.h
index 66b06ae1d6..010b269c81 100644
--- a/xen/include/hypervisor-ifs/hypervisor-if.h
+++ b/xen/include/hypervisor-ifs/hypervisor-if.h
@@ -84,14 +84,14 @@
* This domain that must own all non-page-table pages that are involved in
* MMU updates. By default it is the domain that executes mmu_update(). If the
* caller has sufficient privilege then it can be changed by executing
- * MMUEXT_SET_SUBJECTDOM_{L,H}.
+ * MMUEXT_SET_SUBJECTDOM.
*
* PTS (Page-Table Subject)
* ------------------------
* This domain must own all the page-table pages that are subject to MMU
* updates. By default it is the domain that executes mmu_update(). If the
* caller has sufficient privilege then it can be changed by executing
- * MMUEXT_SET_SUBJECTDOM_H with val[14] (SET_PAGETABLE_SUBJECTDOM) set.
+ * MMUEXT_SET_SUBJECTDOM with val[14] (SET_PAGETABLE_SUBJECTDOM) set.
*
* ptr[1:0] == MMU_NORMAL_PT_UPDATE:
* Updates an entry in a page table.
@@ -122,13 +122,9 @@
* ptr[:2] -- linear address of LDT base (NB. must be page-aligned)
* val[:8] -- number of entries in LDT
*
- * val[7:0] == MMUEXT_SET_SUBJECTDOM_L:
- * (ptr[31:15],val[31:15]) -- dom[31:0]
- *
- * val[7:0] == MMUEXT_SET_SUBJECTDOM_H:
+ * val[7:0] == MMUEXT_SET_SUBJECTDOM:
* val[14] -- if TRUE then sets the PTS in addition to the GPS.
- * (ptr[31:15],val[31:15]) -- dom[63:32]
- * NB. This command must be immediately preceded by SET_SUBJECTDOM_L.
+ * (ptr[31:15],val[31:15]) -- dom[31:0]
*
* val[7:0] == MMUEXT_REASSIGN_PAGE:
* ptr[:2] -- machine address within page to be reassigned to the GPS.
@@ -156,12 +152,10 @@
#define MMUEXT_TLB_FLUSH 6 /* ptr = NULL */
#define MMUEXT_INVLPG 7 /* ptr = VA to invalidate */
#define MMUEXT_SET_LDT 8 /* ptr = VA of table; val = # entries */
-/* NB. MMUEXT_SET_SUBJECTDOM must consist of *_L followed immediately by *_H */
-#define MMUEXT_SET_SUBJECTDOM_L 9 /* (ptr[31:15],val[31:15]) = dom[31:0] */
-#define MMUEXT_SET_SUBJECTDOM_H 10 /* (ptr[31:15],val[31:15]) = dom[63:32] */
-#define SET_PAGETABLE_SUBJECTDOM (1<<14) /* OR into 'val' arg of SUBJECTDOM_H*/
-#define MMUEXT_REASSIGN_PAGE 11
-#define MMUEXT_RESET_SUBJECTDOM 12
+#define MMUEXT_SET_SUBJECTDOM 9 /* (ptr[31:15],val[31:15]) = dom[31:0] */
+#define SET_PAGETABLE_SUBJECTDOM (1<<14) /* OR into 'val' arg of SUBJECTDOM */
+#define MMUEXT_REASSIGN_PAGE 10
+#define MMUEXT_RESET_SUBJECTDOM 11
#define MMUEXT_CMD_MASK 255
#define MMUEXT_CMD_SHIFT 8
@@ -192,9 +186,9 @@
#ifndef __ASSEMBLY__
-typedef u64 domid_t;
+typedef u32 domid_t;
/* DOMID_SELF is used in certain contexts to refer to oneself. */
-#define DOMID_SELF (~1ULL)
+#define DOMID_SELF (0x7FFFFFFEU)
#include "network.h"
#include "block.h"
diff --git a/xen/include/hypervisor-ifs/network.h b/xen/include/hypervisor-ifs/network.h
index 7b00a5369a..eb3b42a4c0 100644
--- a/xen/include/hypervisor-ifs/network.h
+++ b/xen/include/hypervisor-ifs/network.h
@@ -141,7 +141,7 @@ typedef struct net_rule_st
} net_rule_t;
/* These are specified in the 'idx' if the 'dom' is SPECIAL. */
-#define VIF_SPECIAL (~0ULL)
+#define VIF_SPECIAL (0x7FFFFFFFU)
#define VIF_UNKNOWN_INTERFACE 0
#define VIF_PHYSICAL_INTERFACE 1
#define VIF_ANY_INTERFACE 2
diff --git a/xen/include/hypervisor-ifs/sched_ctl.h b/xen/include/hypervisor-ifs/sched_ctl.h
index 641ad2c192..34e1d3866e 100644
--- a/xen/include/hypervisor-ifs/sched_ctl.h
+++ b/xen/include/hypervisor-ifs/sched_ctl.h
@@ -42,9 +42,10 @@ struct sched_ctl_cmd
struct sched_adjdom_cmd
{
- u32 sched_id; /* 0 */
- u32 direction; /* 4 */
+ u32 sched_id; /* 0 */
+ u32 direction; /* 4 */
domid_t domain; /* 8 */
+ u32 __pad;
union { /* 16 */
struct bvt_adjdom
{
diff --git a/xen/include/hypervisor-ifs/vbd.h b/xen/include/hypervisor-ifs/vbd.h
index adf24e9682..9d68da62f4 100644
--- a/xen/include/hypervisor-ifs/vbd.h
+++ b/xen/include/hypervisor-ifs/vbd.h
@@ -60,7 +60,7 @@ typedef struct _vbd_delete {
u16 vdevice; /* 16 bit id domain refers to VBD as */
} vbd_delete_t;
-#define VBD_PROBE_ALL (~0ULL)
+#define VBD_PROBE_ALL (0x7FFFFFFFU)
typedef struct _vbd_probe {
domid_t domain; /* domain in question or VBD_PROBE_ALL */
xen_disk_info_t xdi; /* where's our space for VBD/disk info */
diff --git a/xen/include/xen/mm.h b/xen/include/xen/mm.h
index ecb73627a3..5202c60d4c 100644
--- a/xen/include/xen/mm.h
+++ b/xen/include/xen/mm.h
@@ -164,8 +164,11 @@ static inline int get_page(struct pfn_info *page,
unlikely(x & PGC_zombie) || /* Zombie? */
unlikely(p != domain) ) /* Wrong owner? */
{
- DPRINTK("Error pfn %08lx: ed=%p(%lld), sd=%p(%lld), caf=%08x, taf=%08x\n",
- page_to_pfn(page), domain, (domain)?domain->domain:999, p, (p && !((x & PGC_count_mask) == 0))?p->domain:999, x, page->type_and_flags);
+ DPRINTK("Error pfn %08lx: ed=%p(%u), sd=%p(%u),"
+ " caf=%08x, taf=%08x\n",
+ page_to_pfn(page), domain, (domain)?domain->domain:999,
+ p, (p && !((x & PGC_count_mask) == 0))?p->domain:999,
+ x, page->type_and_flags);
return 0;
}
__asm__ __volatile__(
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index 8ced1a51c3..a9464415fc 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -226,7 +226,7 @@ struct task_struct
extern struct task_struct idle0_task;
extern struct task_struct *idle_task[NR_CPUS];
-#define IDLE_DOMAIN_ID (~0ULL)
+#define IDLE_DOMAIN_ID (0x7FFFFFFFU)
#define is_idle_task(_p) (test_bit(PF_IDLETASK, &(_p)->flags))
#include <xen/slab.h>
diff --git a/xen/include/xen/shadow.h b/xen/include/xen/shadow.h
index 1597e1feb2..cf1a6412da 100644
--- a/xen/include/xen/shadow.h
+++ b/xen/include/xen/shadow.h
@@ -10,9 +10,9 @@
/* Shadow PT flag bits in pfn_info */
-#define PSH_shadowed (1<<31) /* page has a shadow. PFN points to shadow */
-#define PSH_pending (1<<29) /* page is in the process of being shadowed */
-#define PSH_pfn_mask ((1<<21)-1)
+#define PSH_shadowed (1<<31) /* page has a shadow. PFN points to shadow */
+#define PSH_pending (1<<29) /* page is in the process of being shadowed */
+#define PSH_pfn_mask ((1<<21)-1)
/* Shadow PT operation mode : shadowmode variable in mm_struct */
#define SHM_test (1) /* just run domain on shadow PTs */
@@ -27,8 +27,8 @@ extern void shadow_mode_init(void);
extern int shadow_mode_control( struct task_struct *p, dom0_shadow_control_t *sc );
extern int shadow_fault( unsigned long va, long error_code );
extern void shadow_l1_normal_pt_update( unsigned long pa, unsigned long gpte,
- unsigned long *prev_spfn_ptr,
- l1_pgentry_t **prev_spl1e_ptr );
+ unsigned long *prev_spfn_ptr,
+ l1_pgentry_t **prev_spl1e_ptr );
extern void shadow_l2_normal_pt_update( unsigned long pa, unsigned long gpte );
extern void unshadow_table( unsigned long gpfn, unsigned int type );
extern int shadow_mode_enable( struct task_struct *p, unsigned int mode );
@@ -51,7 +51,7 @@ struct shadow_status {
#ifndef NDEBUG
#define SH_LOG(_f, _a...) \
-printk("DOM%lld: (file=shadow.c, line=%d) " _f "\n", \
+printk("DOM%u: (file=shadow.c, line=%d) " _f "\n", \
current->domain , __LINE__ , ## _a )
#else
#define SH_LOG(_f, _a...)
@@ -59,16 +59,16 @@ printk("DOM%lld: (file=shadow.c, line=%d) " _f "\n", \
#if SHADOW_DEBUG
#define SH_VLOG(_f, _a...) \
- printk("DOM%lld: (file=shadow.c, line=%d) " _f "\n", \
- current->domain , __LINE__ , ## _a )
+ printk("DOM%u: (file=shadow.c, line=%d) " _f "\n", \
+ current->domain , __LINE__ , ## _a )
#else
#define SH_VLOG(_f, _a...)
#endif
#if 0
#define SH_VVLOG(_f, _a...) \
- printk("DOM%lld: (file=shadow.c, line=%d) " _f "\n", \
- current->domain , __LINE__ , ## _a )
+ printk("DOM%u: (file=shadow.c, line=%d) " _f "\n", \
+ current->domain , __LINE__ , ## _a )
#else
#define SH_VVLOG(_f, _a...)
#endif
@@ -76,49 +76,44 @@ printk("DOM%lld: (file=shadow.c, line=%d) " _f "\n", \
/************************************************************************/
- static inline void __mark_dirty( struct mm_struct *m, unsigned int mfn )
+static inline void __mark_dirty( struct mm_struct *m, unsigned int mfn )
{
unsigned int pfn;
ASSERT(spin_is_locked(&m->shadow_lock));
-
- //printk("%08x %08lx\n", mfn, machine_to_phys_mapping[mfn] );
pfn = machine_to_phys_mapping[mfn];
/* We use values with the top bit set to mark MFNs that aren't
really part of the domain's psuedo-physical memory map e.g.
the shared info frame. Nothing to do here...
- */
+ */
if ( unlikely(pfn & 0x80000000U) ) return;
ASSERT(m->shadow_dirty_bitmap);
if( likely(pfn<m->shadow_dirty_bitmap_size) )
{
- /* These updates occur with mm.shadow_lock held, so use
- (__) version of test_and_set */
- if( ! __test_and_set_bit( pfn, m->shadow_dirty_bitmap ) )
- {
- m->shadow_dirty_count++;
- }
+ /* These updates occur with mm.shadow_lock held, so use
+ (__) version of test_and_set */
+ if( !__test_and_set_bit( pfn, m->shadow_dirty_bitmap) )
+ m->shadow_dirty_count++;
}
else
{
- extern void show_traceX(void);
- SH_LOG("mark_dirty OOR! mfn=%x pfn=%x max=%x (mm %p)",
- mfn, pfn, m->shadow_dirty_bitmap_size, m );
- SH_LOG("dom=%lld caf=%08x taf=%08x\n",
- frame_table[mfn].u.domain->domain,
- frame_table[mfn].count_and_flags,
- frame_table[mfn].type_and_flags );
- //show_traceX();
+ extern void show_traceX(void);
+ SH_LOG("mark_dirty OOR! mfn=%x pfn=%x max=%x (mm %p)",
+ mfn, pfn, m->shadow_dirty_bitmap_size, m );
+ SH_LOG("dom=%u caf=%08x taf=%08x\n",
+ frame_table[mfn].u.domain->domain,
+ frame_table[mfn].count_and_flags,
+ frame_table[mfn].type_and_flags );
}
}
static inline void mark_dirty( struct mm_struct *m, unsigned int mfn )
-{
+{
ASSERT(local_irq_is_enabled());
//if(spin_is_locked(&m->shadow_lock)) printk("+");
spin_lock(&m->shadow_lock);
@@ -130,7 +125,7 @@ static inline void mark_dirty( struct mm_struct *m, unsigned int mfn )
/************************************************************************/
static inline void l1pte_write_fault( struct mm_struct *m,
- unsigned long *gpte_p, unsigned long *spte_p )
+ unsigned long *gpte_p, unsigned long *spte_p )
{
unsigned long gpte = *gpte_p;
unsigned long spte = *spte_p;
@@ -138,17 +133,17 @@ static inline void l1pte_write_fault( struct mm_struct *m,
switch( m->shadow_mode )
{
case SHM_test:
- spte = gpte;
- gpte |= _PAGE_DIRTY | _PAGE_ACCESSED;
- spte |= _PAGE_RW | _PAGE_DIRTY | _PAGE_ACCESSED;
- break;
+ spte = gpte;
+ gpte |= _PAGE_DIRTY | _PAGE_ACCESSED;
+ spte |= _PAGE_RW | _PAGE_DIRTY | _PAGE_ACCESSED;
+ break;
case SHM_logdirty:
- spte = gpte;
- gpte |= _PAGE_DIRTY | _PAGE_ACCESSED;
- spte |= _PAGE_RW | _PAGE_DIRTY | _PAGE_ACCESSED;
- __mark_dirty( m, (gpte >> PAGE_SHIFT) );
- break;
+ spte = gpte;
+ gpte |= _PAGE_DIRTY | _PAGE_ACCESSED;
+ spte |= _PAGE_RW | _PAGE_DIRTY | _PAGE_ACCESSED;
+ __mark_dirty( m, (gpte >> PAGE_SHIFT) );
+ break;
}
*gpte_p = gpte;
@@ -156,7 +151,7 @@ static inline void l1pte_write_fault( struct mm_struct *m,
}
static inline void l1pte_read_fault( struct mm_struct *m,
- unsigned long *gpte_p, unsigned long *spte_p )
+ unsigned long *gpte_p, unsigned long *spte_p )
{
unsigned long gpte = *gpte_p;
unsigned long spte = *spte_p;
@@ -164,19 +159,19 @@ static inline void l1pte_read_fault( struct mm_struct *m,
switch( m->shadow_mode )
{
case SHM_test:
- spte = gpte;
- gpte |= _PAGE_ACCESSED;
- spte |= _PAGE_ACCESSED;
- if ( ! (gpte & _PAGE_DIRTY ) )
- spte &= ~ _PAGE_RW;
- break;
+ spte = gpte;
+ gpte |= _PAGE_ACCESSED;
+ spte |= _PAGE_ACCESSED;
+ if ( ! (gpte & _PAGE_DIRTY ) )
+ spte &= ~ _PAGE_RW;
+ break;
case SHM_logdirty:
- spte = gpte;
- gpte |= _PAGE_ACCESSED;
- spte |= _PAGE_ACCESSED;
- spte &= ~ _PAGE_RW;
- break;
+ spte = gpte;
+ gpte |= _PAGE_ACCESSED;
+ spte |= _PAGE_ACCESSED;
+ spte &= ~ _PAGE_RW;
+ break;
}
*gpte_p = gpte;
@@ -184,7 +179,7 @@ static inline void l1pte_read_fault( struct mm_struct *m,
}
static inline void l1pte_no_fault( struct mm_struct *m,
- unsigned long *gpte_p, unsigned long *spte_p )
+ unsigned long *gpte_p, unsigned long *spte_p )
{
unsigned long gpte = *gpte_p;
unsigned long spte = *spte_p;
@@ -192,26 +187,26 @@ static inline void l1pte_no_fault( struct mm_struct *m,
switch( m->shadow_mode )
{
case SHM_test:
- spte = 0;
- if ( (gpte & (_PAGE_PRESENT|_PAGE_ACCESSED) ) ==
- (_PAGE_PRESENT|_PAGE_ACCESSED) )
- {
- spte = gpte;
- if ( ! (gpte & _PAGE_DIRTY ) )
- spte &= ~ _PAGE_RW;
- }
- break;
+ spte = 0;
+ if ( (gpte & (_PAGE_PRESENT|_PAGE_ACCESSED) ) ==
+ (_PAGE_PRESENT|_PAGE_ACCESSED) )
+ {
+ spte = gpte;
+ if ( ! (gpte & _PAGE_DIRTY ) )
+ spte &= ~ _PAGE_RW;
+ }
+ break;
case SHM_logdirty:
- spte = 0;
- if ( (gpte & (_PAGE_PRESENT|_PAGE_ACCESSED) ) ==
- (_PAGE_PRESENT|_PAGE_ACCESSED) )
- {
- spte = gpte;
- spte &= ~ _PAGE_RW;
- }
-
- break;
+ spte = 0;
+ if ( (gpte & (_PAGE_PRESENT|_PAGE_ACCESSED) ) ==
+ (_PAGE_PRESENT|_PAGE_ACCESSED) )
+ {
+ spte = gpte;
+ spte &= ~ _PAGE_RW;
+ }
+
+ break;
}
*gpte_p = gpte;
@@ -219,8 +214,8 @@ static inline void l1pte_no_fault( struct mm_struct *m,
}
static inline void l2pde_general( struct mm_struct *m,
- unsigned long *gpde_p, unsigned long *spde_p,
- unsigned long sl1pfn)
+ unsigned long *gpde_p, unsigned long *spde_p,
+ unsigned long sl1pfn)
{
unsigned long gpde = *gpde_p;
unsigned long spde = *spde_p;
@@ -229,16 +224,16 @@ static inline void l2pde_general( struct mm_struct *m,
if ( sl1pfn )
{
- spde = (gpde & ~PAGE_MASK) | (sl1pfn<<PAGE_SHIFT) |
- _PAGE_RW | _PAGE_ACCESSED | _PAGE_DIRTY;
- gpde = gpde | _PAGE_ACCESSED | _PAGE_DIRTY;
-
- if ( unlikely( (sl1pfn<<PAGE_SHIFT) == (gpde & PAGE_MASK) ) )
- {
- // detect linear map, and keep pointing at guest
- SH_VLOG("4c: linear mapping ( %08lx )",sl1pfn);
- spde = gpde & ~_PAGE_RW;
- }
+ spde = (gpde & ~PAGE_MASK) | (sl1pfn<<PAGE_SHIFT) |
+ _PAGE_RW | _PAGE_ACCESSED | _PAGE_DIRTY;
+ gpde = gpde | _PAGE_ACCESSED | _PAGE_DIRTY;
+
+ if ( unlikely( (sl1pfn<<PAGE_SHIFT) == (gpde & PAGE_MASK) ) )
+ {
+ // detect linear map, and keep pointing at guest
+ SH_VLOG("4c: linear mapping ( %08lx )",sl1pfn);
+ spde = gpde & ~_PAGE_RW;
+ }
}
*gpde_p = gpde;
@@ -254,30 +249,30 @@ static void shadow_audit(struct mm_struct *m, int print)
{
int live=0, free=0, j=0, abs;
struct shadow_status *a;
-
- for(j=0;j<shadow_ht_buckets;j++)
+
+ for( j = 0; j < shadow_ht_buckets; j++ )
{
a = &m->shadow_ht[j];
- if(a->pfn){live++; ASSERT(a->spfn_and_flags&PSH_pfn_mask);}
- ASSERT((a->pfn&0xf0000000)==0);
- ASSERT(a->pfn<0x00100000);
- a=a->next;
+ if(a->pfn){live++; ASSERT(a->spfn_and_flags&PSH_pfn_mask);}
+ ASSERT((a->pfn&0xf0000000)==0);
+ ASSERT(a->pfn<0x00100000);
+ a=a->next;
while(a && live<9999)
- {
- live++;
- if(a->pfn == 0 || a->spfn_and_flags == 0)
- {
- printk("XXX live=%d pfn=%08lx sp=%08lx next=%p\n",
- live, a->pfn, a->spfn_and_flags, a->next);
- BUG();
- }
- ASSERT(a->pfn);
- ASSERT((a->pfn&0xf0000000)==0);
- ASSERT(a->pfn<0x00100000);
- ASSERT(a->spfn_and_flags&PSH_pfn_mask);
- a=a->next;
- }
- ASSERT(live<9999);
+ {
+ live++;
+ if(a->pfn == 0 || a->spfn_and_flags == 0)
+ {
+ printk("XXX live=%d pfn=%08lx sp=%08lx next=%p\n",
+ live, a->pfn, a->spfn_and_flags, a->next);
+ BUG();
+ }
+ ASSERT(a->pfn);
+ ASSERT((a->pfn&0xf0000000)==0);
+ ASSERT(a->pfn<0x00100000);
+ ASSERT(a->spfn_and_flags&PSH_pfn_mask);
+ a=a->next;
+ }
+ ASSERT(live<9999);
}
a = m->shadow_ht_free;
@@ -288,9 +283,9 @@ static void shadow_audit(struct mm_struct *m, int print)
abs=(perfc_value(shadow_l1_pages)+perfc_value(shadow_l2_pages))-live;
if( abs < -1 || abs > 1 )
{
- printk("live=%d free=%d l1=%d l2=%d\n",live,free,
- perfc_value(shadow_l1_pages), perfc_value(shadow_l2_pages) );
- BUG();
+ printk("live=%d free=%d l1=%d l2=%d\n",live,free,
+ perfc_value(shadow_l1_pages), perfc_value(shadow_l2_pages) );
+ BUG();
}
}
@@ -302,14 +297,14 @@ static void shadow_audit(struct mm_struct *m, int print)
static inline struct shadow_status* hash_bucket( struct mm_struct *m,
- unsigned int gpfn )
+ unsigned int gpfn )
{
return &(m->shadow_ht[gpfn % shadow_ht_buckets]);
}
static inline unsigned long __shadow_status( struct mm_struct *m,
- unsigned int gpfn )
+ unsigned int gpfn )
{
struct shadow_status **ob, *b, *B = hash_bucket( m, gpfn );
@@ -321,33 +316,33 @@ static inline unsigned long __shadow_status( struct mm_struct *m,
do
{
- if ( b->pfn == gpfn )
- {
- unsigned long t;
- struct shadow_status *x;
-
- // swap with head
- t=B->pfn; B->pfn=b->pfn; b->pfn=t;
- t=B->spfn_and_flags; B->spfn_and_flags=b->spfn_and_flags;
- b->spfn_and_flags=t;
-
- if(ob)
- { // pull to front
- *ob=b->next;
- x=B->next;
- B->next=b;
- b->next=x;
- }
- return B->spfn_and_flags;
- }
+ if ( b->pfn == gpfn )
+ {
+ unsigned long t;
+ struct shadow_status *x;
+
+ // swap with head
+ t=B->pfn; B->pfn=b->pfn; b->pfn=t;
+ t=B->spfn_and_flags; B->spfn_and_flags=b->spfn_and_flags;
+ b->spfn_and_flags=t;
+
+ if( ob )
+ { // pull to front
+ *ob=b->next;
+ x=B->next;
+ B->next=b;
+ b->next=x;
+ }
+ return B->spfn_and_flags;
+ }
#if SHADOW_HASH_DEBUG
- else
- {
- if(b!=B)ASSERT(b->pfn);
- }
+ else
+ {
+ if(b!=B)ASSERT(b->pfn);
+ }
#endif
- ob=&b->next;
- b=b->next;
+ ob=&b->next;
+ b=b->next;
}
while (b);
@@ -359,7 +354,7 @@ ever becomes a problem, but since we need a spin lock on the hash table
anyway its probably not worth being too clever. */
static inline unsigned long get_shadow_status( struct mm_struct *m,
- unsigned int gpfn )
+ unsigned int gpfn )
{
unsigned long res;
@@ -370,15 +365,15 @@ static inline unsigned long get_shadow_status( struct mm_struct *m,
bit in the dirty bitmap.
NB: the VA update path doesn't use this so needs to be handled
independnetly.
- */
+ */
ASSERT(local_irq_is_enabled());
//if(spin_is_locked(&m->shadow_lock)) printk("*");
spin_lock(&m->shadow_lock);
if( m->shadow_mode == SHM_logdirty )
- __mark_dirty( m, gpfn );
-
+ __mark_dirty( m, gpfn );
+
res = __shadow_status( m, gpfn );
if (!res) spin_unlock(&m->shadow_lock);
return res;
@@ -392,7 +387,7 @@ static inline void put_shadow_status( struct mm_struct *m )
static inline void delete_shadow_status( struct mm_struct *m,
- unsigned int gpfn )
+ unsigned int gpfn )
{
struct shadow_status *b, *B, **ob;
@@ -406,29 +401,29 @@ static inline void delete_shadow_status( struct mm_struct *m,
if( b->pfn == gpfn )
{
- if (b->next)
- {
- struct shadow_status *D=b->next;
- b->spfn_and_flags = b->next->spfn_and_flags;
- b->pfn = b->next->pfn;
-
- b->next = b->next->next;
- D->next = m->shadow_ht_free;
- D->pfn = 0;
- D->spfn_and_flags = 0;
- m->shadow_ht_free = D;
- }
- else
- {
- b->pfn = 0;
- b->spfn_and_flags = 0;
- }
+ if (b->next)
+ {
+ struct shadow_status *D=b->next;
+ b->spfn_and_flags = b->next->spfn_and_flags;
+ b->pfn = b->next->pfn;
+
+ b->next = b->next->next;
+ D->next = m->shadow_ht_free;
+ D->pfn = 0;
+ D->spfn_and_flags = 0;
+ m->shadow_ht_free = D;
+ }
+ else
+ {
+ b->pfn = 0;
+ b->spfn_and_flags = 0;
+ }
#if SHADOW_HASH_DEBUG
- if( __shadow_status(m,gpfn) ) BUG();
- shadow_audit(m,0);
+ if( __shadow_status(m,gpfn) ) BUG();
+ shadow_audit(m,0);
#endif
- return;
+ return;
}
ob = &b->next;
@@ -436,25 +431,25 @@ static inline void delete_shadow_status( struct mm_struct *m,
do
{
- if ( b->pfn == gpfn )
- {
- b->pfn = 0;
- b->spfn_and_flags = 0;
+ if ( b->pfn == gpfn )
+ {
+ b->pfn = 0;
+ b->spfn_and_flags = 0;
- // b is in the list
- *ob=b->next;
- b->next = m->shadow_ht_free;
- m->shadow_ht_free = b;
+ // b is in the list
+ *ob=b->next;
+ b->next = m->shadow_ht_free;
+ m->shadow_ht_free = b;
#if SHADOW_HASH_DEBUG
- if( __shadow_status(m,gpfn) ) BUG();
+ if( __shadow_status(m,gpfn) ) BUG();
#endif
- shadow_audit(m,0);
- return;
- }
+ shadow_audit(m,0);
+ return;
+ }
- ob = &b->next;
- b=b->next;
+ ob = &b->next;
+ b=b->next;
}
while (b);
@@ -464,7 +459,7 @@ static inline void delete_shadow_status( struct mm_struct *m,
static inline void set_shadow_status( struct mm_struct *m,
- unsigned int gpfn, unsigned long s )
+ unsigned int gpfn, unsigned long s )
{
struct shadow_status *b, *B, *extra, **fptr;
int i;
@@ -474,22 +469,20 @@ static inline void set_shadow_status( struct mm_struct *m,
B = b = hash_bucket( m, gpfn );
ASSERT(gpfn);
- //ASSERT(s);
- //ASSERT(s&PSH_pfn_mask);
SH_VVLOG("set gpfn=%08x s=%08lx bucket=%p(%p)", gpfn, s, b, b->next );
shadow_audit(m,0);
do
{
- if ( b->pfn == gpfn )
- {
- b->spfn_and_flags = s;
- shadow_audit(m,0);
- return;
- }
-
- b=b->next;
+ if ( b->pfn == gpfn )
+ {
+ b->spfn_and_flags = s;
+ shadow_audit(m,0);
+ return;
+ }
+
+ b=b->next;
}
while (b);
@@ -499,41 +492,41 @@ static inline void set_shadow_status( struct mm_struct *m,
if ( B->pfn == 0 )
{
- // we can use this head
- ASSERT( B->next == 0 );
- B->pfn = gpfn;
- B->spfn_and_flags = s;
- shadow_audit(m,0);
- return;
+ // we can use this head
+ ASSERT( B->next == 0 );
+ B->pfn = gpfn;
+ B->spfn_and_flags = s;
+ shadow_audit(m,0);
+ return;
}
if( unlikely(m->shadow_ht_free == NULL) )
{
- SH_LOG("allocate more shadow hashtable blocks");
+ SH_LOG("allocate more shadow hashtable blocks");
- // we need to allocate more space
- extra = kmalloc( sizeof(void*) + (shadow_ht_extra_size *
- sizeof(struct shadow_status)), GFP_KERNEL );
+ // we need to allocate more space
+ extra = kmalloc( sizeof(void*) + (shadow_ht_extra_size *
+ sizeof(struct shadow_status)), GFP_KERNEL );
- if( ! extra ) BUG(); // should be more graceful here....
+ if( ! extra ) BUG(); // should be more graceful here....
- memset( extra, 0, sizeof(void*) + (shadow_ht_extra_size *
- sizeof(struct shadow_status)) );
+ memset( extra, 0, sizeof(void*) + (shadow_ht_extra_size *
+ sizeof(struct shadow_status)) );
- m->shadow_extras_count++;
-
- // add extras to free list
- fptr = &m->shadow_ht_free;
- for ( i=0; i<shadow_ht_extra_size; i++ )
- {
- *fptr = &extra[i];
- fptr = &(extra[i].next);
- }
- *fptr = NULL;
+ m->shadow_extras_count++;
- *((struct shadow_status ** ) &extra[shadow_ht_extra_size]) =
- m->shadow_ht_extras;
- m->shadow_ht_extras = extra;
+ // add extras to free list
+ fptr = &m->shadow_ht_free;
+ for ( i=0; i<shadow_ht_extra_size; i++ )
+ {
+ *fptr = &extra[i];
+ fptr = &(extra[i].next);
+ }
+ *fptr = NULL;
+
+ *((struct shadow_status ** ) &extra[shadow_ht_extra_size]) =
+ m->shadow_ht_extras;
+ m->shadow_ht_extras = extra;
}
@@ -555,10 +548,10 @@ static inline void __shadow_mk_pagetable( struct mm_struct *mm )
unsigned long gpfn, spfn=0;
gpfn = pagetable_val(mm->pagetable) >> PAGE_SHIFT;
-
+
if ( unlikely((spfn=__shadow_status(mm, gpfn)) == 0 ) )
{
- spfn = shadow_l2_table(mm, gpfn );
+ spfn = shadow_l2_table(mm, gpfn );
}
mm->shadow_table = mk_pagetable(spfn<<PAGE_SHIFT);
}
@@ -566,21 +559,21 @@ static inline void __shadow_mk_pagetable( struct mm_struct *mm )
static inline void shadow_mk_pagetable( struct mm_struct *mm )
{
SH_VVLOG("shadow_mk_pagetable( gptbase=%08lx, mode=%d )",
- pagetable_val(mm->pagetable), mm->shadow_mode );
+ pagetable_val(mm->pagetable), mm->shadow_mode );
if ( unlikely(mm->shadow_mode) )
{
- ASSERT(local_irq_is_enabled());
+ ASSERT(local_irq_is_enabled());
spin_lock(&mm->shadow_lock);
- __shadow_mk_pagetable( mm );
+ __shadow_mk_pagetable( mm );
- spin_unlock(&mm->shadow_lock);
+ spin_unlock(&mm->shadow_lock);
}
SH_VVLOG("leaving shadow_mk_pagetable( gptbase=%08lx, mode=%d ) sh=%08lx",
- pagetable_val(mm->pagetable), mm->shadow_mode,
- pagetable_val(mm->shadow_table) );
+ pagetable_val(mm->pagetable), mm->shadow_mode,
+ pagetable_val(mm->shadow_table) );
}
diff --git a/xen/net/dev.c b/xen/net/dev.c
index 909e586b53..eb7747d6eb 100644
--- a/xen/net/dev.c
+++ b/xen/net/dev.c
@@ -2094,7 +2094,7 @@ static void get_rx_bufs(net_vif_t *vif)
if ( unlikely(pte_pfn >= max_page) ||
unlikely(!get_page_and_type(pte_page, p, PGT_l1_page_table)) )
{
- DPRINTK("Bad page frame for ppte %llu,%08lx,%08lx,%08x\n",
+ DPRINTK("Bad page frame for ppte %u,%08lx,%08lx,%08x\n",
p->domain, pte_pfn, max_page, pte_page->type_and_flags);
make_rx_response(vif, rx.id, 0, RING_STATUS_BAD_PAGE, 0);
continue;
@@ -2265,24 +2265,13 @@ long flush_bufs_for_vif(net_vif_t *vif)
put_page_and_type(&frame_table[rx->pte_ptr >> PAGE_SHIFT]);
- /* if in shadow mode, mark the PTE as dirty */
- if( p->mm.shadow_mode == SHM_logdirty )
- {
- mark_dirty( &p->mm, rx->pte_ptr>>PAGE_SHIFT );
-#if 0
- mark_dirty( &p->mm, rx->buf_pfn ); // XXXXXXX debug
-
- {
- unsigned long * p = map_domain_mem( rx->buf_pfn<<PAGE_SHIFT );
- p[2] = 0xdeadc001;
- unmap_domain_mem(p);
- }
-#endif
-
- }
- /* assume the shadow page table is about to be blown away,
- and that its not worth marking the buffer as dirty */
-
+ /*
+ * If in shadow mode, mark the PTE as dirty.
+ * (We assume the shadow page table is about to be blown away,
+ * and so it's not worth marking the buffer as dirty.)
+ */
+ if ( p->mm.shadow_mode == SHM_logdirty )
+ mark_dirty(&p->mm, rx->pte_ptr>>PAGE_SHIFT);
make_rx_response(vif, rx->id, 0, RING_STATUS_DROPPED, 0);
}
diff --git a/xenolinux-2.4.26-sparse/arch/xen/drivers/blkif/backend/interface.c b/xenolinux-2.4.26-sparse/arch/xen/drivers/blkif/backend/interface.c
index 14a6ab324d..780d793c6c 100644
--- a/xenolinux-2.4.26-sparse/arch/xen/drivers/blkif/backend/interface.c
+++ b/xenolinux-2.4.26-sparse/arch/xen/drivers/blkif/backend/interface.c
@@ -9,8 +9,7 @@
#include "common.h"
#define BLKIF_HASHSZ 1024
-#define BLKIF_HASH(_d,_h) \
- (((int)(_d)^(int)((_d)>>32)^(int)(_h))&(BLKIF_HASHSZ-1))
+#define BLKIF_HASH(_d,_h) (((int)(_d)^(int)(_h))&(BLKIF_HASHSZ-1))
static kmem_cache_t *blkif_cachep;
static blkif_t *blkif_hash[BLKIF_HASHSZ];
@@ -151,7 +150,7 @@ void blkif_connect(blkif_be_connect_t *connect)
blkif = blkif_find_by_handle(domid, handle);
if ( unlikely(blkif == NULL) )
{
- DPRINTK("blkif_connect attempted for non-existent blkif (%llu,%u)\n",
+ DPRINTK("blkif_connect attempted for non-existent blkif (%u,%u)\n",
connect->domid, connect->blkif_handle);
connect->status = BLKIF_BE_STATUS_INTERFACE_NOT_FOUND;
return;
@@ -208,7 +207,7 @@ int blkif_disconnect(blkif_be_disconnect_t *disconnect, u8 rsp_id)
if ( unlikely(blkif == NULL) )
{
DPRINTK("blkif_disconnect attempted for non-existent blkif"
- " (%llu,%u)\n", disconnect->domid, disconnect->blkif_handle);
+ " (%u,%u)\n", disconnect->domid, disconnect->blkif_handle);
disconnect->status = BLKIF_BE_STATUS_INTERFACE_NOT_FOUND;
return 1; /* Caller will send response error message. */
}
diff --git a/xenolinux-2.4.26-sparse/arch/xen/drivers/blkif/backend/main.c b/xenolinux-2.4.26-sparse/arch/xen/drivers/blkif/backend/main.c
index c7404554b6..b5d406ba5e 100644
--- a/xenolinux-2.4.26-sparse/arch/xen/drivers/blkif/backend/main.c
+++ b/xenolinux-2.4.26-sparse/arch/xen/drivers/blkif/backend/main.c
@@ -382,8 +382,7 @@ static void dispatch_rw_block_io(blkif_t *blkif, blkif_request_t *req)
mcl[i].args[0] = MMAP_VADDR(pending_idx, i) >> PAGE_SHIFT;
mcl[i].args[1] = (phys_seg[i].buffer & PAGE_MASK) | remap_prot;
mcl[i].args[2] = 0;
- mcl[i].args[3] = (unsigned long)blkif->domid;
- mcl[i].args[4] = (unsigned long)(blkif->domid>>32);
+ mcl[i].args[3] = blkif->domid;
phys_to_machine_mapping[__pa(MMAP_VADDR(pending_idx, i))>>PAGE_SHIFT] =
phys_seg[i].buffer >> PAGE_SHIFT;
diff --git a/xenolinux-2.4.26-sparse/arch/xen/drivers/blkif/backend/vbd.c b/xenolinux-2.4.26-sparse/arch/xen/drivers/blkif/backend/vbd.c
index bb5b6ea743..6704fbb541 100644
--- a/xenolinux-2.4.26-sparse/arch/xen/drivers/blkif/backend/vbd.c
+++ b/xenolinux-2.4.26-sparse/arch/xen/drivers/blkif/backend/vbd.c
@@ -18,7 +18,7 @@ void vbd_create(blkif_be_vbd_create_t *create)
blkif = blkif_find_by_handle(create->domid, create->blkif_handle);
if ( unlikely(blkif == NULL) )
{
- DPRINTK("vbd_create attempted for non-existent blkif (%llu,%u)\n",
+ DPRINTK("vbd_create attempted for non-existent blkif (%u,%u)\n",
create->domid, create->blkif_handle);
create->status = BLKIF_BE_STATUS_INTERFACE_NOT_FOUND;
return;
@@ -62,7 +62,7 @@ void vbd_create(blkif_be_vbd_create_t *create)
rb_link_node(&vbd->rb, rb_parent, rb_p);
rb_insert_color(&vbd->rb, &blkif->vbd_rb);
- DPRINTK("Successful creation of vdev=%04x (dom=%llu)\n",
+ DPRINTK("Successful creation of vdev=%04x (dom=%u)\n",
vdevice, create->domid);
create->status = BLKIF_BE_STATUS_OKAY;
@@ -83,7 +83,7 @@ void vbd_grow(blkif_be_vbd_grow_t *grow)
blkif = blkif_find_by_handle(grow->domid, grow->blkif_handle);
if ( unlikely(blkif == NULL) )
{
- DPRINTK("vbd_grow attempted for non-existent blkif (%llu,%u)\n",
+ DPRINTK("vbd_grow attempted for non-existent blkif (%u,%u)\n",
grow->domid, grow->blkif_handle);
grow->status = BLKIF_BE_STATUS_INTERFACE_NOT_FOUND;
return;
@@ -128,7 +128,7 @@ void vbd_grow(blkif_be_vbd_grow_t *grow)
*px = x;
- DPRINTK("Successful grow of vdev=%04x (dom=%llu)\n",
+ DPRINTK("Successful grow of vdev=%04x (dom=%u)\n",
vdevice, grow->domid);
grow->status = BLKIF_BE_STATUS_OKAY;
@@ -148,7 +148,7 @@ void vbd_shrink(blkif_be_vbd_shrink_t *shrink)
blkif = blkif_find_by_handle(shrink->domid, shrink->blkif_handle);
if ( unlikely(blkif == NULL) )
{
- DPRINTK("vbd_shrink attempted for non-existent blkif (%llu,%u)\n",
+ DPRINTK("vbd_shrink attempted for non-existent blkif (%u,%u)\n",
shrink->domid, shrink->blkif_handle);
shrink->status = BLKIF_BE_STATUS_INTERFACE_NOT_FOUND;
return;
@@ -206,7 +206,7 @@ void vbd_destroy(blkif_be_vbd_destroy_t *destroy)
blkif = blkif_find_by_handle(destroy->domid, destroy->blkif_handle);
if ( unlikely(blkif == NULL) )
{
- DPRINTK("vbd_destroy attempted for non-existent blkif (%llu,%u)\n",
+ DPRINTK("vbd_destroy attempted for non-existent blkif (%u,%u)\n",
destroy->domid, destroy->blkif_handle);
destroy->status = BLKIF_BE_STATUS_INTERFACE_NOT_FOUND;
return;
@@ -365,7 +365,7 @@ int vbd_translate(phys_seg_t *pseg, blkif_t *blkif, int operation)
goto found;
}
- DPRINTK("vbd_translate; domain %llu attempted to access "
+ DPRINTK("vbd_translate; domain %u attempted to access "
"non-existent VBD.\n", blkif->domid);
spin_unlock(&blkif->vbd_lock);
diff --git a/xenolinux-2.4.26-sparse/arch/xen/drivers/dom0/core.c b/xenolinux-2.4.26-sparse/arch/xen/drivers/dom0/core.c
index a4b01eb83f..5412a28572 100644
--- a/xenolinux-2.4.26-sparse/arch/xen/drivers/dom0/core.c
+++ b/xenolinux-2.4.26-sparse/arch/xen/drivers/dom0/core.c
@@ -73,139 +73,133 @@ static int privcmd_ioctl(struct inode *inode, struct file *file,
case IOCTL_PRIVCMD_MMAP:
{
#define PRIVCMD_MMAP_SZ 32
- privcmd_mmap_t mmapcmd;
- privcmd_mmap_entry_t msg[PRIVCMD_MMAP_SZ], *p;
- int i, rc;
+ privcmd_mmap_t mmapcmd;
+ privcmd_mmap_entry_t msg[PRIVCMD_MMAP_SZ], *p;
+ int i, rc;
if ( copy_from_user(&mmapcmd, (void *)data, sizeof(mmapcmd)) )
return -EFAULT;
- p = mmapcmd.entry;
-
- for (i=0; i<mmapcmd.num; i+=PRIVCMD_MMAP_SZ, p+=PRIVCMD_MMAP_SZ)
- {
- int j, n = ((mmapcmd.num-i)>PRIVCMD_MMAP_SZ)?
- PRIVCMD_MMAP_SZ:(mmapcmd.num-i);
- if ( copy_from_user(&msg, p, n*sizeof(privcmd_mmap_entry_t)) )
- return -EFAULT;
-
- for ( j = 0; j < n; j++ )
- {
- struct vm_area_struct *vma =
- find_vma( current->mm, msg[j].va );
-
- if ( !vma )
- return -EINVAL;
-
- if ( msg[j].va > PAGE_OFFSET )
- return -EINVAL;
-
- if ( (msg[j].va + (msg[j].npages<<PAGE_SHIFT)) > vma->vm_end )
- return -EINVAL;
-
- if ( (rc = direct_remap_area_pages(vma->vm_mm,
- msg[j].va&PAGE_MASK,
- msg[j].mfn<<PAGE_SHIFT,
- msg[j].npages<<PAGE_SHIFT,
- vma->vm_page_prot,
- mmapcmd.dom)) < 0 )
- return rc;
- }
- }
- ret = 0;
+ p = mmapcmd.entry;
+
+ for (i=0; i<mmapcmd.num; i+=PRIVCMD_MMAP_SZ, p+=PRIVCMD_MMAP_SZ)
+ {
+ int j, n = ((mmapcmd.num-i)>PRIVCMD_MMAP_SZ)?
+ PRIVCMD_MMAP_SZ:(mmapcmd.num-i);
+ if ( copy_from_user(&msg, p, n*sizeof(privcmd_mmap_entry_t)) )
+ return -EFAULT;
+
+ for ( j = 0; j < n; j++ )
+ {
+ struct vm_area_struct *vma =
+ find_vma( current->mm, msg[j].va );
+
+ if ( !vma )
+ return -EINVAL;
+
+ if ( msg[j].va > PAGE_OFFSET )
+ return -EINVAL;
+
+ if ( (msg[j].va + (msg[j].npages<<PAGE_SHIFT)) > vma->vm_end )
+ return -EINVAL;
+
+ if ( (rc = direct_remap_area_pages(vma->vm_mm,
+ msg[j].va&PAGE_MASK,
+ msg[j].mfn<<PAGE_SHIFT,
+ msg[j].npages<<PAGE_SHIFT,
+ vma->vm_page_prot,
+ mmapcmd.dom)) < 0 )
+ return rc;
+ }
+ }
+ ret = 0;
}
break;
case IOCTL_PRIVCMD_MMAPBATCH:
{
#define MAX_DIRECTMAP_MMU_QUEUE 130
- mmu_update_t u[MAX_DIRECTMAP_MMU_QUEUE], *w, *v;
- privcmd_mmapbatch_t m;
- struct vm_area_struct *vma = NULL;
- unsigned long *p, addr;
- unsigned long mfn;
- int i;
+ mmu_update_t u[MAX_DIRECTMAP_MMU_QUEUE], *w, *v;
+ privcmd_mmapbatch_t m;
+ struct vm_area_struct *vma = NULL;
+ unsigned long *p, addr;
+ unsigned long mfn;
+ int i;
if ( copy_from_user(&m, (void *)data, sizeof(m)) )
- { ret = -EFAULT; goto batch_err; }
-
- vma = find_vma( current->mm, m.addr );
-
- if ( !vma )
- { ret = -EINVAL; goto batch_err; }
-
- if ( m.addr > PAGE_OFFSET )
- { ret = -EFAULT; goto batch_err; }
-
- if ( (m.addr + (m.num<<PAGE_SHIFT)) > vma->vm_end )
- { ret = -EFAULT; goto batch_err; }
-
- if ( m.dom != 0 )
- {
- u[0].val = (unsigned long)(m.dom<<16) & ~0xFFFFUL;
- u[0].ptr = (unsigned long)(m.dom<< 0) & ~0xFFFFUL;
- u[1].val = (unsigned long)(m.dom>>16) & ~0xFFFFUL;
- u[1].ptr = (unsigned long)(m.dom>>32) & ~0xFFFFUL;
- u[0].ptr |= MMU_EXTENDED_COMMAND;
- u[0].val |= MMUEXT_SET_SUBJECTDOM_L;
- u[1].ptr |= MMU_EXTENDED_COMMAND;
- u[1].val |= MMUEXT_SET_SUBJECTDOM_H;
- v = w = &u[2];
- }
- else
- {
- v = w = &u[0];
- }
-
- p = m.arr;
- addr = m.addr;
- for ( i = 0; i < m.num; i++, addr += PAGE_SIZE, p++ )
- {
- if ( get_user(mfn, p) ) return -EFAULT;
-
- v->val = (mfn << PAGE_SHIFT) | pgprot_val(vma->vm_page_prot) |
- _PAGE_IO;
-
- __direct_remap_area_pages(vma->vm_mm,
+ { ret = -EFAULT; goto batch_err; }
+
+ vma = find_vma( current->mm, m.addr );
+
+ if ( !vma )
+ { ret = -EINVAL; goto batch_err; }
+
+ if ( m.addr > PAGE_OFFSET )
+ { ret = -EFAULT; goto batch_err; }
+
+ if ( (m.addr + (m.num<<PAGE_SHIFT)) > vma->vm_end )
+ { ret = -EFAULT; goto batch_err; }
+
+ if ( m.dom != 0 )
+ {
+ u[0].val = (unsigned long)(m.dom<<16) & ~0xFFFFUL;
+ u[0].ptr = (unsigned long)(m.dom<< 0) & ~0xFFFFUL;
+ u[0].ptr |= MMU_EXTENDED_COMMAND;
+ u[0].val |= MMUEXT_SET_SUBJECTDOM;
+ v = w = &u[1];
+ }
+ else
+ {
+ v = w = &u[0];
+ }
+
+ p = m.arr;
+ addr = m.addr;
+ for ( i = 0; i < m.num; i++, addr += PAGE_SIZE, p++ )
+ {
+ if ( get_user(mfn, p) ) return -EFAULT;
+
+ v->val = (mfn << PAGE_SHIFT) | pgprot_val(vma->vm_page_prot) |
+ _PAGE_IO;
+
+ __direct_remap_area_pages(vma->vm_mm,
addr,
PAGE_SIZE,
v);
- if ( unlikely(HYPERVISOR_mmu_update(u, v - u + 1, NULL) < 0) )
- put_user( 0xF0000000 | mfn, p );
+ if ( unlikely(HYPERVISOR_mmu_update(u, v - u + 1, NULL) < 0) )
+ put_user( 0xF0000000 | mfn, p );
- v = w;
- }
- ret = 0;
- break;
+ v = w;
+ }
+ ret = 0;
+ break;
batch_err:
- printk("batch_err ret=%d vma=%p addr=%lx num=%d arr=%p %lx-%lx\n",
- ret, vma, m.addr, m.num, m.arr, vma->vm_start, vma->vm_end);
- break;
+ printk("batch_err ret=%d vma=%p addr=%lx num=%d arr=%p %lx-%lx\n",
+ ret, vma, m.addr, m.num, m.arr, vma->vm_start, vma->vm_end);
+ break;
}
break;
-
-
default:
ret = -EINVAL;
- break;
+ break;
}
return ret;
}
static int privcmd_mmap(struct file * file, struct vm_area_struct * vma)
{
- /* DONTCOPY is essential for Xen as copy_page_range is broken. */
- vma->vm_flags |= VM_RESERVED | VM_IO | VM_DONTCOPY;
+ /* DONTCOPY is essential for Xen as copy_page_range is broken. */
+ vma->vm_flags |= VM_RESERVED | VM_IO | VM_DONTCOPY;
- return 0;
+ return 0;
}
static struct file_operations privcmd_file_ops = {
- ioctl : privcmd_ioctl,
- mmap: privcmd_mmap
+ ioctl : privcmd_ioctl,
+ mmap: privcmd_mmap
};
@@ -236,3 +230,4 @@ static void __exit cleanup_module(void)
module_init(init_module);
module_exit(cleanup_module);
+#
diff --git a/xenolinux-2.4.26-sparse/arch/xen/drivers/netif/backend/interface.c b/xenolinux-2.4.26-sparse/arch/xen/drivers/netif/backend/interface.c
index c6630c1f39..bfdf4b0efb 100644
--- a/xenolinux-2.4.26-sparse/arch/xen/drivers/netif/backend/interface.c
+++ b/xenolinux-2.4.26-sparse/arch/xen/drivers/netif/backend/interface.c
@@ -10,8 +10,7 @@
#include <linux/rtnetlink.h>
#define NETIF_HASHSZ 1024
-#define NETIF_HASH(_d,_h) \
- (((int)(_d)^(int)((_d)>>32)^(int)(_h))&(NETIF_HASHSZ-1))
+#define NETIF_HASH(_d,_h) (((int)(_d)^(int)(_h))&(NETIF_HASHSZ-1))
static netif_t *netif_hash[NETIF_HASHSZ];
static struct net_device *bridge_dev;
@@ -185,7 +184,7 @@ void netif_connect(netif_be_connect_t *connect)
netif = netif_find_by_handle(domid, handle);
if ( unlikely(netif == NULL) )
{
- DPRINTK("netif_connect attempted for non-existent netif (%llu,%u)\n",
+ DPRINTK("netif_connect attempted for non-existent netif (%u,%u)\n",
connect->domid, connect->netif_handle);
connect->status = NETIF_BE_STATUS_INTERFACE_NOT_FOUND;
return;
@@ -271,7 +270,7 @@ int netif_disconnect(netif_be_disconnect_t *disconnect, u8 rsp_id)
if ( unlikely(netif == NULL) )
{
DPRINTK("netif_disconnect attempted for non-existent netif"
- " (%llu,%u)\n", disconnect->domid, disconnect->netif_handle);
+ " (%u,%u)\n", disconnect->domid, disconnect->netif_handle);
disconnect->status = NETIF_BE_STATUS_INTERFACE_NOT_FOUND;
return 1; /* Caller will send response error message. */
}
diff --git a/xenolinux-2.4.26-sparse/arch/xen/drivers/netif/backend/main.c b/xenolinux-2.4.26-sparse/arch/xen/drivers/netif/backend/main.c
index 7068d89035..60c71aa16e 100644
--- a/xenolinux-2.4.26-sparse/arch/xen/drivers/netif/backend/main.c
+++ b/xenolinux-2.4.26-sparse/arch/xen/drivers/netif/backend/main.c
@@ -36,7 +36,7 @@ typedef struct {
} rx_info_t;
static struct sk_buff_head rx_queue;
static multicall_entry_t rx_mcl[NETIF_RX_RING_SIZE*2];
-static mmu_update_t rx_mmu[NETIF_RX_RING_SIZE*4];
+static mmu_update_t rx_mmu[NETIF_RX_RING_SIZE*3];
static unsigned char rx_notify[NR_EVENT_CHANNELS];
/* Don't currently gate addition of an interface to the tx scheduling list. */
@@ -217,14 +217,10 @@ static void net_rx_action(unsigned long unused)
mmu[0].val = __pa(vdata) >> PAGE_SHIFT;
mmu[1].val = (unsigned long)(netif->domid<<16) & ~0xFFFFUL;
mmu[1].ptr = (unsigned long)(netif->domid<< 0) & ~0xFFFFUL;
- mmu[2].val = (unsigned long)(netif->domid>>16) & ~0xFFFFUL;
- mmu[2].ptr = (unsigned long)(netif->domid>>32) & ~0xFFFFUL;
mmu[1].ptr |= MMU_EXTENDED_COMMAND;
- mmu[1].val |= MMUEXT_SET_SUBJECTDOM_L;
- mmu[2].ptr |= MMU_EXTENDED_COMMAND;
- mmu[2].val |= MMUEXT_SET_SUBJECTDOM_H;
- mmu[3].ptr = (mdata & PAGE_MASK) | MMU_EXTENDED_COMMAND;
- mmu[3].val = MMUEXT_REASSIGN_PAGE;
+ mmu[1].val |= MMUEXT_SET_SUBJECTDOM;
+ mmu[2].ptr = (mdata & PAGE_MASK) | MMU_EXTENDED_COMMAND;
+ mmu[2].val = MMUEXT_REASSIGN_PAGE;
mcl[0].op = __HYPERVISOR_update_va_mapping;
mcl[0].args[0] = vdata >> PAGE_SHIFT;
@@ -232,10 +228,10 @@ static void net_rx_action(unsigned long unused)
mcl[0].args[2] = 0;
mcl[1].op = __HYPERVISOR_mmu_update;
mcl[1].args[0] = (unsigned long)mmu;
- mcl[1].args[1] = 4;
+ mcl[1].args[1] = 3;
mcl[1].args[2] = 0;
- mmu += 4;
+ mmu += 3;
mcl += 2;
((rx_info_t *)&skb->cb[0])->old_mach_ptr = mdata;
@@ -265,7 +261,7 @@ static void net_rx_action(unsigned long unused)
/* Check the reassignment error code. */
if ( unlikely(mcl[1].args[5] != 0) )
{
- DPRINTK("Failed MMU update transferring to DOM%llu\n",
+ DPRINTK("Failed MMU update transferring to DOM%u\n",
netif->domid);
(void)HYPERVISOR_update_va_mapping(
(unsigned long)skb->head >> PAGE_SHIFT,
@@ -514,8 +510,7 @@ static void net_tx_action(unsigned long unused)
mcl[0].args[0] = MMAP_VADDR(pending_idx) >> PAGE_SHIFT;
mcl[0].args[1] = (txreq.addr & PAGE_MASK) | __PAGE_KERNEL;
mcl[0].args[2] = 0;
- mcl[0].args[3] = (unsigned long)netif->domid;
- mcl[0].args[4] = (unsigned long)(netif->domid>>32);
+ mcl[0].args[3] = netif->domid;
mcl++;
((tx_info_t *)&skb->cb[0])->idx = pending_idx;
@@ -760,7 +755,7 @@ static int __init init_module(void)
(void)request_irq(bind_virq_to_irq(VIRQ_DEBUG),
netif_be_dbg, SA_SHIRQ,
- "net-be-dbg", NULL);
+ "net-be-dbg", &netif_be_dbg);
return 0;
}
diff --git a/xenolinux-2.4.26-sparse/arch/xen/mm/ioremap.c b/xenolinux-2.4.26-sparse/arch/xen/mm/ioremap.c
index 4fd28897a4..a9b0faa41d 100644
--- a/xenolinux-2.4.26-sparse/arch/xen/mm/ioremap.c
+++ b/xenolinux-2.4.26-sparse/arch/xen/mm/ioremap.c
@@ -119,13 +119,9 @@ int direct_remap_area_pages(struct mm_struct *mm,
{
u[0].val = (unsigned long)(domid<<16) & ~0xFFFFUL;
u[0].ptr = (unsigned long)(domid<< 0) & ~0xFFFFUL;
- u[1].val = (unsigned long)(domid>>16) & ~0xFFFFUL;
- u[1].ptr = (unsigned long)(domid>>32) & ~0xFFFFUL;
u[0].ptr |= MMU_EXTENDED_COMMAND;
- u[0].val |= MMUEXT_SET_SUBJECTDOM_L;
- u[1].ptr |= MMU_EXTENDED_COMMAND;
- u[1].val |= MMUEXT_SET_SUBJECTDOM_H;
- v = w = &u[2];
+ u[0].val |= MMUEXT_SET_SUBJECTDOM;
+ v = w = &u[1];
}
else
{
diff --git a/xenolinux-2.4.26-sparse/drivers/char/mem.c b/xenolinux-2.4.26-sparse/drivers/char/mem.c
index 1d3ec0fe05..5635b269aa 100644
--- a/xenolinux-2.4.26-sparse/drivers/char/mem.c
+++ b/xenolinux-2.4.26-sparse/drivers/char/mem.c
@@ -233,39 +233,27 @@ static int mmap_mem(struct file * file, struct vm_area_struct * vma)
static int mmap_mem(struct file * file, struct vm_area_struct * vma)
{
unsigned long offset = vma->vm_pgoff << PAGE_SHIFT;
- domid_t domid;
if (!(start_info.flags & SIF_PRIVILEGED))
return -ENXIO;
- domid = file->private_data ? *(domid_t *)file->private_data : 0;
-
/* DONTCOPY is essential for Xen as copy_page_range is broken. */
vma->vm_flags |= VM_RESERVED | VM_IO | VM_DONTCOPY;
vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
if (direct_remap_area_pages(vma->vm_mm, vma->vm_start, offset,
vma->vm_end-vma->vm_start, vma->vm_page_prot,
- domid))
+ (domid_t)file->private_data))
return -EAGAIN;
return 0;
}
static int ioctl_mem(struct inode * inode, struct file * file, unsigned int cmd, unsigned long arg)
{
- if (file->private_data == NULL)
- file->private_data = kmalloc(sizeof(domid_t), GFP_KERNEL);
switch (cmd) {
- case _IO('M', 1): ((unsigned long *)file->private_data)[0]=arg; break;
- case _IO('M', 2): ((unsigned long *)file->private_data)[1]=arg; break;
+ case _IO('M', 1): file->private_data = (void *)arg; break;
default: return -ENOSYS;
}
return 0;
}
-static int release_mem(struct inode * inode, struct file * file)
-{
- if (file->private_data != NULL)
- kfree(file->private_data);
- return 0;
-}
#endif /* CONFIG_XEN */
/*
@@ -685,7 +673,6 @@ static struct file_operations mem_fops = {
mmap: mmap_mem,
open: open_mem,
#if defined(CONFIG_XEN_PRIVILEGED_GUEST)
- release: release_mem,
ioctl: ioctl_mem,
#endif
};
diff --git a/xenolinux-2.4.26-sparse/include/asm-xen/hypervisor.h b/xenolinux-2.4.26-sparse/include/asm-xen/hypervisor.h
index 54e1522c72..3ace0bae8a 100644
--- a/xenolinux-2.4.26-sparse/include/asm-xen/hypervisor.h
+++ b/xenolinux-2.4.26-sparse/include/asm-xen/hypervisor.h
@@ -470,8 +470,7 @@ static inline int HYPERVISOR_update_va_mapping_otherdomain(
__asm__ __volatile__ (
TRAP_INSTR
: "=a" (ret) : "0" (__HYPERVISOR_update_va_mapping_otherdomain),
- "b" (page_nr), "c" ((new_val).pte_low), "d" (flags),
- "S" ((unsigned long)domid), "D" ((unsigned long)(domid>>32)) :
+ "b" (page_nr), "c" ((new_val).pte_low), "d" (flags), "S" (domid) :
"memory" );
return ret;