From: Hollis Blanchard Subject: Re: [patch] 32/64-bit hypercall interface revisited Date: Wed, 26 Apr 2006 16:38:48 -0500 Message-ID: <1146087528.16145.30.camel@basalt.austin.ibm.com> References: <1145049326.8498.39.camel@basalt.austin.ibm.com> <1145469607.9435.19.camel@basalt.austin.ibm.com> <1145906665.19906.46.camel@basalt.austin.ibm.com> <9536edf54f42b043239058a6bbeb530f@cl.cam.ac.uk> <1145996656.3609.21.camel@basalt.austin.ibm.com> <0881e458774a69d7d763866ebea82cfc@cl.cam.ac.uk> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-ip3Fa4uSejT5l5Uxg8Yw" Return-path: In-Reply-To: <0881e458774a69d7d763866ebea82cfc@cl.cam.ac.uk> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Keir Fraser Cc: xen-devel List-Id: xen-devel@lists.xenproject.org --=-ip3Fa4uSejT5l5Uxg8Yw Content-Type: text/plain Content-Transfer-Encoding: 7bit On Wed, 2006-04-26 at 08:50 +0100, Keir Fraser wrote: > On 25 Apr 2006, at 21:24, Hollis Blanchard wrote: > > >> This patch will unconditionally use the 'structural' definition of > >> guest handles for tools and kernels as well as Xen, right? Can > >> XenLinux > >> for x86/ia64 still build with this patch, without needing a bunch of > >> GET/SET_GUEST_HANDLE changes? > > > > Sorry, you're right. Attached are three patches: the Xen patch, the > > linux-2.6-merge patch, and the linux-2.6-sparse patch. > > This looks basically acceptable except.... > > Christian suggested providing GET/SET_XEN_GUEST_HANDLE(), for use at > least in the Linux patches. These could be defined in xen.h after > including arch-foo.h and simply invoke the arch-defined macros. > > Alternatively we could simply change the names of all the macros to > ...XEN_GUEST_HANDLE, and use the new names everywhere. I think that > would be okay as the names aren't that much longer and they aren't used > *that* often outside header files anyway. It'll make the patch a lot > bigger, but most of it'll be search-replace. And XEN_GUEST is more > informative than GUEST. Fine with me. I've split the global rename into a separate patch. > I don't think there's a need to send a patch for the merge tree -- > Christian pulls unstable patches into that in a half-automated way. Ok. > Also, no need to use GET_GUEST_HANDLE() in the libxc's read_console > function. Xen will never update the buffer pointer these days -- it > always fills the buffer from the start. When we eventually kill the > mlock() crap and implement it properly, I think GET_GUEST_HANDLE() can > be killed off entirely. That's fine, but I would like to avoid changing any behavior with these patch. If you want to remove that, you're welcome to... These patches have been compile-tested (Xen, libxc, sparse Linux) on x86(32). -- Hollis Blanchard IBM Linux Technology Center --=-ip3Fa4uSejT5l5Uxg8Yw Content-Disposition: attachment; filename=xen-rename-GUEST-to-XEN_GUEST.diff Content-Type: text/x-patch; name=xen-rename-GUEST-to-XEN_GUEST.diff; charset=utf-8 Content-Transfer-Encoding: 7bit Rename *GUEST_HANDLE to *XEN_GUEST_HANDLE. Signed-off-by: Hollis Blanchard diff -r 1d69cff40b8c xen/arch/ia64/xen/dom0_ops.c --- a/xen/arch/ia64/xen/dom0_ops.c Wed Apr 26 17:41:19 2006 +0100 +++ b/xen/arch/ia64/xen/dom0_ops.c Wed Apr 26 16:11:21 2006 -0500 @@ -20,7 +20,7 @@ #include #include -long arch_do_dom0_op(dom0_op_t *op, GUEST_HANDLE(dom0_op_t) u_dom0_op) +long arch_do_dom0_op(dom0_op_t *op, XEN_GUEST_HANDLE(dom0_op_t) u_dom0_op) { long ret = 0; diff -r 1d69cff40b8c xen/arch/x86/dom0_ops.c --- a/xen/arch/x86/dom0_ops.c Wed Apr 26 17:41:19 2006 +0100 +++ b/xen/arch/x86/dom0_ops.c Wed Apr 26 16:11:21 2006 -0500 @@ -49,7 +49,7 @@ static void read_msr_for(void *unused) (void)rdmsr_safe(msr_addr, msr_lo, msr_hi); } -long arch_do_dom0_op(struct dom0_op *op, GUEST_HANDLE(dom0_op_t) u_dom0_op) +long arch_do_dom0_op(struct dom0_op *op, XEN_GUEST_HANDLE(dom0_op_t) u_dom0_op) { long ret = 0; diff -r 1d69cff40b8c xen/arch/x86/domain.c --- a/xen/arch/x86/domain.c Wed Apr 26 17:41:19 2006 +0100 +++ b/xen/arch/x86/domain.c Wed Apr 26 16:11:21 2006 -0500 @@ -364,7 +364,7 @@ int arch_set_info_guest( long arch_do_vcpu_op( - int cmd, struct vcpu *v, GUEST_HANDLE(void) arg) + int cmd, struct vcpu *v, XEN_GUEST_HANDLE(void) arg) { long rc = 0; diff -r 1d69cff40b8c xen/arch/x86/mm.c --- a/xen/arch/x86/mm.c Wed Apr 26 17:41:19 2006 +0100 +++ b/xen/arch/x86/mm.c Wed Apr 26 16:11:21 2006 -0500 @@ -1757,9 +1757,9 @@ static inline cpumask_t vcpumask_to_pcpu } int do_mmuext_op( - GUEST_HANDLE(mmuext_op_t) uops, + XEN_GUEST_HANDLE(mmuext_op_t) uops, unsigned int count, - GUEST_HANDLE(uint) pdone, + XEN_GUEST_HANDLE(uint) pdone, unsigned int foreigndom) { struct mmuext_op op; @@ -2007,9 +2007,9 @@ int do_mmuext_op( } int do_mmu_update( - GUEST_HANDLE(mmu_update_t) ureqs, + XEN_GUEST_HANDLE(mmu_update_t) ureqs, unsigned int count, - GUEST_HANDLE(uint) pdone, + XEN_GUEST_HANDLE(uint) pdone, unsigned int foreigndom) { struct mmu_update req; @@ -2708,7 +2708,7 @@ long set_gdt(struct vcpu *v, } -long do_set_gdt(GUEST_HANDLE(ulong) frame_list, unsigned int entries) +long do_set_gdt(XEN_GUEST_HANDLE(ulong) frame_list, unsigned int entries) { int nr_pages = (entries + 511) / 512; unsigned long frames[16]; @@ -2812,7 +2812,7 @@ long do_update_descriptor(u64 pa, u64 de } -long arch_memory_op(int op, GUEST_HANDLE(void) arg) +long arch_memory_op(int op, XEN_GUEST_HANDLE(void) arg) { switch ( op ) { diff -r 1d69cff40b8c xen/arch/x86/oprofile/xenoprof.c --- a/xen/arch/x86/oprofile/xenoprof.c Wed Apr 26 17:41:19 2006 +0100 +++ b/xen/arch/x86/oprofile/xenoprof.c Wed Apr 26 16:11:21 2006 -0500 @@ -349,7 +349,7 @@ void free_xenoprof_pages(struct domain * d->xenoprof = NULL; } -int xenoprof_op_init(GUEST_HANDLE(void) arg) +int xenoprof_op_init(XEN_GUEST_HANDLE(void) arg) { struct xenoprof_init xenoprof_init; int is_primary, num_events; @@ -410,7 +410,7 @@ int xenoprof_op_init(GUEST_HANDLE(void) || (op == XENOPROF_release_counters) \ || (op == XENOPROF_shutdown)) -int do_xenoprof_op(int op, GUEST_HANDLE(void) arg) +int do_xenoprof_op(int op, XEN_GUEST_HANDLE(void) arg) { int ret = 0; diff -r 1d69cff40b8c xen/arch/x86/physdev.c --- a/xen/arch/x86/physdev.c Wed Apr 26 17:41:19 2006 +0100 +++ b/xen/arch/x86/physdev.c Wed Apr 26 16:11:21 2006 -0500 @@ -25,7 +25,7 @@ pirq_acktype( /* * Demuxing hypercall. */ -long do_physdev_op(GUEST_HANDLE(physdev_op_t) uop) +long do_physdev_op(XEN_GUEST_HANDLE(physdev_op_t) uop) { struct physdev_op op; long ret; diff -r 1d69cff40b8c xen/arch/x86/traps.c --- a/xen/arch/x86/traps.c Wed Apr 26 17:41:19 2006 +0100 +++ b/xen/arch/x86/traps.c Wed Apr 26 16:11:21 2006 -0500 @@ -1535,7 +1535,7 @@ void __init trap_init(void) } -long do_set_trap_table(GUEST_HANDLE(trap_info_t) traps) +long do_set_trap_table(XEN_GUEST_HANDLE(trap_info_t) traps) { struct trap_info cur; struct trap_info *dst = current->arch.guest_context.trap_ctxt; diff -r 1d69cff40b8c xen/arch/x86/x86_32/mm.c --- a/xen/arch/x86/x86_32/mm.c Wed Apr 26 17:41:19 2006 +0100 +++ b/xen/arch/x86/x86_32/mm.c Wed Apr 26 16:11:21 2006 -0500 @@ -189,7 +189,7 @@ void subarch_init_memory(void) } } -long subarch_memory_op(int op, GUEST_HANDLE(void) arg) +long subarch_memory_op(int op, XEN_GUEST_HANDLE(void) arg) { struct xen_machphys_mfn_list xmml; unsigned long mfn; diff -r 1d69cff40b8c xen/arch/x86/x86_32/traps.c --- a/xen/arch/x86/x86_32/traps.c Wed Apr 26 17:41:19 2006 +0100 +++ b/xen/arch/x86/x86_32/traps.c Wed Apr 26 16:11:21 2006 -0500 @@ -387,7 +387,7 @@ static long unregister_guest_callback(st } -long do_callback_op(int cmd, GUEST_HANDLE(void) arg) +long do_callback_op(int cmd, XEN_GUEST_HANDLE(void) arg) { long ret; diff -r 1d69cff40b8c xen/arch/x86/x86_64/mm.c --- a/xen/arch/x86/x86_64/mm.c Wed Apr 26 17:41:19 2006 +0100 +++ b/xen/arch/x86/x86_64/mm.c Wed Apr 26 16:11:21 2006 -0500 @@ -181,7 +181,7 @@ void subarch_init_memory(void) } } -long subarch_memory_op(int op, GUEST_HANDLE(void) arg) +long subarch_memory_op(int op, XEN_GUEST_HANDLE(void) arg) { struct xen_machphys_mfn_list xmml; l3_pgentry_t l3e; diff -r 1d69cff40b8c xen/arch/x86/x86_64/traps.c --- a/xen/arch/x86/x86_64/traps.c Wed Apr 26 17:41:19 2006 +0100 +++ b/xen/arch/x86/x86_64/traps.c Wed Apr 26 16:11:21 2006 -0500 @@ -371,7 +371,7 @@ static long unregister_guest_callback(st } -long do_callback_op(int cmd, GUEST_HANDLE(void) arg) +long do_callback_op(int cmd, XEN_GUEST_HANDLE(void) arg) { long ret; diff -r 1d69cff40b8c xen/common/acm_ops.c --- a/xen/common/acm_ops.c Wed Apr 26 17:41:19 2006 +0100 +++ b/xen/common/acm_ops.c Wed Apr 26 16:11:21 2006 -0500 @@ -32,7 +32,7 @@ #ifndef ACM_SECURITY -long do_acm_op(GUEST_HANDLE(acm_op_t) u_acm_op) +long do_acm_op(XEN_GUEST_HANDLE(acm_op_t) u_acm_op) { return -ENOSYS; } @@ -57,7 +57,7 @@ int acm_authorize_acm_ops(struct domain return 0; } -long do_acm_op(GUEST_HANDLE(acm_op_t) u_acm_op) +long do_acm_op(XEN_GUEST_HANDLE(acm_op_t) u_acm_op) { long ret = 0; struct acm_op curop, *op = &curop; diff -r 1d69cff40b8c xen/common/dom0_ops.c --- a/xen/common/dom0_ops.c Wed Apr 26 17:41:19 2006 +0100 +++ b/xen/common/dom0_ops.c Wed Apr 26 16:11:21 2006 -0500 @@ -24,7 +24,7 @@ #include extern long arch_do_dom0_op( - struct dom0_op *op, GUEST_HANDLE(dom0_op_t) u_dom0_op); + struct dom0_op *op, XEN_GUEST_HANDLE(dom0_op_t) u_dom0_op); extern void arch_getdomaininfo_ctxt( struct vcpu *, struct vcpu_guest_context *); @@ -90,7 +90,7 @@ static void getdomaininfo(struct domain memcpy(info->handle, d->handle, sizeof(xen_domain_handle_t)); } -long do_dom0_op(GUEST_HANDLE(dom0_op_t) u_dom0_op) +long do_dom0_op(XEN_GUEST_HANDLE(dom0_op_t) u_dom0_op) { long ret = 0; struct dom0_op curop, *op = &curop; diff -r 1d69cff40b8c xen/common/domain.c --- a/xen/common/domain.c Wed Apr 26 17:41:19 2006 +0100 +++ b/xen/common/domain.c Wed Apr 26 16:11:21 2006 -0500 @@ -408,7 +408,7 @@ int boot_vcpu(struct domain *d, int vcpu return arch_set_info_guest(v, ctxt); } -long do_vcpu_op(int cmd, int vcpuid, GUEST_HANDLE(void) arg) +long do_vcpu_op(int cmd, int vcpuid, XEN_GUEST_HANDLE(void) arg) { struct domain *d = current->domain; struct vcpu *v; diff -r 1d69cff40b8c xen/common/event_channel.c --- a/xen/common/event_channel.c Wed Apr 26 17:41:19 2006 +0100 +++ b/xen/common/event_channel.c Wed Apr 26 16:11:21 2006 -0500 @@ -683,7 +683,7 @@ static long evtchn_unmask(evtchn_unmask_ } -long do_event_channel_op(GUEST_HANDLE(evtchn_op_t) uop) +long do_event_channel_op(XEN_GUEST_HANDLE(evtchn_op_t) uop) { long rc; struct evtchn_op op; diff -r 1d69cff40b8c xen/common/grant_table.c --- a/xen/common/grant_table.c Wed Apr 26 17:41:19 2006 +0100 +++ b/xen/common/grant_table.c Wed Apr 26 16:11:21 2006 -0500 @@ -301,7 +301,7 @@ __gnttab_map_grant_ref( static long gnttab_map_grant_ref( - GUEST_HANDLE(gnttab_map_grant_ref_t) uop, unsigned int count) + XEN_GUEST_HANDLE(gnttab_map_grant_ref_t) uop, unsigned int count) { int i; struct gnttab_map_grant_ref op; @@ -438,7 +438,7 @@ __gnttab_unmap_grant_ref( static long gnttab_unmap_grant_ref( - GUEST_HANDLE(gnttab_unmap_grant_ref_t) uop, unsigned int count) + XEN_GUEST_HANDLE(gnttab_unmap_grant_ref_t) uop, unsigned int count) { int i; struct gnttab_unmap_grant_ref op; @@ -462,7 +462,7 @@ fault: static long gnttab_setup_table( - GUEST_HANDLE(gnttab_setup_table_t) uop, unsigned int count) + XEN_GUEST_HANDLE(gnttab_setup_table_t) uop, unsigned int count) { struct gnttab_setup_table op; struct domain *d; @@ -598,7 +598,7 @@ gnttab_prepare_for_transfer( static long gnttab_transfer( - GUEST_HANDLE(gnttab_transfer_t) uop, unsigned int count) + XEN_GUEST_HANDLE(gnttab_transfer_t) uop, unsigned int count) { struct domain *d = current->domain; struct domain *e; @@ -711,7 +711,7 @@ gnttab_transfer( long do_grant_table_op( - unsigned int cmd, GUEST_HANDLE(void) uop, unsigned int count) + unsigned int cmd, XEN_GUEST_HANDLE(void) uop, unsigned int count) { long rc; struct domain *d = current->domain; @@ -728,7 +728,7 @@ do_grant_table_op( { case GNTTABOP_map_grant_ref: { - GUEST_HANDLE(gnttab_map_grant_ref_t) map = + XEN_GUEST_HANDLE(gnttab_map_grant_ref_t) map = guest_handle_cast(uop, gnttab_map_grant_ref_t); if ( unlikely(!guest_handle_okay(map, count)) ) goto out; @@ -737,7 +737,7 @@ do_grant_table_op( } case GNTTABOP_unmap_grant_ref: { - GUEST_HANDLE(gnttab_unmap_grant_ref_t) unmap = + XEN_GUEST_HANDLE(gnttab_unmap_grant_ref_t) unmap = guest_handle_cast(uop, gnttab_unmap_grant_ref_t); if ( unlikely(!guest_handle_okay(unmap, count)) ) goto out; @@ -752,7 +752,7 @@ do_grant_table_op( } case GNTTABOP_transfer: { - GUEST_HANDLE(gnttab_transfer_t) transfer = + XEN_GUEST_HANDLE(gnttab_transfer_t) transfer = guest_handle_cast(uop, gnttab_transfer_t); if ( unlikely(!guest_handle_okay(transfer, count)) ) goto out; diff -r 1d69cff40b8c xen/common/kernel.c --- a/xen/common/kernel.c Wed Apr 26 17:41:19 2006 +0100 +++ b/xen/common/kernel.c Wed Apr 26 16:11:21 2006 -0500 @@ -118,7 +118,7 @@ void add_taint(unsigned flag) * Simple hypercalls. */ -long do_xen_version(int cmd, GUEST_HANDLE(void) arg) +long do_xen_version(int cmd, XEN_GUEST_HANDLE(void) arg) { switch ( cmd ) { @@ -244,7 +244,7 @@ long unregister_guest_nmi_callback(void) return 0; } -long do_nmi_op(unsigned int cmd, GUEST_HANDLE(void) arg) +long do_nmi_op(unsigned int cmd, XEN_GUEST_HANDLE(void) arg) { struct xennmi_callback cb; long rc = 0; diff -r 1d69cff40b8c xen/common/memory.c --- a/xen/common/memory.c Wed Apr 26 17:41:19 2006 +0100 +++ b/xen/common/memory.c Wed Apr 26 16:11:21 2006 -0500 @@ -31,7 +31,7 @@ static long static long increase_reservation( struct domain *d, - GUEST_HANDLE(ulong) extent_list, + XEN_GUEST_HANDLE(ulong) extent_list, unsigned int nr_extents, unsigned int extent_order, unsigned int flags, @@ -80,7 +80,7 @@ static long static long populate_physmap( struct domain *d, - GUEST_HANDLE(ulong) extent_list, + XEN_GUEST_HANDLE(ulong) extent_list, unsigned int nr_extents, unsigned int extent_order, unsigned int flags, @@ -177,7 +177,7 @@ static long static long decrease_reservation( struct domain *d, - GUEST_HANDLE(ulong) extent_list, + XEN_GUEST_HANDLE(ulong) extent_list, unsigned int nr_extents, unsigned int extent_order, unsigned int flags, @@ -211,7 +211,7 @@ decrease_reservation( static long translate_gpfn_list( - GUEST_HANDLE(xen_translate_gpfn_list_t) uop, unsigned long *progress) + XEN_GUEST_HANDLE(xen_translate_gpfn_list_t) uop, unsigned long *progress) { struct xen_translate_gpfn_list op; unsigned long i, gpfn, mfn; @@ -270,7 +270,7 @@ translate_gpfn_list( return 0; } -long do_memory_op(unsigned long cmd, GUEST_HANDLE(void) arg) +long do_memory_op(unsigned long cmd, XEN_GUEST_HANDLE(void) arg) { struct domain *d; int rc, op, flags = 0, preempted = 0; diff -r 1d69cff40b8c xen/common/multicall.c --- a/xen/common/multicall.c Wed Apr 26 17:41:19 2006 +0100 +++ b/xen/common/multicall.c Wed Apr 26 16:11:21 2006 -0500 @@ -18,7 +18,7 @@ struct mc_state mc_state[NR_CPUS]; long do_multicall( - GUEST_HANDLE(multicall_entry_t) call_list, unsigned int nr_calls) + XEN_GUEST_HANDLE(multicall_entry_t) call_list, unsigned int nr_calls) { struct mc_state *mcs = &mc_state[smp_processor_id()]; unsigned int i; diff -r 1d69cff40b8c xen/common/perfc.c --- a/xen/common/perfc.c Wed Apr 26 17:41:19 2006 +0100 +++ b/xen/common/perfc.c Wed Apr 26 16:11:21 2006 -0500 @@ -131,7 +131,7 @@ void perfc_reset(unsigned char key) static dom0_perfc_desc_t perfc_d[NR_PERFCTRS]; static int perfc_init = 0; -static int perfc_copy_info(GUEST_HANDLE(dom0_perfc_desc_t) desc) +static int perfc_copy_info(XEN_GUEST_HANDLE(dom0_perfc_desc_t) desc) { unsigned int i, j; atomic_t *counters = (atomic_t *)&perfcounters; diff -r 1d69cff40b8c xen/common/schedule.c --- a/xen/common/schedule.c Wed Apr 26 17:41:19 2006 +0100 +++ b/xen/common/schedule.c Wed Apr 26 16:11:21 2006 -0500 @@ -365,7 +365,7 @@ long do_sched_op_compat(int cmd, unsigne return ret; } -long do_sched_op(int cmd, GUEST_HANDLE(void) arg) +long do_sched_op(int cmd, XEN_GUEST_HANDLE(void) arg) { long ret = 0; diff -r 1d69cff40b8c xen/drivers/char/console.c --- a/xen/drivers/char/console.c Wed Apr 26 17:41:19 2006 +0100 +++ b/xen/drivers/char/console.c Wed Apr 26 16:11:21 2006 -0500 @@ -221,7 +221,7 @@ static void putchar_console_ring(int c) conringc = conringp - CONRING_SIZE; } -long read_console_ring(GUEST_HANDLE(char) str, u32 *pcount, int clear) +long read_console_ring(XEN_GUEST_HANDLE(char) str, u32 *pcount, int clear) { unsigned int idx, len, max, sofar, c; unsigned long flags; @@ -319,7 +319,7 @@ static void serial_rx(char c, struct cpu __serial_rx(c, regs); } -static long guest_console_write(GUEST_HANDLE(char) buffer, int count) +static long guest_console_write(XEN_GUEST_HANDLE(char) buffer, int count) { char kbuf[128], *kptr; int kcount; @@ -355,7 +355,7 @@ static long guest_console_write(GUEST_HA return 0; } -long do_console_io(int cmd, int count, GUEST_HANDLE(char) buffer) +long do_console_io(int cmd, int count, XEN_GUEST_HANDLE(char) buffer) { long rc; unsigned int idx, len; diff -r 1d69cff40b8c xen/include/asm-ia64/guest_access.h --- a/xen/include/asm-ia64/guest_access.h Wed Apr 26 17:41:19 2006 +0100 +++ b/xen/include/asm-ia64/guest_access.h Wed Apr 26 16:11:21 2006 -0500 @@ -18,10 +18,10 @@ /* Cast a guest handle to the specified type of handle. */ #define guest_handle_cast(hnd, type) ({ \ type *_x = (hnd).p; \ - (GUEST_HANDLE(type)) { _x }; \ + (XEN_GUEST_HANDLE(type)) { _x }; \ }) -#define guest_handle_from_ptr(ptr, type) ((GUEST_HANDLE(type)) { (type *)ptr }) +#define guest_handle_from_ptr(ptr, type) ((XEN_GUEST_HANDLE(type)) { (type *)ptr }) /* * Copy an array of objects to guest context via a guest handle, diff -r 1d69cff40b8c xen/include/asm-x86/guest_access.h --- a/xen/include/asm-x86/guest_access.h Wed Apr 26 17:41:19 2006 +0100 +++ b/xen/include/asm-x86/guest_access.h Wed Apr 26 16:11:21 2006 -0500 @@ -18,7 +18,7 @@ /* Cast a guest handle to the specified type of handle. */ #define guest_handle_cast(hnd, type) ({ \ type *_x = (hnd).p; \ - (GUEST_HANDLE(type)) { _x }; \ + (XEN_GUEST_HANDLE(type)) { _x }; \ }) /* diff -r 1d69cff40b8c xen/include/asm-x86/hypercall.h --- a/xen/include/asm-x86/hypercall.h Wed Apr 26 17:41:19 2006 +0100 +++ b/xen/include/asm-x86/hypercall.h Wed Apr 26 16:11:21 2006 -0500 @@ -9,18 +9,18 @@ extern long do_set_trap_table( - GUEST_HANDLE(trap_info_t) traps); + XEN_GUEST_HANDLE(trap_info_t) traps); extern int do_mmu_update( - GUEST_HANDLE(mmu_update_t) ureqs, + XEN_GUEST_HANDLE(mmu_update_t) ureqs, unsigned int count, - GUEST_HANDLE(uint) pdone, + XEN_GUEST_HANDLE(uint) pdone, unsigned int foreigndom); extern long do_set_gdt( - GUEST_HANDLE(ulong) frame_list, + XEN_GUEST_HANDLE(ulong) frame_list, unsigned int entries); extern long @@ -54,7 +54,7 @@ do_update_va_mapping( extern long do_physdev_op( - GUEST_HANDLE(physdev_op_t) uop); + XEN_GUEST_HANDLE(physdev_op_t) uop); extern int do_update_va_mapping_otherdomain( @@ -65,9 +65,9 @@ do_update_va_mapping_otherdomain( extern int do_mmuext_op( - GUEST_HANDLE(mmuext_op_t) uops, + XEN_GUEST_HANDLE(mmuext_op_t) uops, unsigned int count, - GUEST_HANDLE(uint) pdone, + XEN_GUEST_HANDLE(uint) pdone, unsigned int foreigndom); extern unsigned long @@ -77,7 +77,7 @@ struct vcpu; struct vcpu; extern long arch_do_vcpu_op( - int cmd, struct vcpu *v, GUEST_HANDLE(void) arg); + int cmd, struct vcpu *v, XEN_GUEST_HANDLE(void) arg); #ifdef __x86_64__ diff -r 1d69cff40b8c xen/include/asm-x86/mm.h --- a/xen/include/asm-x86/mm.h Wed Apr 26 17:41:19 2006 +0100 +++ b/xen/include/asm-x86/mm.h Wed Apr 26 16:11:21 2006 -0500 @@ -382,7 +382,7 @@ int __sync_lazy_execstate(void); int __sync_lazy_execstate(void); /* Arch-specific portion of memory_op hypercall. */ -long arch_memory_op(int op, GUEST_HANDLE(void) arg); -long subarch_memory_op(int op, GUEST_HANDLE(void) arg); +long arch_memory_op(int op, XEN_GUEST_HANDLE(void) arg); +long subarch_memory_op(int op, XEN_GUEST_HANDLE(void) arg); #endif /* __ASM_X86_MM_H__ */ diff -r 1d69cff40b8c xen/include/public/acm_ops.h --- a/xen/include/public/acm_ops.h Wed Apr 26 17:41:19 2006 +0100 +++ b/xen/include/public/acm_ops.h Wed Apr 26 16:11:21 2006 -0500 @@ -83,7 +83,7 @@ typedef struct acm_op { struct acm_getdecision getdecision; } u; } acm_op_t; -DEFINE_GUEST_HANDLE(acm_op_t); +DEFINE_XEN_GUEST_HANDLE(acm_op_t); #endif /* __XEN_PUBLIC_ACM_OPS_H__ */ diff -r 1d69cff40b8c xen/include/public/arch-ia64.h --- a/xen/include/public/arch-ia64.h Wed Apr 26 17:41:19 2006 +0100 +++ b/xen/include/public/arch-ia64.h Wed Apr 26 16:11:21 2006 -0500 @@ -8,25 +8,25 @@ #define __HYPERVISOR_IF_IA64_H__ #ifdef __XEN__ -#define __DEFINE_GUEST_HANDLE(name, type) \ +#define __DEFINE_XEN_GUEST_HANDLE(name, type) \ typedef struct { type *p; } __guest_handle_ ## name #else -#define __DEFINE_GUEST_HANDLE(name, type) \ +#define __DEFINE_XEN_GUEST_HANDLE(name, type) \ typedef type * __guest_handle_ ## name #endif -#define DEFINE_GUEST_HANDLE(name) __DEFINE_GUEST_HANDLE(name, name) -#define GUEST_HANDLE(name) __guest_handle_ ## name +#define DEFINE_XEN_GUEST_HANDLE(name) __DEFINE_XEN_GUEST_HANDLE(name, name) +#define XEN_GUEST_HANDLE(name) __guest_handle_ ## name #ifndef __ASSEMBLY__ /* Guest handles for primitive C types. */ -__DEFINE_GUEST_HANDLE(uchar, unsigned char); -__DEFINE_GUEST_HANDLE(uint, unsigned int); -__DEFINE_GUEST_HANDLE(ulong, unsigned long); -DEFINE_GUEST_HANDLE(char); -DEFINE_GUEST_HANDLE(int); -DEFINE_GUEST_HANDLE(long); -DEFINE_GUEST_HANDLE(void); +__DEFINE_XEN_GUEST_HANDLE(uchar, unsigned char); +__DEFINE_XEN_GUEST_HANDLE(uint, unsigned int); +__DEFINE_XEN_GUEST_HANDLE(ulong, unsigned long); +DEFINE_XEN_GUEST_HANDLE(char); +DEFINE_XEN_GUEST_HANDLE(int); +DEFINE_XEN_GUEST_HANDLE(long); +DEFINE_XEN_GUEST_HANDLE(void); #endif /* Maximum number of virtual CPUs in multi-processor guests. */ @@ -320,7 +320,7 @@ typedef struct vcpu_guest_context { arch_initrd_info_t initrd; char cmdline[IA64_COMMAND_LINE_SIZE]; } vcpu_guest_context_t; -DEFINE_GUEST_HANDLE(vcpu_guest_context_t); +DEFINE_XEN_GUEST_HANDLE(vcpu_guest_context_t); #endif /* !__ASSEMBLY__ */ diff -r 1d69cff40b8c xen/include/public/arch-x86_32.h --- a/xen/include/public/arch-x86_32.h Wed Apr 26 17:41:19 2006 +0100 +++ b/xen/include/public/arch-x86_32.h Wed Apr 26 16:11:21 2006 -0500 @@ -10,25 +10,25 @@ #define __XEN_PUBLIC_ARCH_X86_32_H__ #ifdef __XEN__ -#define __DEFINE_GUEST_HANDLE(name, type) \ +#define __DEFINE_XEN_GUEST_HANDLE(name, type) \ typedef struct { type *p; } __guest_handle_ ## name #else -#define __DEFINE_GUEST_HANDLE(name, type) \ +#define __DEFINE_XEN_GUEST_HANDLE(name, type) \ typedef type * __guest_handle_ ## name #endif -#define DEFINE_GUEST_HANDLE(name) __DEFINE_GUEST_HANDLE(name, name) -#define GUEST_HANDLE(name) __guest_handle_ ## name +#define DEFINE_XEN_GUEST_HANDLE(name) __DEFINE_XEN_GUEST_HANDLE(name, name) +#define XEN_GUEST_HANDLE(name) __guest_handle_ ## name #ifndef __ASSEMBLY__ /* Guest handles for primitive C types. */ -__DEFINE_GUEST_HANDLE(uchar, unsigned char); -__DEFINE_GUEST_HANDLE(uint, unsigned int); -__DEFINE_GUEST_HANDLE(ulong, unsigned long); -DEFINE_GUEST_HANDLE(char); -DEFINE_GUEST_HANDLE(int); -DEFINE_GUEST_HANDLE(long); -DEFINE_GUEST_HANDLE(void); +__DEFINE_XEN_GUEST_HANDLE(uchar, unsigned char); +__DEFINE_XEN_GUEST_HANDLE(uint, unsigned int); +__DEFINE_XEN_GUEST_HANDLE(ulong, unsigned long); +DEFINE_XEN_GUEST_HANDLE(char); +DEFINE_XEN_GUEST_HANDLE(int); +DEFINE_XEN_GUEST_HANDLE(long); +DEFINE_XEN_GUEST_HANDLE(void); #endif /* @@ -102,7 +102,7 @@ typedef struct trap_info { uint16_t cs; /* code selector */ unsigned long address; /* code offset */ } trap_info_t; -DEFINE_GUEST_HANDLE(trap_info_t); +DEFINE_XEN_GUEST_HANDLE(trap_info_t); typedef struct cpu_user_regs { uint32_t ebx; @@ -126,7 +126,7 @@ typedef struct cpu_user_regs { uint16_t fs, _pad4; uint16_t gs, _pad5; } cpu_user_regs_t; -DEFINE_GUEST_HANDLE(cpu_user_regs_t); +DEFINE_XEN_GUEST_HANDLE(cpu_user_regs_t); typedef uint64_t tsc_timestamp_t; /* RDTSC timestamp */ @@ -154,7 +154,7 @@ typedef struct vcpu_guest_context { unsigned long failsafe_callback_eip; unsigned long vm_assist; /* VMASST_TYPE_* bitmap */ } vcpu_guest_context_t; -DEFINE_GUEST_HANDLE(vcpu_guest_context_t); +DEFINE_XEN_GUEST_HANDLE(vcpu_guest_context_t); typedef struct arch_shared_info { unsigned long max_pfn; /* max pfn that appears in table */ diff -r 1d69cff40b8c xen/include/public/arch-x86_64.h --- a/xen/include/public/arch-x86_64.h Wed Apr 26 17:41:19 2006 +0100 +++ b/xen/include/public/arch-x86_64.h Wed Apr 26 16:11:21 2006 -0500 @@ -10,25 +10,25 @@ #define __XEN_PUBLIC_ARCH_X86_64_H__ #ifdef __XEN__ -#define __DEFINE_GUEST_HANDLE(name, type) \ +#define __DEFINE_XEN_GUEST_HANDLE(name, type) \ typedef struct { type *p; } __guest_handle_ ## name #else -#define __DEFINE_GUEST_HANDLE(name, type) \ +#define __DEFINE_XEN_GUEST_HANDLE(name, type) \ typedef type * __guest_handle_ ## name #endif -#define DEFINE_GUEST_HANDLE(name) __DEFINE_GUEST_HANDLE(name, name) -#define GUEST_HANDLE(name) __guest_handle_ ## name +#define DEFINE_XEN_GUEST_HANDLE(name) __DEFINE_XEN_GUEST_HANDLE(name, name) +#define XEN_GUEST_HANDLE(name) __guest_handle_ ## name #ifndef __ASSEMBLY__ /* Guest handles for primitive C types. */ -__DEFINE_GUEST_HANDLE(uchar, unsigned char); -__DEFINE_GUEST_HANDLE(uint, unsigned int); -__DEFINE_GUEST_HANDLE(ulong, unsigned long); -DEFINE_GUEST_HANDLE(char); -DEFINE_GUEST_HANDLE(int); -DEFINE_GUEST_HANDLE(long); -DEFINE_GUEST_HANDLE(void); +__DEFINE_XEN_GUEST_HANDLE(uchar, unsigned char); +__DEFINE_XEN_GUEST_HANDLE(uint, unsigned int); +__DEFINE_XEN_GUEST_HANDLE(ulong, unsigned long); +DEFINE_XEN_GUEST_HANDLE(char); +DEFINE_XEN_GUEST_HANDLE(int); +DEFINE_XEN_GUEST_HANDLE(long); +DEFINE_XEN_GUEST_HANDLE(void); #endif /* @@ -157,7 +157,7 @@ typedef struct trap_info { uint16_t cs; /* code selector */ unsigned long address; /* code offset */ } trap_info_t; -DEFINE_GUEST_HANDLE(trap_info_t); +DEFINE_XEN_GUEST_HANDLE(trap_info_t); #ifdef __GNUC__ /* Anonymous union includes both 32- and 64-bit names (e.g., eax/rax). */ @@ -197,7 +197,7 @@ typedef struct cpu_user_regs { uint16_t fs, _pad5[3]; /* Non-zero => takes precedence over fs_base. */ uint16_t gs, _pad6[3]; /* Non-zero => takes precedence over gs_base_usr. */ } cpu_user_regs_t; -DEFINE_GUEST_HANDLE(cpu_user_regs_t); +DEFINE_XEN_GUEST_HANDLE(cpu_user_regs_t); #undef __DECL_REG @@ -230,7 +230,7 @@ typedef struct vcpu_guest_context { uint64_t gs_base_kernel; uint64_t gs_base_user; } vcpu_guest_context_t; -DEFINE_GUEST_HANDLE(vcpu_guest_context_t); +DEFINE_XEN_GUEST_HANDLE(vcpu_guest_context_t); typedef struct arch_shared_info { unsigned long max_pfn; /* max pfn that appears in table */ diff -r 1d69cff40b8c xen/include/public/callback.h --- a/xen/include/public/callback.h Wed Apr 26 17:41:19 2006 +0100 +++ b/xen/include/public/callback.h Wed Apr 26 16:11:21 2006 -0500 @@ -36,7 +36,7 @@ typedef struct callback_register { int type; xen_callback_t address; } callback_register_t; -DEFINE_GUEST_HANDLE(callback_register_t); +DEFINE_XEN_GUEST_HANDLE(callback_register_t); /* * Unregister a callback. @@ -48,7 +48,7 @@ typedef struct callback_unregister { typedef struct callback_unregister { int type; } callback_unregister_t; -DEFINE_GUEST_HANDLE(callback_unregister_t); +DEFINE_XEN_GUEST_HANDLE(callback_unregister_t); #endif /* __XEN_PUBLIC_CALLBACK_H__ */ diff -r 1d69cff40b8c xen/include/public/dom0_ops.h --- a/xen/include/public/dom0_ops.h Wed Apr 26 17:41:19 2006 +0100 +++ b/xen/include/public/dom0_ops.h Wed Apr 26 16:11:21 2006 -0500 @@ -28,21 +28,21 @@ typedef struct dom0_getmemlist { /* IN variables. */ domid_t domain; unsigned long max_pfns; - GUEST_HANDLE(ulong) buffer; + XEN_GUEST_HANDLE(ulong) buffer; /* OUT variables. */ unsigned long num_pfns; } dom0_getmemlist_t; -DEFINE_GUEST_HANDLE(dom0_getmemlist_t); +DEFINE_XEN_GUEST_HANDLE(dom0_getmemlist_t); #define DOM0_SCHEDCTL 6 /* struct sched_ctl_cmd is from sched-ctl.h */ typedef struct sched_ctl_cmd dom0_schedctl_t; -DEFINE_GUEST_HANDLE(dom0_schedctl_t); +DEFINE_XEN_GUEST_HANDLE(dom0_schedctl_t); #define DOM0_ADJUSTDOM 7 /* struct sched_adjdom_cmd is from sched-ctl.h */ typedef struct sched_adjdom_cmd dom0_adjustdom_t; -DEFINE_GUEST_HANDLE(dom0_adjustdom_t); +DEFINE_XEN_GUEST_HANDLE(dom0_adjustdom_t); #define DOM0_CREATEDOMAIN 8 typedef struct dom0_createdomain { @@ -53,28 +53,28 @@ typedef struct dom0_createdomain { /* Identifier for new domain (auto-allocate if zero is specified). */ domid_t domain; } dom0_createdomain_t; -DEFINE_GUEST_HANDLE(dom0_createdomain_t); +DEFINE_XEN_GUEST_HANDLE(dom0_createdomain_t); #define DOM0_DESTROYDOMAIN 9 typedef struct dom0_destroydomain { /* IN variables. */ domid_t domain; } dom0_destroydomain_t; -DEFINE_GUEST_HANDLE(dom0_destroydomain_t); +DEFINE_XEN_GUEST_HANDLE(dom0_destroydomain_t); #define DOM0_PAUSEDOMAIN 10 typedef struct dom0_pausedomain { /* IN parameters. */ domid_t domain; } dom0_pausedomain_t; -DEFINE_GUEST_HANDLE(dom0_pausedomain_t); +DEFINE_XEN_GUEST_HANDLE(dom0_pausedomain_t); #define DOM0_UNPAUSEDOMAIN 11 typedef struct dom0_unpausedomain { /* IN parameters. */ domid_t domain; } dom0_unpausedomain_t; -DEFINE_GUEST_HANDLE(dom0_unpausedomain_t); +DEFINE_XEN_GUEST_HANDLE(dom0_unpausedomain_t); #define DOM0_GETDOMAININFO 12 typedef struct dom0_getdomaininfo { @@ -100,7 +100,7 @@ typedef struct dom0_getdomaininfo { uint32_t ssidref; xen_domain_handle_t handle; } dom0_getdomaininfo_t; -DEFINE_GUEST_HANDLE(dom0_getdomaininfo_t); +DEFINE_XEN_GUEST_HANDLE(dom0_getdomaininfo_t); #define DOM0_SETVCPUCONTEXT 13 typedef struct dom0_setvcpucontext { @@ -108,9 +108,9 @@ typedef struct dom0_setvcpucontext { domid_t domain; uint32_t vcpu; /* IN/OUT parameters */ - GUEST_HANDLE(vcpu_guest_context_t) ctxt; + XEN_GUEST_HANDLE(vcpu_guest_context_t) ctxt; } dom0_setvcpucontext_t; -DEFINE_GUEST_HANDLE(dom0_setvcpucontext_t); +DEFINE_XEN_GUEST_HANDLE(dom0_setvcpucontext_t); #define DOM0_MSR 15 typedef struct dom0_msr { @@ -124,7 +124,7 @@ typedef struct dom0_msr { uint32_t out1; uint32_t out2; } dom0_msr_t; -DEFINE_GUEST_HANDLE(dom0_msr_t); +DEFINE_XEN_GUEST_HANDLE(dom0_msr_t); /* * Set clock such that it would read after 00:00:00 UTC, @@ -137,7 +137,7 @@ typedef struct dom0_settime { uint32_t nsecs; uint64_t system_time; } dom0_settime_t; -DEFINE_GUEST_HANDLE(dom0_settime_t); +DEFINE_XEN_GUEST_HANDLE(dom0_settime_t); #define DOM0_GETPAGEFRAMEINFO 18 #define LTAB_SHIFT 28 @@ -159,7 +159,7 @@ typedef struct dom0_getpageframeinfo { /* Is the page PINNED to a type? */ uint32_t type; /* see above type defs */ } dom0_getpageframeinfo_t; -DEFINE_GUEST_HANDLE(dom0_getpageframeinfo_t); +DEFINE_XEN_GUEST_HANDLE(dom0_getpageframeinfo_t); /* * Read console content from Xen buffer ring. @@ -169,10 +169,10 @@ typedef struct dom0_readconsole { /* IN variables. */ uint32_t clear; /* Non-zero -> clear after reading. */ /* IN/OUT variables. */ - GUEST_HANDLE(char) buffer; /* In: Buffer start; Out: Used buffer start */ + XEN_GUEST_HANDLE(char) buffer; /* In: Buffer start; Out: Used buffer start */ uint32_t count; /* In: Buffer size; Out: Used buffer size */ } dom0_readconsole_t; -DEFINE_GUEST_HANDLE(dom0_readconsole_t); +DEFINE_XEN_GUEST_HANDLE(dom0_readconsole_t); /* * Set which physical cpus a vcpu can execute on. @@ -184,7 +184,7 @@ typedef struct dom0_setvcpuaffinity { uint32_t vcpu; cpumap_t cpumap; } dom0_setvcpuaffinity_t; -DEFINE_GUEST_HANDLE(dom0_setvcpuaffinity_t); +DEFINE_XEN_GUEST_HANDLE(dom0_setvcpuaffinity_t); /* Get trace buffers machine base address */ #define DOM0_TBUFCONTROL 21 @@ -204,7 +204,7 @@ typedef struct dom0_tbufcontrol { unsigned long buffer_mfn; uint32_t size; } dom0_tbufcontrol_t; -DEFINE_GUEST_HANDLE(dom0_tbufcontrol_t); +DEFINE_XEN_GUEST_HANDLE(dom0_tbufcontrol_t); /* * Get physical information about the host machine @@ -220,7 +220,7 @@ typedef struct dom0_physinfo { unsigned long free_pages; uint32_t hw_cap[8]; } dom0_physinfo_t; -DEFINE_GUEST_HANDLE(dom0_physinfo_t); +DEFINE_XEN_GUEST_HANDLE(dom0_physinfo_t); /* * Get the ID of the current scheduler. @@ -230,7 +230,7 @@ typedef struct dom0_sched_id { /* OUT variable */ uint32_t sched_id; } dom0_sched_id_t; -DEFINE_GUEST_HANDLE(dom0_sched_id_t); +DEFINE_XEN_GUEST_HANDLE(dom0_sched_id_t); /* * Control shadow pagetables operation @@ -252,19 +252,19 @@ typedef struct dom0_shadow_control_stats uint32_t dirty_net_count; uint32_t dirty_block_count; } dom0_shadow_control_stats_t; -DEFINE_GUEST_HANDLE(dom0_shadow_control_stats_t); +DEFINE_XEN_GUEST_HANDLE(dom0_shadow_control_stats_t); typedef struct dom0_shadow_control { /* IN variables. */ domid_t domain; uint32_t op; - GUEST_HANDLE(ulong) dirty_bitmap; + XEN_GUEST_HANDLE(ulong) dirty_bitmap; /* IN/OUT variables. */ unsigned long pages; /* size of buffer, updated with actual size */ /* OUT variables. */ dom0_shadow_control_stats_t stats; } dom0_shadow_control_t; -DEFINE_GUEST_HANDLE(dom0_shadow_control_t); +DEFINE_XEN_GUEST_HANDLE(dom0_shadow_control_t); #define DOM0_SETDOMAINMAXMEM 28 typedef struct dom0_setdomainmaxmem { @@ -272,7 +272,7 @@ typedef struct dom0_setdomainmaxmem { domid_t domain; unsigned long max_memkb; } dom0_setdomainmaxmem_t; -DEFINE_GUEST_HANDLE(dom0_setdomainmaxmem_t); +DEFINE_XEN_GUEST_HANDLE(dom0_setdomainmaxmem_t); #define DOM0_GETPAGEFRAMEINFO2 29 /* batched interface */ typedef struct dom0_getpageframeinfo2 { @@ -280,9 +280,9 @@ typedef struct dom0_getpageframeinfo2 { domid_t domain; unsigned long num; /* IN/OUT variables. */ - GUEST_HANDLE(ulong) array; + XEN_GUEST_HANDLE(ulong) array; } dom0_getpageframeinfo2_t; -DEFINE_GUEST_HANDLE(dom0_getpageframeinfo2_t); +DEFINE_XEN_GUEST_HANDLE(dom0_getpageframeinfo2_t); /* * Request memory range (@mfn, @mfn+@nr_mfns-1) to have type @type. @@ -301,7 +301,7 @@ typedef struct dom0_add_memtype { uint32_t handle; uint32_t reg; } dom0_add_memtype_t; -DEFINE_GUEST_HANDLE(dom0_add_memtype_t); +DEFINE_XEN_GUEST_HANDLE(dom0_add_memtype_t); /* * Tear down an existing memory-range type. If @handle is remembered then it @@ -316,7 +316,7 @@ typedef struct dom0_del_memtype { uint32_t handle; uint32_t reg; } dom0_del_memtype_t; -DEFINE_GUEST_HANDLE(dom0_del_memtype_t); +DEFINE_XEN_GUEST_HANDLE(dom0_del_memtype_t); /* Read current type of an MTRR (x86-specific). */ #define DOM0_READ_MEMTYPE 33 @@ -328,7 +328,7 @@ typedef struct dom0_read_memtype { unsigned long nr_mfns; uint32_t type; } dom0_read_memtype_t; -DEFINE_GUEST_HANDLE(dom0_read_memtype_t); +DEFINE_XEN_GUEST_HANDLE(dom0_read_memtype_t); /* Interface for controlling Xen software performance counters. */ #define DOM0_PERFCCONTROL 34 @@ -340,23 +340,23 @@ typedef struct dom0_perfc_desc { uint32_t nr_vals; /* number of values for this counter */ uint32_t vals[64]; /* array of values */ } dom0_perfc_desc_t; -DEFINE_GUEST_HANDLE(dom0_perfc_desc_t); +DEFINE_XEN_GUEST_HANDLE(dom0_perfc_desc_t); typedef struct dom0_perfccontrol { /* IN variables. */ uint32_t op; /* DOM0_PERFCCONTROL_OP_??? */ /* OUT variables. */ uint32_t nr_counters; /* number of counters */ - GUEST_HANDLE(dom0_perfc_desc_t) desc; /* counter information (or NULL) */ + XEN_GUEST_HANDLE(dom0_perfc_desc_t) desc; /* counter information (or NULL) */ } dom0_perfccontrol_t; -DEFINE_GUEST_HANDLE(dom0_perfccontrol_t); +DEFINE_XEN_GUEST_HANDLE(dom0_perfccontrol_t); #define DOM0_MICROCODE 35 typedef struct dom0_microcode { /* IN variables. */ - GUEST_HANDLE(void) data; /* Pointer to microcode data */ + XEN_GUEST_HANDLE(void) data; /* Pointer to microcode data */ uint32_t length; /* Length of microcode data. */ } dom0_microcode_t; -DEFINE_GUEST_HANDLE(dom0_microcode_t); +DEFINE_XEN_GUEST_HANDLE(dom0_microcode_t); #define DOM0_IOPORT_PERMISSION 36 typedef struct dom0_ioport_permission { @@ -365,7 +365,7 @@ typedef struct dom0_ioport_permission { uint32_t nr_ports; /* size of port range */ uint8_t allow_access; /* allow or deny access to range? */ } dom0_ioport_permission_t; -DEFINE_GUEST_HANDLE(dom0_ioport_permission_t); +DEFINE_XEN_GUEST_HANDLE(dom0_ioport_permission_t); #define DOM0_GETVCPUCONTEXT 37 typedef struct dom0_getvcpucontext { @@ -373,9 +373,9 @@ typedef struct dom0_getvcpucontext { domid_t domain; /* domain to be affected */ uint32_t vcpu; /* vcpu # */ /* OUT variables. */ - GUEST_HANDLE(vcpu_guest_context_t) ctxt; + XEN_GUEST_HANDLE(vcpu_guest_context_t) ctxt; } dom0_getvcpucontext_t; -DEFINE_GUEST_HANDLE(dom0_getvcpucontext_t); +DEFINE_XEN_GUEST_HANDLE(dom0_getvcpucontext_t); #define DOM0_GETVCPUINFO 43 typedef struct dom0_getvcpuinfo { @@ -390,18 +390,18 @@ typedef struct dom0_getvcpuinfo { uint32_t cpu; /* current mapping */ cpumap_t cpumap; /* allowable mapping */ } dom0_getvcpuinfo_t; -DEFINE_GUEST_HANDLE(dom0_getvcpuinfo_t); +DEFINE_XEN_GUEST_HANDLE(dom0_getvcpuinfo_t); #define DOM0_GETDOMAININFOLIST 38 typedef struct dom0_getdomaininfolist { /* IN variables. */ domid_t first_domain; uint32_t max_domains; - GUEST_HANDLE(dom0_getdomaininfo_t) buffer; + XEN_GUEST_HANDLE(dom0_getdomaininfo_t) buffer; /* OUT variables. */ uint32_t num_domains; } dom0_getdomaininfolist_t; -DEFINE_GUEST_HANDLE(dom0_getdomaininfolist_t); +DEFINE_XEN_GUEST_HANDLE(dom0_getdomaininfolist_t); #define DOM0_PLATFORM_QUIRK 39 #define QUIRK_NOIRQBALANCING 1 /* Do not restrict IO-APIC RTE targets */ @@ -411,7 +411,7 @@ typedef struct dom0_platform_quirk { /* IN variables. */ uint32_t quirk_id; } dom0_platform_quirk_t; -DEFINE_GUEST_HANDLE(dom0_platform_quirk_t); +DEFINE_XEN_GUEST_HANDLE(dom0_platform_quirk_t); #define DOM0_PHYSICAL_MEMORY_MAP 40 typedef struct dom0_memory_map_entry { @@ -419,36 +419,36 @@ typedef struct dom0_memory_map_entry { uint32_t flags; /* reserved */ uint8_t is_ram; } dom0_memory_map_entry_t; -DEFINE_GUEST_HANDLE(dom0_memory_map_entry_t); +DEFINE_XEN_GUEST_HANDLE(dom0_memory_map_entry_t); typedef struct dom0_physical_memory_map { /* IN variables. */ uint32_t max_map_entries; /* OUT variables. */ uint32_t nr_map_entries; - GUEST_HANDLE(dom0_memory_map_entry_t) memory_map; + XEN_GUEST_HANDLE(dom0_memory_map_entry_t) memory_map; } dom0_physical_memory_map_t; -DEFINE_GUEST_HANDLE(dom0_physical_memory_map_t); +DEFINE_XEN_GUEST_HANDLE(dom0_physical_memory_map_t); #define DOM0_MAX_VCPUS 41 typedef struct dom0_max_vcpus { domid_t domain; /* domain to be affected */ uint32_t max; /* maximum number of vcpus */ } dom0_max_vcpus_t; -DEFINE_GUEST_HANDLE(dom0_max_vcpus_t); +DEFINE_XEN_GUEST_HANDLE(dom0_max_vcpus_t); #define DOM0_SETDOMAINHANDLE 44 typedef struct dom0_setdomainhandle { domid_t domain; xen_domain_handle_t handle; } dom0_setdomainhandle_t; -DEFINE_GUEST_HANDLE(dom0_setdomainhandle_t); +DEFINE_XEN_GUEST_HANDLE(dom0_setdomainhandle_t); #define DOM0_SETDEBUGGING 45 typedef struct dom0_setdebugging { domid_t domain; uint8_t enable; } dom0_setdebugging_t; -DEFINE_GUEST_HANDLE(dom0_setdebugging_t); +DEFINE_XEN_GUEST_HANDLE(dom0_setdebugging_t); #define DOM0_IRQ_PERMISSION 46 typedef struct dom0_irq_permission { @@ -456,7 +456,7 @@ typedef struct dom0_irq_permission { uint8_t pirq; uint8_t allow_access; /* flag to specify enable/disable of IRQ access */ } dom0_irq_permission_t; -DEFINE_GUEST_HANDLE(dom0_irq_permission_t); +DEFINE_XEN_GUEST_HANDLE(dom0_irq_permission_t); #define DOM0_IOMEM_PERMISSION 47 typedef struct dom0_iomem_permission { @@ -465,14 +465,14 @@ typedef struct dom0_iomem_permission { unsigned long nr_mfns; /* number of pages in range (>0) */ uint8_t allow_access; /* allow (!0) or deny (0) access to range? */ } dom0_iomem_permission_t; -DEFINE_GUEST_HANDLE(dom0_iomem_permission_t); +DEFINE_XEN_GUEST_HANDLE(dom0_iomem_permission_t); #define DOM0_HYPERCALL_INIT 48 typedef struct dom0_hypercall_init { domid_t domain; /* domain to be affected */ unsigned long mfn; /* machine frame to be initialised */ } dom0_hypercall_init_t; -DEFINE_GUEST_HANDLE(dom0_hypercall_init_t); +DEFINE_XEN_GUEST_HANDLE(dom0_hypercall_init_t); typedef struct dom0_op { uint32_t cmd; @@ -518,7 +518,7 @@ typedef struct dom0_op { uint8_t pad[128]; } u; } dom0_op_t; -DEFINE_GUEST_HANDLE(dom0_op_t); +DEFINE_XEN_GUEST_HANDLE(dom0_op_t); #endif /* __XEN_PUBLIC_DOM0_OPS_H__ */ diff -r 1d69cff40b8c xen/include/public/event_channel.h --- a/xen/include/public/event_channel.h Wed Apr 26 17:41:19 2006 +0100 +++ b/xen/include/public/event_channel.h Wed Apr 26 16:11:21 2006 -0500 @@ -10,7 +10,7 @@ #define __XEN_PUBLIC_EVENT_CHANNEL_H__ typedef uint32_t evtchn_port_t; -DEFINE_GUEST_HANDLE(evtchn_port_t); +DEFINE_XEN_GUEST_HANDLE(evtchn_port_t); /* * EVTCHNOP_alloc_unbound: Allocate a port in domain and mark as @@ -196,7 +196,7 @@ typedef struct evtchn_op { evtchn_unmask_t unmask; } u; } evtchn_op_t; -DEFINE_GUEST_HANDLE(evtchn_op_t); +DEFINE_XEN_GUEST_HANDLE(evtchn_op_t); #endif /* __XEN_PUBLIC_EVENT_CHANNEL_H__ */ diff -r 1d69cff40b8c xen/include/public/grant_table.h --- a/xen/include/public/grant_table.h Wed Apr 26 17:41:19 2006 +0100 +++ b/xen/include/public/grant_table.h Wed Apr 26 16:11:21 2006 -0500 @@ -167,7 +167,7 @@ typedef struct gnttab_map_grant_ref { grant_handle_t handle; uint64_t dev_bus_addr; } gnttab_map_grant_ref_t; -DEFINE_GUEST_HANDLE(gnttab_map_grant_ref_t); +DEFINE_XEN_GUEST_HANDLE(gnttab_map_grant_ref_t); /* * GNTTABOP_unmap_grant_ref: Destroy one or more grant-reference mappings @@ -189,7 +189,7 @@ typedef struct gnttab_unmap_grant_ref { /* OUT parameters. */ int16_t status; /* GNTST_* */ } gnttab_unmap_grant_ref_t; -DEFINE_GUEST_HANDLE(gnttab_unmap_grant_ref_t); +DEFINE_XEN_GUEST_HANDLE(gnttab_unmap_grant_ref_t); /* * GNTTABOP_setup_table: Set up a grant table for comprising at least @@ -207,9 +207,9 @@ typedef struct gnttab_setup_table { uint32_t nr_frames; /* OUT parameters. */ int16_t status; /* GNTST_* */ - GUEST_HANDLE(ulong) frame_list; + XEN_GUEST_HANDLE(ulong) frame_list; } gnttab_setup_table_t; -DEFINE_GUEST_HANDLE(gnttab_setup_table_t); +DEFINE_XEN_GUEST_HANDLE(gnttab_setup_table_t); /* * GNTTABOP_dump_table: Dump the contents of the grant table to the @@ -222,7 +222,7 @@ typedef struct gnttab_dump_table { /* OUT parameters. */ int16_t status; /* GNTST_* */ } gnttab_dump_table_t; -DEFINE_GUEST_HANDLE(gnttab_dump_table_t); +DEFINE_XEN_GUEST_HANDLE(gnttab_dump_table_t); /* * GNTTABOP_transfer_grant_ref: Transfer to a foreign domain. The @@ -241,7 +241,7 @@ typedef struct gnttab_transfer { /* OUT parameters. */ int16_t status; } gnttab_transfer_t; -DEFINE_GUEST_HANDLE(gnttab_transfer_t); +DEFINE_XEN_GUEST_HANDLE(gnttab_transfer_t); /* * Bitfield values for update_pin_status.flags. diff -r 1d69cff40b8c xen/include/public/memory.h --- a/xen/include/public/memory.h Wed Apr 26 17:41:19 2006 +0100 +++ b/xen/include/public/memory.h Wed Apr 26 16:11:21 2006 -0500 @@ -29,7 +29,7 @@ typedef struct xen_memory_reservation { * OUT: GMFN bases of extents that were allocated * (NB. This command also updates the mach_to_phys translation table) */ - GUEST_HANDLE(ulong) extent_start; + XEN_GUEST_HANDLE(ulong) extent_start; /* Number of extents, and size/alignment of each (2^extent_order pages). */ unsigned long nr_extents; @@ -50,7 +50,7 @@ typedef struct xen_memory_reservation { domid_t domid; } xen_memory_reservation_t; -DEFINE_GUEST_HANDLE(xen_memory_reservation_t); +DEFINE_XEN_GUEST_HANDLE(xen_memory_reservation_t); /* * Returns the maximum machine frame number of mapped RAM in this system. @@ -86,7 +86,7 @@ typedef struct xen_machphys_mfn_list { * any large discontiguities in the machine address space, 2MB gaps in * the machphys table will be represented by an MFN base of zero. */ - GUEST_HANDLE(ulong) extent_start; + XEN_GUEST_HANDLE(ulong) extent_start; /* * Number of extents written to the above array. This will be smaller @@ -94,7 +94,7 @@ typedef struct xen_machphys_mfn_list { */ unsigned int nr_extents; } xen_machphys_mfn_list_t; -DEFINE_GUEST_HANDLE(xen_machphys_mfn_list_t); +DEFINE_XEN_GUEST_HANDLE(xen_machphys_mfn_list_t); /* * Sets the GPFN at which a particular page appears in the specified guest's @@ -117,7 +117,7 @@ typedef struct xen_add_to_physmap { /* GPFN where the source mapping page should appear. */ unsigned long gpfn; } xen_add_to_physmap_t; -DEFINE_GUEST_HANDLE(xen_add_to_physmap_t); +DEFINE_XEN_GUEST_HANDLE(xen_add_to_physmap_t); /* * Translates a list of domain-specific GPFNs into MFNs. Returns a -ve error @@ -132,15 +132,15 @@ typedef struct xen_translate_gpfn_list { unsigned long nr_gpfns; /* List of GPFNs to translate. */ - GUEST_HANDLE(ulong) gpfn_list; + XEN_GUEST_HANDLE(ulong) gpfn_list; /* * Output list to contain MFN translations. May be the same as the input * list (in which case each input GPFN is overwritten with the output MFN). */ - GUEST_HANDLE(ulong) mfn_list; + XEN_GUEST_HANDLE(ulong) mfn_list; } xen_translate_gpfn_list_t; -DEFINE_GUEST_HANDLE(xen_translate_gpfn_list_t); +DEFINE_XEN_GUEST_HANDLE(xen_translate_gpfn_list_t); #endif /* __XEN_PUBLIC_MEMORY_H__ */ diff -r 1d69cff40b8c xen/include/public/nmi.h --- a/xen/include/public/nmi.h Wed Apr 26 17:41:19 2006 +0100 +++ b/xen/include/public/nmi.h Wed Apr 26 16:11:21 2006 -0500 @@ -38,7 +38,7 @@ typedef struct xennmi_callback { unsigned long handler_address; unsigned long pad; } xennmi_callback_t; -DEFINE_GUEST_HANDLE(xennmi_callback_t); +DEFINE_XEN_GUEST_HANDLE(xennmi_callback_t); /* * Deregister NMI callback for this (calling) VCPU. diff -r 1d69cff40b8c xen/include/public/physdev.h --- a/xen/include/public/physdev.h Wed Apr 26 17:41:19 2006 +0100 +++ b/xen/include/public/physdev.h Wed Apr 26 16:11:21 2006 -0500 @@ -56,7 +56,7 @@ typedef struct physdev_op { physdevop_irq_t irq_op; } u; } physdev_op_t; -DEFINE_GUEST_HANDLE(physdev_op_t); +DEFINE_XEN_GUEST_HANDLE(physdev_op_t); #endif /* __XEN_PUBLIC_PHYSDEV_H__ */ diff -r 1d69cff40b8c xen/include/public/sched.h --- a/xen/include/public/sched.h Wed Apr 26 17:41:19 2006 +0100 +++ b/xen/include/public/sched.h Wed Apr 26 16:11:21 2006 -0500 @@ -49,7 +49,7 @@ typedef struct sched_shutdown { typedef struct sched_shutdown { unsigned int reason; /* SHUTDOWN_* */ } sched_shutdown_t; -DEFINE_GUEST_HANDLE(sched_shutdown_t); +DEFINE_XEN_GUEST_HANDLE(sched_shutdown_t); /* * Poll a set of event-channel ports. Return when one or more are pending. An @@ -58,11 +58,11 @@ DEFINE_GUEST_HANDLE(sched_shutdown_t); */ #define SCHEDOP_poll 3 typedef struct sched_poll { - GUEST_HANDLE(evtchn_port_t) ports; + XEN_GUEST_HANDLE(evtchn_port_t) ports; unsigned int nr_ports; uint64_t timeout; } sched_poll_t; -DEFINE_GUEST_HANDLE(sched_poll_t); +DEFINE_XEN_GUEST_HANDLE(sched_poll_t); /* * Declare a shutdown for another domain. The main use of this function is @@ -75,7 +75,7 @@ typedef struct sched_remote_shutdown { domid_t domain_id; /* Remote domain ID */ unsigned int reason; /* SHUTDOWN_xxx reason */ } sched_remote_shutdown_t; -DEFINE_GUEST_HANDLE(sched_remote_shutdown_t); +DEFINE_XEN_GUEST_HANDLE(sched_remote_shutdown_t); /* * Reason codes for SCHEDOP_shutdown. These may be interpreted by control diff -r 1d69cff40b8c xen/include/public/xen.h --- a/xen/include/public/xen.h Wed Apr 26 17:41:19 2006 +0100 +++ b/xen/include/public/xen.h Wed Apr 26 16:11:21 2006 -0500 @@ -185,7 +185,7 @@ typedef struct mmuext_op { void *vcpumask; } arg2; } mmuext_op_t; -DEFINE_GUEST_HANDLE(mmuext_op_t); +DEFINE_XEN_GUEST_HANDLE(mmuext_op_t); #endif /* These are passed as 'flags' to update_va_mapping. They can be ORed. */ @@ -252,7 +252,7 @@ typedef struct mmu_update { uint64_t ptr; /* Machine address of PTE. */ uint64_t val; /* New contents of PTE. */ } mmu_update_t; -DEFINE_GUEST_HANDLE(mmu_update_t); +DEFINE_XEN_GUEST_HANDLE(mmu_update_t); /* * Send an array of these to HYPERVISOR_multicall(). @@ -262,7 +262,7 @@ typedef struct multicall_entry { unsigned long op, result; unsigned long args[6]; } multicall_entry_t; -DEFINE_GUEST_HANDLE(multicall_entry_t); +DEFINE_XEN_GUEST_HANDLE(multicall_entry_t); /* * Event channel endpoints per domain: diff -r 1d69cff40b8c xen/include/public/xenoprof.h --- a/xen/include/public/xenoprof.h Wed Apr 26 17:41:19 2006 +0100 +++ b/xen/include/public/xenoprof.h Wed Apr 26 16:11:21 2006 -0500 @@ -52,7 +52,7 @@ typedef struct xenoprof_buf { uint64_t lost_samples; struct event_log event_log[1]; } xenoprof_buf_t; -DEFINE_GUEST_HANDLE(xenoprof_buf_t); +DEFINE_XEN_GUEST_HANDLE(xenoprof_buf_t); typedef struct xenoprof_init { int32_t max_samples; @@ -63,7 +63,7 @@ typedef struct xenoprof_init { uint64_t buf_maddr; char cpu_type[XENOPROF_CPU_TYPE_SIZE]; } xenoprof_init_t; -DEFINE_GUEST_HANDLE(xenoprof_init_t); +DEFINE_XEN_GUEST_HANDLE(xenoprof_init_t); typedef struct xenoprof_counter { uint32_t ind; @@ -75,7 +75,7 @@ typedef struct xenoprof_counter { uint32_t user; uint64_t unit_mask; } xenoprof_counter_t; -DEFINE_GUEST_HANDLE(xenoprof_counter_t); +DEFINE_XEN_GUEST_HANDLE(xenoprof_counter_t); #endif /* __XEN_PUBLIC_XENOPROF_H__ */ diff -r 1d69cff40b8c xen/include/xen/console.h --- a/xen/include/xen/console.h Wed Apr 26 17:41:19 2006 +0100 +++ b/xen/include/xen/console.h Wed Apr 26 16:11:21 2006 -0500 @@ -14,7 +14,7 @@ extern spinlock_t console_lock; void set_printk_prefix(const char *prefix); -long read_console_ring(GUEST_HANDLE(char), u32 *, int); +long read_console_ring(XEN_GUEST_HANDLE(char), u32 *, int); void init_console(void); void console_endboot(int disable_vga); diff -r 1d69cff40b8c xen/include/xen/hypercall.h --- a/xen/include/xen/hypercall.h Wed Apr 26 17:41:19 2006 +0100 +++ b/xen/include/xen/hypercall.h Wed Apr 26 16:11:21 2006 -0500 @@ -25,20 +25,20 @@ extern long extern long do_sched_op( int cmd, - GUEST_HANDLE(void) arg); + XEN_GUEST_HANDLE(void) arg); extern long do_dom0_op( - GUEST_HANDLE(dom0_op_t) u_dom0_op); + XEN_GUEST_HANDLE(dom0_op_t) u_dom0_op); extern long do_memory_op( int cmd, - GUEST_HANDLE(void) arg); + XEN_GUEST_HANDLE(void) arg); extern long do_multicall( - GUEST_HANDLE(multicall_entry_t) call_list, + XEN_GUEST_HANDLE(multicall_entry_t) call_list, unsigned int nr_calls); extern long @@ -47,23 +47,23 @@ do_set_timer_op( extern long do_event_channel_op( - GUEST_HANDLE(evtchn_op_t) uop); + XEN_GUEST_HANDLE(evtchn_op_t) uop); extern long do_xen_version( int cmd, - GUEST_HANDLE(void) arg); + XEN_GUEST_HANDLE(void) arg); extern long do_console_io( int cmd, int count, - GUEST_HANDLE(char) buffer); + XEN_GUEST_HANDLE(char) buffer); extern long do_grant_table_op( unsigned int cmd, - GUEST_HANDLE(void) uop, + XEN_GUEST_HANDLE(void) uop, unsigned int count); extern long @@ -75,15 +75,15 @@ do_vcpu_op( do_vcpu_op( int cmd, int vcpuid, - GUEST_HANDLE(void) arg); + XEN_GUEST_HANDLE(void) arg); extern long do_acm_op( - GUEST_HANDLE(acm_op_t) u_acm_op); + XEN_GUEST_HANDLE(acm_op_t) u_acm_op); extern long do_nmi_op( unsigned int cmd, - GUEST_HANDLE(void) arg); + XEN_GUEST_HANDLE(void) arg); #endif /* __XEN_HYPERCALL_H__ */ diff -r 1d69cff40b8c xen/include/xen/sched.h --- a/xen/include/xen/sched.h Wed Apr 26 17:41:19 2006 +0100 +++ b/xen/include/xen/sched.h Wed Apr 26 16:11:21 2006 -0500 @@ -316,7 +316,7 @@ void startup_cpu_idle_loop(void); * It contains one character per argument as follows: * 'i' [unsigned] {char, int} * 'l' [unsigned] long - * 'h' guest handle (GUEST_HANDLE(foo)) + * 'h' guest handle (XEN_GUEST_HANDLE(foo)) */ unsigned long hypercall_create_continuation( unsigned int op, const char *format, ...); --=-ip3Fa4uSejT5l5Uxg8Yw Content-Disposition: attachment; filename=xen-SET_XEN_GUEST_HANDLE.diff Content-Type: text/x-patch; name=xen-SET_XEN_GUEST_HANDLE.diff; charset=utf-8 Content-Transfer-Encoding: 7bit Wrap all GUEST_HANDLEs in structures, and define SET/GET macros to access them in Linux and libxc. Signed-off-by: Hollis Blanchard diff -r 96cc994dee76 linux-2.6-xen-sparse/arch/i386/kernel/microcode-xen.c --- a/linux-2.6-xen-sparse/arch/i386/kernel/microcode-xen.c Wed Apr 26 15:54:02 2006 -0500 +++ b/linux-2.6-xen-sparse/arch/i386/kernel/microcode-xen.c Wed Apr 26 16:21:20 2006 -0500 @@ -70,7 +70,7 @@ static int do_microcode_update (void) return err; op.cmd = DOM0_MICROCODE; - op.u.microcode.data = user_buffer; + SET_XEN_GUEST_HANDLE(op.u.microcode.data, user_buffer); op.u.microcode.length = user_buffer_size; err = HYPERVISOR_dom0_op(&op); diff -r 96cc994dee76 linux-2.6-xen-sparse/arch/i386/kernel/setup-xen.c --- a/linux-2.6-xen-sparse/arch/i386/kernel/setup-xen.c Wed Apr 26 15:54:02 2006 -0500 +++ b/linux-2.6-xen-sparse/arch/i386/kernel/setup-xen.c Wed Apr 26 16:21:20 2006 -0500 @@ -1368,7 +1368,7 @@ legacy_init_iomem_resources(struct resou #ifdef CONFIG_XEN map = alloc_bootmem_low_pages(PAGE_SIZE); op.cmd = DOM0_PHYSICAL_MEMORY_MAP; - op.u.physical_memory_map.memory_map = map; + SET_XEN_GUEST_HANDLE(op.u.physical_memory_map.memory_map, map); op.u.physical_memory_map.max_map_entries = PAGE_SIZE / sizeof(struct dom0_memory_map_entry); BUG_ON(HYPERVISOR_dom0_op(&op)); diff -r 96cc994dee76 linux-2.6-xen-sparse/arch/i386/mm/hypervisor.c --- a/linux-2.6-xen-sparse/arch/i386/mm/hypervisor.c Wed Apr 26 15:54:02 2006 -0500 +++ b/linux-2.6-xen-sparse/arch/i386/mm/hypervisor.c Wed Apr 26 16:21:20 2006 -0500 @@ -271,11 +271,11 @@ int xen_create_contiguous_region( pte_t *pte; unsigned long frame, i, flags; struct xen_memory_reservation reservation = { - .extent_start = &frame, .nr_extents = 1, .extent_order = 0, .domid = DOMID_SELF }; + SET_XEN_GUEST_HANDLE(reservation.extent_start, &frame); /* * Currently an auto-translated guest will not perform I/O, nor will @@ -357,11 +357,11 @@ void xen_destroy_contiguous_region(unsig pte_t *pte; unsigned long frame, i, flags; struct xen_memory_reservation reservation = { - .extent_start = &frame, .nr_extents = 1, .extent_order = 0, .domid = DOMID_SELF }; + SET_XEN_GUEST_HANDLE(reservation.extent_start, &frame); if (xen_feature(XENFEAT_auto_translated_physmap)) return; diff -r 96cc994dee76 linux-2.6-xen-sparse/arch/x86_64/kernel/e820-xen.c --- a/linux-2.6-xen-sparse/arch/x86_64/kernel/e820-xen.c Wed Apr 26 15:54:02 2006 -0500 +++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/e820-xen.c Wed Apr 26 16:21:20 2006 -0500 @@ -600,7 +600,7 @@ void __init e820_reserve_resources(void) map = alloc_bootmem_low_pages(PAGE_SIZE); op.cmd = DOM0_PHYSICAL_MEMORY_MAP; - op.u.physical_memory_map.memory_map = map; + SET_XEN_GUEST_HANDLE(op.u.physical_memory_map.memory_map, map); op.u.physical_memory_map.max_map_entries = PAGE_SIZE / sizeof(struct dom0_memory_map_entry); BUG_ON(HYPERVISOR_dom0_op(&op)); diff -r 96cc994dee76 linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c --- a/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c Wed Apr 26 15:54:02 2006 -0500 +++ b/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c Wed Apr 26 16:21:20 2006 -0500 @@ -195,14 +195,14 @@ static int increase_reservation(unsigned page = balloon_next_page(page); } - reservation.extent_start = frame_list; + SET_XEN_GUEST_HANDLE(reservation.extent_start, frame_list); reservation.nr_extents = nr_pages; rc = HYPERVISOR_memory_op( XENMEM_populate_physmap, &reservation); if (rc < nr_pages) { int ret; /* We hit the Xen hard limit: reprobe. */ - reservation.extent_start = frame_list; + SET_XEN_GUEST_HANDLE(reservation.extent_start, frame_list); reservation.nr_extents = rc; ret = HYPERVISOR_memory_op(XENMEM_decrease_reservation, &reservation); @@ -308,7 +308,7 @@ static int decrease_reservation(unsigned balloon_append(pfn_to_page(pfn)); } - reservation.extent_start = frame_list; + SET_XEN_GUEST_HANDLE(reservation.extent_start, frame_list); reservation.nr_extents = nr_pages; ret = HYPERVISOR_memory_op(XENMEM_decrease_reservation, &reservation); BUG_ON(ret != nr_pages); @@ -522,11 +522,11 @@ static int dealloc_pte_fn( unsigned long mfn = pte_mfn(*pte); int ret; struct xen_memory_reservation reservation = { - .extent_start = &mfn, .nr_extents = 1, .extent_order = 0, .domid = DOMID_SELF }; + SET_XEN_GUEST_HANDLE(reservation.extent_start, &mfn); set_pte_at(&init_mm, addr, pte, __pte_ma(0)); set_phys_to_machine(__pa(addr) >> PAGE_SHIFT, INVALID_P2M_ENTRY); ret = HYPERVISOR_memory_op(XENMEM_decrease_reservation, &reservation); diff -r 96cc994dee76 linux-2.6-xen-sparse/drivers/xen/core/gnttab.c --- a/linux-2.6-xen-sparse/drivers/xen/core/gnttab.c Wed Apr 26 15:54:02 2006 -0500 +++ b/linux-2.6-xen-sparse/drivers/xen/core/gnttab.c Wed Apr 26 16:21:20 2006 -0500 @@ -399,7 +399,7 @@ gnttab_resume(void) setup.dom = DOMID_SELF; setup.nr_frames = NR_GRANT_FRAMES; - setup.frame_list = frames; + SET_XEN_GUEST_HANDLE(setup.frame_list, frames); rc = HYPERVISOR_grant_table_op(GNTTABOP_setup_table, &setup, 1); if (rc == -ENOSYS) diff -r 96cc994dee76 linux-2.6-xen-sparse/drivers/xen/netback/netback.c --- a/linux-2.6-xen-sparse/drivers/xen/netback/netback.c Wed Apr 26 15:54:02 2006 -0500 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/netback.c Wed Apr 26 16:21:20 2006 -0500 @@ -105,11 +105,11 @@ static unsigned long alloc_mfn(void) { unsigned long mfn = 0, flags; struct xen_memory_reservation reservation = { - .extent_start = mfn_list, .nr_extents = MAX_MFN_ALLOC, .extent_order = 0, .domid = DOMID_SELF }; + SET_XEN_GUEST_HANDLE(reservation.extent_start, mfn_list); spin_lock_irqsave(&mfn_lock, flags); if ( unlikely(alloc_index == 0) ) alloc_index = HYPERVISOR_memory_op( diff -r 96cc994dee76 linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c --- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c Wed Apr 26 15:54:02 2006 -0500 +++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c Wed Apr 26 16:21:20 2006 -0500 @@ -607,7 +607,7 @@ static void network_alloc_rx_buffers(str /* Tell the ballon driver what is going on. */ balloon_update_driver_allowance(i); - reservation.extent_start = np->rx_pfn_array; + SET_XEN_GUEST_HANDLE(reservation.extent_start, np->rx_pfn_array); reservation.nr_extents = i; reservation.extent_order = 0; reservation.address_bits = 0; diff -r 96cc994dee76 linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypervisor.h --- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypervisor.h Wed Apr 26 15:54:02 2006 -0500 +++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypervisor.h Wed Apr 26 16:21:20 2006 -0500 @@ -163,13 +163,14 @@ HYPERVISOR_poll( evtchn_port_t *ports, unsigned int nr_ports, u64 timeout) { struct sched_poll sched_poll = { - .ports = ports, .nr_ports = nr_ports, .timeout = jiffies_to_st(timeout) }; - - int rc = HYPERVISOR_sched_op(SCHEDOP_poll, &sched_poll); - + int rc; + + SET_XEN_GUEST_HANDLE(sched_poll.ports, ports); + + rc = HYPERVISOR_sched_op(SCHEDOP_poll, &sched_poll); if (rc == -ENOSYS) rc = HYPERVISOR_sched_op_compat(SCHEDOP_yield, 0); diff -r 96cc994dee76 tools/libxc/xc_domain.c --- a/tools/libxc/xc_domain.c Wed Apr 26 15:54:02 2006 -0500 +++ b/tools/libxc/xc_domain.c Wed Apr 26 16:21:20 2006 -0500 @@ -171,7 +171,7 @@ int xc_domain_getinfolist(int xc_handle, op.cmd = DOM0_GETDOMAININFOLIST; op.u.getdomaininfolist.first_domain = first_domain; op.u.getdomaininfolist.max_domains = max_domains; - op.u.getdomaininfolist.buffer = info; + SET_XEN_GUEST_HANDLE(op.u.getdomaininfolist.buffer, info); if ( xc_dom0_op(xc_handle, &op) < 0 ) ret = -1; @@ -195,7 +195,7 @@ int xc_vcpu_getcontext(int xc_handle, op.cmd = DOM0_GETVCPUCONTEXT; op.u.getvcpucontext.domain = (domid_t)domid; op.u.getvcpucontext.vcpu = (uint16_t)vcpu; - op.u.getvcpucontext.ctxt = ctxt; + SET_XEN_GUEST_HANDLE(op.u.getvcpucontext.ctxt, ctxt); if ( (rc = mlock(ctxt, sizeof(*ctxt))) != 0 ) return rc; @@ -220,7 +220,7 @@ int xc_shadow_control(int xc_handle, op.cmd = DOM0_SHADOW_CONTROL; op.u.shadow_control.domain = (domid_t)domid; op.u.shadow_control.op = sop; - op.u.shadow_control.dirty_bitmap = dirty_bitmap; + SET_XEN_GUEST_HANDLE(op.u.shadow_control.dirty_bitmap, dirty_bitmap); op.u.shadow_control.pages = pages; rc = do_dom0_op(xc_handle, &op); @@ -295,13 +295,15 @@ int xc_domain_memory_increase_reservatio { int err; struct xen_memory_reservation reservation = { - .extent_start = extent_start, /* may be NULL */ .nr_extents = nr_extents, .extent_order = extent_order, .address_bits = address_bits, .domid = domid }; + /* may be NULL */ + SET_XEN_GUEST_HANDLE(reservation.extent_start, extent_start); + err = xc_memory_op(xc_handle, XENMEM_increase_reservation, &reservation); if ( err == nr_extents ) return 0; @@ -326,12 +328,13 @@ int xc_domain_memory_decrease_reservatio { int err; struct xen_memory_reservation reservation = { - .extent_start = extent_start, .nr_extents = nr_extents, .extent_order = extent_order, .address_bits = 0, .domid = domid }; + + SET_XEN_GUEST_HANDLE(reservation.extent_start, extent_start); if ( extent_start == NULL ) { @@ -364,12 +367,12 @@ int xc_domain_memory_populate_physmap(in { int err; struct xen_memory_reservation reservation = { - .extent_start = extent_start, .nr_extents = nr_extents, .extent_order = extent_order, .address_bits = address_bits, .domid = domid }; + SET_XEN_GUEST_HANDLE(reservation.extent_start, extent_start); err = xc_memory_op(xc_handle, XENMEM_populate_physmap, &reservation); if ( err == nr_extents ) @@ -395,9 +398,9 @@ int xc_domain_translate_gpfn_list(int xc struct xen_translate_gpfn_list op = { .domid = domid, .nr_gpfns = nr_gpfns, - .gpfn_list = gpfn_list, - .mfn_list = mfn_list }; + SET_XEN_GUEST_HANDLE(op.gpfn_list, gpfn_list); + SET_XEN_GUEST_HANDLE(op.mfn_list, mfn_list); return xc_memory_op(xc_handle, XENMEM_translate_gpfn_list, &op); } @@ -467,7 +470,7 @@ int xc_vcpu_setcontext(int xc_handle, op.cmd = DOM0_SETVCPUCONTEXT; op.u.setvcpucontext.domain = domid; op.u.setvcpucontext.vcpu = vcpu; - op.u.setvcpucontext.ctxt = ctxt; + SET_XEN_GUEST_HANDLE(op.u.setvcpucontext.ctxt, ctxt); if ( (rc = mlock(ctxt, sizeof(*ctxt))) != 0 ) return rc; diff -r 96cc994dee76 tools/libxc/xc_hvm_build.c --- a/tools/libxc/xc_hvm_build.c Wed Apr 26 15:54:02 2006 -0500 +++ b/tools/libxc/xc_hvm_build.c Wed Apr 26 16:21:20 2006 -0500 @@ -440,7 +440,7 @@ static int xc_hvm_build_internal(int xc_ launch_op.u.setvcpucontext.domain = (domid_t)domid; launch_op.u.setvcpucontext.vcpu = 0; - launch_op.u.setvcpucontext.ctxt = ctxt; + SET_XEN_GUEST_HANDLE(launch_op.u.setvcpucontext.ctxt, ctxt); launch_op.cmd = DOM0_SETVCPUCONTEXT; rc = xc_dom0_op(xc_handle, &launch_op); diff -r 96cc994dee76 tools/libxc/xc_linux_build.c --- a/tools/libxc/xc_linux_build.c Wed Apr 26 15:54:02 2006 -0500 +++ b/tools/libxc/xc_linux_build.c Wed Apr 26 16:21:20 2006 -0500 @@ -1180,7 +1180,7 @@ static int xc_linux_build_internal(int x launch_op.u.setvcpucontext.domain = (domid_t)domid; launch_op.u.setvcpucontext.vcpu = 0; - launch_op.u.setvcpucontext.ctxt = ctxt; + SET_XEN_GUEST_HANDLE(launch_op.u.setvcpucontext.ctxt, ctxt); launch_op.cmd = DOM0_SETVCPUCONTEXT; rc = xc_dom0_op(xc_handle, &launch_op); diff -r 96cc994dee76 tools/libxc/xc_linux_restore.c --- a/tools/libxc/xc_linux_restore.c Wed Apr 26 15:54:02 2006 -0500 +++ b/tools/libxc/xc_linux_restore.c Wed Apr 26 16:21:20 2006 -0500 @@ -583,11 +583,11 @@ int xc_linux_restore(int xc_handle, int if (count > 0) { struct xen_memory_reservation reservation = { - .extent_start = pfntab, .nr_extents = count, .extent_order = 0, .domid = dom }; + SET_XEN_GUEST_HANDLE(reservation.extent_start, pfntab); if ((rc = xc_memory_op(xc_handle, XENMEM_decrease_reservation, &reservation)) != count) { @@ -727,7 +727,7 @@ int xc_linux_restore(int xc_handle, int op.cmd = DOM0_SETVCPUCONTEXT; op.u.setvcpucontext.domain = (domid_t)dom; op.u.setvcpucontext.vcpu = 0; - op.u.setvcpucontext.ctxt = &ctxt; + SET_XEN_GUEST_HANDLE(op.u.setvcpucontext.ctxt, &ctxt); rc = xc_dom0_op(xc_handle, &op); if (rc != 0) { diff -r 96cc994dee76 tools/libxc/xc_linux_save.c --- a/tools/libxc/xc_linux_save.c Wed Apr 26 15:54:02 2006 -0500 +++ b/tools/libxc/xc_linux_save.c Wed Apr 26 16:21:20 2006 -0500 @@ -509,16 +509,18 @@ static unsigned long *xc_map_m2p(int xc_ privcmd_mmap_entry_t *entries; unsigned long m2p_chunks, m2p_size; unsigned long *m2p; + unsigned long *extent_start; int i, rc; m2p_size = M2P_SIZE(max_mfn); m2p_chunks = M2P_CHUNKS(max_mfn); xmml.max_extents = m2p_chunks; - if (!(xmml.extent_start = malloc(m2p_chunks * sizeof(unsigned long)))) { + if (!(extent_start = malloc(m2p_chunks * sizeof(unsigned long)))) { ERR("failed to allocate space for m2p mfns"); return NULL; } + SET_XEN_GUEST_HANDLE(xmml.extent_start, extent_start); if (xc_memory_op(xc_handle, XENMEM_machphys_mfn_list, &xmml) || (xmml.nr_extents != m2p_chunks)) { @@ -543,7 +545,7 @@ static unsigned long *xc_map_m2p(int xc_ for (i=0; i < m2p_chunks; i++) { entries[i].va = (unsigned long)(((void *)m2p) + (i * M2P_CHUNK_SIZE)); - entries[i].mfn = xmml.extent_start[i]; + entries[i].mfn = extent_start[i]; entries[i].npages = M2P_CHUNK_SIZE >> PAGE_SHIFT; } @@ -552,7 +554,7 @@ static unsigned long *xc_map_m2p(int xc_ return NULL; } - free(xmml.extent_start); + free(extent_start); free(entries); return m2p; diff -r 96cc994dee76 tools/libxc/xc_misc.c --- a/tools/libxc/xc_misc.c Wed Apr 26 15:54:02 2006 -0500 +++ b/tools/libxc/xc_misc.c Wed Apr 26 16:21:20 2006 -0500 @@ -30,7 +30,7 @@ int xc_readconsolering(int xc_handle, unsigned int nr_chars = *pnr_chars; op.cmd = DOM0_READCONSOLE; - op.u.readconsole.buffer = buffer; + SET_XEN_GUEST_HANDLE(op.u.readconsole.buffer, buffer); op.u.readconsole.count = nr_chars; op.u.readconsole.clear = clear; @@ -39,7 +39,7 @@ int xc_readconsolering(int xc_handle, if ( (ret = do_dom0_op(xc_handle, &op)) == 0 ) { - *pbuffer = op.u.readconsole.buffer; + GET_XEN_GUEST_HANDLE(*pbuffer, op.u.readconsole.buffer); *pnr_chars = op.u.readconsole.count; } @@ -91,7 +91,7 @@ int xc_perfc_control(int xc_handle, op.cmd = DOM0_PERFCCONTROL; op.u.perfccontrol.op = opcode; - op.u.perfccontrol.desc = desc; + SET_XEN_GUEST_HANDLE(op.u.perfccontrol.desc, desc); rc = do_dom0_op(xc_handle, &op); diff -r 96cc994dee76 tools/libxc/xc_private.c --- a/tools/libxc/xc_private.c Wed Apr 26 15:54:02 2006 -0500 +++ b/tools/libxc/xc_private.c Wed Apr 26 16:21:20 2006 -0500 @@ -71,7 +71,7 @@ int xc_get_pfn_type_batch(int xc_handle, op.cmd = DOM0_GETPAGEFRAMEINFO2; op.u.getpageframeinfo2.domain = (domid_t)dom; op.u.getpageframeinfo2.num = num; - op.u.getpageframeinfo2.array = arr; + SET_XEN_GUEST_HANDLE(op.u.getpageframeinfo2.array, arr); return do_dom0_op(xc_handle, &op); } @@ -191,6 +191,9 @@ int xc_memory_op(int xc_handle, struct xen_memory_reservation *reservation = arg; struct xen_machphys_mfn_list *xmml = arg; struct xen_translate_gpfn_list *trans = arg; + unsigned long *extent_start; + unsigned long *gpfn_list; + unsigned long *mfn_list; long ret = -EINVAL; hypercall.op = __HYPERVISOR_memory_op; @@ -207,8 +210,9 @@ int xc_memory_op(int xc_handle, PERROR("Could not mlock"); goto out1; } - if ( (reservation->extent_start != NULL) && - (mlock(reservation->extent_start, + GET_XEN_GUEST_HANDLE(extent_start, reservation->extent_start); + if ( (extent_start != NULL) && + (mlock(extent_start, reservation->nr_extents * sizeof(unsigned long)) != 0) ) { PERROR("Could not mlock"); @@ -222,7 +226,8 @@ int xc_memory_op(int xc_handle, PERROR("Could not mlock"); goto out1; } - if ( mlock(xmml->extent_start, + GET_XEN_GUEST_HANDLE(extent_start, reservation->extent_start); + if ( mlock(extent_start, xmml->max_extents * sizeof(unsigned long)) != 0 ) { PERROR("Could not mlock"); @@ -243,16 +248,18 @@ int xc_memory_op(int xc_handle, PERROR("Could not mlock"); goto out1; } - if ( mlock(trans->gpfn_list, trans->nr_gpfns * sizeof(long)) != 0 ) + GET_XEN_GUEST_HANDLE(gpfn_list, trans->gpfn_list); + if ( mlock(gpfn_list, trans->nr_gpfns * sizeof(long)) != 0 ) { PERROR("Could not mlock"); safe_munlock(trans, sizeof(*trans)); goto out1; } - if ( mlock(trans->mfn_list, trans->nr_gpfns * sizeof(long)) != 0 ) - { - PERROR("Could not mlock"); - safe_munlock(trans->gpfn_list, trans->nr_gpfns * sizeof(long)); + GET_XEN_GUEST_HANDLE(mfn_list, trans->mfn_list); + if ( mlock(mfn_list, trans->nr_gpfns * sizeof(long)) != 0 ) + { + PERROR("Could not mlock"); + safe_munlock(gpfn_list, trans->nr_gpfns * sizeof(long)); safe_munlock(trans, sizeof(*trans)); goto out1; } @@ -267,21 +274,25 @@ int xc_memory_op(int xc_handle, case XENMEM_decrease_reservation: case XENMEM_populate_physmap: safe_munlock(reservation, sizeof(*reservation)); - if ( reservation->extent_start != NULL ) - safe_munlock(reservation->extent_start, + GET_XEN_GUEST_HANDLE(extent_start, reservation->extent_start); + if ( extent_start != NULL ) + safe_munlock(extent_start, reservation->nr_extents * sizeof(unsigned long)); break; case XENMEM_machphys_mfn_list: safe_munlock(xmml, sizeof(*xmml)); - safe_munlock(xmml->extent_start, + GET_XEN_GUEST_HANDLE(extent_start, reservation->extent_start); + safe_munlock(extent_start, xmml->max_extents * sizeof(unsigned long)); break; case XENMEM_add_to_physmap: safe_munlock(arg, sizeof(struct xen_add_to_physmap)); break; case XENMEM_translate_gpfn_list: - safe_munlock(trans->mfn_list, trans->nr_gpfns * sizeof(long)); - safe_munlock(trans->gpfn_list, trans->nr_gpfns * sizeof(long)); + GET_XEN_GUEST_HANDLE(mfn_list, trans->mfn_list); + safe_munlock(mfn_list, trans->nr_gpfns * sizeof(long)); + GET_XEN_GUEST_HANDLE(gpfn_list, trans->gpfn_list); + safe_munlock(gpfn_list, trans->nr_gpfns * sizeof(long)); safe_munlock(trans, sizeof(*trans)); break; } @@ -317,7 +328,7 @@ int xc_get_pfn_list(int xc_handle, op.cmd = DOM0_GETMEMLIST; op.u.getmemlist.domain = (domid_t)domid; op.u.getmemlist.max_pfns = max_pfns; - op.u.getmemlist.buffer = pfn_buf; + SET_XEN_GUEST_HANDLE(op.u.getmemlist.buffer, pfn_buf); #ifdef VALGRIND memset(pfn_buf, 0, max_pfns * sizeof(unsigned long)); diff -r 96cc994dee76 xen/include/public/arch-ia64.h --- a/xen/include/public/arch-ia64.h Wed Apr 26 15:54:02 2006 -0500 +++ b/xen/include/public/arch-ia64.h Wed Apr 26 16:21:20 2006 -0500 @@ -7,16 +7,13 @@ #ifndef __HYPERVISOR_IF_IA64_H__ #define __HYPERVISOR_IF_IA64_H__ -#ifdef __XEN__ #define __DEFINE_XEN_GUEST_HANDLE(name, type) \ typedef struct { type *p; } __guest_handle_ ## name -#else -#define __DEFINE_XEN_GUEST_HANDLE(name, type) \ - typedef type * __guest_handle_ ## name -#endif - -#define DEFINE_XEN_GUEST_HANDLE(name) __DEFINE_XEN_GUEST_HANDLE(name, name) -#define XEN_GUEST_HANDLE(name) __guest_handle_ ## name + +#define DEFINE_XEN_GUEST_HANDLE(name) __DEFINE_XEN_GUEST_HANDLE(name, name) +#define XEN_GUEST_HANDLE(name) __guest_handle_ ## name +#define SET_XEN_GUEST_HANDLE(hnd, val) do { (hnd).p = val; } while (0) +#define GET_XEN_GUEST_HANDLE(val, hnd) do { val = (hnd).p; } while (0) #ifndef __ASSEMBLY__ /* Guest handles for primitive C types. */ diff -r 96cc994dee76 xen/include/public/arch-x86_32.h --- a/xen/include/public/arch-x86_32.h Wed Apr 26 15:54:02 2006 -0500 +++ b/xen/include/public/arch-x86_32.h Wed Apr 26 16:21:20 2006 -0500 @@ -9,16 +9,13 @@ #ifndef __XEN_PUBLIC_ARCH_X86_32_H__ #define __XEN_PUBLIC_ARCH_X86_32_H__ -#ifdef __XEN__ #define __DEFINE_XEN_GUEST_HANDLE(name, type) \ typedef struct { type *p; } __guest_handle_ ## name -#else -#define __DEFINE_XEN_GUEST_HANDLE(name, type) \ - typedef type * __guest_handle_ ## name -#endif -#define DEFINE_XEN_GUEST_HANDLE(name) __DEFINE_XEN_GUEST_HANDLE(name, name) -#define XEN_GUEST_HANDLE(name) __guest_handle_ ## name +#define DEFINE_XEN_GUEST_HANDLE(name) __DEFINE_XEN_GUEST_HANDLE(name, name) +#define XEN_GUEST_HANDLE(name) __guest_handle_ ## name +#define SET_XEN_GUEST_HANDLE(hnd, val) do { (hnd).p = val; } while (0) +#define GET_XEN_GUEST_HANDLE(val, hnd) do { val = (hnd).p; } while (0) #ifndef __ASSEMBLY__ /* Guest handles for primitive C types. */ diff -r 96cc994dee76 xen/include/public/arch-x86_64.h --- a/xen/include/public/arch-x86_64.h Wed Apr 26 15:54:02 2006 -0500 +++ b/xen/include/public/arch-x86_64.h Wed Apr 26 16:21:20 2006 -0500 @@ -9,16 +9,13 @@ #ifndef __XEN_PUBLIC_ARCH_X86_64_H__ #define __XEN_PUBLIC_ARCH_X86_64_H__ -#ifdef __XEN__ #define __DEFINE_XEN_GUEST_HANDLE(name, type) \ typedef struct { type *p; } __guest_handle_ ## name -#else -#define __DEFINE_XEN_GUEST_HANDLE(name, type) \ - typedef type * __guest_handle_ ## name -#endif - -#define DEFINE_XEN_GUEST_HANDLE(name) __DEFINE_XEN_GUEST_HANDLE(name, name) -#define XEN_GUEST_HANDLE(name) __guest_handle_ ## name + +#define DEFINE_XEN_GUEST_HANDLE(name) __DEFINE_XEN_GUEST_HANDLE(name, name) +#define XEN_GUEST_HANDLE(name) __guest_handle_ ## name +#define SET_XEN_GUEST_HANDLE(hnd, val) do { (hnd).p = val; } while (0) +#define GET_XEN_GUEST_HANDLE(val, hnd) do { val = (hnd).p; } while (0) #ifndef __ASSEMBLY__ /* Guest handles for primitive C types. */ --=-ip3Fa4uSejT5l5Uxg8Yw Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=-ip3Fa4uSejT5l5Uxg8Yw--