aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/x86.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/kvm/x86.c')
-rw-r--r--arch/x86/kvm/x86.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index b5e9932e0f62..e990d164b56d 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -3005,9 +3005,6 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
3005 goto out; 3005 goto out;
3006 } 3006 }
3007 3007
3008 if (vcpu->guest_debug.enabled)
3009 kvm_x86_ops->guest_debug_pre(vcpu);
3010
3011 vcpu->guest_mode = 1; 3008 vcpu->guest_mode = 1;
3012 /* 3009 /*
3013 * Make sure that guest_mode assignment won't happen after 3010 * Make sure that guest_mode assignment won't happen after
@@ -3218,7 +3215,7 @@ int kvm_arch_vcpu_ioctl_get_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
3218 /* 3215 /*
3219 * Don't leak debug flags in case they were set for guest debugging 3216 * Don't leak debug flags in case they were set for guest debugging
3220 */ 3217 */
3221 if (vcpu->guest_debug.enabled && vcpu->guest_debug.singlestep) 3218 if (vcpu->guest_debug & KVM_GUESTDBG_SINGLESTEP)
3222 regs->rflags &= ~(X86_EFLAGS_TF | X86_EFLAGS_RF); 3219 regs->rflags &= ~(X86_EFLAGS_TF | X86_EFLAGS_RF);
3223 3220
3224 vcpu_put(vcpu); 3221 vcpu_put(vcpu);
@@ -3837,8 +3834,8 @@ int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu,
3837 return 0; 3834 return 0;
3838} 3835}
3839 3836
3840int kvm_arch_vcpu_ioctl_debug_guest(struct kvm_vcpu *vcpu, 3837int kvm_arch_vcpu_ioctl_set_guest_debug(struct kvm_vcpu *vcpu,
3841 struct kvm_debug_guest *dbg) 3838 struct kvm_guest_debug *dbg)
3842{ 3839{
3843 int r; 3840 int r;
3844 3841
@@ -3846,6 +3843,11 @@ int kvm_arch_vcpu_ioctl_debug_guest(struct kvm_vcpu *vcpu,
3846 3843
3847 r = kvm_x86_ops->set_guest_debug(vcpu, dbg); 3844 r = kvm_x86_ops->set_guest_debug(vcpu, dbg);
3848 3845
3846 if (dbg->control & KVM_GUESTDBG_INJECT_DB)
3847 kvm_queue_exception(vcpu, DB_VECTOR);
3848 else if (dbg->control & KVM_GUESTDBG_INJECT_BP)
3849 kvm_queue_exception(vcpu, BP_VECTOR);
3850
3849 vcpu_put(vcpu); 3851 vcpu_put(vcpu);
3850 3852
3851 return r; 3853 return r;