i386/x86_64 segment register issuses

H. J. Lu hjl@lucon.org
Tue Mar 29 03:00:00 GMT 2005


On Mon, Mar 28, 2005 at 02:34:16PM -0500, Ross Ridge wrote:
> > The assembler in CVS generates the same binary code as
> > 
> > 	movw %ds,(%eax)
> > 
> > for
> > 
> > 	movl %ds,(%eax)
> 
> Which is the way I think the GNU assembler should work.  In case like

I'd like to disallow

 	movl %ds,(%eax)

since there is no such an instruction. People can use

 	mov %ds,(%eax)

with old and new assemblers or

 	movw %ds,(%eax)

with the newer assembler.

> Linux kernel code you quoted, you really do want a 16-bit move when a
> memory destination is used and a 32-bit move when a register destination
> used.  The only problem here is that the Linux kernel doesn't ingore
> the higher 16-bits of the resulting variable, which aren't guaranteed
> to be zero in either case.
> 

The higher bits are guaranteed to be zero for x86_64 and Pentium Pro
or above. I am testing Linux kernel patches to make sure that both
old and new assembler will generate optimized binary.


H.J.



More information about the Binutils mailing list