aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxc/xc_misc.c
diff options
context:
space:
mode:
authorJoe Epstein <jepstein98@gmail.com>2011-01-07 11:54:50 +0000
committerJoe Epstein <jepstein98@gmail.com>2011-01-07 11:54:50 +0000
commitcd0e05deebf9fe278dc3afcdc03d496b70ca34f8 (patch)
tree86ef4b7d7dc08f57c96022eb7788239d6b92daec /tools/libxc/xc_misc.c
parentdf402bb9f0dcf49f03098ac3bca64b01dd4decce (diff)
downloadxen-cd0e05deebf9fe278dc3afcdc03d496b70ca34f8.tar.gz
xen-cd0e05deebf9fe278dc3afcdc03d496b70ca34f8.tar.bz2
xen-cd0e05deebf9fe278dc3afcdc03d496b70ca34f8.zip
mem_access: added trap injection to libxc
* Carries forward the trap injection hypercall into libxc Signed-off-by: Joe Epstein <jepstein98@gmail.com> Acked-by: Keir Fraser <keir@xen.org> Acked-by: Ian Campbell <Ian.Campbell@citrix.com>
Diffstat (limited to 'tools/libxc/xc_misc.c')
-rw-r--r--tools/libxc/xc_misc.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/tools/libxc/xc_misc.c b/tools/libxc/xc_misc.c
index f4004b1d82..b87bbc0cf9 100644
--- a/tools/libxc/xc_misc.c
+++ b/tools/libxc/xc_misc.c
@@ -572,6 +572,38 @@ int xc_hvm_get_mem_access(
return rc;
}
+int xc_hvm_inject_trap(
+ xc_interface *xch, domid_t dom, int vcpu, uint32_t trap, uint32_t error_code,
+ uint64_t cr2)
+{
+ DECLARE_HYPERCALL;
+ DECLARE_HYPERCALL_BUFFER(struct xen_hvm_inject_trap, arg);
+ int rc;
+
+ arg = xc_hypercall_buffer_alloc(xch, arg, sizeof(*arg));
+ if ( arg == NULL )
+ {
+ PERROR("Could not allocate memory for xc_hvm_inject_trap hypercall");
+ return -1;
+ }
+
+ arg->domid = dom;
+ arg->vcpuid = vcpu;
+ arg->trap = trap;
+ arg->error_code = error_code;
+ arg->cr2 = cr2;
+
+ hypercall.op = __HYPERVISOR_hvm_op;
+ hypercall.arg[0] = HVMOP_inject_trap;
+ hypercall.arg[1] = HYPERCALL_BUFFER_AS_ARG(arg);
+
+ rc = do_xen_hypercall(xch, &hypercall);
+
+ xc_hypercall_buffer_free(xch, arg);
+
+ return rc;
+}
+
/*
* Local variables:
* mode: C