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 12:26:43PM +1030, Alan Modra wrote:
> 
> {"str",	   1, 0x0f00, 1, Cpu286, wlq_Suf|Modrm,		{ WordReg|InvMem, 0, 0} },
> {"str",	   1, 0x0f00, 1, Cpu286, w_Suf|Modrm|IgnoreSize,{ Reg16|ShortMem, 0, 0} },

That does seem to work.  (The InvMem thingy seems unnecessary.)
There's another quirk, for backward compatibility "str %bx" needs to
continue generating the same thing as "strl %ebx".  That gives me

{"str",    1, 0x0f00, 1, Cpu286, NoSuf|Modrm|Size32,	{ Reg16, 0, 0} },
{"str",    1, 0x0f00, 1, Cpu286, wlq_Suf|Modrm,         { WordReg, 0, 0} },
{"str",    1, 0x0f00, 1, Cpu286, w_Suf|Modrm|IgnoreSize,{ ShortMem, 0, 0} },

and then the disassembler mustn't ever emit "str %bx" because it
doesn't mean what it appears to mean, so

    { "strP",	Ev, XX, XX },

My test case

        str     %bx
        str     %ebx
        nop
        strw    %bx
        strl    %ebx
        nop
        str     (%ebx)
        strw    (%ebx)

now generates

   0:   0f 00 cb                str    %ebx
   3:   0f 00 cb                str    %ebx
   6:   90                      nop    
   7:   66 0f 00 cb             strw   %bx
   b:   0f 00 cb                str    %ebx
   e:   90                      nop    
   f:   0f 00 0b                str    (%ebx)
  12:   0f 00 0b                str    (%ebx)

and that produces an identical object file when fed back into the
assembler.  So we're now almost correct.  The remaining problem is
that suffix_always mode will disassemble 0f 00 0b as strl (%ebx),
which is wrong and will be rejected by the assembler when fed back in.
I don't see how to fix that.

Also I wonder if any of the other [sl]<seg> instructions need the same
treatment.

zw


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