Skip to contentSkip to conversation

libxc: add instruction length for inject trap in userspace

PATCH In review Xudong Hao 1 participant 1 message May 30, 2012

lore
Share & tools
lore

Xudong Hao

author
#0 lore raw

PATCH v2 4/4 libxc: add instruction length for inject trap in userspace

Add a parameter to represent instruction length in function xc_hvm_inject_trap(), user should set this value when this function is called.

---
 tools/libxc/xc_misc.c               |    5 +++--
 tools/libxc/xenctrl.h               |    4 ++--
 tools/tests/xen-access/xen-access.c |    2 +-
 3 files changed, 6 insertions(+), 5 deletions(-)
tools/libxc/xc_misc.c +3 -2
index a029d79..2989a62 100644
@@ -602,8 +602,8 @@ int xc_hvm_get_mem_access(
 }
 
 int xc_hvm_inject_trap(
-    xc_interface *xch, domid_t dom, int vcpu, uint32_t trap, uint32_t error_code, 
-    uint64_t cr2)
+    xc_interface *xch, domid_t dom, int vcpu, uint32_t trap, uint32_t inslen, 
+    uint32_t error_code, uint64_t cr2)
 {
     DECLARE_HYPERCALL;
     DECLARE_HYPERCALL_BUFFER(struct xen_hvm_inject_trap, arg);
@@ -619,6 +619,7 @@ int xc_hvm_inject_trap(
     arg->domid       = dom;
     arg->vcpuid      = vcpu;
     arg->trap        = trap;
+    arg->inslen      = inslen;
     arg->error_code  = error_code;
     arg->cr2         = cr2;
 
tools/libxc/xenctrl.h +2 -2
index 3bbc827..7ed4c64 100644
@@ -1578,8 +1578,8 @@ int xc_hvm_get_mem_access(
  * resumes. 
  */
 int xc_hvm_inject_trap(
-    xc_interface *xch, domid_t dom, int vcpu, uint32_t trap, uint32_t error_code, 
-    uint64_t cr2);
+    xc_interface *xch, domid_t dom, int vcpu, uint32_t trap, uint32_t inslen, 
+    uint32_t error_code, uint64_t cr2);
 
 /*
  *  LOGGING AND ERROR REPORTING
tools/tests/xen-access/xen-access.c +1 -1
index 906f46f..98332b0 100644
@@ -662,7 +662,7 @@ int main(int argc, char *argv[])
                        req.vcpu_id);
 
                 /* Reinject */
-                rc = xc_hvm_inject_trap(xch, domain_id, req.vcpu_id, 3, -1, 0);
+                rc = xc_hvm_inject_trap(xch, domain_id, req.vcpu_id, 3, 1, -1, 0);
                 if (rc < 0)
                 {
                     ERROR("Error %d injecting int3\n", rc);
Signature · 1 line
1.5.5