This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


>+  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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]