summaryrefslogtreecommitdiff
path: root/.topmsg
blob: 38bf5ea4032178761384f3389f1bd167b132c7b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
COMMITED

From: Samuel Thibault <samuel.thibault@gnu.org>
Subject: [PATCH] hurd: add TLS support

2009-07-30  Samuel Thibault  <samuel.thibault@gnu.org>

	Add TLS support: __mach_setup_tls allocates and sets
	architecture state for the TLS area.  i386 fork needs to
	propagate the segment kernel definitions.

	* sysdeps/mach/hurd/bits/libc-lock.h [_LIBC - 0]: Include <tls.h>
	* sysdeps/mach/hurd/tls.h: Include <stdint.h> and <sysdep.h>
	* include/errno.h (__GNU__): Do not define TLS errno for now.

	* sysdeps/generic/thread_state.h (MACHINE_NEW_THREAD_STATE_FLAVOR): New
	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 (__i386_selector_is_ldt): New
	macro.
	(_hurd_tls_init): Use kern_return_t error type.  Use
	__i386_selector_is_ldt to test for LDT segment type.
	(_hurd_tls_fork): Use kern_return_t error type.  Duplicate existing LDT
	descriptor instead of creating a new one.
	(_hurd_tls_new): New function, creates a new descriptor and updates tcb.

	* mach/mach.h (__mach_setup_tls,mach_setup_tls): Add declarations.
	* mach/setup-thread.c: Include <ldsodefs.h>.
	(__mach_setup_thread): Use MACHINE_NEW_THREAD_STATE_FLAVOR instead of
	MACHINE_THREAD_STATE_FLAVOR.
	(__mach_setup_tls): New function.
	* hurd/hurdfault.c (_hurdsig_fault_init): Call
	MACHINE_THREAD_STATE_FIX_NEW.

	* sysdeps/mach/hurd/profil.c (update_waiter): Call __mach_setup_tls.
	* sysdeps/mach/hurd/setitimer.c (setitimer_locked): Call
	__mach_setup_tls.
	* hurd/hurdsig.c (_hurdsig_init): Call __mach_setup_tls.
	* sysdeps/mach/hurd/fork.c (__fork): Call _hurd_tls_fork for
	sigthread.  Pass kernel thread to _hurd_tls_fork.
	* sysdeps/mach/hurd/i386/init-first.c (init): Move ELF header parsing
	after getting up the environment pointer.  Call
	__pthread_initialize_minimal.
	* csu/libc-start.c (LIBC_START_MAIN) [__GNU__]: Do not call
	__pthread_initialize_minimal.