From: Aravindh Puthiyaparambil Date: Fri, 20 Apr 2012 08:43:46 +0000 (+0100) Subject: vmx: Allow software (user defined) interrupts to be injected in to the guest X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=f5a7804a189ddeb17409fd382ca92c2712edee5f;p=xen.git vmx: Allow software (user defined) interrupts to be injected in to the guest If xc_hvm_inject_trap() is called on a software (user defined) interrupt, it causes the guest to crash with a vmentry failure. The following patch fixes this issue. Signed-off-by: Aravindh Puthiyaparambil Committed-by: Keir Fraser --- diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c index 111de983cc..de945ce05c 100644 --- a/xen/arch/x86/hvm/vmx/vmx.c +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ -1364,6 +1364,8 @@ void vmx_inject_hw_exception(int trap, int error_code) } if ( cpu_has_monitor_trap_flag ) break; + /* fall through */ + case TRAP_int3: if ( curr->domain->debugger_attached ) { @@ -1374,6 +1376,15 @@ void vmx_inject_hw_exception(int trap, int error_code) type = X86_EVENTTYPE_SW_EXCEPTION; __vmwrite(VM_ENTRY_INSTRUCTION_LEN, 1); /* int3 */ + break; + + default: + if ( trap > TRAP_last_reserved ) + { + type = X86_EVENTTYPE_SW_EXCEPTION; + __vmwrite(VM_ENTRY_INSTRUCTION_LEN, 2); /* int imm8 */ + } + break; } if ( unlikely(intr_info & INTR_INFO_VALID_MASK) && diff --git a/xen/include/asm-x86/processor.h b/xen/include/asm-x86/processor.h index 718d719196..4c6f52ed8e 100644 --- a/xen/include/asm-x86/processor.h +++ b/xen/include/asm-x86/processor.h @@ -111,6 +111,7 @@ #define TRAP_alignment_check 17 #define TRAP_machine_check 18 #define TRAP_simd_error 19 +#define TRAP_last_reserved 31 /* Set for entry via SYSCALL. Informs return code to use SYSRETQ not IRETQ. */ /* NB. Same as VGCF_in_syscall. No bits in common with any other TRAP_ defn. */