]> sourceware.org Git - glibc.git/commitdiff
Update.
authorUlrich Drepper <drepper@redhat.com>
Fri, 25 Apr 2003 22:28:13 +0000 (22:28 +0000)
committerUlrich Drepper <drepper@redhat.com>
Fri, 25 Apr 2003 22:28:13 +0000 (22:28 +0000)
* pthread.c (__pthread_initialize_manager): Subtract
TLS_PRE_TCB_SIZE bytes from tcbp to get to descr.
* manager.c (pthread_handle_create): Subtract or add TLS_PRE_TCB_SIZE
instead of sizeof (pthread_descr).
(pthread_free): Add TLS_PRE_TCB_SIZE instead of sizeof (pthread_descr).
* sysdeps/powerpc/tls.h (TLS_INIT_TCB_SIZE, TLS_TCB_SIZE): Define to 0.

17 files changed:
linuxthreads/ChangeLog
linuxthreads/manager.c
linuxthreads/sysdeps/powerpc/powerpc32/tcb-offsets.sym [deleted file]
linuxthreads/sysdeps/powerpc/tcb-offsets.sym [new file with mode: 0644]
linuxthreads/sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h
nptl/ChangeLog
nptl/allocatestack.c
nptl/descr.h
nptl/sysdeps/ia64/tcb-offsets.sym
nptl/sysdeps/powerpc/tcb-offsets.sym
nptl/sysdeps/powerpc/tls.h
nptl/sysdeps/pthread/createthread.c
nptl/sysdeps/sh/tcb-offsets.sym
nptl/sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h
nptl/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h
nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep-cancel.h
nptl/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h

index b8cd2282dfbadeb5e9bead4992be559dbef7199e..061f0ad318d73d2d7ab18d822e30188f88d0cc85 100644 (file)
@@ -1,16 +1,11 @@
 2003-04-22  Jakub Jelinek  <jakub@redhat.com>
 
-       * descr.h (p_multiple_threads): Define as function-like macro.
-       (struct _pthread_descr_struct) [TLS_MULTIPLE_THREADS_IN_TCB]:
-       Move multiple_threads to last int in the structure.
-       * pthread.c (__pthread_initialize_manager): Use p_multiple_threads
-       macro.  Subtract TLS_PRE_TCB_SIZE bytes from tcbp to get to descr.
-       * manager.c (pthread_handle_create): Use p_multiple_threads macro.
-       Subtract or add TLS_PRE_TCB_SIZE instead of sizeof (pthread_descr).
-       (pthread_free): Add TLS_PRE_TCB_SIZE instead of
-       sizeof (pthread_descr).
-       * sysdeps/powerpc/tls.h: Don't include tcb-offsets.h.
-       (TLS_INIT_TCB_SIZE, TLS_TCB_SIZE): Define to 0.
+       * pthread.c (__pthread_initialize_manager): Subtract
+       TLS_PRE_TCB_SIZE bytes from tcbp to get to descr.
+       * manager.c (pthread_handle_create): Subtract or add TLS_PRE_TCB_SIZE
+       instead of sizeof (pthread_descr).
+       (pthread_free): Add TLS_PRE_TCB_SIZE instead of sizeof (pthread_descr).
+       * sysdeps/powerpc/tls.h (TLS_INIT_TCB_SIZE, TLS_TCB_SIZE): Define to 0.
        (TLS_INIT_TCB_ALIGN, TLS_TCB_ALIGN): Define to alignment of
        pthread_descr.
        (TLS_PRE_TCB_SIZE): Increase to cover tcbhead_t preceeded by pad
        (TLS_INIT_TP, THREAD_SELF, INIT_THREAD_SELF): Don't add TLS_TCB_SIZE
        unneccessarily.
        (NO_TLS_OFFSET): Define.
-       * sysdeps/powerpc/powerpc32/tcb-offsets.sym: New file.
-       * sysdeps/powerpc/tcb-offsets.sym: Removed.
-       * sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h: Include
-       tcb-offsets.h if __ASSEMBLER__.
-       (SINGLE_THREAD_P): Use p_multiple_threads macro.
-       * sysdeps/ia64/tcb-offsets.sym (MULTIPLE_THREADS): Define to
-       -sizeof(int).
-       * sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h (SINGLE_THREAD_P):
-       Use p_multiple_threads macro.
-       * sysdeps/unix/sysv/linux/sh/sysdep-cancel.h (SINGLE_THREAD_P):
-       Likewise.
-       * sysdeps/sh/tcb-offsets.sym (MULTIPLE_THREADS): Likewise.
 
 2003-04-22  Roland McGrath  <roland@redhat.com>
 
