diff options
author | Neal H. Walfield <neal@gnu.org> | 2008-02-13 10:38:57 +0000 |
---|---|---|
committer | Thomas Schwinge <tschwinge@gnu.org> | 2009-04-07 23:13:54 +0200 |
commit | 0c44c267ed37d9bb1c3c1343e1e651e90ef23e7b (patch) | |
tree | 0018b6c3e690b903fb41c1c32ba337ac67b747cd | |
parent | 0e7c0da6e02f122ece6ea3af9fbd5352eaaee15d (diff) |
libpthread/
2008-02-13 Neal H. Walfield <neal@gnu.org>
* sysdeps/l4/hurd/pt-sysdep.c (_pthread_init_routine): Change
function signature to take a function pointer and an argument and
to not return.
(init_routine): Likewise. Pass entry and argument to
__pthread_create_internal. Instead of returning, jump to the
program counter and switch stacks.
libc-parts/
2008-02-13 Neal H. Walfield <neal@gnu.org>
* ia32-cmain.c (cmain): Update user of _pthread_init_routine to
reflect API change.
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | sysdeps/l4/hurd/pt-sysdep.c | 16 |
2 files changed, 19 insertions, 6 deletions
@@ -1,3 +1,12 @@ +2008-02-13 Neal H. Walfield <neal@gnu.org> + + * sysdeps/l4/hurd/pt-sysdep.c (_pthread_init_routine): Change + function signature to take a function pointer and an argument and + to not return. + (init_routine): Likewise. Pass entry and argument to + __pthread_create_internal. Instead of returning, jump to the + program counter and switch stacks. + 2008-02-11 Neal H. Walfield <neal@gnu.org> * sysdeps/l4/hurd/ia32/pt-setup.c (_pthread_entry_point): New diff --git a/sysdeps/l4/hurd/pt-sysdep.c b/sysdeps/l4/hurd/pt-sysdep.c index a05eb0a..604f5bf 100644 --- a/sysdeps/l4/hurd/pt-sysdep.c +++ b/sysdeps/l4/hurd/pt-sysdep.c @@ -38,17 +38,18 @@ sigprocmask (int HOW, const sigset_t *restrict SET, sigset_t *restrict OLDSET) } /* Forward. */ -static void *init_routine (void); +static void init_routine (void (*) (void *), void *) + __attribute__ ((noreturn)); /* OK, the name of this variable isn't really appropriate, but I don't want to change it yet. */ -void *(*_pthread_init_routine)(void) = &init_routine; +void (*_pthread_init_routine)(void (*) (void *), void *) = &init_routine; /* This function is called from the Hurd-specific startup code. It should return a new stack pointer for the main thread. The caller will switch to this new stack before doing anything serious. */ -static void * -init_routine (void) +static void +init_routine (void (*entry) (void *), void *arg) { /* Initialize the library. */ __pthread_initialize (); @@ -57,8 +58,11 @@ init_routine (void) int err; /* Create the pthread structure for the main thread (i.e. us). */ - err = __pthread_create_internal (&thread, 0, 0, 0); + err = __pthread_create_internal (&thread, 0, + (void *(*)(void *)) entry, arg); assert_perror (err); - return (void *) thread->mcontext.sp; + /* Switch stacks. */ + l4_start_sp_ip (l4_myself (), thread->mcontext.sp, + thread->mcontext.pc); } |