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, 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)