aboutsummaryrefslogtreecommitdiff
path: root/nptl/sysdeps
diff options
context:
space:
mode:
Diffstat (limited to 'nptl/sysdeps')
-rw-r--r--nptl/sysdeps/ia64/tcb-offsets.sym2
-rw-r--r--nptl/sysdeps/powerpc/tcb-offsets.sym11
-rw-r--r--nptl/sysdeps/powerpc/tls.h4
-rw-r--r--nptl/sysdeps/pthread/createthread.c8
-rw-r--r--nptl/sysdeps/sh/tcb-offsets.sym2
-rw-r--r--nptl/sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h2
-rw-r--r--nptl/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h3
-rw-r--r--nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep-cancel.h3
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h3
9 files changed, 22 insertions, 16 deletions
diff --git a/nptl/sysdeps/ia64/tcb-offsets.sym b/nptl/sysdeps/ia64/tcb-offsets.sym
index 9f92bb6..11cc06a 100644
--- a/nptl/sysdeps/ia64/tcb-offsets.sym
+++ b/nptl/sysdeps/ia64/tcb-offsets.sym
@@ -1,4 +1,4 @@
#include <sysdep.h>
#include <tls.h>
-MULTIPLE_THREADS_OFFSET -sizeof(int)
+MULTIPLE_THREADS_OFFSET offsetof (struct pthread, header.multiple_threads) - sizeof (struct pthread)
diff --git a/nptl/sysdeps/powerpc/tcb-offsets.sym b/nptl/sysdeps/powerpc/tcb-offsets.sym
index 58ee030..d6b7560 100644
--- a/nptl/sysdeps/powerpc/tcb-offsets.sym
+++ b/nptl/sysdeps/powerpc/tcb-offsets.sym
@@ -1,4 +1,13 @@
#include <sysdep.h>
#include <tls.h>
-MULTIPLE_THREADS_OFFSET ((void *) &p_multiple_threads ((struct pthread) ((void *) 0 - TLS_TCB_OFFSET - TLS_PRE_TCB_SIZE)) - (void *) 0)
+--
+
+-- Abuse tls.h macros to derive offsets relative to the thread register.
+# undef __thread_register
+# define __thread_register ((void *) 0)
+# define thread_offsetof(mem) ((void *) &THREAD_SELF->mem - (void *) 0)
+
+#if TLS_MULTIPLE_THREADS_IN_TCB
+MULTIPLE_THREADS_OFFSET thread_offsetof (header.multiple_threads)
+#endif
diff --git a/nptl/sysdeps/powerpc/tls.h b/nptl/sysdeps/powerpc/tls.h
index e3e0424..6573bb6 100644
--- a/nptl/sysdeps/powerpc/tls.h
+++ b/nptl/sysdeps/powerpc/tls.h
@@ -81,7 +81,9 @@ typedef struct
# define TLS_TCB_ALIGN __alignof__ (struct pthread)
/* This is the size we need before TCB. */
-# define TLS_PRE_TCB_SIZE (sizeof (struct pthread) + 32)
+# define TLS_PRE_TCB_SIZE \
+ (sizeof (struct pthread) \
+ + ((sizeof (tcbhead_t) + TLS_TCB_ALIGN - 1) & ~(TLS_TCB_ALIGN - 1)))
# ifndef __powerpc64__
/* Register r2 (tp) is reserved by the ABI as "thread pointer". */
diff --git a/nptl/sysdeps/pthread/createthread.c b/nptl/sysdeps/pthread/createthread.c
index f5c6406..9d00e4e 100644
--- a/nptl/sysdeps/pthread/createthread.c
+++ b/nptl/sysdeps/pthread/createthread.c
@@ -87,11 +87,7 @@ create_thread (struct pthread *pd, STACK_VARIABLES_PARMS)
thread might not yet have the flag set. No need to set
the global variable again if this is what we use. */
#ifdef TLS_MULTIPLE_THREADS_IN_TCB
-# if TLS_DTV_AT_TP
- p_multiple_threads (THREAD_SELF) = 1;
-# else
THREAD_SETMEM (THREAD_SELF, header.multiple_threads, 1);
-# endif
#endif
/* Now fill in the information about the new thread in
@@ -163,11 +159,7 @@ create_thread (struct pthread *pd, STACK_VARIABLES_PARMS)
not yet have the flag set. No need to set the global variable
again if this is what we use. */
#ifdef TLS_MULTIPLE_THREADS_IN_TCB
-# if TLS_DTV_AT_TP
- p_multiple_threads (THREAD_SELF) = 1;
-# else
THREAD_SETMEM (THREAD_SELF, header.multiple_threads, 1);
-# endif
#endif
return 0;
diff --git a/nptl/sysdeps/sh/tcb-offsets.sym b/nptl/sysdeps/sh/tcb-offsets.sym
index 940c933..3386f1d 100644
--- a/nptl/sysdeps/sh/tcb-offsets.sym
+++ b/nptl/sysdeps/sh/tcb-offsets.sym
@@ -1,5 +1,5 @@
#include <sysdep.h>
#include <tls.h>
-MULTIPLE_THREADS_OFFSET ((char *) &p_multiple_threads ((struct pthread *)0) - (char *) 0)
+MULTIPLE_THREADS_OFFSET offsetof (struct pthread, header.multiple_threads)
TLS_PRE_TCB_SIZE sizeof (struct pthread)
diff --git a/nptl/sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h b/nptl/sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h
index 930cc14..667abce 100644
--- a/nptl/sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h
+++ b/nptl/sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h
@@ -101,7 +101,7 @@ __syscall_error_##args: \
# ifndef __ASSEMBLER__
# define SINGLE_THREAD_P \
- __builtin_expect (p_multiple_threads (THREAD_SELF) == 0, 1)
+ __builtin_expect (THREAD_GETMEM (THREAD_SELF, header.multiple_threads) == 0, 1)
# else
# define SINGLE_THREAD_P \
adds r14 = MULTIPLE_THREADS_OFFSET, r13 ;; ld4 r14 = [r14] ;; cmp4.ne p6, p7 = 0, r14
diff --git a/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h b/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h
index f82addb..d256f8d 100644
--- a/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h
+++ b/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h
@@ -86,7 +86,8 @@
# ifndef __ASSEMBLER__
# define SINGLE_THREAD_P \
- __builtin_expect (p_multiple_threads (THREAD_SELF) == 0, 1)
+ __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
+ header.multiple_threads) == 0, 1)
# else
# define SINGLE_THREAD_P \
lwz 10,MULTIPLE_THREADS_OFFSET(2); \
diff --git a/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep-cancel.h b/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep-cancel.h
index 00dc3a2..5483586 100644
--- a/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep-cancel.h
+++ b/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep-cancel.h
@@ -86,7 +86,8 @@
# ifndef __ASSEMBLER__
# define SINGLE_THREAD_P \
- __builtin_expect (p_multiple_threads (THREAD_SELF) == 0, 1)
+ __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
+ header.multiple_threads) == 0, 1)
# else
# define SINGLE_THREAD_P \
lwz 10,MULTIPLE_THREADS_OFFSET(13); \
diff --git a/nptl/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h b/nptl/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h
index 10189a4..16f8ad5 100644
--- a/nptl/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h
+++ b/nptl/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h
@@ -117,7 +117,8 @@
# ifndef __ASSEMBLER__
# define SINGLE_THREAD_P \
- __builtin_expect (p_multiple_threads (THREAD_SELF) == 0, 1)
+ __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
+ header.multiple_threads) == 0, 1)
# else
# define SINGLE_THREAD_P \
stc gbr,r0; \