diff options
author | Ian Campbell <ian.campbell@citrix.com> | 2011-03-11 18:18:18 +0000 |
---|---|---|
committer | Ian Campbell <ian.campbell@citrix.com> | 2011-03-11 18:18:18 +0000 |
commit | 44baceec2d35beb902ddf909d667f2329576381f (patch) | |
tree | f972cba285df51123bf1c6488e642efa1c4200c0 /tools/libxc/xc_solaris.c | |
parent | 8627dcc084e9f84eaad8ec4723d86186440df8dd (diff) | |
download | xen-44baceec2d35beb902ddf909d667f2329576381f.tar.gz xen-44baceec2d35beb902ddf909d667f2329576381f.tar.bz2 xen-44baceec2d35beb902ddf909d667f2329576381f.zip |
libxc: osdep: convert hypercall buffer allocation
This will allow us to use OS specific interfaces to ensure that the
allocated memory is safe for use as a hypercall buffer in the future.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Diffstat (limited to 'tools/libxc/xc_solaris.c')
-rw-r--r-- | tools/libxc/xc_solaris.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tools/libxc/xc_solaris.c b/tools/libxc/xc_solaris.c index 981c272951..9de8505bb6 100644 --- a/tools/libxc/xc_solaris.c +++ b/tools/libxc/xc_solaris.c @@ -24,6 +24,7 @@ #include <xen/sys/evtchn.h> #include <unistd.h> #include <fcntl.h> +#include <malloc.h> static xc_osdep_handle solaris_privcmd_open(xc_interface *xch) { @@ -67,6 +68,16 @@ static int solaris_privcmd_close(xc_interface *xch, xc_osdep_handle h) return close(fd); } +static void *solaris_privcmd_alloc_hypercall_buffer(xc_interface *xch, xc_osdep_handle h, int npages) +{ + return memalign(XC_PAGE_SIZE, npages * XC_PAGE_SIZE); +} + +static void solaris_privcmd_free_hypercall_buffer(xc_interface *xch, xc_osdep_handle h, void *ptr, int npages) +{ + free(ptr); +} + static int solaris_privcmd_hypercall(xc_interface *xch, xc_osdep_handle h, privcmd_hypercall_t *hypercall) { int fd = (int)h; @@ -172,6 +183,9 @@ static struct xc_osdep_ops solaris_privcmd_ops = { .close = &solaris_privcmd_close, .u.privcmd = { + .alloc_hypercall_buffer = &solaris_privcmd_alloc_hypercall_buffer, + .free_hypercall_buffer = &solaris_privcmd_free_hypercall_buffer, + .hypercall = &solaris_privcmd_hypercall; .map_foreign_batch = &solaris_privcmd_map_foreign_batch, |