aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/x86.c
diff options
context:
space:
mode:
authorJan Kiszka <jan.kiszka@siemens.com>2008-12-15 07:52:10 -0500
committerAvi Kivity <avi@redhat.com>2009-03-24 05:02:50 -0400
commitae675ef01cd86014acf8da5dee87876b71122495 (patch)
tree7e386de9eb17d6c3fb264aef8505128e5daaf0d9 /arch/x86/kvm/x86.c
parent42dbaa5a057736bf8b5c22aa42dbe975bf1080e5 (diff)
KVM: x86: Wire-up hardware breakpoints for guest debugging
Add the remaining bits to make use of debug registers also for guest debugging, thus enabling the use of hardware breakpoints and watchpoints. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/x86.c')
-rw-r--r--arch/x86/kvm/x86.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 300bc4d42abc..2477e87b2f84 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -3861,10 +3861,22 @@ int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu,
3861int kvm_arch_vcpu_ioctl_set_guest_debug(struct kvm_vcpu *vcpu, 3861int kvm_arch_vcpu_ioctl_set_guest_debug(struct kvm_vcpu *vcpu,
3862 struct kvm_guest_debug *dbg) 3862 struct kvm_guest_debug *dbg)
3863{ 3863{
3864 int r; 3864 int i, r;
3865 3865
3866 vcpu_load(vcpu); 3866 vcpu_load(vcpu);
3867 3867
3868 if ((dbg->control & (KVM_GUESTDBG_ENABLE | KVM_GUESTDBG_USE_HW_BP)) ==
3869 (KVM_GUESTDBG_ENABLE | KVM_GUESTDBG_USE_HW_BP)) {
3870 for (i = 0; i < KVM_NR_DB_REGS; ++i)
3871 vcpu->arch.eff_db[i] = dbg->arch.debugreg[i];
3872 vcpu->arch.switch_db_regs =
3873 (dbg->arch.debugreg[7] & DR7_BP_EN_MASK);
3874 } else {
3875 for (i = 0; i < KVM_NR_DB_REGS; i++)
3876 vcpu->arch.eff_db[i] = vcpu->arch.db[i];
3877 vcpu->arch.switch_db_regs = (vcpu->arch.dr7 & DR7_BP_EN_MASK);
3878 }
3879
3868 r = kvm_x86_ops->set_guest_debug(vcpu, dbg); 3880 r = kvm_x86_ops->set_guest_debug(vcpu, dbg);
3869 3881
3870 if (dbg->control & KVM_GUESTDBG_INJECT_DB) 3882 if (dbg->control & KVM_GUESTDBG_INJECT_DB)