[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] libxc: convert xc_version over to hypercall buffers
# HG changeset patch # User Ian Campbell <ian.campbell@xxxxxxxxxx> # Date 1287756891 -3600 # Node ID ca4a781c8ae88c05a86a9c5f1918ed58c789d085 # Parent 6f904c99db56b341a285134c6d00f0b21ce86e9c libxc: convert xc_version over to hypercall buffers Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx> Signed-off-by: Ian Jackson <ian.jackson.citrix.com> --- tools/libxc/xc_private.c | 34 +++++++++++++++++++--------------- tools/libxc/xc_private.h | 9 +++++---- 2 files changed, 24 insertions(+), 19 deletions(-) diff -r 6f904c99db56 -r ca4a781c8ae8 tools/libxc/xc_private.c --- a/tools/libxc/xc_private.c Tue Oct 26 12:11:37 2010 +0100 +++ b/tools/libxc/xc_private.c Fri Oct 22 15:14:51 2010 +0100 @@ -567,42 +567,46 @@ int xc_sysctl(xc_interface *xch, struct int xc_version(xc_interface *xch, int cmd, void *arg) { - int rc, argsize = 0; + DECLARE_HYPERCALL_BOUNCE(arg, 0, XC_HYPERCALL_BUFFER_BOUNCE_OUT); /* Size unknown until cmd decoded */ + size_t sz = 0; + int rc; switch ( cmd ) { case XENVER_extraversion: - argsize = sizeof(xen_extraversion_t); + sz = sizeof(xen_extraversion_t); break; case XENVER_compile_info: - argsize = sizeof(xen_compile_info_t); + sz = sizeof(xen_compile_info_t); break; case XENVER_capabilities: - argsize = sizeof(xen_capabilities_info_t); + sz = sizeof(xen_capabilities_info_t); break; case XENVER_changeset: - argsize = sizeof(xen_changeset_info_t); + sz = sizeof(xen_changeset_info_t); break; case XENVER_platform_parameters: - argsize = sizeof(xen_platform_parameters_t); + sz = sizeof(xen_platform_parameters_t); break; } - if ( (argsize != 0) && (lock_pages(xch, arg, argsize) != 0) ) - { - PERROR("Could not lock memory for version hypercall"); + HYPERCALL_BOUNCE_SET_SIZE(arg, sz); + + if ( (sz != 0) && xc_hypercall_bounce_pre(xch, arg) ) + { + PERROR("Could not bounce buffer for version hypercall"); return -ENOMEM; } #ifdef VALGRIND - if (argsize != 0) - memset(arg, 0, argsize); + if (sz != 0) + memset(hypercall_bounce_get(bounce), 0, sz); #endif - rc = do_xen_version(xch, cmd, arg); - - if ( argsize != 0 ) - unlock_pages(xch, arg, argsize); + rc = do_xen_version(xch, cmd, HYPERCALL_BUFFER(arg)); + + if ( sz != 0 ) + xc_hypercall_bounce_post(xch, arg); return rc; } diff -r 6f904c99db56 -r ca4a781c8ae8 tools/libxc/xc_private.h --- a/tools/libxc/xc_private.h Tue Oct 26 12:11:37 2010 +0100 +++ b/tools/libxc/xc_private.h Fri Oct 22 15:14:51 2010 +0100 @@ -166,13 +166,14 @@ void xc__hypercall_bounce_post(xc_interf int do_xen_hypercall(xc_interface *xch, privcmd_hypercall_t *hypercall); -static inline int do_xen_version(xc_interface *xch, int cmd, void *dest) -{ - DECLARE_HYPERCALL; +static inline int do_xen_version(xc_interface *xch, int cmd, xc_hypercall_buffer_t *dest) +{ + DECLARE_HYPERCALL; + DECLARE_HYPERCALL_BUFFER_ARGUMENT(dest); hypercall.op = __HYPERVISOR_xen_version; hypercall.arg[0] = (unsigned long) cmd; - hypercall.arg[1] = (unsigned long) dest; + hypercall.arg[1] = HYPERCALL_BUFFER_AS_ARG(dest); return do_xen_hypercall(xch, &hypercall); } _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |