summaryrefslogtreecommitdiff
path: root/sysdeps/l4
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2012-04-27 01:32:54 +0000
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2012-04-27 01:37:36 +0000
commit25260994c812050a5d7addf125cdc90c911ca5c1 (patch)
tree255b2ba5ba5b799b1a5f23aef17d75534103de0a /sysdeps/l4
parente84c82a43e671c7506401936ac097b55d0fb47bf (diff)
Store self in __thread variable instead of threadvar
* sysdeps/mach/hurd/pt-sysdep.h (_HURD_THREADVAR_THREAD): Remove macro. (___pthread_self): Declare new __thread variable. (_pthread_self): Take self pointer from ___pthread_self instead of threadvar. * sysdeps/mach/hurd/pt-sysdep.c (___pthread_self): Define new __thread variable. (init_routine): Set ___pthread_self to initial thread structure. * pthread/pt-internal.h (__pthread_setup): Add `self' parameter to `entry_point' parameter. * pthread/pt-create.c (entry_point): Add `self' parameter. Store it in ___pthread_self. * sysdeps/l4/hurd/ia32/pt-setup.c (stack_setup): Add `self parameter to `entry_point' parameter. Pass it the `thread' parameter. (__pthread_setup): Likewise. * sysdeps/l4/hurd/powerpc/pt-setup.c (struct start_info): Add `self' field. (first_entry_1): Pass `self' parameter. (stack_setup): Add `self' parameter to `entry_point' parameter, pass it the `thread' parameter. (__pthread_setup): Likewise. * sysdeps/mach/hurd/ia32/pt-setup.c (stack_setup): Pass `thread' parameter to the start routine. (stack_setup): Add `self' parameter to `entry_point' paramter.
Diffstat (limited to 'sysdeps/l4')
-rw-r--r--sysdeps/l4/hurd/ia32/pt-setup.c5
-rw-r--r--sysdeps/l4/hurd/powerpc/pt-setup.c7
2 files changed, 8 insertions, 4 deletions
diff --git a/sysdeps/l4/hurd/ia32/pt-setup.c b/sysdeps/l4/hurd/ia32/pt-setup.c
index 579905c..de7359c 100644
--- a/sysdeps/l4/hurd/ia32/pt-setup.c
+++ b/sysdeps/l4/hurd/ia32/pt-setup.c
@@ -65,7 +65,7 @@ __pthread_entry_point:\n\
static void *
stack_setup (struct __pthread *thread,
void *(*start_routine)(void *), void *arg,
- void (*entry_point)(void *(*)(void *), void *))
+ void (*entry_point)(struct __pthread *, void *(*)(void *), void *))
{
uintptr_t *top;
@@ -80,6 +80,7 @@ stack_setup (struct __pthread *thread,
/* Set up call frame. */
*--top = (uintptr_t) arg; /* Argument to START_ROUTINE. */
*--top = (uintptr_t) start_routine;
+ *--top = (uintptr_t) thread;
*--top = 0; /* Fake return address. */
*--top = (uintptr_t) entry_point;
}
@@ -89,7 +90,7 @@ stack_setup (struct __pthread *thread,
int
__pthread_setup (struct __pthread *thread,
- void (*entry_point)(void *(*)(void *), void *),
+ void (*entry_point)(struct __pthread *, void *(*)(void *), void *),
void *(*start_routine)(void *), void *arg)
{
thread->mcontext.pc = (void *) &_pthread_entry_point;
diff --git a/sysdeps/l4/hurd/powerpc/pt-setup.c b/sysdeps/l4/hurd/powerpc/pt-setup.c
index d3cf4ec..d309216 100644
--- a/sysdeps/l4/hurd/powerpc/pt-setup.c
+++ b/sysdeps/l4/hurd/powerpc/pt-setup.c
@@ -28,6 +28,7 @@
struct start_info
{
void (*entry_point) (void *(*)(void *), void *);
+ struct __pthread *self;
void *(*start_routine) (void *);
void *arg;
};
@@ -41,6 +42,7 @@ first_entry_1: ;\
lwz 0, 0(1) ;\
lwz 3, 4(1) ;\
lwz 4, 8(1) ;\
+ lwz 5, 12(1) ;\
mtctr 0 ;\
bctrl ;\
");
@@ -51,7 +53,7 @@ first_entry_1: ;\
opportunity to install THREAD in our utcb. */
static void *
stack_setup (struct __pthread *thread,
- void (*entry_point)(void *(*)(void *), void *),
+ void (*entry_point)(struct __pthread *, void *(*)(void *), void *),
void *(*start_routine)(void *), void *arg)
{
l4_word_t *top;
@@ -68,6 +70,7 @@ stack_setup (struct __pthread *thread,
struct start_info *info = ((struct start_info *) top) - 1;
info->entry_point = entry_point;
+ info->self = thread;
info->start_routine = start_routine;
info->arg = arg;
return (void *) info;
@@ -77,7 +80,7 @@ stack_setup (struct __pthread *thread,
int
__pthread_setup (struct __pthread *thread,
- void (*entry_point)(void *(*)(void *), void *),
+ void (*entry_point)(struct __pthread *, void *(*)(void *), void *),
void *(*start_routine)(void *), void *arg)
{
thread->mcontext.pc = first_entry_1;