WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH 11 of 24] libxc: convert xc_version over to hypercall

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 11 of 24] libxc: convert xc_version over to hypercall buffers
From: Ian Campbell <ian.campbell@xxxxxxxxxx>
Date: Mon, 06 Sep 2010 14:38:31 +0100
Cc: Ian Campbell <ian.campbell@xxxxxxxxxx>
Delivery-date: Mon, 06 Sep 2010 06:52:20 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1283780300@xxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1283779691 -3600
# Node ID f3b26cbd7eb5cc0ce7321aaae9eefb821192e86f
# Parent  bf7fb64762eb7decea9a6804460f0f966496ba07
libxc: convert xc_version over to hypercall buffers

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>

diff -r bf7fb64762eb -r f3b26cbd7eb5 tools/libxc/xc_private.c
--- a/tools/libxc/xc_private.c  Mon Sep 06 14:28:11 2010 +0100
+++ b/tools/libxc/xc_private.c  Mon Sep 06 14:28:11 2010 +0100
@@ -629,42 +629,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) )
+    HYPERCALL_BOUNCE_SET_SIZE(arg, sz);
+
+    if ( (sz != 0) && xc_hypercall_bounce_pre(xch, arg) )
     {
         PERROR("Could not lock memory 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);
+    rc = do_xen_version(xch, cmd, HYPERCALL_BUFFER(arg));
 
-    if ( argsize != 0 )
-        unlock_pages(xch, arg, argsize);
+    if ( sz != 0 )
+        xc_hypercall_bounce_post(xch, arg);
 
     return rc;
 }
diff -r bf7fb64762eb -r f3b26cbd7eb5 tools/libxc/xc_private.h
--- a/tools/libxc/xc_private.h  Mon Sep 06 14:28:11 2010 +0100
+++ b/tools/libxc/xc_private.h  Mon Sep 06 14:28:11 2010 +0100
@@ -164,13 +164,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)
+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-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>