[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 6 of 6] REDO: mem_access & mem_access 2: added trap injection to libxc


  • To: xen-devel@xxxxxxxxxxxxxxxxxxx
  • From: Joe Epstein <jepstein98@xxxxxxxxx>
  • Date: Tue, 4 Jan 2011 14:07:28 -0800
  • Delivery-date: Tue, 04 Jan 2011 14:17:13 -0800
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type; b=rIP+nICQKCC/3XTof9Irsx2RuX294T82yXLRZNYYHBenKRgzG+arZJEf/w4XybALXS r7VJyl/WFfw9wzvvqKWfFKg4dqBHpVhQ2pPPERpnh8ZKQ+MbXQ+VxYqAsaxqPRoF/J+k s4CCReA+ubNHp3qardkOu/EJNN8KFaB8y9QEw=
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>

* Carries forward the trap injection hypercall into libxc

Signed-off-by: Joe Epstein <jepstein98@xxxxxxxxx>

diff -r c1866aff7a5f -r 137a70154bdc tools/libxc/xc_misc.c
--- a/tools/libxc/xc_misc.c     Tue Jan 04 12:35:49 2011 -0800
+++ b/tools/libxc/xc_misc.c     Tue Jan 04 12:46:03 2011 -0800
@@ -572,6 +572,38 @@
     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
diff -r c1866aff7a5f -r 137a70154bdc tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h     Tue Jan 04 12:35:49 2011 -0800
+++ b/tools/libxc/xenctrl.h     Tue Jan 04 12:46:03 2011 -0800
@@ -1413,6 +1413,14 @@
     xc_interface *xch, domid_t dom, uint64_t pfn, hvmmem_access_t* memaccess);

 /*
+ * Injects a hardware/software CPU trap, to take effect the next time the HVM
+ * resumes.
+ */
+int xc_hvm_inject_trap(
+    xc_interface *xch, domid_t dom, int vcpu, uint32_t trap, uint32_t
error_code,
+    uint64_t cr2);
+
+/*
  *  LOGGING AND ERROR REPORTING
  */

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.