diff options
author | Jan Kiszka <jan.kiszka@web.de> | 2009-10-02 18:31:21 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2009-12-03 02:32:14 -0500 |
commit | 355be0b9300579e02275d7d19374806a974ce622 (patch) | |
tree | faa52bac7a0d1d83c7a0a8f1bec01088b77a68fb /arch/x86/kvm/svm.c | |
parent | 201d945bcfb0d53e67c9c081f7c28532eb4669c7 (diff) |
KVM: x86: Refactor guest debug IOCTL handling
Much of so far vendor-specific code for setting up guest debug can
actually be handled by the generic code. This also fixes a minor deficit
in the SVM part /wrt processing KVM_GUESTDBG_ENABLE.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/svm.c')
-rw-r--r-- | arch/x86/kvm/svm.c | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 02a4269be645..279a2ae21b4f 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c | |||
@@ -1065,26 +1065,16 @@ static void update_db_intercept(struct kvm_vcpu *vcpu) | |||
1065 | vcpu->guest_debug = 0; | 1065 | vcpu->guest_debug = 0; |
1066 | } | 1066 | } |
1067 | 1067 | ||
1068 | static int svm_guest_debug(struct kvm_vcpu *vcpu, struct kvm_guest_debug *dbg) | 1068 | static void svm_guest_debug(struct kvm_vcpu *vcpu, struct kvm_guest_debug *dbg) |
1069 | { | 1069 | { |
1070 | int old_debug = vcpu->guest_debug; | ||
1071 | struct vcpu_svm *svm = to_svm(vcpu); | 1070 | struct vcpu_svm *svm = to_svm(vcpu); |
1072 | 1071 | ||
1073 | vcpu->guest_debug = dbg->control; | ||
1074 | |||
1075 | update_db_intercept(vcpu); | ||
1076 | |||
1077 | if (vcpu->guest_debug & KVM_GUESTDBG_USE_HW_BP) | 1072 | if (vcpu->guest_debug & KVM_GUESTDBG_USE_HW_BP) |
1078 | svm->vmcb->save.dr7 = dbg->arch.debugreg[7]; | 1073 | svm->vmcb->save.dr7 = dbg->arch.debugreg[7]; |
1079 | else | 1074 | else |
1080 | svm->vmcb->save.dr7 = vcpu->arch.dr7; | 1075 | svm->vmcb->save.dr7 = vcpu->arch.dr7; |
1081 | 1076 | ||
1082 | if (vcpu->guest_debug & KVM_GUESTDBG_SINGLESTEP) | 1077 | update_db_intercept(vcpu); |
1083 | svm->vmcb->save.rflags |= X86_EFLAGS_TF | X86_EFLAGS_RF; | ||
1084 | else if (old_debug & KVM_GUESTDBG_SINGLESTEP) | ||
1085 | svm->vmcb->save.rflags &= ~(X86_EFLAGS_TF | X86_EFLAGS_RF); | ||
1086 | |||
1087 | return 0; | ||
1088 | } | 1078 | } |
1089 | 1079 | ||
1090 | static void load_host_msrs(struct kvm_vcpu *vcpu) | 1080 | static void load_host_msrs(struct kvm_vcpu *vcpu) |