KVM: x86: Clear DR6[0:3] on #DB during handle_dr
authorNadav Amit <namit@cs.technion.ac.il>
Sun, 2 Nov 2014 09:54:44 +0000 (11:54 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 7 Nov 2014 14:44:03 +0000 (15:44 +0100)
DR6[0:3] (previous breakpoint indications) are cleared when #DB is injected
during handle_exception, just as real hardware does.  Similarily, handle_dr
should clear DR6[0:3].

Signed-off-by: Nadav Amit <namit@cs.technion.ac.il>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/vmx.c

index f9d56c1945de13de9815303f2f788a03b9c50b1f..ad5e0806e1e12f90a93463275762f949dfbbe5ad 100644 (file)
@@ -5125,6 +5125,7 @@ static int handle_dr(struct kvm_vcpu *vcpu)
                        vcpu->run->exit_reason = KVM_EXIT_DEBUG;
                        return 0;
                } else {
+                       vcpu->arch.dr6 &= ~15;
                        vcpu->arch.dr6 |= DR6_BD | DR6_RTM;
                        kvm_queue_exception(vcpu, DB_VECTOR);
                        return 1;