summaryrefslogtreecommitdiff
path: root/libthreads/stack.c
diff options
context:
space:
mode:
Diffstat (limited to 'libthreads/stack.c')
-rw-r--r--libthreads/stack.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/libthreads/stack.c b/libthreads/stack.c
index dd2ba9bd..d6dd9fff 100644
--- a/libthreads/stack.c
+++ b/libthreads/stack.c
@@ -25,7 +25,21 @@
*/
/*
* HISTORY
- * $Log: stack.c,v $
+ * $Log: stack.c,v $
+ * Revision 1.8 2002/05/27 02:50:41 roland
+ * 2002-05-26 Roland McGrath <roland@frob.com>
+ *
+ * Changes merged from CMU MK83a version:
+ * * cthreads.h, options.h: Various cleanups.
+ * * call.c, cthread_data.c, sync.c, mig_support.c, stack.c: Likewise.
+ * * i386/cthreads.h, i386/thread.c, i386/lock.s: Likewise.
+ * * cthread_internals.h: Add decls for internal functions.
+ * (struct cproc): Use vm_offset_t for stack_base and stack_size members.
+ * Use natural_t for context member.
+ * * cprocs.c: Use prototypes for all defns.
+ * * cthreads.c: Likewise.
+ * (cthread_exit): Cast any_t to integer_t before int.
+ *
* Revision 2.14 93/01/14 18:05:58 danner
* Converted file to ANSI C.
* [92/12/18 pds]
@@ -317,6 +331,18 @@ stack_init(cproc_t p)
cthread_stack_mask = cthread_stack_size - 1;
#endif /* defined(STACK_GROWTH_UP) */
+ /* Set up the variables so GNU can find its per-thread variables. */
+ __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.
*/