Re: patch for x86 treatment of fs and gs in signal handlers

Jamie Lokier (lkd@tantalophile.demon.co.uk)
Tue, 1 Sep 1998 16:10:08 +0100


On Mon, Aug 31, 1998 at 01:11:13PM -0700, Ulrich Drepper wrote:
> > 1. An x86 attribute to say "use this segment prefix when addressing this
> > object". Where "segment" can be any of the x86 segment registers. That
> > needn't be considered specific to a thread model.
>
> How exactly would you define the semantics? The addresses must be
> converted. And, one might want to have more than one object in the
> segment.

Simply that "%gs:" is emitted as an address prefix for an instruction
that address an object with the segment attribute. (Or "%fs:" etc.).
Nothing else.

> > Then ld.so would know to duplicate the data on loading, to group all
> > these PHDR blocks from different libraries together (this can be
> > incremental), to set up LDT entries to point to all the blocks, and to
> > relocate all the addresses in __thread_local_reloc (at library load
> > time) to be offsets from the start of the thread-local blocks.
>
> Here it becomes unusable. You cannot go on and require every single
> component of the system to be changed in a certain way which is usable
> only for this specific use.

Although it sounds complicated, the only changes are to ld.so (part of
Glibc which you're changing anyway), and the GCC attributes. The PHDR
is not strictly required, but might be tidier. That would be one line
added to the linker script.

> You have to find a general solution which does not require extensive
> changes like this or implement it with the current means.

ELF is pretty good at this sort of thing already.

> There might be other uses for the segment registers and the like and
> you would make it impossible to use it. Nothing which is not written
> down in the ABI must be demanded to be available all the time.

You are talking of using %gs throughout a threaded program, and I am
suggesting the same. Are we meaning something different?

-- Jamie

-
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.altern.org/andrebalsa/doc/lkml-faq.html