summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1994-05-04 13:07:56 +0000
committerRoland McGrath <roland@gnu.org>1994-05-04 13:07:56 +0000
commit8a585a52b98e1999dfc97dd6bc716d4a2dcdfe1e (patch)
treec357aee2c01bb90495036d4dd4e93dcca837a325
parenteeb78d1cccbbeea72214513be98e8548486d3b23 (diff)
Formerly stack.c.~2~
-rw-r--r--libthreads/stack.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/libthreads/stack.c b/libthreads/stack.c
index 2764470f..d82b4e81 100644
--- a/libthreads/stack.c
+++ b/libthreads/stack.c
@@ -275,6 +275,10 @@ probe_stack(stack_bottom, stack_top)
*stack_top = last_end_addr;
}
+/* For GNU: */
+unsigned long int __hurd_threadvar_stack_mask;
+unsigned long int __hurd_threadvar_stack_offset;
+
vm_offset_t
stack_init(p)
cproc_t p;
@@ -304,6 +308,9 @@ stack_init(p)
cthread_stack_mask = cthread_stack_size - 1;
#endif STACK_GROWTH_UP
+ /* Set up the variables so GNU can find its per-thread variables. */
+ __hurd_threadvar_stack_mask = cthread_stack_mask;
+
/*
* Guess at first available region for stack.
*/
@@ -328,11 +335,18 @@ 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.
*/
- return cproc_stack_base(p, sizeof(ur_cthread_t *));
+ return cproc_stack_base(p,
+ sizeof(ur_cthread_t *) +
+ /* Account for GNU per-thread variables. */
+ __hurd_threadvar_max * sizeof (long int));
}
/*