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

[Xen-changelog] [xen-unstable] Add instruction length and trap type in HVMOP_inject_trap.


  • To: xen-changelog@xxxxxxxxxxxxxxxxxxx
  • From: Xen patchbot-unstable <patchbot@xxxxxxx>
  • Date: Wed, 30 May 2012 19:33:08 +0000
  • Delivery-date: Wed, 30 May 2012 19:33:18 +0000
  • List-id: "Change log for Mercurial \(receive only\)" <xen-changelog.lists.xen.org>

# HG changeset patch
# User Xudong Hao <xudong.hao@xxxxxxxxx>
# Date 1338374321 -3600
# Node ID ad348c6575b8e32d19c907baae045ea3842944c3
# Parent  e53a1d3c212c6187299e03cb03ae1d751424ed26
Add instruction length and trap type in HVMOP_inject_trap.

Signed-off-by: Xudong Hao <xudong.hao@xxxxxxxxx>
Signed-off-by: Xiantao Zhang <xiantao.zhang@xxxxxxxxx>
Signed-off-by: Keir Fraser <keir@xxxxxxx>
---


diff -r e53a1d3c212c -r ad348c6575b8 tools/libxc/xc_misc.c
--- a/tools/libxc/xc_misc.c     Wed May 30 10:57:10 2012 +0100
+++ b/tools/libxc/xc_misc.c     Wed May 30 11:38:41 2012 +0100
@@ -602,7 +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, 
+    xc_interface *xch, domid_t dom, int vcpu, uint32_t vector,
+    uint32_t type, uint32_t error_code, uint32_t inslen,
     uint64_t cr2)
 {
     DECLARE_HYPERCALL;
@@ -618,8 +619,10 @@ int xc_hvm_inject_trap(
 
     arg->domid       = dom;
     arg->vcpuid      = vcpu;
-    arg->trap        = trap;
+    arg->vector      = vector;
+    arg->type        = type;
     arg->error_code  = error_code;
+    arg->inslen      = inslen;
     arg->cr2         = cr2;
 
     hypercall.op     = __HYPERVISOR_hvm_op;
diff -r e53a1d3c212c -r ad348c6575b8 tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h     Wed May 30 10:57:10 2012 +0100
+++ b/tools/libxc/xenctrl.h     Wed May 30 11:38:41 2012 +0100
@@ -1578,7 +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, 
+    xc_interface *xch, domid_t dom, int vcpu, uint32_t vector,
+    uint32_t type, uint32_t error_code, uint32_t inslen,
     uint64_t cr2);
 
 /*
diff -r e53a1d3c212c -r ad348c6575b8 tools/tests/xen-access/xen-access.c
--- a/tools/tests/xen-access/xen-access.c       Wed May 30 10:57:10 2012 +0100
+++ b/tools/tests/xen-access/xen-access.c       Wed May 30 11:38:41 2012 +0100
@@ -662,7 +662,9 @@ 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,
+                    HVMOP_TRAP_hw_exc, -1, 0, 0);
                 if (rc < 0)
                 {
                     ERROR("Error %d injecting int3\n", rc);
diff -r e53a1d3c212c -r ad348c6575b8 xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c    Wed May 30 10:57:10 2012 +0100
+++ b/xen/arch/x86/hvm/hvm.c    Wed May 30 11:38:41 2012 +0100
@@ -4289,8 +4289,10 @@ long do_hvm_op(unsigned long op, XEN_GUE
             rc = -EBUSY;
         else 
         {
-            v->arch.hvm_vcpu.inject_trap.vector = tr.trap;
+            v->arch.hvm_vcpu.inject_trap.vector = tr.vector;
+            v->arch.hvm_vcpu.inject_trap.type = tr.type;
             v->arch.hvm_vcpu.inject_trap.error_code = tr.error_code;
+            v->arch.hvm_vcpu.inject_trap.inslen = tr.inslen;
             v->arch.hvm_vcpu.inject_trap.cr2 = tr.cr2;
         }
 
diff -r e53a1d3c212c -r ad348c6575b8 xen/include/asm-x86/hvm/hvm.h
--- a/xen/include/asm-x86/hvm/hvm.h     Wed May 30 10:57:10 2012 +0100
+++ b/xen/include/asm-x86/hvm/hvm.h     Wed May 30 11:38:41 2012 +0100
@@ -75,8 +75,8 @@ struct hvm_trap {
     int           vector;
     unsigned int  type;         /* X86_EVENTTYPE_* */
     int           error_code;   /* HVM_DELIVER_NO_ERROR_CODE if n/a */
+    int           inslen;       /* Instruction length */ 
     unsigned long cr2;          /* Only for TRAP_page_fault h/w exception */
-    int           inslen;       /* Instruction length */ 
 };
 
 /*
@@ -372,12 +372,12 @@ static inline int hvm_do_pmu_interrupt(s
  *  Intel VMX: {VM_ENTRY,VM_EXIT,IDT_VECTORING}_INTR_INFO[10:8]
  *  AMD SVM: eventinj[10:8] and exitintinfo[10:8] (types 0-4 only)
  */
