From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mohammed Gamal Subject: [PATCH 1/2] x86 emulator: Fix emulator return values Date: Sat, 14 Aug 2010 18:51:33 +0300 Message-ID: <1281801094-4515-1-git-send-email-m.gamal005@gmail.com> Cc: mtosatti@redhat.com, kvm@vger.kernel.org, Mohammed Gamal To: avi@redhat.com Return-path: Received: from mail-ww0-f44.google.com ([74.125.82.44]:33946 "EHLO mail-ww0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755994Ab0HNPvu (ORCPT ); Sat, 14 Aug 2010 11:51:50 -0400 Received: by wwj40 with SMTP id 40so4351140wwj.1 for ; Sat, 14 Aug 2010 08:51:49 -0700 (PDT) Sender: kvm-owner@vger.kernel.org List-ID: Let the emulator return X86EMUL_* return codes instead of hardcoded values. Signed-off-by: Mohammed Gamal --- 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