index b4893c19f21999c36be076b8103e67b1736f4832..91620a2cc4abc8d6fbecccf42e98a733acb2a24d 100644 (file)
@@ -643,7 +643,7 @@ static int pthread_handle_create(pthread_t *thread, const pthread_attr_t *attr,
   new_thread->p_header.data.self = new_thread;
 #endif
 #if TLS_MULTIPLE_THREADS_IN_TCB || !defined USE_TLS || !TLS_DTV_AT_TP
-  p_multiple_threads (new_thread) = 1;
+  new_thread->p_multiple_threads = 1;
 #endif
   new_thread->p_tid = new_thread_id;
   new_thread->p_lock = &(__pthread_handles[sseg].h_lock);
diff --git a/linuxthreads/sysdeps/powerpc/powerpc32/tcb-offsets.sym b/linuxthreads/sysdeps/powerpc/powerpc32/tcb-offsets.sym
deleted file mode 100644 (file)
index 8c6bddb..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <sysdep.h>
-#include <tls.h>
-
---
-#ifdef USE_TLS
-MULTIPLE_THREADS_OFFSET        ((void *) &p_multiple_threads ((pthread_descr) ((void *) 0 - TLS_TCB_OFFSET - TLS_PRE_TCB_SIZE)) - (void *) 0)
-#else
-MULTIPLE_THREADS_OFFSET        offsetof (tcbhead_t, multiple_threads)
-#endif
diff --git a/linuxthreads/sysdeps/powerpc/tcb-offsets.sym b/linuxthreads/sysdeps/powerpc/tcb-offsets.sym
new file mode 100644 (file)
index 0000000..bb4226f
--- /dev/null
@@ -0,0 +1,24 @@
+#include <sysdep.h>
+#include <tls.h>
+
+--
+
+-- This could go into powerpc32/ instead and conditionalize #include of it.
+#ifndef __powerpc64__
+
+# ifdef USE_TLS
+
+-- 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->p_##mem - (void *) 0)
+
+# else
+
+#  define thread_offsetof(mem) offsetof (tcbhead_t, mem)
+
+# endif
+
+MULTIPLE_THREADS_OFFSET                thread_offsetof (multiple_threads)
+
+#endif
index 7982d272d859ffc5d6e2ba17bb8a313fcbee654c..af45b19356d283d0c0819954543c7c5c0c084c0b 100644 (file)
@@ -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, p_multiple_threads) == 0, 1)
 # else
 #  define SINGLE_THREAD_P \
   adds r14 = MULTIPLE_THREADS_OFFSET, r13 ;; ld4 r14 = [r14] ;; cmp4.ne p6, p7 = 0, r14
index 8e76d9e417a611efc37dcdfbd8396a95b9478387..d88e60acd33626780431802b1f624444a069c766 100644 (file)
@@ -1,12 +1,9 @@
 2003-04-22  Jakub Jelinek  <jakub@redhat.com>
 
-       * descr.h (p_multiple_threads): Define.
-       (struct pthread) [TLS_MULTIPLE_THREADS_IN_TCB]: Move
-       multiple_threads to last int in the structure.
        * allocatestack.c (TLS_TPADJ): Add TLS_PRE_TCB_SIZE instead of
        sizeof (struct pthread).
        (allocate_stack): Subtract TLS_PRE_TCB_SIZE bytes instead of
-       1 struct pthread.  Use p_multiple_threads macro.
+       1 struct pthread.
        * sysdeps/pthread/createthread.c (create_thread): Use
        p_multiple_threads macro if TLS_DTV_AT_TP.
        * sysdeps/powerpc/tls.h (TLS_INIT_TCB_SIZE, TLS_TCB_SIZE): Define
        (TLS_INIT_TP, THREAD_SELF, INIT_THREAD_SELF): Don't add TLS_TCB_SIZE
        unneccessarily.
        (NO_TLS_OFFSET): Define.
-       * sysdeps/powerpc/tcb-offsets.sym (MULTIPLE_THREADS): Use
-       p_multiple_threads macro.
-       * sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h
-       (SINGLE_THREAD_P): Likewise.
-       * sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep-cancel.h
-       (SINGLE_THREAD_P): Likewise.
        * sysdeps/unix/sysv/linux/powerpc/createthread.c (TLS_VALUE): Don't
        add TLS_TCB_SIZE unnecessarily.
