i386/x86_64 segment register issuses

Ross Ridge rridge@csclub.uwaterloo.ca
Mon Mar 28 20:07:00 GMT 2005


> The current gas will accept this and. But if fsindex is ever a memory
> operand,
> 
>                 asm volatile("movl %%fs,%0" : "=g" (fsindex));
> 
> fsindex will have some random value in the upper 16bits.

fsindex will have whatever value it had before in the upper 16-bits.
It's only undefined because of a bug in the Linux kernel, not because
the instruction itself ever produces an undefined result when a memory
operand is used.  This kind of move instruction can never have a 32-bit
memory operand.

							Ross Ridge



More information about the Binutils mailing list