This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: PATCH: Fix i386 disassembler with index == 0x4 in SIB (Re: objdump bug-report)
- From: "H. J. Lu" <hjl at lucon dot org>
- To: "Allan B. Cruse" <cruse at cs dot usfca dot edu>,binutils at sources dot redhat dot com
- Date: Thu, 13 Jan 2005 09:08:49 -0800
- Subject: Re: PATCH: Fix i386 disassembler with index == 0x4 in SIB (Re: objdump bug-report)
- References: <20050111210753.0C8CB219E0@nexus.cs.usfca.edu> <20050112191052.GA12463@lucon.org> <20050113034440.GG30985@bubble.modra.org>
On Thu, Jan 13, 2005 at 02:14:40PM +1030, Alan Modra wrote:
> On Wed, Jan 12, 2005 at 11:10:52AM -0800, H. J. Lu wrote:
> > > .byte 0x8B, 0x04, 0x63 # effect is: movl (%ebx), %eax
> [snip]
> > > 8048081: 8b 04 63 mov (%ebx,2),%eax
>
> I don't agree that this is a problem. In fact, I think that this
> disassembly is more accurate than "mov (%ebx),%eax". Note that gas
> accepts "mov (%ebx,2),%eax" giving
> Warning: scale factor of 2 without an index register
But it generates "8b 03", not "8b 04 63".
>
> Yes, I agree that the effect of executing these byte sequences is the
> same as "mov (%ebx),%eax", but that's beside the point. For example,
> plenty of x86 instructions execute as a nop, but that doesn't mean they
> should all be disassembled as "nop". The disassembler ought to reflect
> the machine encoding as closely as possible, and in this case that means
> printing the ignored scale factor.
>
> I think this change should be reverted.
>
IA-32 instruction reference manual says when INDEX == 0x4, scaled index
is "[none]". Displaying "(%ebx,2)" is simply wrong here.
H.J.