diff options
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/aarch64/nptl/tls.h | 2 | ||||
-rw-r--r-- | sysdeps/alpha/nptl/tls.h | 2 | ||||
-rw-r--r-- | sysdeps/arm/nptl/tls.h | 2 | ||||
-rw-r--r-- | sysdeps/generic/tls.h | 7 | ||||
-rw-r--r-- | sysdeps/hppa/nptl/tls.h | 2 | ||||
-rw-r--r-- | sysdeps/ia64/nptl/tls.h | 2 | ||||
-rw-r--r-- | sysdeps/m68k/nptl/tls.h | 2 | ||||
-rw-r--r-- | sysdeps/mach/hurd/i386/tls.h | 75 | ||||
-rw-r--r-- | sysdeps/microblaze/nptl/tls.h | 2 | ||||
-rw-r--r-- | sysdeps/mips/nptl/tls.h | 2 | ||||
-rw-r--r-- | sysdeps/tile/nptl/tls.h | 2 |
11 files changed, 38 insertions, 62 deletions
diff --git a/sysdeps/aarch64/nptl/tls.h b/sysdeps/aarch64/nptl/tls.h index 8b260a1c69..ef8f3af90d 100644 --- a/sysdeps/aarch64/nptl/tls.h +++ b/sysdeps/aarch64/nptl/tls.h @@ -90,7 +90,7 @@ typedef struct /* Code to initially initialize the thread pointer. This might need special attention since 'errno' is not yet available and if the operation can cause a failure 'errno' must not be touched. */ -# define TLS_INIT_TP(tcbp, secondcall) \ +# define TLS_INIT_TP(tcbp) \ ({ __asm __volatile ("msr tpidr_el0, %0" : : "r" (tcbp)); NULL; }) /* Return the address of the dtv for the current thread. */ diff --git a/sysdeps/alpha/nptl/tls.h b/sysdeps/alpha/nptl/tls.h index b2e082d548..fbc579ac08 100644 --- a/sysdeps/alpha/nptl/tls.h +++ b/sysdeps/alpha/nptl/tls.h @@ -84,7 +84,7 @@ typedef struct /* Code to initially initialize the thread pointer. This might need special attention since 'errno' is not yet available and if the operation can cause a failure 'errno' must not be touched. */ -# define TLS_INIT_TP(tcbp, secondcall) \ +# define TLS_INIT_TP(tcbp) \ (__builtin_set_thread_pointer ((void *)(tcbp)), NULL) /* Return the address of the dtv for the current thread. */ diff --git a/sysdeps/arm/nptl/tls.h b/sysdeps/arm/nptl/tls.h index 1a2d606ba7..fc828d2e7f 100644 --- a/sysdeps/arm/nptl/tls.h +++ b/sysdeps/arm/nptl/tls.h @@ -91,7 +91,7 @@ typedef struct /* Code to initially initialize the thread pointer. This might need special attention since 'errno' is not yet available and if the operation can cause a failure 'errno' must not be touched. */ -# define TLS_INIT_TP(tcbp, secondcall) \ +# define TLS_INIT_TP(tcbp) \ ({ INTERNAL_SYSCALL_DECL (err); \ long result_var; \ result_var = INTERNAL_SYSCALL_ARM (set_tls, err, 1, (tcbp)); \ diff --git a/sysdeps/generic/tls.h b/sysdeps/generic/tls.h index fb3d965bb9..1c55f26b1b 100644 --- a/sysdeps/generic/tls.h +++ b/sysdeps/generic/tls.h @@ -59,12 +59,11 @@ use the value. - TLS_INIT_TP(tcb, firstcall) + TLS_INIT_TP(tcb) This macro must initialize the thread pointer to enable normal TLS - operation. The first parameter is a pointer to the thread control - block. The second parameter specifies whether this is the first - call for the TCB. ld.so calls this macro more than once. + operation. The parameter is a pointer to the thread control block. + ld.so calls this macro once. THREAD_DTV() diff --git a/sysdeps/hppa/nptl/tls.h b/sysdeps/hppa/nptl/tls.h index e4dc197945..6c721e0c64 100644 --- a/sysdeps/hppa/nptl/tls.h +++ b/sysdeps/hppa/nptl/tls.h @@ -95,7 +95,7 @@ typedef struct /* Code to initially initialize the thread pointer. This might need special attention since 'errno' is not yet available and if the operation can cause a failure 'errno' must not be touched. */ -# define TLS_INIT_TP(tcbp, secondcall) \ +# define TLS_INIT_TP(tcbp) \ ({ __set_cr27(tcbp); NULL; }) /* Return the address of the dtv for the current thread. */ diff --git a/sysdeps/ia64/nptl/tls.h b/sysdeps/ia64/nptl/tls.h index 3f9225a31f..3eca4e68be 100644 --- a/sysdeps/ia64/nptl/tls.h +++ b/sysdeps/ia64/nptl/tls.h @@ -118,7 +118,7 @@ register struct pthread *__thread_self __asm__("r13"); /* Code to initially initialize the thread pointer. This might need special attention since 'errno' is not yet available and if the operation can cause a failure 'errno' must not be touched. */ -# define TLS_INIT_TP(thrdescr, secondcall) \ +# define TLS_INIT_TP(thrdescr) \ (__thread_self = (thrdescr), INIT_SYSINFO, NULL) /* Return the address of the dtv for the current thread. */ diff --git a/sysdeps/m68k/nptl/tls.h b/sysdeps/m68k/nptl/tls.h index 471775a3b9..c1df875b5e 100644 --- a/sysdeps/m68k/nptl/tls.h +++ b/sysdeps/m68k/nptl/tls.h @@ -103,7 +103,7 @@ typedef struct /* Code to initially initialize the thread pointer. This might need special attention since 'errno' is not yet available and if the operation can cause a failure 'errno' must not be touched. */ -# define TLS_INIT_TP(tcbp, secondcall) \ +# define TLS_INIT_TP(tcbp) \ ({ \ INTERNAL_SYSCALL_DECL (err); \ int _sys_result; \ diff --git a/sysdeps/mach/hurd/i386/tls.h b/sysdeps/mach/hurd/i386/tls.h index 03741cd9fe..5b7abd0767 100644 --- a/sysdeps/mach/hurd/i386/tls.h +++ b/sysdeps/mach/hurd/i386/tls.h @@ -90,69 +90,46 @@ typedef struct static inline const char * __attribute__ ((unused)) -_hurd_tls_init (tcbhead_t *tcb, int secondcall) +_hurd_tls_init (tcbhead_t *tcb) { HURD_TLS_DESC_DECL (desc, tcb); - if (!secondcall) + /* This field is used by TLS accesses to get our "thread pointer" + from the TLS point of view. */ + tcb->tcb = tcb; + + /* Cache our thread port. */ + tcb->self = __mach_thread_self (); + + /* Get the first available selector. */ + int sel = -1; + error_t err = __i386_set_gdt (tcb->self, &sel, desc); + if (err == MIG_BAD_ID) { - /* This field is used by TLS accesses to get our "thread pointer" - from the TLS point of view. */ - tcb->tcb = tcb; - - /* Cache our thread port. */ - tcb->self = __mach_thread_self (); - - /* Get the first available selector. */ - int sel = -1; - error_t err = __i386_set_gdt (tcb->self, &sel, desc); - if (err == MIG_BAD_ID) - { - /* Old kernel, use a per-thread LDT. */ - sel = 0x27; - err = __i386_set_ldt (tcb->self, sel, &desc, 1); - assert_perror (err); - if (err) - return "i386_set_ldt failed"; - } - else if (err) - { - assert_perror (err); /* Separate from above with different line #. */ - return "i386_set_gdt failed"; - } - - /* Now install the new selector. */ - asm volatile ("mov %w0, %%gs" :: "q" (sel)); + /* Old kernel, use a per-thread LDT. */ + sel = 0x27; + err = __i386_set_ldt (tcb->self, sel, &desc, 1); + assert_perror (err); + if (err) + return "i386_set_ldt failed"; } - else + else if (err) { - /* Fetch the selector set by the first call. */ - int sel; - asm ("mov %%gs, %w0" : "=q" (sel) : "0" (0)); - if (__builtin_expect (sel, 0x50) & 4) /* LDT selector */ - { - error_t err = __i386_set_ldt (tcb->self, sel, &desc, 1); - assert_perror (err); - if (err) - return "i386_set_ldt failed"; - } - else - { - error_t err = __i386_set_gdt (tcb->self, &sel, desc); - assert_perror (err); - if (err) - return "i386_set_gdt failed"; - } + assert_perror (err); /* Separate from above with different line #. */ + return "i386_set_gdt failed"; } + /* Now install the new selector. */ + asm volatile ("mov %w0, %%gs" :: "q" (sel)); + return 0; } /* Code to initially initialize the thread pointer. This might need special attention since 'errno' is not yet available and if the operation can cause a failure 'errno' must not be touched. */ -# define TLS_INIT_TP(descr, secondcall) \ - _hurd_tls_init ((tcbhead_t *) (descr), (secondcall)) +# define TLS_INIT_TP(descr) \ + _hurd_tls_init ((tcbhead_t *) (descr)) /* Return the TCB address of the current thread. */ # define THREAD_SELF \ diff --git a/sysdeps/microblaze/nptl/tls.h b/sysdeps/microblaze/nptl/tls.h index 71f1dd990f..e75a30c9cf 100644 --- a/sysdeps/microblaze/nptl/tls.h +++ b/sysdeps/microblaze/nptl/tls.h @@ -98,7 +98,7 @@ static inline void *__microblaze_get_thread_area (void) /* Code to initially initialize the thread pointer. r21 is reserved for thread pointer. */ -# define TLS_INIT_TP(tcbp, secondcall) \ +# define TLS_INIT_TP(tcbp) \ ({ __asm __volatile ("or r21,r0,%0" : : "r" ((void *)tcbp)); 0; }) /* Return the address of the dtv for the current thread. */ diff --git a/sysdeps/mips/nptl/tls.h b/sysdeps/mips/nptl/tls.h index 754d4e47dc..d6fd83d31c 100644 --- a/sysdeps/mips/nptl/tls.h +++ b/sysdeps/mips/nptl/tls.h @@ -118,7 +118,7 @@ typedef struct /* Code to initially initialize the thread pointer. This might need special attention since 'errno' is not yet available and if the operation can cause a failure 'errno' must not be touched. */ -# define TLS_INIT_TP(tcbp, secondcall) \ +# define TLS_INIT_TP(tcbp) \ ({ INTERNAL_SYSCALL_DECL (err); \ long result_var; \ result_var = INTERNAL_SYSCALL (set_thread_area, err, 1, \ diff --git a/sysdeps/tile/nptl/tls.h b/sysdeps/tile/nptl/tls.h index 2a9bbc1b04..c93e8a88c3 100644 --- a/sysdeps/tile/nptl/tls.h +++ b/sysdeps/tile/nptl/tls.h @@ -106,7 +106,7 @@ register void *__thread_pointer asm ("tp"); # define GET_DTV(tcbp) (((tcbhead_t *) (tcbp))[-1].dtv) /* Code to initially initialize the thread pointer (tp). */ -# define TLS_INIT_TP(tcbp, secondcall) \ +# define TLS_INIT_TP(tcbp) \ (__thread_pointer = (char *)(tcbp) + TLS_TCB_OFFSET, NULL) /* Return the address of the dtv for the current thread. */ |