public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] x86 emulator: Fix emulator return values
@ 2010-08-14 15:51 Mohammed Gamal
  2010-08-14 15:51 ` [PATCH 2/2] x86: Bail out on unemulated instructions Mohammed Gamal
  0 siblings, 1 reply; 11+ messages in thread
From: Mohammed Gamal @ 2010-08-14 15:51 UTC (permalink / raw)
  To: avi; +Cc: mtosatti, kvm, Mohammed Gamal

Let the emulator return X86EMUL_* return codes instead of hardcoded values.

Signed-off-by: Mohammed Gamal <m.gamal005@gmail.com>
---
 arch/x86/kvm/emulate.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

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;
 }
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2010-08-15 16:17 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-14 15:51 [PATCH 1/2] x86 emulator: Fix emulator return values Mohammed Gamal
2010-08-14 15:51 ` [PATCH 2/2] x86: Bail out on unemulated instructions Mohammed Gamal
2010-08-15  7:32   ` Gleb Natapov
2010-08-15 12:40     ` Mohammed Gamal
2010-08-15 12:41       ` Gleb Natapov
2010-08-15 12:43         ` Mohammed Gamal
2010-08-15 12:49           ` Gleb Natapov
2010-08-15 15:58             ` Avi Kivity
2010-08-15 16:11               ` Gleb Natapov
2010-08-15 16:17                 ` Avi Kivity
2010-08-15 15:40           ` Avi Kivity

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox