diff mbox

[1/2] x86 emulator: Fix emulator return values

Message ID 1281801094-4515-1-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/emulate.c b/arch/x86/kvm/emulate.c
index c476a67..c718589 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -2434,7 +2434,7 @@  x86_decode_insn(struct x86_emulate_ctxt *ctxt)
 		break;
 #endif
 	default:
-		return -1;
+		return X86EMUL_UNHANDLEABLE;
 	}
 
 	c->op_bytes = def_op_bytes;
@@ -2531,7 +2531,7 @@  done_prefixes:
 	/* Unrecognised? */
 	if (c->d == 0 || (c->d & Undefined)) {
 		DPRINTF("Cannot emulate %02x\n", c->b);
-		return -1;
+		return X86EMUL_UNHANDLEABLE;
 	}
 
 	if (mode == X86EMUL_MODE_PROT64 && (c->d & Stack))
@@ -2720,11 +2720,11 @@  done_prefixes:
 		/* Special instructions do their own operand decoding. */
 	default:
 		c->dst.type = OP_NONE; /* Disable writeback. */
-		return 0;
+		return X86EMUL_CONTINUE;
 	}
 
 done:
-	return (rc == X86EMUL_UNHANDLEABLE) ? -1 : 0;
+	return rc;
 }
 
 int
@@ -3256,7 +3256,7 @@  writeback:
 	ctxt->eip = c->eip;
 
 done:
-	return (rc == X86EMUL_UNHANDLEABLE) ? -1 : 0;
+	return rc;
 
 twobyte_insn:
 	switch (c->b) {
@@ -3558,5 +3558,5 @@  twobyte_insn:
 
 cannot_emulate:
 	DPRINTF("Cannot emulate %02x\n", c->b);
-	return -1;
+	return X86EMUL_UNHANDLEABLE;
 }