|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] hvm: Add instruction length to hvm_trap info.
# HG changeset patch
# User Keir Fraser <keir@xxxxxxx>
# Date 1338367244 -3600
# Node ID 29aa5da5a18cfae084d4b89d038f438945dbf17b
# Parent a418c32885ab45dff20e35f118341e422b782df8
hvm: Add instruction length to hvm_trap info.
Add documentation notes to vmx_inject_trap() and respect instruiction
length parameter for software-generated exceptions/interrupts.
Signed-off-by: Xudong Hao <xudong.hao@xxxxxxxxx>
Signed-off-by: Eddie Dong <eddie.dong@xxxxxxxxx>
Signed-off-by: Xiantao Zhang <xiantao.zhang@xxxxxxxxx>
Signed-off-by: Keir Fraser <keir@xxxxxxx>
---
diff -r a418c32885ab -r 29aa5da5a18c xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c Wed May 30 09:27:51 2012 +0100
+++ b/xen/arch/x86/hvm/vmx/vmx.c Wed May 30 09:40:44 2012 +0100
@@ -1381,6 +1381,14 @@ void vmx_inject_nmi(void)
HVM_DELIVER_NO_ERROR_CODE);
}
+/*
+ * Generate a virtual event in the guest.
+ * NOTES:
+ * - INT 3 (CC) and INTO (CE) are X86_EVENTTYPE_SW_EXCEPTION;
+ * - INT nn (CD nn) is X86_EVENTTYPE_SW_INTERRUPT;
+ * - #DB is X86_EVENTTYPE_HW_EXCEPTION, except when generated by
+ * opcode 0xf1 (which is X86_EVENTTYPE_PRI_SW_EXCEPTION)
+ */
static void vmx_inject_trap(struct hvm_trap *trap)
{
unsigned long intr_info;
@@ -1425,6 +1433,9 @@ static void vmx_inject_trap(struct hvm_t
_trap.error_code = 0;
}
+ if ( _trap.type >= X86_EVENTTYPE_SW_INTERRUPT )
+ __vmwrite(VM_ENTRY_INSTRUCTION_LEN, _trap.inslen);
+
if ( nestedhvm_vcpu_in_guestmode(curr) &&
nvmx_intercepts_exception(curr, _trap.vector, _trap.error_code) )
{
@@ -2424,7 +2435,8 @@ void vmx_vmexit_handler(struct cpu_user_
struct hvm_trap trap = {
.vector = TRAP_int3,
.type = X86_EVENTTYPE_SW_EXCEPTION,
- .error_code = HVM_DELIVER_NO_ERROR_CODE
+ .error_code = HVM_DELIVER_NO_ERROR_CODE,
+ .inslen = __vmread(VM_EXIT_INSTRUCTION_LEN)
};
hvm_inject_trap(&trap);
break;
diff -r a418c32885ab -r 29aa5da5a18c xen/include/asm-x86/hvm/hvm.h
--- a/xen/include/asm-x86/hvm/hvm.h Wed May 30 09:27:51 2012 +0100
+++ b/xen/include/asm-x86/hvm/hvm.h Wed May 30 09:40:44 2012 +0100
@@ -76,6 +76,7 @@ struct hvm_trap {
unsigned int type; /* X86_EVENTTYPE_* */
int error_code; /* HVM_DELIVER_NO_ERROR_CODE if n/a */
unsigned long cr2; /* Only for TRAP_page_fault h/w exception */
+ int inslen; /* Instruction length */
};
/*
@@ -375,6 +376,7 @@ static inline int hvm_do_pmu_interrupt(s
#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 */
int hvm_event_needs_reinjection(uint8_t type, uint8_t vector);
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |