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<[email protected]>
---

  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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to