summaryrefslogtreecommitdiffstats
path: root/sys/i386/include/xen
diff options
context:
space:
mode:
authorroyger <royger@FreeBSD.org>2014-10-22 17:07:20 +0000
committerroyger <royger@FreeBSD.org>2014-10-22 17:07:20 +0000
commit919b7d8b7c042461296e10914c4a96ee74240c0a (patch)
tree55aa165c8081697ca81872e6d35c62170f353661 /sys/i386/include/xen
parent28b52d792fe59919f599dd95f29b9446e570f700 (diff)
downloadFreeBSD-src-919b7d8b7c042461296e10914c4a96ee74240c0a.zip
FreeBSD-src-919b7d8b7c042461296e10914c4a96ee74240c0a.tar.gz
xen: implement the privcmd user-space device
This device is only attached to priviledged domains, and allows the toolstack to interact with Xen. The two functions of the privcmd interface is to allow the execution of hypercalls from user-space, and the mapping of foreign domain memory. Sponsored by: Citrix Systems R&D i386/include/xen/hypercall.h: amd64/include/xen/hypercall.h: - Introduce a function to make generic hypercalls into Xen. xen/interface/xen.h: xen/interface/memory.h: - Import the new hypercall XENMEM_add_to_physmap_range used by auto-translated guests to map memory from foreign domains. dev/xen/privcmd/privcmd.c: - This device has the following functions: - Allow user-space applications to make hypercalls into Xen. - Allow user-space applications to map memory from foreign domains, this is accomplished using the newly introduced hypercall (XENMEM_add_to_physmap_range). xen/privcmd.h: - Public ioctl interface for the privcmd device. x86/xen/hvm.c: - Remove declaration of hypercall_page, now it's declared in hypercall.h. conf/files: - Add the privcmd device to the build process.
Diffstat (limited to 'sys/i386/include/xen')
-rw-r--r--sys/i386/include/xen/hypercall.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/sys/i386/include/xen/hypercall.h b/sys/i386/include/xen/hypercall.h
index 16b5ee2..c7e2a00 100644
--- a/sys/i386/include/xen/hypercall.h
+++ b/sys/i386/include/xen/hypercall.h
@@ -34,6 +34,8 @@
#include <xen/interface/xen.h>
#include <xen/interface/sched.h>
+extern char *hypercall_page;
+
#define __STR(x) #x
#define STR(x) __STR(x)
#define ENOXENSYS 38
@@ -115,6 +117,24 @@
(type)__res; \
})
+static inline long
+privcmd_hypercall(long op, long a1, long a2, long a3, long a4, long a5)
+{
+ long __res, __ign1, __ign2, __ign3, __ign4, __ign5, __call;
+
+ __call = (long)&hypercall_page + (op * 32);
+ __asm__ volatile (
+ "call *%[call]"
+ : "=a" (__res), "=b" (__ign1), "=c" (__ign2),
+ "=d" (__ign3), "=S" (__ign4), "=D" (__ign5)
+ : "1" ((long)(a1)), "2" ((long)(a2)),
+ "3" ((long)(a3)), "4" ((long)(a4)),
+ "5" ((long)(a5)), [call] "a" (__call)
+ : "memory" );
+
+ return __res;
+}
+
static inline int
HYPERVISOR_set_trap_table(
trap_info_t *table)
OpenPOWER on IntegriCloud