Module Name: src
Committed By: joerg
Date: Thu Mar 8 16:33:46 UTC 2012
Modified Files:
src/lib/libpthread: pthread.c
Log Message:
Fix the stack base pointer for the initial thread on !HPPA.
AT_STACKBASE is pointing to the start of the stack, which is the
upper limit on platforms where the stack grows down.
To generate a diff of this commit:
cvs rdiff -u -r1.126 -r1.127 src/lib/libpthread/pthread.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/libpthread/pthread.c
diff -u src/lib/libpthread/pthread.c:1.126 src/lib/libpthread/pthread.c:1.127
--- src/lib/libpthread/pthread.c:1.126 Fri Mar 2 18:06:05 2012
+++ src/lib/libpthread/pthread.c Thu Mar 8 16:33:45 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: pthread.c,v 1.126 2012/03/02 18:06:05 joerg Exp $ */
+/* $NetBSD: pthread.c,v 1.127 2012/03/08 16:33:45 joerg Exp $ */
/*-
* Copyright (c) 2001, 2002, 2003, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: pthread.c,v 1.126 2012/03/02 18:06:05 joerg Exp $");
+__RCSID("$NetBSD: pthread.c,v 1.127 2012/03/08 16:33:45 joerg Exp $");
#define __EXPOSE_STACK 1
@@ -1202,16 +1202,23 @@ pthread__initmainstack(void)
{
struct rlimit slimit;
const AuxInfo *aux;
+ size_t size;
_DIAGASSERT(_dlauxinfo() != NULL);
if (getrlimit(RLIMIT_STACK, &slimit) == -1)
err(1, "Couldn't get stack resource consumption limits");
- pthread__main.pt_stack.ss_size = slimit.rlim_cur;
+ size = slimit.rlim_cur;
+ pthread__main.pt_stack.ss_size = size;
for (aux = _dlauxinfo(); aux->a_type != AT_NULL; ++aux) {
if (aux->a_type == AT_STACKBASE) {
pthread__main.pt_stack.ss_sp = (void *)aux->a_v;
+#ifdef __MACHINE_STACK_GROWS_UP
+ pthread__main.pt_stack.ss_sp = (void *)aux->a_v;
+#else
+ pthread__main.pt_stack.ss_sp = (char *)aux->a_v - size;
+#endif
break;
}
}