diff options
author | kaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk> | 2005-07-04 15:34:57 +0000 |
---|---|---|
committer | kaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk> | 2005-07-04 15:34:57 +0000 |
commit | 63ba48b8076f17ae871f39af2f59fc4a3b9751e4 (patch) | |
tree | 5bf356b7ed03ab4712b22262c3a93c15b29e303c /tools/libxc/xc_gnttab.c | |
parent | 905bd758931263d024f57b77d99a52f941227599 (diff) | |
download | xen-63ba48b8076f17ae871f39af2f59fc4a3b9751e4.tar.gz xen-63ba48b8076f17ae871f39af2f59fc4a3b9751e4.tar.bz2 xen-63ba48b8076f17ae871f39af2f59fc4a3b9751e4.zip |
Fix grant-table interface by removing the unnecessary union.
This fixes a domU crash introduced over the weekend.
Signed-off-by: Keir Fraser <keir@xensource.com>
Diffstat (limited to 'tools/libxc/xc_gnttab.c')
-rw-r--r-- | tools/libxc/xc_gnttab.c | 75 |
1 files changed, 37 insertions, 38 deletions
diff --git a/tools/libxc/xc_gnttab.c b/tools/libxc/xc_gnttab.c index 409539cb14..4101ca74dd 100644 --- a/tools/libxc/xc_gnttab.c +++ b/tools/libxc/xc_gnttab.c @@ -11,20 +11,20 @@ #include "xen/grant_table.h" static int -do_gnttab_op( int xc_handle, - unsigned long cmd, - gnttab_op_t *op, - unsigned long count ) +do_gnttab_op(int xc_handle, + unsigned long cmd, + void *op, + unsigned long count) { int ret = -1; privcmd_hypercall_t hypercall; hypercall.op = __HYPERVISOR_grant_table_op; hypercall.arg[0] = cmd; - hypercall.arg[1] = (unsigned long)(op); + hypercall.arg[1] = (unsigned long)op; hypercall.arg[2] = count; - if ( mlock(op, sizeof(*op)) != 0 ) + if ( mlock(op, 64) ) { PERROR("do_gnttab_op: op mlock failed"); goto out; @@ -33,7 +33,7 @@ do_gnttab_op( int xc_handle, if ( (ret = do_xen_hypercall(xc_handle, &hypercall)) < 0 ) ERROR("do_gnttab_op: HYPERVISOR_grant_table_op failed: %d", ret); - safe_munlock(op, sizeof(*op)); + safe_munlock(op, 64); out: return ret; } @@ -47,18 +47,19 @@ int xc_gnttab_map_grant_ref(int xc_handle, s16 *handle, memory_t *dev_bus_addr) { - gnttab_op_t op; - int rc; + struct gnttab_map_grant_ref op; + int rc; - op.u.map_grant_ref.host_virt_addr = host_virt_addr; - op.u.map_grant_ref.dom = (domid_t)dom; - op.u.map_grant_ref.ref = ref; - op.u.map_grant_ref.flags = flags; + op.host_virt_addr = host_virt_addr; + op.dom = (domid_t)dom; + op.ref = ref; + op.flags = flags; - if ( (rc = do_gnttab_op(xc_handle, GNTTABOP_map_grant_ref, &op, 1)) == 0 ) + if ( (rc = do_gnttab_op(xc_handle, GNTTABOP_map_grant_ref, + &op, 1)) == 0 ) { - *handle = op.u.map_grant_ref.handle; - *dev_bus_addr = op.u.map_grant_ref.dev_bus_addr; + *handle = op.handle; + *dev_bus_addr = op.dev_bus_addr; } return rc; @@ -71,15 +72,18 @@ int xc_gnttab_unmap_grant_ref(int xc_handle, u16 handle, s16 *status) { - gnttab_op_t op; - int rc; + struct gnttab_unmap_grant_ref op; + int rc; - op.u.unmap_grant_ref.host_virt_addr = host_virt_addr; - op.u.unmap_grant_ref.dev_bus_addr = dev_bus_addr; - op.u.unmap_grant_ref.handle = handle; + op.host_virt_addr = host_virt_addr; + op.dev_bus_addr = dev_bus_addr; + op.handle = handle; - if ( (rc = do_gnttab_op(xc_handle, GNTTABOP_unmap_grant_ref, &op, 1)) == 0 ) - *status = op.u.unmap_grant_ref.status; + if ( (rc = do_gnttab_op(xc_handle, GNTTABOP_unmap_grant_ref, + &op, 1)) == 0 ) + { + *status = op.status; + } return rc; } @@ -90,20 +94,17 @@ int xc_gnttab_setup_table(int xc_handle, s16 *status, memory_t **frame_list) { - gnttab_op_t op; - int rc; - int i; + struct gnttab_setup_table op; + int rc, i; - op.u.setup_table.dom = (domid_t)dom; - op.u.setup_table.nr_frames = nr_frames; + op.dom = (domid_t)dom; + op.nr_frames = nr_frames; if ( (rc = do_gnttab_op(xc_handle, GNTTABOP_setup_table, &op, 1)) == 0 ) { - *status = op.u.setup_table.status; + *status = op.status; for ( i = 0; i < nr_frames; i++ ) - { - (*frame_list)[i] = op.u.setup_table.frame_list[i]; - } + (*frame_list)[i] = op.frame_list[i]; } return rc; @@ -113,15 +114,13 @@ int xc_gnttab_dump_table(int xc_handle, u32 dom, s16 *status) { - gnttab_op_t op; - int rc; + struct gnttab_dump_table op; + int rc; - op.u.dump_table.dom = (domid_t)dom; - - printf("xc_gnttab_dump_table: domain %d\n", dom); + op.dom = (domid_t)dom; if ( (rc = do_gnttab_op(xc_handle, GNTTABOP_dump_table, &op, 1)) == 0 ) - *status = op.u.dump_table.status; + *status = op.status; return rc; } |