ndisasm: fix disassembly of JRCXZ
authorH. Peter Anvin <hpa@zytor.com>
Fri, 26 Jun 2009 23:18:00 +0000 (16:18 -0700)
committerH. Peter Anvin <hpa@zytor.com>
Fri, 26 Jun 2009 23:18:00 +0000 (16:18 -0700)
Fix the disassembly of JRCXZ; in 64-bit mode, we should only accept
JECXZ for disassembly with 32-bit address size override.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
assemble.c
disasm.c
insns.dat

index 705ae27..928dab6 100644 (file)
@@ -75,7 +75,7 @@
  *                 which is to be extended to the operand size.
  * \310          - indicates fixed 16-bit address size, i.e. optional 0x67.
  * \311          - indicates fixed 32-bit address size, i.e. optional 0x67.
- * \312          - (disassembler only) marker on LOOP, LOOPxx instructions.
+ * \312          - (disassembler only) invalid with non-default address size.
  * \313          - indicates fixed 64-bit address size, 0x67 invalid.
  * \314          - (disassembler only) invalid with REX.B
  * \315          - (disassembler only) invalid with REX.X
index 0c13635..4cf25ef 100644 (file)
--- a/disasm.c
+++ b/disasm.c
@@ -726,7 +726,7 @@ static int matches(const struct itemplate *t, uint8_t *data,
            break;
 
        case 0311:
-            if (asize == 16)
+            if (asize != 32)
                 return false;
             else
                 a_used = true;
index ce7df5a..5e4819b 100644 (file)
--- a/insns.dat
+++ b/insns.dat
@@ -619,6 +619,7 @@ IRETQ               void                            \324\1\xCF                                      X64
 IRETW          void                            \320\1\xCF                                      8086
 JCXZ           imm                             \310\1\xE3\50                                   8086,NOLONG
 JECXZ          imm                             \311\1\xE3\50                                   386
+JRCXZ          imm                             \313\1\xE3\50                                   X64
 JMP            imm|short                       \1\xEB\50                                       8086
 JMP            imm                             \371\1\xEB\50                                   8086,ND
 JMP            imm                             \322\1\xE9\64                                   8086
@@ -656,7 +657,6 @@ JMPE                imm16                           \320\2\x0F\xB8\64                               IA64
 JMPE           imm32                           \321\2\x0F\xB8\64                               IA64
 JMPE           rm16                            \320\2\x0F\x00\206                              IA64
 JMPE           rm32                            \321\2\x0F\x00\206                              IA64
-JRCXZ          imm                             \1\xE3\50                                       X64
 LAHF           void                            \1\x9F                                          8086
 LAR            reg16,mem                       \320\2\x0F\x02\110                              286,PROT,SW
 LAR            reg16,reg16                     \320\2\x0F\x02\110                              286,PROT