]> granicus.if.org Git - yasm/commitdiff
Revert r2029. According to both AMD64 and Intel 64 instruction set
authorPeter Johnson <peter@tortall.net>
Sat, 2 Feb 2008 19:23:17 +0000 (19:23 -0000)
committerPeter Johnson <peter@tortall.net>
Sat, 2 Feb 2008 19:23:17 +0000 (19:23 -0000)
references, REX + 90h opcode is not NOP, but a valid XCHG:

"The x86 architecture commonly uses the XCHG EAX, EAX instruction (opcode
90h) as a one-byte NOP. In 64-bit mode, the processor treats opcode 90h as
a true NOP only if it would exchange rAX with itself. Without this special
handling, the instruction would zero-extend the upper 32 bits of RAX, and
thus it would not be a true nooperation.  Opcode 90h can still be used to
exchange rAX and r8 if the appropriate REX prefix is used."

Noticed by: nasm64developer@users.sf.net

svn path=/trunk/yasm/; revision=2031

modules/arch/x86/gen_x86_insn.py
modules/arch/x86/tests/xchg64.hex
modules/arch/x86/x86id.c

index bb1ec5fee9ed4ebae3399afbfcd2b6942a8ea2d3..fd923d4fbbdc0c64f9bc0c532fd58b785e981c18 100755 (executable)
@@ -1357,12 +1357,12 @@ add_group("xchg",
     opersize=16,
     opcode=[0x90],
     operands=[Operand(type="Areg", size=16, dest=None),
-              Operand(type="RegNotR8", size=16, dest="Op0Add")])
+              Operand(type="Reg", size=16, dest="Op0Add")])
 add_group("xchg",
     suffix="w",
     opersize=16,
     opcode=[0x90],
-    operands=[Operand(type="RegNotR8", size=16, dest="Op0Add"),
+    operands=[Operand(type="Reg", size=16, dest="Op0Add"),
               Operand(type="Areg", size=16, dest=None)])
 add_group("xchg",
     suffix="w",
@@ -1396,12 +1396,12 @@ add_group("xchg",
     opersize=32,
     opcode=[0x90],
     operands=[Operand(type="Areg", size=32, dest=None),
-              Operand(type="RegNotR8", size=32, dest="Op0Add")])
+              Operand(type="Reg", size=32, dest="Op0Add")])
 add_group("xchg",
     suffix="l",
     opersize=32,
     opcode=[0x90],
-    operands=[Operand(type="RegNotR8", size=32, dest="Op0Add"),
+    operands=[Operand(type="Reg", size=32, dest="Op0Add"),
               Operand(type="Areg", size=32, dest=None)])
 add_group("xchg",
     suffix="l",
@@ -1428,12 +1428,12 @@ add_group("xchg",
     opersize=64,
     opcode=[0x90],
     operands=[Operand(type="Areg", size=64, dest=None),
-              Operand(type="RegNotR8", size=64, dest="Op0Add")])
+              Operand(type="Reg", size=64, dest="Op0Add")])
 add_group("xchg",
     suffix="q",
     opersize=64,
     opcode=[0x90],
-    operands=[Operand(type="RegNotR8", size=64, dest="Op0Add"),
+    operands=[Operand(type="Reg", size=64, dest="Op0Add"),
               Operand(type="Areg", size=64, dest=None)])
 add_group("xchg",
     suffix="q",
index d052b668601890da5582c3498baa5cab7ec68f20..44adfca85c56eab48e9b947e6a686a0094934bc9 100644 (file)
@@ -24,13 +24,11 @@ c0
 66 
 90 
 66 
-44 
-87 
-c0 
+41 
+90 
 66 
 41 
-87 
-c0 
+90 
 66 
 41 
 91 
@@ -39,23 +37,19 @@ c0
 91 
 87 
 c0 
-44 
-87 
-c0 
 41 
-87 
-c0 
+90 
+41 
+90 
 41 
 91 
 41 
 91 
 90 
-4c 
-87 
-c0 
 49 
-87 
-c0 
+90 
+49 
+90 
 49 
 91 
 49 
index 874ad010b4df33ed2da8c69d663539ef16e6cded..d17f045c1873d370b505563e3499cbeec8e6c139 100644 (file)
@@ -105,9 +105,7 @@ enum x86_operand_type {
     /* EAX memory operand only (EA) [special case for SVM skinit opcode] */
     OPT_MemEAX = 26,
     /* SIMDReg with value equal to operand 0 SIMDReg */
-    OPT_SIMDRegMatch0 = 27,
-    /* Reg with value != 8 [special case for xchg r8, rax] */
-    OPT_RegNotR8 = 28
+    OPT_SIMDRegMatch0 = 27
 };
 
 enum x86_operand_size {
@@ -808,25 +806,6 @@ x86_find_match(x86_id_insn *id_insn, yasm_insn_operand **ops,
                         mismatch = 1;
                     break;
                 }
-                case OPT_RegNotR8:
-                    if (op->type != YASM_INSN__OPERAND_REG ||
-                        ((op->data.reg&0xFUL) == 8))
-                        mismatch = 1;
-                    else {
-                        switch ((x86_expritem_reg_size)(op->data.reg&~0xFUL)) {
-                            case X86_REG8:
-                            case X86_REG8X:
-                            case X86_REG16:
-                            case X86_REG32:
-                            case X86_REG64:
-                            case X86_FPUREG:
-                                break;
-                            default:
-                                mismatch = 1;
-                                break;
-                        }
-                    }
-                    break;
                 default:
                     yasm_internal_error(N_("invalid operand type"));
             }