summaryrefslogtreecommitdiff
path: root/libthreads
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1994-05-05 16:00:09 +0000
committerRoland McGrath <roland@gnu.org>1994-05-05 16:00:09 +0000
commit75f928ffd9b3455a6ddb0737d60bb6e4bd3f8726 (patch)
treefde1d50c8c4ca31b1f0627860d6f7f838a0fc1fb /libthreads
parent656dfd991c7d4cc9aef9073d4d6782314685c221 (diff)
entered into RCS
Diffstat (limited to 'libthreads')
-rw-r--r--libthreads/stack.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/libthreads/stack.c b/libthreads/stack.c
index 2cb50d91..322934a1 100644
--- a/libthreads/stack.c
+++ b/libthreads/stack.c
@@ -279,6 +279,7 @@ probe_stack(stack_bottom, stack_top)
/* For GNU: */
unsigned long int __hurd_threadvar_stack_mask;
unsigned long int __hurd_threadvar_stack_offset;
+unsigned int __hurd_threadvar_max;
vm_offset_t
stack_init(p)
@@ -310,7 +311,16 @@ stack_init(p)
#endif STACK_GROWTH_UP
/* Set up the variables so GNU can find its per-thread variables. */
- __hurd_threadvar_stack_mask = cthread_stack_mask;
+ __hurd_threadvar_stack_mask = ~(cthread_stack_size - 1);
+ /* The GNU per-thread variables will be stored just after the
+ cthread-self pointer at the base of the stack. */
+#ifdef STACK_GROWTH_UP
+ __hurd_threadvar_stack_offset = sizeof (ur_cthread_t *);
+#else
+ __hurd_threadvar_stack_offset = (cthread_stack_size -
+ sizeof (ur_cthread_t *) -
+ __hurd_threadvar_max * sizeof (long));
+#endif
/*
* Guess at first available region for stack.
@@ -336,10 +346,6 @@ stack_init(p)
#endif STACK_GROWTH_UP
MACH_CALL(vm_deallocate(mach_task_self(),start,size),r);
- /* The GNU per-thread variables will be stored just after the
- cthread-self pointer at the base of the stack. */
- __hurd_threadvar_stack_offset = sizeof (ur_cthread_t *);
-
/*
* Return new stack; it gets passed back to the caller
* of cthread_init who must switch to it.