mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 18:21:39 +01:00
On solaris mlock requires a page aligned address and mlock doesn't ensure the pages won't minor page fault. Signed-off-by: Mark Johnson <mark.johnson@sun.com>
52 lines
1.2 KiB
C
52 lines
1.2 KiB
C
/******************************************************************************
|
|
* xc_evtchn.c
|
|
*
|
|
* API for manipulating and accessing inter-domain event channels.
|
|
*
|
|
* Copyright (c) 2004, K A Fraser.
|
|
*/
|
|
|
|
#include "xc_private.h"
|
|
|
|
|
|
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] = cmd;
|
|
hypercall.arg[1] = (unsigned long)arg;
|
|
|
|
if ( lock_pages(arg, arg_size) != 0 )
|
|
{
|
|
PERROR("do_evtchn_op: arg lock failed");
|
|
goto out;
|
|
}
|
|
|
|
if ((ret = do_xen_hypercall(xc_handle, &hypercall)) < 0)
|
|
ERROR("do_evtchn_op: HYPERVISOR_event_channel_op failed: %d", ret);
|
|
|
|
unlock_pages(arg, arg_size);
|
|
out:
|
|
return ret;
|
|
}
|
|
|
|
|
|
int xc_evtchn_alloc_unbound(int xc_handle,
|
|
uint32_t dom,
|
|
uint32_t remote_dom)
|
|
{
|
|
int rc;
|
|
struct evtchn_alloc_unbound arg = {
|
|
.dom = (domid_t)dom,
|
|
.remote_dom = (domid_t)remote_dom
|
|
};
|
|
|
|
rc = do_evtchn_op(xc_handle, EVTCHNOP_alloc_unbound, &arg, sizeof(arg));
|
|
if ( rc == 0 )
|
|
rc = arg.port;
|
|
|
|
return rc;
|
|
}
|