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, 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        +


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