aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNadav Amit <namit@cs.technion.ac.il>2014-07-24 07:51:23 -0400
committerPaolo Bonzini <pbonzini@redhat.com>2014-07-24 08:03:54 -0400
commitb9a1ecb909e8f772934cc4bf1f164124c9fbb0d0 (patch)
tree601e3dac423c8528adb089df01cedb37e7416e88
parentc756ad036fc8ef432438e89aab63cc723eda39b4 (diff)
KVM: x86: Setting rflags.rf during rep-string emulation
This patch updates RF for rep-string emulation. The flag is set upon the first iteration, and cleared after the last (if emulated). It is intended to make sure that if a trap (in future data/io #DB emulation) or interrupt is delivered to the guest during the rep-string instruction, RF will be set correctly. RF affects whether instruction breakpoint in the guest is masked. Signed-off-by: Nadav Amit <namit@cs.technion.ac.il> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--arch/x86/kvm/emulate.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index 8d415563e05b..57743edfb4e2 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -4683,7 +4683,10 @@ special_insn:
4683 goto done; 4683 goto done;
4684 } 4684 }
4685 4685
4686 ctxt->eflags &= ~EFLG_RF; 4686 if (ctxt->rep_prefix && (ctxt->d & String))
4687 ctxt->eflags |= EFLG_RF;
4688 else
4689 ctxt->eflags &= ~EFLG_RF;
4687 4690
4688 if (ctxt->execute) { 4691 if (ctxt->execute) {
4689 if (ctxt->d & Fastop) { 4692 if (ctxt->d & Fastop) {
@@ -4824,6 +4827,7 @@ writeback:
4824 } 4827 }
4825 goto done; /* skip rip writeback */ 4828 goto done; /* skip rip writeback */
4826 } 4829 }
4830 ctxt->eflags &= ~EFLG_RF;
4827 } 4831 }
4828 4832
4829 ctxt->eip = ctxt->_eip; 4833 ctxt->eip = ctxt->_eip;