Subject: Re: lib/26900: pthread should save/restore %fs resgister on i386
To: Valeriy E. Ushakov <uwe@ptc.spbu.ru>
From: Charles M. Hannum <abuse@spamalicious.com>
List: port-i386
Date: 09/28/2004 14:20:02
On Tuesday 28 September 2004 11:25, Valeriy E. Ushakov wrote:
> On Tue, Sep 28, 2004 at 12:03:10 +0200, Martin Husemann wrote:
> > On Tue, Sep 28, 2004 at 07:00:59PM +0900, TAMURA Kent wrote:
> > > IMO, the issue seems not significant if no other applications
> > > use %fs register.
> >
> > What does the ABI say about %fs?
>
> %cs, %ds, %es, %ss
>
>     The segment registers are initialized so that the user process can
>     address the code, data, and stack segments using a 32-bit virtual
>     address. A program that alters their values does not conform to
>     the ABI and has undefined behavior.
>
> It doesn't mention %fs and %gs, I'd assume they are to be treated no
> differently from %ds and %es.

That would be an incorrect assumption.  The ABI knows that very little code 
uses %fs and %gs on x86.  It was also written in the days of the 386, when 
saving and restoring segment registers was very expensive.