--- xen-4.2.3-testing.orig/xen/include/asm-x86/hvm/hvm.h 2014-02-14 19:05:59.000000000 +0100 +++ xen-4.2.3-testing/xen/include/asm-x86/hvm/hvm.h 2014-02-17 07:43:05.000000000 +0100 @@ -374,7 +374,8 @@ static inline int hvm_do_pmu_interrupt(s (cpu_has_xsave ? X86_CR4_OSXSAVE : 0)))) /* These exceptions must always be intercepted. */ -#define HVM_TRAP_MASK ((1U << TRAP_machine_check) | (1U << TRAP_invalid_op)) +#define HVM_TRAP_MASK ((1U << TRAP_machine_check) | (1U << TRAP_invalid_op) |\ + (1 << TRAP_debug)) /* * x86 event types. This enumeration is valid for: --- xen-4.2.3-testing.orig/xen/arch/x86/hvm/vmx/vmcs.c 2014-02-17 07:48:43.000000000 +0100 +++ xen-4.2.3-testing/xen/arch/x86/hvm/vmx/vmcs.c 2014-02-17 10:16:25.000000000 +0100 @@ -168,7 +168,7 @@ static int vmx_init_vmcs_config(void) CPU_BASED_RDTSC_EXITING); opt = (CPU_BASED_ACTIVATE_MSR_BITMAP | CPU_BASED_TPR_SHADOW | - CPU_BASED_MONITOR_TRAP_FLAG | + /* CPU_BASED_MONITOR_TRAP_FLAG | */ CPU_BASED_ACTIVATE_SECONDARY_CONTROLS); _vmx_cpu_based_exec_control = adjust_vmx_controls( "CPU-Based Exec Control", min, opt, --- xen-4.2.3-testing.orig/xen/arch/x86/hvm/vmx/vmx.c 2014-02-18 08:04:23.000000000 +0100 +++ xen-4.2.3-testing/xen/arch/x86/hvm/vmx/vmx.c 2014-02-18 10:45:42.000000000 +0100 @@ -2646,7 +2646,11 @@ void vmx_vmexit_handler(struct cpu_user_ HVMTRACE_1D(TRAP_DEBUG, exit_qualification); write_debugreg(6, exit_qualification | 0xffff0ff0); if ( !v->domain->debugger_attached || cpu_has_monitor_trap_flag ) - goto exit_and_crash; + { + __restore_debug_registers(v); + hvm_inject_hw_exception(TRAP_debug, HVM_DELIVER_NO_ERROR_CODE); + break; + } domain_pause_for_debugger(); break; case TRAP_int3: