[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] Move dom0_op hypercall to the guest_handle interface (inside Xen).
# HG changeset patch # User kaf24@xxxxxxxxxxxxxxxxxxxx # Node ID 621d32a54e2d143f0b059997a2f438121bae1d5a # Parent d088ce2d3528e4014c5f8aca8a261229f2d5465c Move dom0_op hypercall to the guest_handle interface (inside Xen). Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx> diff -r d088ce2d3528 -r 621d32a54e2d xen/arch/ia64/xen/dom0_ops.c --- a/xen/arch/ia64/xen/dom0_ops.c Fri Mar 3 14:56:34 2006 +++ b/xen/arch/ia64/xen/dom0_ops.c Fri Mar 3 17:26:41 2006 @@ -16,10 +16,11 @@ #include <asm/pdb.h> #include <xen/trace.h> #include <xen/console.h> +#include <xen/guest_access.h> #include <public/sched_ctl.h> #include <asm/vmx.h> -long arch_do_dom0_op(dom0_op_t *op, dom0_op_t *u_dom0_op) +long arch_do_dom0_op(dom0_op_t *op, guest_handle(dom0_op_t) u_dom0_op) { long ret = 0; @@ -64,7 +65,7 @@ put_domain(d); - copy_to_user(u_dom0_op, op, sizeof(*op)); + copy_to_guest(u_dom0_op, op, 1); } break; @@ -74,7 +75,6 @@ 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; struct domain *d; unsigned long *l_arr; ret = -ESRCH; @@ -95,7 +95,8 @@ { int k = ((num-n)>GPF2_BATCH)?GPF2_BATCH:(num-n); - if ( copy_from_user(l_arr, &s_ptr[n], k*sizeof(unsigned long)) ) + if ( copy_from_guest_offset(l_arr, op->u.getpageframeinfo2.array, + n, k) ) { ret = -EINVAL; break; @@ -135,7 +136,8 @@ } - if ( copy_to_user(&s_ptr[n], l_arr, k*sizeof(unsigned long)) ) + if ( copy_to_guest_offset(op->u.getpageframeinfo2.array, + n, l_arr, k) ) { ret = -EINVAL; break; @@ -160,7 +162,6 @@ unsigned long start_page = op->u.getmemlist.max_pfns >> 32; unsigned long nr_pages = op->u.getmemlist.max_pfns & 0xffffffff; unsigned long mfn; - unsigned long *buffer = op->u.getmemlist.buffer; ret = -EINVAL; if ( d != NULL ) @@ -180,16 +181,16 @@ { mfn = gmfn_to_mfn_foreign(d, i); - if ( put_user(mfn, buffer) ) + if ( copy_to_guest_offset(op->u.getmemlist.buffer, + i - start_page, &mfn, 1) ) { ret = -EFAULT; break; } - buffer++; } op->u.getmemlist.num_pfns = i - start_page; - copy_to_user(u_dom0_op, op, sizeof(*op)); + copy_to_guest(u_dom0_op, op, 1); put_domain(d); } @@ -211,7 +212,7 @@ memset(pi->hw_cap, 0, sizeof(pi->hw_cap)); //memcpy(pi->hw_cap, boot_cpu_data.x86_capability, NCAPINTS*4); ret = 0; - if ( copy_to_user(u_dom0_op, op, sizeof(*op)) ) + if ( copy_to_guest(u_dom0_op, op, 1) ) ret = -EFAULT; } break; diff -r d088ce2d3528 -r 621d32a54e2d xen/arch/x86/dom0_ops.c --- a/xen/arch/x86/dom0_ops.c Fri Mar 3 14:56:34 2006 +++ b/xen/arch/x86/dom0_ops.c Fri Mar 3 17:26:41 2006 @@ -10,6 +10,7 @@ #include <xen/types.h> #include <xen/lib.h> #include <xen/mm.h> +#include <xen/guest_access.h> #include <public/dom0_ops.h> #include <xen/sched.h> #include <xen/event.h> @@ -48,7 +49,7 @@ (void)rdmsr_safe(msr_addr, msr_lo, msr_hi); } -long arch_do_dom0_op(struct dom0_op *op, struct dom0_op *u_dom0_op) +long arch_do_dom0_op(struct dom0_op *op, guest_handle(dom0_op_t) u_dom0_op) { long ret = 0; @@ -75,7 +76,7 @@ op->u.msr.out1 = msr_lo; op->u.msr.out2 = msr_hi; - copy_to_user(u_dom0_op, op, sizeof(*op)); + copy_to_guest(u_dom0_op, op, 1); } ret = 0; } @@ -90,7 +91,7 @@ { ret = shadow_mode_control(d, &op->u.shadow_control); put_domain(d); - copy_to_user(u_dom0_op, op, sizeof(*op)); + copy_to_guest(u_dom0_op, op, 1); } } break; @@ -102,10 +103,11 @@ op->u.add_memtype.nr_mfns, op->u.add_memtype.type, 1); - if (ret > 0) - { - (void)__put_user(0, &u_dom0_op->u.add_memtype.handle); - (void)__put_user(ret, &u_dom0_op->u.add_memtype.reg); + if ( ret > 0 ) + { + op->u.add_memtype.handle = 0; + op->u.add_memtype.reg = ret; + (void)copy_to_guest(u_dom0_op, op, 1); ret = 0; } } @@ -136,9 +138,10 @@ if ( op->u.read_memtype.reg < num_var_ranges ) { mtrr_if->get(op->u.read_memtype.reg, &mfn, &nr_mfns, &type); - (void)__put_user(mfn, &u_dom0_op->u.read_memtype.mfn); - (void)__put_user(nr_mfns, &u_dom0_op->u.read_memtype.nr_mfns); - (void)__put_user(type, &u_dom0_op->u.read_memtype.type); + op->u.read_memtype.mfn = mfn; + op->u.read_memtype.nr_mfns = nr_mfns; + op->u.read_memtype.type = type; + (void)copy_to_guest(u_dom0_op, op, 1); ret = 0; } } @@ -147,7 +150,7 @@ case DOM0_MICROCODE: { extern int microcode_update(void *buf, unsigned long len); - ret = microcode_update(op->u.microcode.data, op->u.microcode.length); + ret = microcode_update(op->u.microcode.data.p, op->u.microcode.length); } break; @@ -195,7 +198,7 @@ memset(pi->hw_cap, 0, sizeof(pi->hw_cap)); memcpy(pi->hw_cap, boot_cpu_data.x86_capability, NCAPINTS*4); ret = 0; - if ( copy_to_user(u_dom0_op, op, sizeof(*op)) ) + if ( copy_to_guest(u_dom0_op, op, 1) ) ret = -EFAULT; } break; @@ -245,7 +248,7 @@ put_domain(d); - copy_to_user(u_dom0_op, op, sizeof(*op)); + copy_to_guest(u_dom0_op, op, 1); } break; @@ -255,7 +258,6 @@ 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; struct domain *d; unsigned long *l_arr; ret = -ESRCH; @@ -277,7 +279,8 @@ { int k = ((num-n)>GPF2_BATCH)?GPF2_BATCH:(num-n); - if ( copy_from_user(l_arr, &s_ptr[n], k*sizeof(unsigned long)) ) + if ( copy_from_guest_offset(l_arr, op->u.getpageframeinfo2.array, + n, k) ) { ret = -EINVAL; break; @@ -320,7 +323,8 @@ } - if ( copy_to_user(&s_ptr[n], l_arr, k*sizeof(unsigned long)) ) + if ( copy_to_guest_offset(op->u.getpageframeinfo2.array, + n, l_arr, k) ) { ret = -EINVAL; break; @@ -341,7 +345,6 @@ struct domain *d = find_domain_by_id(op->u.getmemlist.domain); unsigned long max_pfns = op->u.getmemlist.max_pfns; unsigned long mfn; - unsigned long *buffer = op->u.getmemlist.buffer; struct list_head *list_ent; ret = -EINVAL; @@ -353,19 +356,20 @@ list_ent = d->page_list.next; for ( i = 0; (i < max_pfns) && (list_ent != &d->page_list); i++ ) { - mfn = page_to_mfn(list_entry(list_ent, struct page_info, list)); - if ( put_user(mfn, buffer) ) + mfn = page_to_mfn(list_entry( + list_ent, struct page_info, list)); + if ( copy_to_guest_offset(op->u.getmemlist.buffer, + i, &mfn, 1) ) { ret = -EFAULT; break; } - buffer++; list_ent = mfn_to_page(mfn)->list.next; } spin_unlock(&d->page_alloc_lock); op->u.getmemlist.num_pfns = i; - copy_to_user(u_dom0_op, op, sizeof(*op)); + copy_to_guest(u_dom0_op, op, 1); put_domain(d); } @@ -401,13 +405,12 @@ entry.start = e820.map[i].addr; entry.end = e820.map[i].addr + e820.map[i].size; entry.is_ram = (e820.map[i].type == E820_RAM); - (void)copy_to_user( - &op->u.physical_memory_map.memory_map[i], - &entry, sizeof(entry)); + (void)copy_to_guest_offset( + op->u.physical_memory_map.memory_map, i, &entry, 1); } op->u.physical_memory_map.nr_map_entries = i; - (void)copy_to_user(u_dom0_op, op, sizeof(*op)); + (void)copy_to_guest(u_dom0_op, op, 1); } break; diff -r d088ce2d3528 -r 621d32a54e2d xen/arch/x86/shadow32.c --- a/xen/arch/x86/shadow32.c Fri Mar 3 14:56:34 2006 +++ b/xen/arch/x86/shadow32.c Fri Mar 3 17:26:41 2006 @@ -29,6 +29,7 @@ #include <xen/event.h> #include <xen/sched.h> #include <xen/trace.h> +#include <xen/guest_access.h> #define MFN_PINNED(_x) (mfn_to_page(_x)->u.inuse.type_info & PGT_pinned) #define va_to_l1mfn(_ed, _va) \ @@ -1508,14 +1509,14 @@ d->arch.shadow_fault_count = 0; d->arch.shadow_dirty_count = 0; - if ( (sc->dirty_bitmap == NULL) || + if ( guest_handle_is_null(sc->dirty_bitmap) || (d->arch.shadow_dirty_bitmap == NULL) ) { rc = -EINVAL; break; } - if(sc->pages > d->arch.shadow_dirty_bitmap_size) + if ( sc->pages > d->arch.shadow_dirty_bitmap_size ) sc->pages = d->arch.shadow_dirty_bitmap_size; #define chunk (8*1024) /* Transfer and clear in 1kB chunks for L1 cache. */ @@ -1524,10 +1525,10 @@ int bytes = ((((sc->pages - i) > chunk) ? chunk : (sc->pages - i)) + 7) / 8; - if (copy_to_user( - sc->dirty_bitmap + (i/(8*sizeof(unsigned long))), - d->arch.shadow_dirty_bitmap +(i/(8*sizeof(unsigned long))), - bytes)) + if ( copy_to_guest_offset( + sc->dirty_bitmap, i/(8*sizeof(unsigned long)), + d->arch.shadow_dirty_bitmap +(i/(8*sizeof(unsigned long))), + (bytes+sizeof(unsigned long)-1) / sizeof(unsigned long)) ) { rc = -EINVAL; break; @@ -1544,18 +1545,20 @@ sc->stats.fault_count = d->arch.shadow_fault_count; sc->stats.dirty_count = d->arch.shadow_dirty_count; - if ( (sc->dirty_bitmap == NULL) || + if ( guest_handle_is_null(sc->dirty_bitmap) || (d->arch.shadow_dirty_bitmap == NULL) ) { rc = -EINVAL; break; } - if(sc->pages > d->arch.shadow_dirty_bitmap_size) + if ( sc->pages > d->arch.shadow_dirty_bitmap_size ) sc->pages = d->arch.shadow_dirty_bitmap_size; - if (copy_to_user(sc->dirty_bitmap, - d->arch.shadow_dirty_bitmap, (sc->pages+7)/8)) + if ( copy_to_guest(sc->dirty_bitmap, + d->arch.shadow_dirty_bitmap, + (((sc->pages+7)/8)+sizeof(unsigned long)-1) / + sizeof(unsigned long)) ) { rc = -EINVAL; break; diff -r d088ce2d3528 -r 621d32a54e2d xen/arch/x86/shadow_public.c --- a/xen/arch/x86/shadow_public.c Fri Mar 3 14:56:34 2006 +++ b/xen/arch/x86/shadow_public.c Fri Mar 3 17:26:41 2006 @@ -29,6 +29,7 @@ #include <xen/event.h> #include <xen/sched.h> #include <xen/trace.h> +#include <xen/guest_access.h> #include <asm/shadow_64.h> static int alloc_p2m_table(struct domain *d); @@ -1267,14 +1268,14 @@ d->arch.shadow_fault_count = 0; d->arch.shadow_dirty_count = 0; - if ( (sc->dirty_bitmap == NULL) || + if ( guest_handle_is_null(sc->dirty_bitmap) || (d->arch.shadow_dirty_bitmap == NULL) ) { rc = -EINVAL; break; } - if(sc->pages > d->arch.shadow_dirty_bitmap_size) + if ( sc->pages > d->arch.shadow_dirty_bitmap_size ) sc->pages = d->arch.shadow_dirty_bitmap_size; #define chunk (8*1024) /* Transfer and clear in 1kB chunks for L1 cache. */ @@ -1283,10 +1284,10 @@ int bytes = ((((sc->pages - i) > chunk) ? chunk : (sc->pages - i)) + 7) / 8; - if (copy_to_user( - sc->dirty_bitmap + (i/(8*sizeof(unsigned long))), + if ( copy_to_guest_offset( + sc->dirty_bitmap, i/(8*sizeof(unsigned long)), d->arch.shadow_dirty_bitmap +(i/(8*sizeof(unsigned long))), - bytes)) + (bytes+sizeof(unsigned long)-1) / sizeof(unsigned long)) ) { rc = -EINVAL; break; @@ -1302,18 +1303,20 @@ sc->stats.fault_count = d->arch.shadow_fault_count; sc->stats.dirty_count = d->arch.shadow_dirty_count; - if ( (sc->dirty_bitmap == NULL) || + if ( guest_handle_is_null(sc->dirty_bitmap) || (d->arch.shadow_dirty_bitmap == NULL) ) { rc = -EINVAL; break; } - if(sc->pages > d->arch.shadow_dirty_bitmap_size) + if ( sc->pages > d->arch.shadow_dirty_bitmap_size ) sc->pages = d->arch.shadow_dirty_bitmap_size; - if (copy_to_user(sc->dirty_bitmap, - d->arch.shadow_dirty_bitmap, (sc->pages+7)/8)) + if ( copy_to_guest(sc->dirty_bitmap, + d->arch.shadow_dirty_bitmap, + (((sc->pages+7)/8)+sizeof(unsigned long)-1) / + sizeof(unsigned long)) ) { rc = -EINVAL; break; diff -r d088ce2d3528 -r 621d32a54e2d xen/common/dom0_ops.c --- a/xen/common/dom0_ops.c Fri Mar 3 14:56:34 2006 +++ b/xen/common/dom0_ops.c Fri Mar 3 17:26:41 2006 @@ -17,13 +17,14 @@ #include <xen/trace.h> #include <xen/console.h> #include <xen/iocap.h> +#include <xen/guest_access.h> #include <asm/current.h> #include <public/dom0_ops.h> #include <public/sched_ctl.h> #include <acm/acm_hooks.h> extern long arch_do_dom0_op( - struct dom0_op *op, struct dom0_op *u_dom0_op); + struct dom0_op *op, guest_handle(dom0_op_t) u_dom0_op); extern void arch_getdomaininfo_ctxt( struct vcpu *, struct vcpu_guest_context *); @@ -89,7 +90,7 @@ memcpy(info->handle, d->handle, sizeof(xen_domain_handle_t)); } -long do_dom0_op(struct dom0_op *u_dom0_op) +long do_dom0_op(guest_handle(dom0_op_t) u_dom0_op) { long ret = 0; struct dom0_op curop, *op = &curop; @@ -99,7 +100,7 @@ if ( !IS_PRIV(current->domain) ) return -EPERM; - if ( copy_from_user(op, u_dom0_op, sizeof(*op)) ) + if ( copy_from_guest(op, u_dom0_op, 1) ) return -EFAULT; if ( op->interface_version != DOM0_INTERFACE_VERSION ) @@ -239,7 +240,7 @@ ret = 0; op->u.createdomain.domain = d->domain_id; - if ( copy_to_user(u_dom0_op, op, sizeof(*op)) ) + if ( copy_to_guest(u_dom0_op, op, 1) ) ret = -EFAULT; } break; @@ -357,7 +358,7 @@ case DOM0_SCHEDCTL: { ret = sched_ctl(&op->u.schedctl); - if ( copy_to_user(u_dom0_op, op, sizeof(*op)) ) + if ( copy_to_guest(u_dom0_op, op, 1) ) ret = -EFAULT; } break; @@ -365,7 +366,7 @@ case DOM0_ADJUSTDOM: { ret = sched_adjdom(&op->u.adjustdom); - if ( copy_to_user(u_dom0_op, op, sizeof(*op)) ) + if ( copy_to_guest(u_dom0_op, op, 1) ) ret = -EFAULT; } break; @@ -398,20 +399,17 @@ getdomaininfo(d, &op->u.getdomaininfo); - if ( copy_to_user(u_dom0_op, op, sizeof(*op)) ) + if ( copy_to_guest(u_dom0_op, op, 1) ) ret = -EFAULT; put_domain(d); } break; - - case DOM0_GETDOMAININFOLIST: { struct domain *d; dom0_getdomaininfo_t info; - dom0_getdomaininfo_t *buffer = op->u.getdomaininfolist.buffer; u32 num_domains = 0; read_lock(&domlist_lock); @@ -432,13 +430,13 @@ put_domain(d); - if ( copy_to_user(buffer, &info, sizeof(dom0_getdomaininfo_t)) ) + if ( copy_to_guest_offset(op->u.getdomaininfolist.buffer, + num_domains, &info, 1) ) { ret = -EFAULT; break; } - buffer++; num_domains++; } @@ -449,7 +447,7 @@ op->u.getdomaininfolist.num_domains = num_domains; - if ( copy_to_user(u_dom0_op, op, sizeof(*op)) ) + if ( copy_to_guest(u_dom0_op, op, 1) ) ret = -EFAULT; } break; @@ -489,12 +487,12 @@ if ( v != current ) vcpu_unpause(v); - if ( copy_to_user(op->u.getvcpucontext.ctxt, c, sizeof(*c)) ) + if ( copy_to_guest(op->u.getvcpucontext.ctxt, c, 1) ) ret = -EFAULT; xfree(c); - if ( copy_to_user(u_dom0_op, op, sizeof(*op)) ) + if ( copy_to_guest(u_dom0_op, op, 1) ) ret = -EFAULT; getvcpucontext_out: @@ -534,7 +532,7 @@ (int)sizeof(op->u.getvcpuinfo.cpumap))); ret = 0; - if ( copy_to_user(u_dom0_op, op, sizeof(*op)) ) + if ( copy_to_guest(u_dom0_op, op, 1) ) ret = -EFAULT; getvcpuinfo_out: @@ -554,7 +552,7 @@ case DOM0_TBUFCONTROL: { ret = tb_control(&op->u.tbufcontrol); - if ( copy_to_user(u_dom0_op, op, sizeof(*op)) ) + if ( copy_to_guest(u_dom0_op, op, 1) ) ret = -EFAULT; } break; @@ -562,10 +560,10 @@ case DOM0_READCONSOLE: { ret = read_console_ring( - &op->u.readconsole.buffer, + op->u.readconsole.buffer, &op->u.readconsole.count, op->u.readconsole.clear); - if ( copy_to_user(u_dom0_op, op, sizeof(*op)) ) + if ( copy_to_guest(u_dom0_op, op, 1) ) ret = -EFAULT; } break; @@ -573,7 +571,7 @@ case DOM0_SCHED_ID: { op->u.sched_id.sched_id = sched_id(); - if ( copy_to_user(u_dom0_op, op, sizeof(*op)) ) + if ( copy_to_guest(u_dom0_op, op, 1) ) ret = -EFAULT; else ret = 0; @@ -678,15 +676,15 @@ { extern int perfc_control(dom0_perfccontrol_t *); ret = perfc_control(&op->u.perfccontrol); - if ( copy_to_user(u_dom0_op, op, sizeof(*op)) ) + if ( copy_to_guest(u_dom0_op, op, 1) ) ret = -EFAULT; } break; #endif default: - ret = arch_do_dom0_op(op,u_dom0_op); - + ret = arch_do_dom0_op(op, u_dom0_op); + break; } spin_unlock(&dom0_lock); diff -r d088ce2d3528 -r 621d32a54e2d xen/common/domain.c --- a/xen/common/domain.c Fri Mar 3 14:56:34 2006 +++ b/xen/common/domain.c Fri Mar 3 17:26:41 2006 @@ -17,6 +17,7 @@ #include <xen/softirq.h> #include <xen/domain_page.h> #include <xen/rangeset.h> +#include <xen/guest_access.h> #include <asm/debugger.h> #include <public/dom0_ops.h> #include <public/sched.h> @@ -380,7 +381,7 @@ domain_pause(d); rc = -EFAULT; - if ( copy_from_user(c, setvcpucontext->ctxt, sizeof(*c)) == 0 ) + if ( copy_from_guest(c, setvcpucontext->ctxt, 1) == 0 ) rc = arch_set_info_guest(v, c); domain_unpause(d); diff -r d088ce2d3528 -r 621d32a54e2d xen/common/perfc.c --- a/xen/common/perfc.c Fri Mar 3 14:56:34 2006 +++ b/xen/common/perfc.c Fri Mar 3 17:26:41 2006 @@ -5,9 +5,10 @@ #include <xen/perfc.h> #include <xen/keyhandler.h> #include <xen/spinlock.h> +#include <xen/mm.h> +#include <xen/guest_access.h> #include <public/dom0_ops.h> #include <asm/uaccess.h> -#include <xen/mm.h> #undef PERFCOUNTER #undef PERFCOUNTER_CPU @@ -131,12 +132,12 @@ static dom0_perfc_desc_t perfc_d[NR_PERFCTRS]; static int perfc_init = 0; -static int perfc_copy_info(dom0_perfc_desc_t *desc) +static int perfc_copy_info(guest_handle(dom0_perfc_desc_t) desc) { unsigned int i, j; atomic_t *counters = (atomic_t *)&perfcounters; - if ( desc == NULL ) + if ( guest_handle_is_null(desc) ) return 0; /* We only copy the name and array-size information once. */ @@ -196,7 +197,7 @@ } } - return (copy_to_user(desc, perfc_d, NR_PERFCTRS * sizeof(*desc)) ? + return (copy_to_guest(desc, (dom0_perfc_desc_t *)perfc_d, NR_PERFCTRS) ? -EFAULT : 0); } diff -r d088ce2d3528 -r 621d32a54e2d xen/drivers/char/console.c --- a/xen/drivers/char/console.c Fri Mar 3 14:56:34 2006 +++ b/xen/drivers/char/console.c Fri Mar 3 17:26:41 2006 @@ -20,6 +20,7 @@ #include <xen/keyhandler.h> #include <xen/mm.h> #include <xen/delay.h> +#include <xen/guest_access.h> #include <asm/current.h> #include <asm/uaccess.h> #include <asm/debugger.h> @@ -221,9 +222,8 @@ conringc = conringp - CONRING_SIZE; } -long read_console_ring(char **pstr, u32 *pcount, int clear) -{ - char *str = *pstr; +long read_console_ring(guest_handle(char) str, u32 *pcount, int clear) +{ unsigned int idx, len, max, sofar, c; unsigned long flags; @@ -239,7 +239,7 @@ len = CONRING_SIZE - idx; if ( (sofar + len) > max ) len = max - sofar; - if ( copy_to_user(str + sofar, &conring[idx], len) ) + if ( copy_to_guest_offset(str, sofar, &conring[idx], len) ) return -EFAULT; sofar += len; c += len; diff -r d088ce2d3528 -r 621d32a54e2d xen/include/public/arch-ia64.h --- a/xen/include/public/arch-ia64.h Fri Mar 3 14:56:34 2006 +++ b/xen/include/public/arch-ia64.h Fri Mar 3 17:26:41 2006 @@ -298,6 +298,7 @@ arch_initrd_info_t initrd; char cmdline[IA64_COMMAND_LINE_SIZE]; } vcpu_guest_context_t; +define_guest_handle(vcpu_guest_context_t); #endif /* !__ASSEMBLY__ */ diff -r d088ce2d3528 -r 621d32a54e2d xen/include/public/arch-x86_32.h --- a/xen/include/public/arch-x86_32.h Fri Mar 3 14:56:34 2006 +++ b/xen/include/public/arch-x86_32.h Fri Mar 3 17:26:41 2006 @@ -130,6 +130,7 @@ unsigned long failsafe_callback_eip; unsigned long vm_assist; /* VMASST_TYPE_* bitmap */ } vcpu_guest_context_t; +define_guest_handle(vcpu_guest_context_t); typedef struct arch_shared_info { unsigned long max_pfn; /* max pfn that appears in table */ diff -r d088ce2d3528 -r 621d32a54e2d xen/include/public/arch-x86_64.h --- a/xen/include/public/arch-x86_64.h Fri Mar 3 14:56:34 2006 +++ b/xen/include/public/arch-x86_64.h Fri Mar 3 17:26:41 2006 @@ -215,6 +215,7 @@ uint64_t gs_base_kernel; uint64_t gs_base_user; } vcpu_guest_context_t; +define_guest_handle(vcpu_guest_context_t); typedef struct arch_shared_info { unsigned long max_pfn; /* max pfn that appears in table */ diff -r d088ce2d3528 -r 621d32a54e2d xen/include/public/dom0_ops.h --- a/xen/include/public/dom0_ops.h Fri Mar 3 14:56:34 2006 +++ b/xen/include/public/dom0_ops.h Fri Mar 3 17:26:41 2006 @@ -28,18 +28,21 @@ /* IN variables. */ domid_t domain; unsigned long max_pfns; - void *buffer; + guest_handle(ulong) buffer; /* OUT variables. */ unsigned long num_pfns; } dom0_getmemlist_t; +define_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 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 DOM0_CREATEDOMAIN 8 typedef struct dom0_createdomain { @@ -50,24 +53,28 @@ /* Identifier for new domain (auto-allocate if zero is specified). */ domid_t domain; } dom0_createdomain_t; +define_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 DOM0_PAUSEDOMAIN 10 typedef struct dom0_pausedomain { /* IN parameters. */ domid_t domain; } dom0_pausedomain_t; +define_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 DOM0_GETDOMAININFO 12 typedef struct dom0_getdomaininfo { @@ -93,6 +100,7 @@ uint32_t ssidref; xen_domain_handle_t handle; } dom0_getdomaininfo_t; +define_guest_handle(dom0_getdomaininfo_t); #define DOM0_SETVCPUCONTEXT 13 typedef struct dom0_setvcpucontext { @@ -100,8 +108,9 @@ domid_t domain; uint32_t vcpu; /* IN/OUT parameters */ - vcpu_guest_context_t *ctxt; + guest_handle(vcpu_guest_context_t) ctxt; } dom0_setvcpucontext_t; +define_guest_handle(dom0_setvcpucontext_t); #define DOM0_MSR 15 typedef struct dom0_msr { @@ -115,6 +124,7 @@ uint32_t out1; uint32_t out2; } dom0_msr_t; +define_guest_handle(dom0_msr_t); /* * Set clock such that it would read <secs,nsecs> after 00:00:00 UTC, @@ -127,6 +137,7 @@ uint32_t nsecs; uint64_t system_time; } dom0_settime_t; +define_guest_handle(dom0_settime_t); #define DOM0_GETPAGEFRAMEINFO 18 #define NOTAB 0 /* normal page */ @@ -147,6 +158,7 @@ /* Is the page PINNED to a type? */ uint32_t type; /* see above type defs */ } dom0_getpageframeinfo_t; +define_guest_handle(dom0_getpageframeinfo_t); /* * Read console content from Xen buffer ring. @@ -154,11 +166,12 @@ #define DOM0_READCONSOLE 19 typedef struct dom0_readconsole { /* IN variables. */ - uint32_t clear; /* Non-zero -> clear after reading. */ + uint32_t clear; /* Non-zero -> clear after reading. */ /* IN/OUT variables. */ - char *buffer; /* In: Buffer start; Out: Used buffer start */ - uint32_t count; /* In: Buffer size; Out: Used buffer size */ + 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); /* * Set which physical cpus a vcpu can execute on. @@ -170,6 +183,7 @@ uint32_t vcpu; cpumap_t cpumap; } dom0_setvcpuaffinity_t; +define_guest_handle(dom0_setvcpuaffinity_t); /* Get trace buffers machine base address */ #define DOM0_TBUFCONTROL 21 @@ -189,6 +203,7 @@ unsigned long buffer_mfn; uint32_t size; } dom0_tbufcontrol_t; +define_guest_handle(dom0_tbufcontrol_t); /* * Get physical information about the host machine @@ -204,6 +219,7 @@ unsigned long free_pages; uint32_t hw_cap[8]; } dom0_physinfo_t; +define_guest_handle(dom0_physinfo_t); /* * Get the ID of the current scheduler. @@ -213,6 +229,7 @@ /* OUT variable */ uint32_t sched_id; } dom0_sched_id_t; +define_guest_handle(dom0_sched_id_t); /* * Control shadow pagetables operation @@ -234,17 +251,19 @@ uint32_t dirty_net_count; uint32_t dirty_block_count; } dom0_shadow_control_stats_t; +define_guest_handle(dom0_shadow_control_stats_t); typedef struct dom0_shadow_control { /* IN variables. */ domid_t domain; uint32_t op; - unsigned long *dirty_bitmap; /* pointer to locked buffer */ + 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 DOM0_SETDOMAINMAXMEM 28 typedef struct dom0_setdomainmaxmem { @@ -252,6 +271,7 @@ domid_t domain; unsigned long max_memkb; } dom0_setdomainmaxmem_t; +define_guest_handle(dom0_setdomainmaxmem_t); #define DOM0_GETPAGEFRAMEINFO2 29 /* batched interface */ typedef struct dom0_getpageframeinfo2 { @@ -259,8 +279,9 @@ domid_t domain; unsigned long num; /* IN/OUT variables. */ - unsigned long *array; + guest_handle(ulong) array; } dom0_getpageframeinfo2_t; +define_guest_handle(dom0_getpageframeinfo2_t); /* * Request memory range (@mfn, @mfn+@nr_mfns-1) to have type @type. @@ -279,6 +300,7 @@ uint32_t handle; uint32_t reg; } dom0_add_memtype_t; +define_guest_handle(dom0_add_memtype_t); /* * Tear down an existing memory-range type. If @handle is remembered then it @@ -293,6 +315,7 @@ uint32_t handle; uint32_t reg; } dom0_del_memtype_t; +define_guest_handle(dom0_del_memtype_t); /* Read current type of an MTRR (x86-specific). */ #define DOM0_READ_MEMTYPE 33 @@ -304,6 +327,7 @@ unsigned long nr_mfns; uint32_t type; } dom0_read_memtype_t; +define_guest_handle(dom0_read_memtype_t); /* Interface for controlling Xen software performance counters. */ #define DOM0_PERFCCONTROL 34 @@ -315,20 +339,23 @@ 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); typedef struct dom0_perfccontrol { /* IN variables. */ uint32_t op; /* DOM0_PERFCCONTROL_OP_??? */ /* OUT variables. */ uint32_t nr_counters; /* number of counters */ - dom0_perfc_desc_t *desc; /* counter information (or NULL) */ + guest_handle(dom0_perfc_desc_t) desc; /* counter information (or NULL) */ } dom0_perfccontrol_t; +define_guest_handle(dom0_perfccontrol_t); #define DOM0_MICROCODE 35 typedef struct dom0_microcode { /* IN variables. */ - void *data; /* Pointer to microcode data */ + 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 DOM0_IOPORT_PERMISSION 36 typedef struct dom0_ioport_permission { @@ -337,6 +364,7 @@ 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 DOM0_GETVCPUCONTEXT 37 typedef struct dom0_getvcpucontext { @@ -344,8 +372,9 @@ domid_t domain; /* domain to be affected */ uint32_t vcpu; /* vcpu # */ /* OUT variables. */ - vcpu_guest_context_t *ctxt; + guest_handle(vcpu_guest_context_t) ctxt; } dom0_getvcpucontext_t; +define_guest_handle(dom0_getvcpucontext_t); #define DOM0_GETVCPUINFO 43 typedef struct dom0_getvcpuinfo { @@ -360,16 +389,18 @@ uint32_t cpu; /* current mapping */ cpumap_t cpumap; /* allowable mapping */ } dom0_getvcpuinfo_t; +define_guest_handle(dom0_getvcpuinfo_t); #define DOM0_GETDOMAININFOLIST 38 typedef struct dom0_getdomaininfolist { /* IN variables. */ domid_t first_domain; uint32_t max_domains; - dom0_getdomaininfo_t *buffer; + guest_handle(dom0_getdomaininfo_t) buffer; /* OUT variables. */ uint32_t num_domains; } dom0_getdomaininfolist_t; +define_guest_handle(dom0_getdomaininfolist_t); #define DOM0_PLATFORM_QUIRK 39 #define QUIRK_NOIRQBALANCING 1 @@ -377,37 +408,44 @@ /* IN variables. */ uint32_t quirk_id; } dom0_platform_quirk_t; +define_guest_handle(dom0_platform_quirk_t); #define DOM0_PHYSICAL_MEMORY_MAP 40 +typedef struct dom0_memory_map_entry { + uint64_t start, end; + uint32_t flags; /* reserved */ + uint8_t is_ram; +} dom0_memory_map_entry_t; +define_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; - struct dom0_memory_map_entry { - uint64_t start, end; - uint32_t flags; /* reserved */ - uint8_t is_ram; - } *memory_map; + guest_handle(dom0_memory_map_entry_t) memory_map; } dom0_physical_memory_map_t; +define_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 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 DOM0_SETDEBUGGING 45 typedef struct dom0_setdebugging { domid_t domain; uint8_t enable; } dom0_setdebugging_t; +define_guest_handle(dom0_setdebugging_t); #define DOM0_IRQ_PERMISSION 46 typedef struct dom0_irq_permission { @@ -415,6 +453,7 @@ 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 DOM0_IOMEM_PERMISSION 47 typedef struct dom0_iomem_permission { @@ -423,12 +462,14 @@ 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 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); typedef struct dom0_op { uint32_t cmd; @@ -471,9 +512,10 @@ struct dom0_irq_permission irq_permission; struct dom0_iomem_permission iomem_permission; struct dom0_hypercall_init hypercall_init; - uint8_t pad[128]; + uint8_t pad[128]; } u; } dom0_op_t; +define_guest_handle(dom0_op_t); #endif /* __XEN_PUBLIC_DOM0_OPS_H__ */ diff -r d088ce2d3528 -r 621d32a54e2d xen/include/xen/console.h --- a/xen/include/xen/console.h Fri Mar 3 14:56:34 2006 +++ b/xen/include/xen/console.h Fri Mar 3 17:26:41 2006 @@ -13,7 +13,7 @@ void set_printk_prefix(const char *prefix); -long read_console_ring(char **, u32 *, int); +long read_console_ring(guest_handle(char), u32 *, int); void init_console(void); void console_endboot(int disable_vga); _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |