libxencall: introduce variant of xencall2() returning long
authorJan Beulich <jbeulich@suse.com>
Thu, 24 Jun 2021 14:39:02 +0000 (16:39 +0200)
committerJan Beulich <jbeulich@suse.com>
Thu, 24 Jun 2021 14:39:02 +0000 (16:39 +0200)
Some hypercalls, memory-op in particular, can return values requiring
more than 31 bits to represent. Hence the underlying layers need to make
sure they won't truncate such values.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Ian Jackson <iwj@xenproject.org>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
tools/include/xencall.h
tools/libs/call/core.c
tools/libs/call/libxencall.map

index 2d0c42ad5ee449afd6b820aa1f3325540e685ac3..fc95ed0fe58eea7fb7830458fe6207bce610d63a 100644 (file)
@@ -113,6 +113,10 @@ int xencall5(xencall_handle *xcall, unsigned int op,
              uint64_t arg1, uint64_t arg2, uint64_t arg3,
              uint64_t arg4, uint64_t arg5);
 
+/* Variant(s) of the above, as needed, returning "long" instead of "int". */
+long xencall2L(xencall_handle *xcall, unsigned int op,
+               uint64_t arg1, uint64_t arg2);
+
 /*
  * Allocate and free memory which is suitable for use as a pointer
  * argument to a hypercall.
index 57d3a33e6b2a4cf5196ff908274db338af3047e1..02c4f8e1aefa9a87846daf0ae811cc91e12a0c00 100644 (file)
@@ -127,6 +127,17 @@ int xencall2(xencall_handle *xcall, unsigned int op,
     return osdep_hypercall(xcall, &call);
 }
 
+long xencall2L(xencall_handle *xcall, unsigned int op,
+               uint64_t arg1, uint64_t arg2)
+{
+    privcmd_hypercall_t call = {
+        .op = op,
+        .arg = { arg1, arg2 },
+    };
+
+    return osdep_hypercall(xcall, &call);
+}
+
 int xencall3(xencall_handle *xcall, unsigned int op,
              uint64_t arg1, uint64_t arg2, uint64_t arg3)
 {
index 6922b96511e06f987e68960393abf3b7379d547a..ad7518b0e019114c74e8ef9c790e77f387496ba6 100644 (file)
@@ -27,3 +27,8 @@ VERS_1.2 {
        global:
                xencall_fd;
 } VERS_1.1;
+
+VERS_1.3 {
+       global:
+               xencall2L;
+} VERS_1.2;