diff options
author | kaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk> | 2006-03-07 18:40:42 +0100 |
---|---|---|
committer | kaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk> | 2006-03-07 18:40:42 +0100 |
commit | 97bdaa5bdfc8bd417c69ef8244ca31de174d67e7 (patch) | |
tree | 0014dda63b9546722b697809d50aafa165f808e9 /xen/common/multicall.c | |
parent | 15c0d5d00a502a4f68a3cbc3eb0e6ae812e0e137 (diff) | |
download | xen-97bdaa5bdfc8bd417c69ef8244ca31de174d67e7.tar.gz xen-97bdaa5bdfc8bd417c69ef8244ca31de174d67e7.tar.bz2 xen-97bdaa5bdfc8bd417c69ef8244ca31de174d67e7.zip |
Upgrade all hypercalls to use the new guest_handle interface (on the Xen side).
Signed-off-by: Keir Fraser <keir@xensource.com>
Diffstat (limited to 'xen/common/multicall.c')
-rw-r--r-- | xen/common/multicall.c | 33 |
1 files changed, 11 insertions, 22 deletions
diff --git a/xen/common/multicall.c b/xen/common/multicall.c index 823625aad1..16e2fc1a1c 100644 --- a/xen/common/multicall.c +++ b/xen/common/multicall.c @@ -10,12 +10,15 @@ #include <xen/sched.h> #include <xen/event.h> #include <xen/multicall.h> +#include <xen/guest_access.h> #include <asm/current.h> #include <asm/hardirq.h> struct mc_state mc_state[NR_CPUS]; -long do_multicall(struct multicall_entry *call_list, unsigned int nr_calls) +long +do_multicall( + GUEST_HANDLE(multicall_entry_t) call_list, unsigned int nr_calls) { struct mc_state *mcs = &mc_state[smp_processor_id()]; unsigned int i; @@ -26,22 +29,13 @@ long do_multicall(struct multicall_entry *call_list, unsigned int nr_calls) return -EINVAL; } - if ( unlikely(!array_access_ok(call_list, nr_calls, sizeof(*call_list))) ) - { - DPRINTK("Bad memory range %p for %u*%u bytes.\n", - call_list, nr_calls, (unsigned int)sizeof(*call_list)); + if ( unlikely(!guest_handle_okay(call_list, nr_calls)) ) goto fault; - } for ( i = 0; i < nr_calls; i++ ) { - if ( unlikely(__copy_from_user(&mcs->call, &call_list[i], - sizeof(*call_list))) ) - { - DPRINTK("Error copying from user range %p for %u bytes.\n", - &call_list[i], (unsigned int)sizeof(*call_list)); + if ( unlikely(__copy_from_guest_offset(&mcs->call, call_list, i, 1)) ) goto fault; - } do_multicall_call(&mcs->call); @@ -53,17 +47,12 @@ long do_multicall(struct multicall_entry *call_list, unsigned int nr_calls) */ struct multicall_entry corrupt; memset(&corrupt, 0xAA, sizeof(corrupt)); - (void)__copy_to_user(&call_list[i], &corrupt, sizeof(corrupt)); + (void)__copy_to_guest_offset(call_list, i, &corrupt, 1); } #endif - if ( unlikely(__copy_to_user(&call_list[i].result, - &mcs->call.result, - sizeof(mcs->call.result))) ) - { - DPRINTK("Error writing result back to multicall block.\n"); + if ( unlikely(__copy_to_guest_offset(call_list, i, &mcs->call, 1)) ) goto fault; - } if ( hypercall_preempt_check() ) { @@ -74,15 +63,15 @@ long do_multicall(struct multicall_entry *call_list, unsigned int nr_calls) if ( !test_bit(_MCSF_call_preempted, &mcs->flags) ) i++; else - (void)__copy_to_user(&call_list[i], &mcs->call, - sizeof(*call_list)); + (void)__copy_to_guest_offset(call_list, i, &mcs->call, 1); /* Only create a continuation if there is work left to be done. */ if ( i < nr_calls ) { mcs->flags = 0; + guest_handle_add_offset(call_list, i); return hypercall_create_continuation( - __HYPERVISOR_multicall, "pi", &call_list[i], nr_calls-i); + __HYPERVISOR_multicall, "hi", call_list, nr_calls-i); } } } |