mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "H. J. Lu" <hjl@lucon.org>
To: Andi Kleen <ak@muc.de>
Cc: linux kernel <linux-kernel@vger.kernel.org>
Subject: Re: i386/x86_64 segment register issuses (Re: PATCH: Fix x86 segment register access)
Date: Mon, 28 Mar 2005 10:22:07 -0800	[thread overview]
Message-ID: <20050328182207.GA25316@lucon.org> (raw)
In-Reply-To: <20050328174600.GA24675@lucon.org>

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" <hjl@lucon.org> 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.

  reply	other threads:[~2005-03-28 18:26 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20050326020506.GA8068@lucon.org>
2005-03-27 22:24 ` H. J. Lu
2005-03-28 15:47   ` Andi Kleen
2005-03-28 17:46     ` H. J. Lu
2005-03-28 18:22       ` H. J. Lu [this message]
2005-03-30  0:30     ` Linus Torvalds
2005-03-30  1:53       ` H. J. Lu
2005-03-30  2:44         ` Linus Torvalds
2005-03-30  4:00           ` H. J. Lu
2005-03-30 15:57             ` Linus Torvalds
2005-03-30 16:23               ` linux-os
2005-03-30 21:11                 ` H. J. Lu
2005-03-30 21:08               ` H. J. Lu
2005-03-30 22:18                 ` Pau Aliagas
2005-03-31  0:34                   ` H. J. Lu
2005-03-31  0:57                     ` Pau Aliagas
2005-03-31  1:52                       ` H. J. Lu
2005-03-31 10:19                   ` Andi Kleen
2005-03-30 15:25           ` Andi Kleen
2005-03-29 19:17   ` PATCH: i386/x86_64 segment register access update H. J. Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050328182207.GA25316@lucon.org \
    --to=hjl@lucon.org \
    --cc=ak@muc.de \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome