summaryrefslogtreecommitdiff
path: root/hurd/hurd/threadvar.h
diff options
context:
space:
mode:
Diffstat (limited to 'hurd/hurd/threadvar.h')
-rw-r--r--hurd/hurd/threadvar.h29
1 files changed, 21 insertions, 8 deletions
diff --git a/hurd/hurd/threadvar.h b/hurd/hurd/threadvar.h
index ff43598d2c..414e452db5 100644
--- a/hurd/hurd/threadvar.h
+++ b/hurd/hurd/threadvar.h
@@ -1,5 +1,5 @@
/* Internal per-thread variables for the Hurd.
- Copyright (C) 1994-2016 Free Software Foundation, Inc.
+ Copyright (C) 1994-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -22,6 +22,21 @@
#include <features.h>
#include <tls.h>
+/* The per-thread variables are found by ANDing this mask
+ with the value of the stack pointer and then adding this offset.
+
+ In the multi-threaded case, cthreads initialization sets
+ __hurd_threadvar_stack_mask to ~(cthread_stack_size - 1), a mask which
+ finds the base of the fixed-size cthreads stack; and
+ __hurd_threadvar_stack_offset to a small offset that skips the data
+ cthreads itself maintains at the base of each thread's stack.
+
+ In the single-threaded or libpthread case, __hurd_threadvar_stack_mask is
+ zero, so the stack pointer is ignored. */
+
+extern unsigned long int __hurd_threadvar_stack_mask;
+extern unsigned long int __hurd_threadvar_stack_offset;
+
/* The variables __hurd_sigthread_stack_base and
__hurd_sigthread_stack_end define the bounds of the stack used by the
signal thread, so that thread can always be specifically identified. */
@@ -29,13 +44,11 @@
extern unsigned long int __hurd_sigthread_stack_base;
extern unsigned long int __hurd_sigthread_stack_end;
-
-/* We do not use threadvars any more, this is kept as zero for compatibility with cthreads */
-extern unsigned long int __hurd_threadvar_stack_mask;
-extern unsigned long int __hurd_threadvar_stack_offset;
-extern unsigned int __hurd_threadvar_max;
-
+/* Store the MiG reply port reply port until we enable TLS. */
extern mach_port_t __hurd_reply_port0;
-#define __hurd_local_reply_port (*(__LIBC_NO_TLS() ? &__hurd_reply_port0 : &THREAD_SELF->reply_port))
+
+/* This returns either the TLS reply port variable, or a single-thread variable
+ when TLS is not initialized yet. */
+#define __hurd_local_reply_port (*(__LIBC_NO_TLS () ? &__hurd_reply_port0 : &THREAD_SELF->reply_port))
#endif /* hurd/threadvar.h */