diff options
author | Thomas Schwinge <thomas@codesourcery.com> | 2012-08-31 00:04:26 +0200 |
---|---|---|
committer | Thomas Schwinge <thomas@codesourcery.com> | 2012-08-31 00:04:26 +0200 |
commit | c8538dfe4032c398974e46edef97cac03a9f185f (patch) | |
tree | 68890f5a31937f1f3616dae163d005f91ef0e067 | |
parent | e2c739a43175f15d423010ef83ca3be67a26da8e (diff) |
Revert "Store self in __thread variable instead of threadvar"t/tls-threadvar-pthread_self
This reverts commit 25260994c812050a5d7addf125cdc90c911ca5c1.
Conflicts:
sysdeps/l4/hurd/ia32/pt-setup.c
sysdeps/l4/hurd/powerpc/pt-setup.c
-rw-r--r-- | .topmsg | 5 | ||||
-rw-r--r-- | pthread/pt-create.c | 6 | ||||
-rw-r--r-- | pthread/pt-internal.h | 3 | ||||
-rw-r--r-- | sysdeps/mach/hurd/i386/pt-setup.c | 12 | ||||
-rw-r--r-- | sysdeps/mach/hurd/pt-sysdep.c | 5 | ||||
-rw-r--r-- | sysdeps/mach/hurd/pt-sysdep.h | 6 |
6 files changed, 20 insertions, 17 deletions
@@ -1,7 +1,12 @@ Subject: [PATCH] tls-threadvar-pthread_self +Was implemented in: + commit 25260994c812050a5d7addf125cdc90c911ca5c1 Author: Samuel Thibault <samuel.thibault@ens-lyon.org> Date: Fri Apr 27 01:32:54 2012 +0000 Store self in __thread variable instead of threadvar + +..., but has been reverted; id:"87wr16xxey.fsf@kepler.schwinge.homeip.net" +needs to be addressed. diff --git a/pthread/pt-create.c b/pthread/pt-create.c index 4d81a95..ca6b66c 100644 --- a/pthread/pt-create.c +++ b/pthread/pt-create.c @@ -38,12 +38,8 @@ __atomic_t __pthread_total; /* The entry-point for new threads. */ static void -entry_point (struct __pthread *self, void *(*start_routine)(void *), void *arg) +entry_point (void *(*start_routine)(void *), void *arg) { -#ifdef ENABLE_TLS - ___pthread_self = self; -#endif - #ifdef HAVE_USELOCALE /* A fresh thread needs to be bound to the global locale. */ uselocale (LC_GLOBAL_LOCALE); diff --git a/pthread/pt-internal.h b/pthread/pt-internal.h index 067fb73..2a21744 100644 --- a/pthread/pt-internal.h +++ b/pthread/pt-internal.h @@ -219,8 +219,7 @@ extern void __pthread_stack_dealloc (void *stackaddr, size_t stacksize); /* Setup thread THREAD's context. */ extern int __pthread_setup (struct __pthread *__restrict thread, - void (*entry_point)(struct __pthread *, - void *(*)(void *), + void (*entry_point)(void *(*)(void *), void *), void *(*start_routine)(void *), void *__restrict arg); diff --git a/sysdeps/mach/hurd/i386/pt-setup.c b/sysdeps/mach/hurd/i386/pt-setup.c index 73fd43d..5420dc8 100644 --- a/sysdeps/mach/hurd/i386/pt-setup.c +++ b/sysdeps/mach/hurd/i386/pt-setup.c @@ -57,14 +57,16 @@ stack_setup (struct __pthread *thread, /* Next, make room for the TSDs. */ top -= __hurd_threadvar_max; + /* Save the self pointer. */ + top[_HURD_THREADVAR_THREAD] = (uintptr_t) thread; + if (start_routine) { /* And then the call frame. */ - top -= 3; + top -= 2; top = (uintptr_t *) ((uintptr_t) top & ~0xf); - top[2] = (uintptr_t) arg; /* Argument to START_ROUTINE. */ - top[1] = (uintptr_t) start_routine; - top[0] = (uintptr_t) thread; + top[1] = (uintptr_t) arg; /* Argument to START_ROUTINE. */ + top[0] = (uintptr_t) start_routine; *--top = 0; /* Fake return address. */ } @@ -80,7 +82,7 @@ stack_setup (struct __pthread *thread, int __pthread_setup (struct __pthread *thread, - void (*entry_point)(struct __pthread *, void *(*)(void *), void *), + void (*entry_point)(void *(*)(void *), void *), void *(*start_routine)(void *), void *arg) { error_t err; diff --git a/sysdeps/mach/hurd/pt-sysdep.c b/sysdeps/mach/hurd/pt-sysdep.c index f40fee5..95a4d36 100644 --- a/sysdeps/mach/hurd/pt-sysdep.c +++ b/sysdeps/mach/hurd/pt-sysdep.c @@ -28,8 +28,6 @@ #include <pt-internal.h> -__thread struct __pthread *___pthread_self; - /* Forward. */ static void *init_routine (void); @@ -53,7 +51,8 @@ init_routine (void) err = __pthread_create_internal (&thread, 0, 0, 0); assert_perror (err); - ___pthread_self = thread; + ((void **) (__hurd_threadvar_stack_offset))[_HURD_THREADVAR_THREAD] + = thread; /* Decrease the number of threads, to take into account that the signal thread (which will be created by the glibc startup code diff --git a/sysdeps/mach/hurd/pt-sysdep.h b/sysdeps/mach/hurd/pt-sysdep.h index bec1b40..13e235d 100644 --- a/sysdeps/mach/hurd/pt-sysdep.h +++ b/sysdeps/mach/hurd/pt-sysdep.h @@ -35,13 +35,15 @@ mach_msg_header_t wakeupmsg; \ int have_kernel_resources; -extern __thread struct __pthread *___pthread_self; +#define _HURD_THREADVAR_THREAD _HURD_THREADVAR_DYNAMIC_USER + #define _pthread_self() \ ({ \ struct __pthread *thread; \ \ assert (__pthread_threads); \ - thread = ___pthread_self; \ + thread = *(struct __pthread **) \ + __hurd_threadvar_location (_HURD_THREADVAR_THREAD); \ \ assert (thread); \ assert (({ mach_port_t ktid = __mach_thread_self (); \ |