-       * sysdeps/ia64/tcb-offsets.sym (MULTIPLE_THREADS): Define to
-       -sizeof(int).
-       * sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h (SINGLE_THREAD_P):
-       Use p_multiple_threads macro.
-       * sysdeps/sh/tcb-offsets.sym (MULTIPLE_THREADS): Likewise.
-       * sysdeps/unix/sysv/linux/sh/sysdep-cancel.h (SINGLE_THREAD_P):
-       Likewise.
 
 2003-04-22  Roland McGrath  <roland@redhat.com>
 
index c6b89d873e12c1160d2b16aa5c93bf8d82eaf6db..680f365e04a1d4c0d1f0d99467c0be4da9c236db 100644 (file)
@@ -322,7 +322,7 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
 
 #ifdef TLS_MULTIPLE_THREADS_IN_TCB
       /* This is at least the second thread.  */
-      p_multiple_threads (pd) = 1;
+      pd->header.multiple_threads = 1;
 #else
       __pthread_multiple_threads = *__libc_multiple_threads_ptr = 1;
 #endif
@@ -449,7 +449,7 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
 
 #ifdef TLS_MULTIPLE_THREADS_IN_TCB
          /* This is at least the second thread.  */
-         p_multiple_threads (pd) = 1;
+         pd->header.multiple_threads = 1;
 #else
          __pthread_multiple_threads = *__libc_multiple_threads_ptr = 1;
 #endif
index 7fd64ecb39157bd4b36af488e795c9e30a852f80..efb25c7479c236ba897a8d36edd0c5a58e880958 100644 (file)
@@ -99,7 +99,11 @@ struct pthread
 #if !TLS_DTV_AT_TP
     /* This overlaps the TCB as used for TLS without threads (see tls.h).  */
     tcbhead_t header;
-# define p_multiple_threads(descr) (descr)->header.multiple_threads
+#elif TLS_MULTIPLE_THREADS_IN_TCB
+    struct
+    {
+      int multiple_threads;
+    } header;
 #endif
 
     /* This extra padding has no special purpose, and this structure layout
@@ -228,21 +232,6 @@ struct pthread
   size_t stackblock_size;
   /* Size of the included guard area.  */
   size_t guardsize;
-
-#if TLS_DTV_AT_TP && TLS_MULTIPLE_THREADS_IN_TCB
-  /* Must come last.  */
-  int __multiple_threads;
-# define p_multiple_threads(descr) \
-  ((union                                                      \
-    {                                                          \
-      struct pthread s;                                                \
-      struct                                                   \
-       {                                                       \
-         char dummy[sizeof (struct pthread) - sizeof (int)];   \
-         int multiple_threads;                                 \
-       } m;                                                    \
-    } *)(descr)->m.multiple_threads)
-#endif
 } __attribute ((aligned (TCB_ALIGNMENT)));
 
 
index 9f92bb62cdcf1a8743db945c2a23206063c07245..11cc06ab31946708e6bff035ddb2bc53bcd0a67c 100644 (file)
@@ -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)
index 58ee03072ea5a4e323b4aef577ce88633854cdf1..d6b7560b8e3b0aec6c5548dfc0a814dda41851a0 100644 (file)
@@ -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
index e3e0424fe0e117b2a21c75c086ed8e3f9adba1b4..6573bb6b04a4051559ecaa8ab9461a25b60bff4f 100644 (file)
@@ -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". */
index f5c640607af69a7c6f1e5ce01e67bfba59acd928..9d00e4e1355ac77ffafbf18934a6f7e1a17cc011 100644 (file)
@@ -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;
index 940c933edf1fa174123ce0531bb03077f8f6495c..3386f1d056bea27e8c2a82c0d34c3a74748140af 100644 (file)
@@ -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)
index 930cc14e45ddb7e744d43c9f59a3e389ac9731fc..667abce34066c7ae3af228798c0322602f0e0b82 100644 (file)
@@ -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
index f82addb3ad2611bf1fe14dd87b7c10d4bc45ffe4..d256f8d8b20c538a03631d151fa2eb3c2de5f63f 100644 (file)
@@ -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);                                   \
index 00dc3a2a6a834fc89da8509602b9879ec9420475..5483586c7bdb1c0608ecd7fd1d2705086c33b7cd 100644 (file)
@@ -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);                                \
index 10189a49b5f8280dd647608b51a58add1e8e48b9..16f8ad5e0f437d3ce3aee9696117d244c839e94e 100644 (file)
 
 # 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; \
This page took 0.062301 seconds and 5 git commands to generate.