[PATCH 2/3] nptl: Fix start_thread() for _STACK_GROWS_UP

Will Newton will.newton at gmail.com
Wed Jan 12 12:06:44 UTC 2011


This patch adds a working implementation of pthread_create for architectures
where STACK_GROWS_UP.

Signed-off-by: Matt Fleming <matthew.fleming at imgtec.com>
---
 libpthread/nptl/pthread_create.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/libpthread/nptl/pthread_create.c b/libpthread/nptl/pthread_create.c
index 63e5588..42ffbaf 100644
--- a/libpthread/nptl/pthread_create.c
+++ b/libpthread/nptl/pthread_create.c
@@ -383,7 +383,8 @@ start_thread (void *arg)
   char *sp = CURRENT_STACK_FRAME;
   size_t freesize = (sp - (char *) pd->stackblock) & ~pagesize_m1;
 #else
-# error "to do"
+  char *sp = CURRENT_STACK_FRAME;
+  size_t freesize = ((char *) pd->stackblock - sp) & ~pagesize_m1;
 #endif
   assert (freesize < pd->stackblock_size);
   if (freesize > PTHREAD_STACK_MIN)
-- 
1.7.2.2


More information about the uClibc mailing list