about summary refs log tree commit diff
path: root/sysdeps/generic
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2018-03-17 03:17:36 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2018-03-17 03:17:36 +0100
commitf8baf2a2242029600beb213d3f042e7c0482e502 (patch)
tree43df708e6da8a0cb7520bb218d6ebfcecfe54c86 /sysdeps/generic
parentc553cd6f7e939ae4ef62b52b3c55fbe76dddecee (diff)
downloadglibc-f8baf2a2242029600beb213d3f042e7c0482e502.tar.gz
glibc-f8baf2a2242029600beb213d3f042e7c0482e502.tar.xz
glibc-f8baf2a2242029600beb213d3f042e7c0482e502.zip
hurd: add TLS support
	* sysdeps/generic/thread_state.h (MACHINE_NEW_THREAD_STATE_FLAVOR):
	Define macro.
	* sysdeps/mach/thread_state.h (MACHINE_THREAD_STATE_FIX_NEW): New macro.
	* sysdeps/mach/i386/thread_state.h
	(MACHINE_NEW_THREAD_STATE_FLAVOR): New macro, defined to
	i386_THREAD_STATE.
	(MACHINE_THREAD_STATE_FLAVOR): Define to i386_REGS_SEGS_STATE instead of
	i386_THREAD_STATE.
	(MACHINE_THREAD_STATE_FIX_NEW): New macro, reads segments.

	* sysdeps/mach/hurd/i386/trampoline.c (_hurd_setup_sighandler): Use
	i386_REGS_SEGS_STATE instead of i386_THREAD_STATE.

	* sysdeps/mach/hurd/i386/tls.h (TCB_ALIGNMENT, HURD_SEL_LDT): New
	macros.
	(_hurd_tls_fork): Add original thread parameter, Duplicate existing LDT
	descriptor instead of creating a new one.
	(_hurd_tls_new): New function, creates a new descriptor and updates tcb.

	* mach/setup-thread.c: Include <ldsodefs.h>.
	(__mach_setup_thread): Call _dl_allocate_tls, pass
	MACHINE_NEW_THREAD_STATE_FLAVOR to __thread_set_state instead of
	MACHINE_THREAD_STATE_FLAVOR, before getting
	MACHINE_THREAD_STATE_FLAVOR, calling _hurd_tls_new, and setting
	MACHINE_THREAD_STATE_FLAVOR with the result.
	* hurd/hurdfault.c (_hurdsig_fault_init): Call
	MACHINE_THREAD_STATE_FIX_NEW.
	* sysdeps/mach/hurd/fork.c (__fork): Call _hurd_tls_fork for sigthread
	too.  Add original thread parameter.
Diffstat (limited to 'sysdeps/generic')
-rw-r--r--sysdeps/generic/thread_state.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/sysdeps/generic/thread_state.h b/sysdeps/generic/thread_state.h
index 32994c313d..99b7c923e8 100644
--- a/sysdeps/generic/thread_state.h
+++ b/sysdeps/generic/thread_state.h
@@ -22,6 +22,11 @@
 
 /* Replace <machine> with "i386" or "mips" or whatever.  */
 
+/* This lets the kernel define architecture-specific registers for a new
+   thread.  */
+#define MACHINE_NEW_THREAD_STATE_FLAVOR	<machine>_NEW_THREAD_STATE
+/* This makes the kernel load all architectures-specific registers for the
+   thread.  */
 #define MACHINE_THREAD_STATE_FLAVOR	<machine>_THREAD_STATE
 #define MACHINE_THREAD_STATE_COUNT	<machine>_THREAD_STATE_COUNT