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

Marcus Meissner (msmeissn@cip.informatik.uni-erlangen.de)
Wed, 26 Aug 1998 10:42:32 +0200 (METDST)


In article <19980825173855.A1242@dot.cygnus.com> you write:
>Currently the code that sets up the context in which a signal handler
>runs resets both %fs and %gs to __USER_DS. I argue that this is less
>than desirable, if not incorrect.

...

>In contrast, for x86 we have these two, currently unused, segment regs
>being clobbered for no particular reason I can divine.

They are not clobbered, they are saved in the struct sigcontext passed
to the signal handler.

>This comes up because it interferes with a potential use of %gs we have
>in mind for linuxthreads. That is, %gs is set up at the birth of the
>thread to point to the thread-local data structures, and is thereafter
>left alone.

It is not impossible to use the registers anyway.

WINE has the same problem, since it uses %fs just like Win32 for thread
local storage.

WINE however restores the %fs in signalhandlers from the passed struct
sigcontext which works (including additional checks for signals from 16bit
code) rather good.

Ciao, Marcus

-
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