diff options
author | kaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk> | 2006-04-30 09:16:15 +0100 |
---|---|---|
committer | kaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk> | 2006-04-30 09:16:15 +0100 |
commit | 013351bd7ab3e35717e0133b5f44f82efd6a5d28 (patch) | |
tree | 07939fd55c2d3554fa6d89d443d01a1a4427b6fa /tools/libxc/xc_evtchn.c | |
parent | 4fabe234e8d2895bd2f49d43263f3dafb4658695 (diff) | |
download | xen-013351bd7ab3e35717e0133b5f44f82efd6a5d28.tar.gz xen-013351bd7ab3e35717e0133b5f44f82efd6a5d28.tar.bz2 xen-013351bd7ab3e35717e0133b5f44f82efd6a5d28.zip |
Define new event-channel and physdev hypercalls with a more extensible
interface (the legacy hypercalls would break if subcommands with large
argument structures were added, as it would grow the size of the
union of all argument structures).
Also, based on a patch from Kevin Tian, add a new physdev op to
signal EOI for a particular irq.
Signed-off-by: Keir Fraser <keir@xensource.com>
Diffstat (limited to 'tools/libxc/xc_evtchn.c')
-rw-r--r-- | tools/libxc/xc_evtchn.c | 37 |
1 files changed, 16 insertions, 21 deletions
diff --git a/tools/libxc/xc_evtchn.c b/tools/libxc/xc_evtchn.c index 27d464bb2f..e43d210faf 100644 --- a/tools/libxc/xc_evtchn.c +++ b/tools/libxc/xc_evtchn.c @@ -9,24 +9,25 @@ #include "xc_private.h" -static int do_evtchn_op(int xc_handle, evtchn_op_t *op) +static int do_evtchn_op(int xc_handle, int cmd, void *arg, size_t arg_size) { int ret = -1; DECLARE_HYPERCALL; hypercall.op = __HYPERVISOR_event_channel_op; - hypercall.arg[0] = (unsigned long)op; + hypercall.arg[0] = cmd; + hypercall.arg[1] = (unsigned long)arg; - if ( mlock(op, sizeof(*op)) != 0 ) + if ( mlock(arg, arg_size) != 0 ) { - PERROR("do_evtchn_op: op mlock failed"); + PERROR("do_evtchn_op: arg mlock failed"); goto out; } if ((ret = do_xen_hypercall(xc_handle, &hypercall)) < 0) ERROR("do_evtchn_op: HYPERVISOR_event_channel_op failed: %d", ret); - safe_munlock(op, sizeof(*op)); + safe_munlock(arg, arg_size); out: return ret; } @@ -37,13 +38,14 @@ int xc_evtchn_alloc_unbound(int xc_handle, uint32_t remote_dom) { int rc; - evtchn_op_t op = { - .cmd = EVTCHNOP_alloc_unbound, - .u.alloc_unbound.dom = (domid_t)dom, - .u.alloc_unbound.remote_dom = (domid_t)remote_dom }; + struct evtchn_alloc_unbound arg = { + .dom = (domid_t)dom, + .remote_dom = (domid_t)remote_dom + }; - if ( (rc = do_evtchn_op(xc_handle, &op)) == 0 ) - rc = op.u.alloc_unbound.port; + rc = do_evtchn_op(xc_handle, EVTCHNOP_alloc_unbound, &arg, sizeof(arg)); + if ( rc == 0 ) + rc = arg.port; return rc; } @@ -54,14 +56,7 @@ int xc_evtchn_status(int xc_handle, evtchn_port_t port, xc_evtchn_status_t *status) { - int rc; - evtchn_op_t op = { - .cmd = EVTCHNOP_status, - .u.status.dom = (domid_t)dom, - .u.status.port = port }; - - if ( (rc = do_evtchn_op(xc_handle, &op)) == 0 ) - memcpy(status, &op.u.status, sizeof(*status)); - - return rc; + status->dom = (domid_t)dom; + status->port = port; + return do_evtchn_op(xc_handle, EVTCHNOP_status, status, sizeof(*status)); } |