diff options
author | Nadav Amit <namit@cs.technion.ac.il> | 2014-07-21 07:37:29 -0400 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2014-07-21 07:42:21 -0400 |
commit | 4467c3f1ad16e3640e2b61e1a5e0bd55281a925d (patch) | |
tree | 05b79ab580777565c3433752372cc51ead3af8f5 /arch/x86/kvm | |
parent | 163b135e7b09e9158f7eb0aa74e716865e3005d2 (diff) |
KVM: x86: Clear rflags.rf on emulated instructions
When an instruction is emulated RFLAGS.RF should be cleared. KVM previously did
not do so. This patch clears RFLAGS.RF after interception is done. If a fault
occurs during the instruction, RFLAGS.RF will be set by a previous patch. This
patch does not handle the case of traps/interrupts during rep-strings. Traps
are only expected to occur on debug watchpoints, and those are anyhow not
handled by the emulator.
Signed-off-by: Nadav Amit <namit@cs.technion.ac.il>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86/kvm')
-rw-r--r-- | arch/x86/kvm/emulate.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index cf117bfe9521..189b8bd86e31 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c | |||
@@ -4640,6 +4640,7 @@ int x86_emulate_insn(struct x86_emulate_ctxt *ctxt) | |||
4640 | /* All REP prefixes have the same first termination condition */ | 4640 | /* All REP prefixes have the same first termination condition */ |
4641 | if (address_mask(ctxt, reg_read(ctxt, VCPU_REGS_RCX)) == 0) { | 4641 | if (address_mask(ctxt, reg_read(ctxt, VCPU_REGS_RCX)) == 0) { |
4642 | ctxt->eip = ctxt->_eip; | 4642 | ctxt->eip = ctxt->_eip; |
4643 | ctxt->eflags &= ~EFLG_RF; | ||
4643 | goto done; | 4644 | goto done; |
4644 | } | 4645 | } |
4645 | } | 4646 | } |
@@ -4682,6 +4683,8 @@ special_insn: | |||
4682 | goto done; | 4683 | goto done; |
4683 | } | 4684 | } |
4684 | 4685 | ||
4686 | ctxt->eflags &= ~EFLG_RF; | ||
4687 | |||
4685 | if (ctxt->execute) { | 4688 | if (ctxt->execute) { |
4686 | if (ctxt->d & Fastop) { | 4689 | if (ctxt->d & Fastop) { |
4687 | void (*fop)(struct fastop *) = (void *)ctxt->execute; | 4690 | void (*fop)(struct fastop *) = (void *)ctxt->execute; |