浏览代码

KVM: x86: Clearing rflags.rf upon skipped emulated instruction

When skipping an emulated instruction, rflags.rf should be cleared as it would
be on real x86 CPU.

Signed-off-by: Nadav Amit <namit@cs.technion.ac.il>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Nadav Amit 11 年之前
父节点
当前提交
bb663c7ada
共有 1 个文件被更改,包括 2 次插入0 次删除
  1. 2 0
      arch/x86/kvm/x86.c

+ 2 - 0
arch/x86/kvm/x86.c

@@ -5229,6 +5229,8 @@ int x86_emulate_instruction(struct kvm_vcpu *vcpu,
 
 
 	if (emulation_type & EMULTYPE_SKIP) {
 	if (emulation_type & EMULTYPE_SKIP) {
 		kvm_rip_write(vcpu, ctxt->_eip);
 		kvm_rip_write(vcpu, ctxt->_eip);
+		if (ctxt->eflags & X86_EFLAGS_RF)
+			kvm_set_rflags(vcpu, ctxt->eflags & ~X86_EFLAGS_RF);
 		return EMULATE_DONE;
 		return EMULATE_DONE;
 	}
 	}