diff options
author | Will Newton <will.newton@imgtec.com> | 2011-01-20 15:26:14 +0100 |
---|---|---|
committer | Carmelo Amoroso <carmelo.amoroso@st.com> | 2011-01-20 15:26:14 +0100 |
commit | 5c02df4f734011cccc65441e5dae2f5c18447f39 (patch) | |
tree | c91652b07c5eedc7e96e73968bb68188301a2ea0 /libpthread/nptl | |
parent | 8fb5b1cffd576ba9cec8c42df028e8afd6933dcd (diff) |
nptl: fix start_thread() for _STACK_GROWS_UP
This patch adds a working implementation of pthread_create for architectures
where STACK_GROWS_UP.
Signed-off-by: Matt Fleming <matthew.fleming@imgtec.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
Diffstat (limited to 'libpthread/nptl')
-rw-r--r-- | libpthread/nptl/pthread_create.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libpthread/nptl/pthread_create.c b/libpthread/nptl/pthread_create.c index 63e5588d5..86ff1488b 100644 --- a/libpthread/nptl/pthread_create.c +++ b/libpthread/nptl/pthread_create.c @@ -379,11 +379,11 @@ start_thread (void *arg) /* Mark the memory of the stack as usable to the kernel. We free everything except for the space used for the TCB itself. */ size_t pagesize_m1 = __getpagesize () - 1; -#ifdef _STACK_GROWS_DOWN char *sp = CURRENT_STACK_FRAME; +#ifdef _STACK_GROWS_DOWN size_t freesize = (sp - (char *) pd->stackblock) & ~pagesize_m1; #else -# error "to do" + size_t freesize = ((char *) pd->stackblock - sp) & ~pagesize_m1; #endif assert (freesize < pd->stackblock_size); if (freesize > PTHREAD_STACK_MIN) |