lkml.org 
[lkml]   [1999]   [Oct]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: PATCH - assembler glitches
Alan Modra wrote:
>
> This is a copy of something I posted a while back that should clear up the
> confusion over gas and x86 segment registers. If Martin's patch is
> applied, then you are forcing people to move to new binutils - which may
> be required anyway with the new bootsect stuff. Martin, please review
> your patch after reading the following. Your patch is looks mostly
> correct to me (for new binutils), with the exception of
> arch/i386/kernel/signal.c, where you will unnecessarily add a prefix.
>
> ==================================
> On Mon, 9 Aug 1999, Alan Cox wrote:
>
> > > - AFAIU, there is no point in using just the lower half of a register to
> > > fill in a segment register, with a movl to boot.
> >
> > I seem to remember there was. This came up before if I remember rightly
> > and Linus had a specific reason for it. Check with Linus.
>
> Compatibility with old binutils.
>
> For example, when transferring %eax to %ds:
>
> `movl %eax,%ds' is the "correct" instruction, but this fails to assemble
> on old binutils.
>
> `movw %ax,%ds' is also correct, but will generate an operand size prefix
> on older binutils. You don't want extra prefixes if you can help it.
>
> `movl %ax,%ds' gets a warning on new binutils, but assembles correctly on
> both old and new binutils. ie. without a prefix. This is the form that
> should be used despite the warning.
>
> Note: When transferring the other way, `movw %ds,%ax' and `movl %ds,%eax'
> actually do different things. The first form leaves the upper 16 bits of
> %eax unchanged (and costs you an operand size prefix), while the second
> form sets the top 16 bits of %eax to "an implementation defined value"
> according to Intel. If you don't care about the top 16 bits of %eax, use
> `movl %ds,%ax'. Again, note the missing `e' for compatibility with old
> binutils.
>
> By old binutils, I mean anything before April 1998 in the Cygnus tree, or
> earlier than 2.9.0.3 from H.J. Lu

Been there have done it already. However I would like to preffer just to
change
the note about the needed binutils, since this is what allmost all other
platforms are really needing (ASM comes first to mind if I read the
ChangeLog's
from binutils correctly). And anyway newer binutils are a real win
apparently
for everybody not just hacking on the kernel but writing user space code
too... (In esp C++)

--
Marcin Dalecki

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:54    [W:0.038 / U:0.288 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site