[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] x86emul: drop SrcInvalid



commit c4e7a67e3a109a3d507d2617b77017e40d59f04a
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Tue Aug 16 15:44:05 2016 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Tue Aug 16 15:44:05 2016 +0200

    x86emul: drop SrcInvalid
    
    As of commit a800e4f611 ("x86emul: drop pointless and add useful
    default cases") we no longer need the early bailing when "d == 0" (the
    default cases in the main switch() statements take care of that),
    removal of which renders both callers of internal_error() wrong and
    SrcInvalid useless. Drop them, as they're going to get in the way of
    completing the decoder to cover all known insns (to allow it to be
    used by more callers) without at the same time completing the actual
    emulation logic.
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 40 +++++++---------------------------
 1 file changed, 8 insertions(+), 32 deletions(-)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c 
b/xen/arch/x86/x86_emulate/x86_emulate.c
index 134638f..940227c 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -31,15 +31,14 @@
 #define DstMem      (3<<1) /* Memory operand. */
 #define DstMask     (3<<1)
 /* Source operand type. */
-#define SrcInvalid  (0<<3) /* Unimplemented opcode. */
-#define SrcNone     (1<<3) /* No source operand. */
-#define SrcImplicit (1<<3) /* Source operand is implicit in the opcode. */
-#define SrcReg      (2<<3) /* Register operand. */
-#define SrcMem      (3<<3) /* Memory operand. */
-#define SrcMem16    (4<<3) /* Memory operand (16-bit). */
-#define SrcImm      (5<<3) /* Immediate operand. */
-#define SrcImmByte  (6<<3) /* 8-bit sign-extended immediate operand. */
-#define SrcImm16    (7<<3) /* 16-bit zero-extended immediate operand. */
+#define SrcNone     (0<<3) /* No source operand. */
+#define SrcImplicit (0<<3) /* Source operand is implicit in the opcode. */
+#define SrcReg      (1<<3) /* Register operand. */
+#define SrcMem      (2<<3) /* Memory operand. */
+#define SrcMem16    (3<<3) /* Memory operand (16-bit). */
+#define SrcImm      (4<<3) /* Immediate operand. */
+#define SrcImmByte  (5<<3) /* 8-bit sign-extended immediate operand. */
+#define SrcImm16    (6<<3) /* 16-bit zero-extended immediate operand. */
 #define SrcMask     (7<<3)
 /* Generic ModRM decode. */
 #define ModRM       (1<<6)
@@ -1531,19 +1530,6 @@ int x86emul_unhandleable_rw(
     return X86EMUL_UNHANDLEABLE;
 }
 
-static void internal_error(const char *which, uint8_t byte,
-                           const struct cpu_user_regs *regs)
-{
-#ifdef __XEN__
-    static bool_t logged;
-
-    if ( !test_and_set_bool(logged) )
-        gprintk(XENLOG_ERR, "Internal error: %s/%02x [%04x:%08lx]\n",
-                which, byte, regs->cs, regs->eip);
-#endif
-    ASSERT_UNREACHABLE();
-}
-
 int
 x86_emulate(
     struct x86_emulate_ctxt *ctxt,
@@ -1663,10 +1649,6 @@ x86_emulate(
                 break;
             }
         }
-
-        /* Unrecognised? */
-        if ( d == 0 )
-            goto cannot_emulate;
     }
 
     /* Lock prefix is allowed only on RMW instructions. */
@@ -1728,10 +1710,6 @@ x86_emulate(
                 b = insn_fetch_type(uint8_t);
                 d = twobyte_table[b];
 
-                /* Unrecognised? */
-                if ( d == 0 || b == 0x38 )
-                    goto cannot_emulate;
-
                 modrm = insn_fetch_type(uint8_t);
                 modrm_mod = (modrm & 0xc0) >> 6;
 
@@ -3841,7 +3819,6 @@ x86_emulate(
         break;
 
     default:
-        internal_error("primary", b, ctxt->regs);
         goto cannot_emulate;
     }
 
@@ -4827,7 +4804,6 @@ x86_emulate(
         break;
 
     default:
-        internal_error("secondary", b, ctxt->regs);
         goto cannot_emulate;
     }
     goto writeback;
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.