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 3 of 3] mem_access changes: trap injection

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 3 of 3] mem_access changes: trap injection
From: Joe Epstein <jepstein98@xxxxxxxxx>
Date: Sun, 2 Jan 2011 14:14:01 -0800
Delivery-date: Sun, 02 Jan 2011 14:23:46 -0800
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:from:date :message-id:subject:to:content-type; bh=U23ymfnEF2Wjf/pHy7NOGLLuum/XkESGPYIt2MVase8=; b=xyyI2LjqKurQ66skLhA0AR4pyPMxrfF1msyF9WTSp5/5eTHV1/XEaz4CqkpNzls+n2 OojDnJeJQRRtJZiencr9m77mscRvdXOC9znV1QzYwQMTmyDkBWpwwQMvxo7wiaAvnU4h PHphqhk0e/pJOeelFGChRAmoutCSnDGiqHcUA=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type; b=dQFMhbYOSzUz2XdWiFFNoaffd2gbH3r5Ya0YfpIOu2C43bG6GTBLksbagZU0KhTq2m I9DjnIv/ZbLEVKHy+oxtfV9SeZB4lx5pagez23W/asLgaPcJFSnlVLy2pgUD1Y69gBYq UMpijNGHoz2/SbAaHJK06j8HGvVUBk4F1Zm94=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
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
Adds the ability to inject traps through HVM.

NOTE: the included patches are based on a previous patch series from
me on Dec 28th,
purely for readability.
To apply the patches to the repository, see the attached patch on the
PATCH 0 of 3 email.

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

diff -r 1535fee95f47 tools/libxc/xc_misc.c
--- a/tools/libxc/xc_misc.c     Sun Jan 02 13:19:51 2011 -0800
+++ b/tools/libxc/xc_misc.c     Sun Jan 02 13:20:04 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 1535fee95f47 tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h     Sun Jan 02 13:19:51 2011 -0800
+++ b/tools/libxc/xenctrl.h     Sun Jan 02 13:20:04 2011 -0800
@@ -1412,6 +1412,13 @@
 int xc_hvm_get_mem_access(
     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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH 3 of 3] mem_access changes: trap injection, Joe Epstein <=