This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
PATCH: Display "xchg %ax,%ax" and "xchg %rax,%rax"
- From: "H. J. Lu" <hjl at lucon dot org>
- To: binutils at sources dot redhat dot com
- Date: Thu, 8 Jun 2006 23:38:39 -0700
- Subject: PATCH: Display "xchg %ax,%ax" and "xchg %rax,%rax"
This patch changes the disassembler to display "xchg %ax,%ax" and
"xchg %rax,%rax" instead of "data16 nop" and "rex64 nop" respectively
since nop is just an alias of "xchg %eax,%eax".
H.J.
----
gas/testsuite/
2006-06-08 H.J. Lu <hongjiu.lu@intel.com>
* gas/i386/opcode.s: Add "xchg %ax,%ax".
* gas/i386/opcode.d: Updated.
* gas/i386/x86-64-opcode.s: Add "xchg %rax,%rax".
* gas/i386/x86-64-opcode.d: Updated.
opcodes/
2006-06-08 H.J. Lu <hongjiu.lu@intel.com>
* i386-dis.c (NOP_Fixup): Display "xchg %ax,%ax" and
"xchg %rax,%rax" instead of "data16 nop" and "rex64 nop"
respectively.
--- binutils/gas/testsuite/gas/i386/opcode.d.xchg 2005-03-29 12:09:20.000000000 -0800
+++ binutils/gas/testsuite/gas/i386/opcode.d 2006-06-08 23:10:12.000000000 -0700
@@ -572,4 +572,5 @@ Disassembly of section .text:
9b7: 66 0f bd 90 90 90 90 90 [ ]*bsr 0x90909090\(%eax\),%dx
9bf: 66 0f be 90 90 90 90 90 [ ]*movsbw 0x90909090\(%eax\),%dx
9c7: 66 0f c1 90 90 90 90 90 [ ]*xadd %dx,0x90909090\(%eax\)
+ 9cf: 66 90 [ ]*xchg %ax,%ax
\.\.\.
--- binutils/gas/testsuite/gas/i386/opcode.s.xchg 2005-03-29 12:09:20.000000000 -0800
+++ binutils/gas/testsuite/gas/i386/opcode.s 2006-06-08 23:27:00.000000000 -0700
@@ -566,5 +566,7 @@ foo:
movsbw 0x90909090(%eax),%dx
xadd %dx,0x90909090(%eax)
+ xchg %ax,%ax
+
# Force a good alignment.
.p2align 4,0
--- binutils/gas/testsuite/gas/i386/x86-64-opcode.d.xchg 2005-03-29 12:09:20.000000000 -0800
+++ binutils/gas/testsuite/gas/i386/x86-64-opcode.d 2006-06-08 23:32:10.000000000 -0700
@@ -266,6 +266,6 @@ Disassembly of section .text:
[ ]*[0-9a-f]+:[ ]+e6 00[ ]+out[ ]+%al,\$0[x0]*[ ]*(#.*)*
[ ]*[0-9a-f]+:[ ]+66 e7 00[ ]+out[ ]+%ax,\$0[x0]*[ ]*(#.*)*
[ ]*[0-9a-f]+:[ ]+e7 00[ ]+out[ ]+%eax,\$0[x0]*[ ]*(#.*)*
-[ ]*[0-9a-f]+:[ ]+00 00[ ]+.*
+[ ]*[0-9a-f]+:[ ]+48 90[ ]+xchg[ ]+%rax,%rax[ ]*(#.*)*
[ ]*[0-9a-f]+:[ ]+00 00[ ]+.*
[ *]...
--- binutils/gas/testsuite/gas/i386/x86-64-opcode.s.xchg 2005-03-29 12:09:20.000000000 -0800
+++ binutils/gas/testsuite/gas/i386/x86-64-opcode.s 2006-06-08 23:31:02.000000000 -0700
@@ -387,4 +387,8 @@
# IN
+
+
+ xchg %rax,%rax # -- -- -- 48 90
+
.p2align 4,0
--- binutils/opcodes/i386-dis.c.xchg 2006-05-11 08:52:55.000000000 -0700
+++ binutils/opcodes/i386-dis.c 2006-06-08 23:24:31.000000000 -0700
@@ -4363,9 +4363,27 @@ OP_0fae (int bytemode, int sizeflag)
static void
NOP_Fixup (int bytemode ATTRIBUTE_UNUSED, int sizeflag ATTRIBUTE_UNUSED)
{
- /* NOP with REPZ prefix is called PAUSE. */
if (prefixes == PREFIX_REPZ)
+ /* NOP with REPZ prefix is called PAUSE. */
strcpy (obuf, "pause");
+ else if (prefixes == PREFIX_DATA)
+ {
+ /* We display "xchg %ax,%ax" instead of "data16 nop". */
+ prefixes = 0;
+ if (intel_syntax)
+ strcpy (obuf, "xchg ax,ax");
+ else
+ strcpy (obuf, "xchg %ax,%ax");
+ }
+ else if (rex == 0x48)
+ {
+ /* We display "xchg %rax,%rax" instead of "rex64 nop". */
+ rex = 0;
+ if (intel_syntax)
+ strcpy (obuf, "xchg rax,rax");
+ else
+ strcpy (obuf, "xchg %rax,%rax");
+ }
}
static const char *const Suffix3DNow[] = {