about summary refs log tree commit diff
path: root/linuxthreads/signals.c
diff options
context:
space:
mode:
Diffstat (limited to 'linuxthreads/signals.c')
-rw-r--r--linuxthreads/signals.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/linuxthreads/signals.c b/linuxthreads/signals.c
index 0c9bffd00b..5a4d4f5db4 100644
--- a/linuxthreads/signals.c
+++ b/linuxthreads/signals.c
@@ -79,8 +79,12 @@ static union
 /* The wrapper around user-provided signal handlers */
 static void pthread_sighandler(int signo, SIGCONTEXT ctx)
 {
-  pthread_descr self = thread_self();
+  pthread_descr self;
   char * in_sighandler;
+#ifdef __i386__
+  asm volatile ("movw %w0,%%gs" : : "r" (ctx.gs));
+#endif
+  self = thread_self();
   /* If we're in a sigwait operation, just record the signal received
      and return without calling the user's handler */
   if (THREAD_GETMEM(self, p_sigwaiting)) {
@@ -102,8 +106,12 @@ static void pthread_sighandler(int signo, SIGCONTEXT ctx)
 static void pthread_sighandler_rt(int signo, struct siginfo *si,
 				  struct ucontext *uc)
 {
-  pthread_descr self = thread_self();
+  pthread_descr self;
   char * in_sighandler;
+#ifdef __i386__
+  asm volatile ("movw %w0,%%gs" : : "r" (uc->uc_mcontext.gregs[GS]));
+#endif
+  self =  thread_self();
   /* If we're in a sigwait operation, just record the signal received
      and return without calling the user's handler */
   if (THREAD_GETMEM(self, p_sigwaiting)) {