direct-io.hg

view tools/libxc/xc_evtchn.c @ 12988:e080700efa56

[TOOLS] Fix the build. Clearly demarcate PPC-specific stuff.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Wed Dec 13 10:23:53 2006 +0000 (2006-12-13)
parents e292f0df2d96
children 62e2e515febe
line source
1 /******************************************************************************
2 * xc_evtchn.c
3 *
4 * API for manipulating and accessing inter-domain event channels.
5 *
6 * Copyright (c) 2004, K A Fraser.
7 */
9 #include "xc_private.h"
12 static int do_evtchn_op(int xc_handle, int cmd, void *arg, size_t arg_size)
13 {
14 int ret = -1;
15 DECLARE_HYPERCALL;
17 hypercall.op = __HYPERVISOR_event_channel_op;
18 hypercall.arg[0] = cmd;
19 hypercall.arg[1] = (unsigned long)arg;
21 if ( lock_pages(arg, arg_size) != 0 )
22 {
23 PERROR("do_evtchn_op: arg lock failed");
24 goto out;
25 }
27 if ((ret = do_xen_hypercall(xc_handle, &hypercall)) < 0)
28 ERROR("do_evtchn_op: HYPERVISOR_event_channel_op failed: %d", ret);
30 unlock_pages(arg, arg_size);
31 out:
32 return ret;
33 }
36 int xc_evtchn_alloc_unbound(int xc_handle,
37 uint32_t dom,
38 uint32_t remote_dom)
39 {
40 int rc;
41 struct evtchn_alloc_unbound arg = {
42 .dom = (domid_t)dom,
43 .remote_dom = (domid_t)remote_dom
44 };
46 rc = do_evtchn_op(xc_handle, EVTCHNOP_alloc_unbound, &arg, sizeof(arg));
47 if ( rc == 0 )
48 rc = arg.port;
50 return rc;
51 }