This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Glitches in gas/objdump handling of i386 STR, SLDT, SMSW instructions
- To: Zack Weinberg <zack at codesourcery dot com>
- Subject: Re: Glitches in gas/objdump handling of i386 STR, SLDT, SMSW instructions
- From: "Maciej W. Rozycki" <macro at ds2 dot pg dot gda dot pl>
- Date: Tue, 13 Nov 2001 13:09:44 +0100 (MET)
- Cc: binutils at sources dot redhat dot com
- Organization: Technical University of Gdansk
On Mon, 12 Nov 2001, Zack Weinberg wrote:
> The semantics of the instruction coupled with the backward
> compatibility hack are sufficiently weird that I'm starting to think
> the disassembler should _always_ suffix this instruction.
>
> unsuffixed equivalent
>
> str %bx strl %ebx
> str %ebx strl %ebx
> str (%ebx) strw (%ebx)
Hmm, I see it differently. For 32-bit code:
str %bx strw %bx (prefix)
strw %bx strw %bx (prefix)
strl %bx -> error
str %ebx strl %ebx (no prefix)
strw %ebx -> error
strl %ebx strl %ebx (no prefix)
str (%ebx) strl (%ebx) (no prefix)
strw (%ebx) strw (%ebx) (prefix)
strl (%ebx) strl (%ebx) (no prefix)
Adjust for 16-bit code as needed.
Why do you need "str %bx" to generate "strl %ebx"? Apart from a single
cycle wasted for the data size prefix there is no difference from
program's point of view. Sure, unlike "strw %bx", "strl %ebx" may destroy
the upper part of the register (implementation-specific), but that can be
hardly useful.
If you care of the wasted cycle, then use fixed binutils.
--
+ Maciej W. Rozycki, Technical University of Gdansk, Poland +
+--------------------------------------------------------------+
+ e-mail: macro@ds2.pg.gda.pl, PGP key available +