aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxc/xc_tbuf.c
diff options
context:
space:
mode:
authorIan Campbell <ian.campbell@citrix.com>2010-10-22 15:14:51 +0100
committerIan Campbell <ian.campbell@citrix.com>2010-10-22 15:14:51 +0100
commit4513025a87902aa4469b15e8097beb7590da7b78 (patch)
tree6639b374163076d128b6a5e54a124404b45e8b04 /tools/libxc/xc_tbuf.c
parent231c3160913a957cb9aeb693a7966ac3f8ecc780 (diff)
downloadxen-4513025a87902aa4469b15e8097beb7590da7b78.tar.gz
xen-4513025a87902aa4469b15e8097beb7590da7b78.tar.bz2
xen-4513025a87902aa4469b15e8097beb7590da7b78.zip
libxc: convert sysctl interfaces over to hypercall buffers
Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Ian Jackson <ian.jackson.citrix.com>
Diffstat (limited to 'tools/libxc/xc_tbuf.c')
-rw-r--r--tools/libxc/xc_tbuf.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/tools/libxc/xc_tbuf.c b/tools/libxc/xc_tbuf.c
index 2e98d50d3c..4ea239bb0b 100644
--- a/tools/libxc/xc_tbuf.c
+++ b/tools/libxc/xc_tbuf.c
@@ -116,9 +116,15 @@ int xc_tbuf_disable(xc_interface *xch)
int xc_tbuf_set_cpu_mask(xc_interface *xch, uint32_t mask)
{
DECLARE_SYSCTL;
+ DECLARE_HYPERCALL_BUFFER(uint8_t, bytemap);
int ret = -1;
uint64_t mask64 = mask;
- uint8_t bytemap[sizeof(mask64)];
+
+ bytemap = xc_hypercall_buffer_alloc(xch, bytemap, sizeof(mask64));
+ {
+ PERROR("Could not allocate memory for xc_tbuf_set_cpu_mask hypercall");
+ goto out;
+ }
sysctl.cmd = XEN_SYSCTL_tbuf_op;
sysctl.interface_version = XEN_SYSCTL_INTERFACE_VERSION;
@@ -126,18 +132,12 @@ int xc_tbuf_set_cpu_mask(xc_interface *xch, uint32_t mask)
bitmap_64_to_byte(bytemap, &mask64, sizeof (mask64) * 8);
- set_xen_guest_handle(sysctl.u.tbuf_op.cpu_mask.bitmap, bytemap);
+ xc_set_xen_guest_handle(sysctl.u.tbuf_op.cpu_mask.bitmap, bytemap);
sysctl.u.tbuf_op.cpu_mask.nr_cpus = sizeof(bytemap) * 8;
- if ( lock_pages(xch, &bytemap, sizeof(bytemap)) != 0 )
- {
- PERROR("Could not lock memory for Xen hypercall");
- goto out;
- }
-
ret = do_sysctl(xch, &sysctl);
- unlock_pages(xch, &bytemap, sizeof(bytemap));
+ xc_hypercall_buffer_free(xch, bytemap);
out:
return ret;