-#define X86_EVENTTYPE_EXT_INTR              0    /* external interrupt */
-#define X86_EVENTTYPE_NMI                   2    /* NMI                */
-#define X86_EVENTTYPE_HW_EXCEPTION          3    /* hardware exception */
-#define X86_EVENTTYPE_SW_INTERRUPT          4    /* software interrupt */
-#define X86_EVENTTYPE_PRI_SW_EXCEPTION      5    /* privileged software 
exception */
-#define X86_EVENTTYPE_SW_EXCEPTION          6    /* software exception */
+#define X86_EVENTTYPE_EXT_INTR         0 /* external interrupt */
+#define X86_EVENTTYPE_NMI              2 /* NMI */
+#define X86_EVENTTYPE_HW_EXCEPTION     3 /* hardware exception */
+#define X86_EVENTTYPE_SW_INTERRUPT     4 /* software interrupt (CD nn) */
+#define X86_EVENTTYPE_PRI_SW_EXCEPTION 5 /* ICEBP (F1) */
+#define X86_EVENTTYPE_SW_EXCEPTION     6 /* INT3 (CC), INTO (CE) */
 
 int hvm_event_needs_reinjection(uint8_t type, uint8_t vector);
 
diff -r e53a1d3c212c -r ad348c6575b8 xen/include/public/hvm/hvm_op.h
--- a/xen/include/public/hvm/hvm_op.h   Wed May 30 10:57:10 2012 +0100
+++ b/xen/include/public/hvm/hvm_op.h   Wed May 30 11:38:41 2012 +0100
@@ -217,10 +217,21 @@ struct xen_hvm_inject_trap {
     domid_t domid;
     /* VCPU */
     uint32_t vcpuid;
-    /* Trap number */
-    uint32_t trap;
-    /* Error code, or -1 to skip */
+    /* Vector number */
+    uint32_t vector;
+    /* Trap type (HVMOP_TRAP_*) */
+    uint32_t type;
+/* NB. This enumeration precisely matches hvm.h:X86_EVENTTYPE_* */
+# define HVMOP_TRAP_ext_int    0 /* external interrupt */
+# define HVMOP_TRAP_nmi        2 /* nmi */
+# define HVMOP_TRAP_hw_exc     3 /* hardware exception */
+# define HVMOP_TRAP_sw_int     4 /* software interrupt (CD nn) */
+# define HVMOP_TRAP_pri_sw_exc 5 /* ICEBP (F1) */
+# define HVMOP_TRAP_sw_exc     6 /* INT3 (CC), INTO (CE) */
+    /* Error code, or ~0u to skip */
     uint32_t error_code;
+    /* Intruction length */
+    uint32_t inslen;
     /* CR2 for page faults */
     uint64_aligned_t cr2;
 };

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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