summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--nptl/ChangeLog10
-rw-r--r--nptl/allocatestack.c10
-rw-r--r--nptl/init.c4
-rw-r--r--nptl/sysdeps/i386/tls.h9
-rw-r--r--nptl/sysdeps/x86_64/tls.h7
5 files changed, 31 insertions, 9 deletions
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index 50042d6927..4ebc708733 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,4 +1,12 @@
-2007-05-24  Jakub Jelinek  <jakub@redhat.com>
+2007-04-24  Jakub Jelinek  <jakub@redhat.com>
+
+	* sysdeps/i386/tls.h (THREAD_SET_PRIVATE_FUTEX,
+	THREAD_COPY_PRIVATE_FUTEX): Define.
+	* sysdeps/x86_64/tls.h (THREAD_SET_PRIVATE_FUTEX,
+	THREAD_COPY_PRIVATE_FUTEX): Define.
+	* allocatestack.c (allocate_stack): Use THREAD_COPY_PRIVATE_FUTEX.
+	* init.c (__pthread_initialize_minimal_internal): Use
+	THREAD_SET_PRIVATE_FUTEX.
 
 	* sysdeps/powerpc/tls.h (tcbhead_t): Add gscope_flag.
 	(THREAD_GSCOPE_FLAG_UNUSED, THREAD_GSCOPE_FLAG_USED,
diff --git a/nptl/allocatestack.c b/nptl/allocatestack.c
index 9c9372b2a8..4ac04dbfa1 100644
--- a/nptl/allocatestack.c
+++ b/nptl/allocatestack.c
@@ -376,10 +376,9 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
       __pthread_multiple_threads = *__libc_multiple_threads_ptr = 1;
 #endif
 
-#ifndef __ASSUME_PRIVATE_FUTEX
+#ifdef THREAD_COPY_PRIVATE_FUTEX
       /* The thread must know when private futexes are supported.  */
-      pd->header.private_futex = THREAD_GETMEM (THREAD_SELF,
-						header.private_futex);
+      THREAD_COPY_PRIVATE_FUTEX (pd);
 #endif
 
 #ifdef NEED_DL_SYSINFO
@@ -516,10 +515,9 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
 	  __pthread_multiple_threads = *__libc_multiple_threads_ptr = 1;
 #endif
 
-#ifndef __ASSUME_PRIVATE_FUTEX
+#ifdef THREAD_COPY_PRIVATE_FUTEX
 	  /* The thread must know when private futexes are supported.  */
-	  pd->header.private_futex = THREAD_GETMEM (THREAD_SELF,
-						    header.private_futex);
+	  THREAD_COPY_PRIVATE_FUTEX (pd);
 #endif
 
 #ifdef NEED_DL_SYSINFO
diff --git a/nptl/init.c b/nptl/init.c
index ff81087d0c..03862a147f 100644
--- a/nptl/init.c
+++ b/nptl/init.c
@@ -276,7 +276,7 @@ __pthread_initialize_minimal_internal (void)
 #endif
     set_robust_list_not_avail ();
 
-#ifndef __ASSUME_PRIVATE_FUTEX
+#ifdef THREAD_SET_PRIVATE_FUTEX
   /* Private futexes are always used (at least internally) so that
      doing the test once this early is beneficial.  */
   {
@@ -284,7 +284,7 @@ __pthread_initialize_minimal_internal (void)
     res = INTERNAL_SYSCALL (futex, err, 3, &word,
 			    FUTEX_WAKE | FUTEX_PRIVATE_FLAG, 1);
     if (!INTERNAL_SYSCALL_ERROR_P (res, err))
-      THREAD_SETMEM (pd, header.private_futex, FUTEX_PRIVATE_FLAG);
+      THREAD_SET_PRIVATE_FUTEX (pd, FUTEX_PRIVATE_FLAG);
   }
 #endif
 
diff --git a/nptl/sysdeps/i386/tls.h b/nptl/sysdeps/i386/tls.h
index 41e4327b4a..90a8b50dad 100644
--- a/nptl/sysdeps/i386/tls.h
+++ b/nptl/sysdeps/i386/tls.h
@@ -459,6 +459,15 @@ union user_desc_init
   GL(dl_wait_lookup_done) ()
 
 
+#ifndef __ASSUME_PRIVATE_FUTEX
+# define THREAD_SET_PRIVATE_FUTEX(value) \
+  THREAD_SETMEM (THREAD_SELF, header.private_futex, value)
+# define THREAD_COPY_PRIVATE_FUTEX(descr) \
+  ((descr)->header.private_futex					      \
+   = THREAD_GETMEM (THREAD_SELF, header.private_futex))
+#endif
+
+
 #endif /* __ASSEMBLER__ */
 
 #endif	/* tls.h */
diff --git a/nptl/sysdeps/x86_64/tls.h b/nptl/sysdeps/x86_64/tls.h
index ab6efc47c3..cb3b474f97 100644
--- a/nptl/sysdeps/x86_64/tls.h
+++ b/nptl/sysdeps/x86_64/tls.h
@@ -364,6 +364,13 @@ typedef struct
 #define THREAD_GSCOPE_WAIT() \
   GL(dl_wait_lookup_done) ()
 
+#ifndef __ASSUME_PRIVATE_FUTEX
+# define THREAD_SET_PRIVATE_FUTEX(value) \
+  THREAD_SETMEM (THREAD_SELF, header.private_futex, value)
+# define THREAD_COPY_PRIVATE_FUTEX(descr) \
+  ((descr)->header.private_futex					      \
+   = THREAD_GETMEM (THREAD_SELF, header.private_futex))
+#endif
 
 #endif /* __ASSEMBLER__ */