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

Signed-off-by: Mohammed Gamal <m.gamal...@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

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to