This is the mail archive of the binutils@sources.redhat.com 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]

Re: Glitches in gas/objdump handling of i386 STR, SLDT, SMSW instructions


On Mon, Nov 12, 2001 at 11:35:47AM +1030, Alan Modra wrote:
> On Sun, Nov 11, 2001 at 04:19:11PM -0800, Zack Weinberg wrote:
> > 
> > First and most seriously: gas incorrectly thinks STR is invalid except
> > with a 16-bit operand.  In reality, STR works like most i386
> > word/long/quad instructions: the operand size prefixes apply.  To
> 
> Hmm, that's true when the destination is a register.  It's not true for
> a memory destination according to my reference;  You only get 16 bits
> in memory regardless of operand size.

Indeed; I changed my test program to write the value to memory, and
get 5555xxxx irrespective of the size prefix.

For maximal correctness, I should make the str entry in opcode/i386.h
reject strl <memory>, and generate the same byte sequence for
str <mem> and strw <mem>.  With the current iteration of my patch this

        str     (%ebx)
        strw    (%ebx)
        strl    (%ebx)

assembles to

   0:   0f 00 0b                strl   (%ebx)
   3:   66 0f 00 0b             strw   (%ebx)
   7:   0f 00 0b                strl   (%ebx)

which is not _wrong_, but the disassembly is misleading and strw is
longer than it needs to be.

Is it possible to do that?  I don't really know my way around
these files.

zw


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