diff mbox

[2/2] x86: Bail out on unemulated instructions

Message ID 1281801094-4515-2-git-send-email-m.gamal005@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Mohammed Gamal Aug. 14, 2010, 3:51 p.m. UTC
None
diff mbox

Patch

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 416aa0e..a31db44 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -4036,6 +4036,9 @@  int emulate_instruction(struct kvm_vcpu *vcpu,
 		}
 
 		++vcpu->stat.insn_emulation;
+		if (r == X86EMUL_UNHANDLEABLE)
+			return handle_emulation_failure(vcpu);
+
 		if (r)  {
 			if (reexecute_instruction(vcpu, cr2))
 				return EMULATE_DONE;
@@ -4057,6 +4060,9 @@  int emulate_instruction(struct kvm_vcpu *vcpu,
 restart:
 	r = x86_emulate_insn(&vcpu->arch.emulate_ctxt);
 
+	if (r == X86EMUL_UNHANDLEABLE)
+		return handle_emulation_failure(vcpu);
+
 	if (r) { /* emulation failed */
 		if (reexecute_instruction(vcpu, cr2))
 			return EMULATE_DONE;