Re: i386/x86_64 segment register issuses (Re: PATCH: Fix x86 segment register access)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Mar 28, 2005 at 09:46:00AM -0800, H. J. Lu wrote:
> On Mon, Mar 28, 2005 at 05:47:06PM +0200, Andi Kleen wrote:
> > "H. J. Lu" <[email protected]> writes:
> > > The new assembler will disallow them since those instructions with
> > > memory operand will only use the first 16bits. If the memory operand
> > > is 16bit, you won't see any problems. But if the memory destinatin
> > > is 32bit, the upper 16bits may have random values. The new assembler
> > 
> > Does it really have random values on existing x86 hardware?
> 
> The x86 hardwares will only change the first 16bits. The rest bits
> are unchanged. A simple test program can verify that.
> 
> > 
> > If it is a only a "theoretical" problem that does not happen
> > in practice I would advise to not do the change.
> > 
> 
> It depends on what the initial value in the upper bits is. The
> assembler in CVS generates the same binary code as
> 
> 	movw %ds,(%eax)
> 
> for
> 
> 	movl %ds,(%eax)
> 
> But the previous assemblers will generate
> 
> 	66 8c 18   movw   %ds,(%eax)
> 
> for
> 
> 	movw %ds,(%eax)
> 
> This bug has been fixed for a while. I guess that may be why Linux
> kernel uses
> 
> 	movl %ds,(%eax)

It turns out that both old and new assemblers will generate

   0:   8c 18 movw   %ds,(%eax)

for
 	mov %ds,(%eax)

So kernel can use "mov" instead of "movl" and the binary output will
be the same.


H.J.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux