PATCH: Display "xchg %ax,%ax" and "xchg %rax,%rax"

Jan Beulich jbeulich@novell.com
Fri Jun 9 09:23:00 GMT 2006


>+  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");
>+    }

This is wrong in 16-bit mode. It might be better to call appropriate functions than to use hard-coded strings here.

+  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");
+    }

This doesn't account for the rex bits that are ignored by this instruction. You should consume only rex.w here.

Jan



More information about the Binutils mailing list