Re: [PATCH 2/2] KVM: x86: Preserve guest single-stepping on register

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/04/2009 09:02 PM, Jan Kiszka wrote:

Hmmmm, good point. Mind reverting 2/2 and applying this one instead?

Jan

--------->

KVM: x86: Rework guest single-step flag injection and filtering

Push TF and RF injection and filtering on guest single-stepping into the
vender get/set_rflags callbacks. This makes the whole mechanism more
robust /wrt user space IOTCTL order and instruction emulations.

Signed-off-by: Jan Kiszka<jan.kiszka@xxxxxxxxxxx>
---

  arch/x86/kvm/svm.c |    8 +++++++-
  arch/x86/kvm/vmx.c |    4 ++++
  arch/x86/kvm/x86.c |   24 +++++++++---------------
  3 files changed, 20 insertions(+), 16 deletions(-)

diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 279a2ae..407e1a7 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -797,11 +797,17 @@ static void svm_vcpu_put(struct kvm_vcpu *vcpu)

  static unsigned long svm_get_rflags(struct kvm_vcpu *vcpu)
  {
-	return to_svm(vcpu)->vmcb->save.rflags;
+	unsigned long rflags = to_svm(vcpu)->vmcb->save.rflags;
+
+	if (vcpu->guest_debug&  KVM_GUESTDBG_SINGLESTEP)
+		rflags&= ~(unsigned long)(X86_EFLAGS_TF | X86_EFLAGS_RF);
+	return rflags;
  }

  static void svm_set_rflags(struct kvm_vcpu *vcpu, unsigned long rflags)
  {
+	if (vcpu->guest_debug&  KVM_GUESTDBG_SINGLESTEP)
+		rflags |= X86_EFLAGS_TF | X86_EFLAGS_RF;
  	to_svm(vcpu)->vmcb->save.rflags = rflags;
  }

This code is duplicated in vmx.  How about kvm_[gs]et_rflags to contain it?

--
error compiling committee.c: too many arguments to function

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux