aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxc/xc_minios.c
diff options
context:
space:
mode:
authorIan Campbell <ian.campbell@citrix.com>2011-03-11 18:18:18 +0000
committerIan Campbell <ian.campbell@citrix.com>2011-03-11 18:18:18 +0000
commit44baceec2d35beb902ddf909d667f2329576381f (patch)
treef972cba285df51123bf1c6488e642efa1c4200c0 /tools/libxc/xc_minios.c
parent8627dcc084e9f84eaad8ec4723d86186440df8dd (diff)
downloadxen-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_minios.c')
-rw-r--r--tools/libxc/xc_minios.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/tools/libxc/xc_minios.c b/tools/libxc/xc_minios.c
index db8d3b8810..3b366eb824 100644
--- a/tools/libxc/xc_minios.c
+++ b/tools/libxc/xc_minios.c
@@ -37,6 +37,7 @@
#include <assert.h>
#include <stdint.h>
#include <inttypes.h>
+#include <malloc.h>
#include "xc_private.h"
@@ -70,6 +71,16 @@ void minios_interface_close_fd(int fd)
files[fd].type = FTYPE_NONE;
}
+static void *minios_privcmd_alloc_hypercall_buffer(xc_interface *xch, xc_osdep_handle h, int npages)
+{
+ return memalign(PAGE_SIZE, npages * PAGE_SIZE);
+}
+
+static void minios_privcmd_free_hypercall_buffer(xc_interface *xch, xc_osdep_handle h, void *ptr, int npages)
+{
+ free(ptr);
+}
+
static int minios_privcmd_hypercall(xc_interface *xch, xc_osdep_handle h, privcmd_hypercall_t *hypercall)
{
multicall_entry_t call;
@@ -187,6 +198,9 @@ static struct xc_osdep_ops minios_privcmd_ops = {
.close = &minios_privcmd_close,
.u.privcmd = {
+ .alloc_hypercall_buffer = &minios_privcmd_alloc_hypercall_buffer,
+ .free_hypercall_buffer = &minios_privcmd_free_hypercall_buffer,
+
.hypercall = &minios_privcmd_hypercall,
.map_foreign_batch = &minios_privcmd_map_foreign_batch,