From: Ian Campbell Subject: [PATCH 08 of 25] libxc: convert evtchn interfaces over to hypercall buffers Date: Fri, 22 Oct 2010 15:15:50 +0100 Message-ID: <0ddcbfd4824fe9c44c4f.1287756950@localhost.localdomain> References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com Cc: Ian Campbell List-Id: xen-devel@lists.xenproject.org # HG changeset patch # User Ian Campbell # Date 1287756891 -3600 # Node ID 0ddcbfd4824fe9c44c4f98f9a4e9cf02e869c290 # Parent 64abd5a41eed626a677ec79ff9728ddd68b824d9 libxc: convert evtchn interfaces over to hypercall buffers Signed-off-by: Ian Campbell diff -r 64abd5a41eed -r 0ddcbfd4824f tools/libxc/xc_evtchn.c --- a/tools/libxc/xc_evtchn.c Fri Oct 22 15:14:51 2010 +0100 +++ b/tools/libxc/xc_evtchn.c Fri Oct 22 15:14:51 2010 +0100 @@ -22,31 +22,30 @@ #include "xc_private.h" - static int do_evtchn_op(xc_interface *xch, int cmd, void *arg, size_t arg_size, int silently_fail) { int ret = -1; DECLARE_HYPERCALL; + DECLARE_HYPERCALL_BOUNCE(arg, arg_size, XC_HYPERCALL_BUFFER_BOUNCE_BOTH); + + if ( xc_hypercall_bounce_pre(xch, arg) ) + { + PERROR("do_evtchn_op: bouncing arg failed"); + goto out; + } hypercall.op = __HYPERVISOR_event_channel_op; hypercall.arg[0] = cmd; - hypercall.arg[1] = (unsigned long)arg; - - if ( lock_pages(xch, arg, arg_size) != 0 ) - { - PERROR("do_evtchn_op: arg lock failed"); - goto out; - } + hypercall.arg[1] = HYPERCALL_BUFFER_AS_ARG(arg); if ((ret = do_xen_hypercall(xch, &hypercall)) < 0 && !silently_fail) ERROR("do_evtchn_op: HYPERVISOR_event_channel_op failed: %d", ret); - unlock_pages(xch, arg, arg_size); + xc_hypercall_bounce_post(xch, arg); out: return ret; } - evtchn_port_or_error_t xc_evtchn_alloc_unbound(xc_interface *xch,