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]

Why aren't we consistent on displacement in x86 disassembler?


While working on

http://sourceware.org/bugzilla/show_bug.cgi?id=4429

I noticed that we weren't consistent in the format we use on
displacement:

----
static void
print_operand_value (char *buf, int hex, bfd_vma disp)
...
static void
OP_E (int bytemode, int sizeflag)
{
...
	    print_operand_value (scratchbuf, !riprel, disp);
...
	      print_operand_value (scratchbuf, modrm.mod != 1, disp);
...
	      print_operand_value (scratchbuf, 1, disp);
...
	    print_operand_value (scratchbuf, 0, disp);
...
	      print_operand_value (scratchbuf, modrm.mod != 1, disp);
...
	  print_operand_value (scratchbuf, 1, disp & 0xffff);
}
----

That is we use hex or decimal for displacement, depending on Intel
mode, RIP relative, modrm.mod != 1 and 16bit address mode. It is
confusing. Are there any objections if I use hex for all displacements?


H.J.


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