about summary refs log tree commit diff
path: root/nptl/sysdeps/unix/sysv/linux/ia64
diff options
context:
space:
mode:
Diffstat (limited to 'nptl/sysdeps/unix/sysv/linux/ia64')
-rw-r--r--nptl/sysdeps/unix/sysv/linux/ia64/__ia64_longjmp.S5
-rw-r--r--nptl/sysdeps/unix/sysv/linux/ia64/bits/pthreadtypes.h13
-rw-r--r--nptl/sysdeps/unix/sysv/linux/ia64/clone2.S11
-rw-r--r--nptl/sysdeps/unix/sysv/linux/ia64/createthread.c4
-rw-r--r--nptl/sysdeps/unix/sysv/linux/ia64/dl-sysdep.h4
-rw-r--r--nptl/sysdeps/unix/sysv/linux/ia64/jmpbuf-unwind.h39
-rw-r--r--nptl/sysdeps/unix/sysv/linux/ia64/lowlevellock.h85
-rw-r--r--nptl/sysdeps/unix/sysv/linux/ia64/pt-initfini.c95
-rw-r--r--nptl/sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h8
-rw-r--r--nptl/sysdeps/unix/sysv/linux/ia64/unwind-forcedunwind.c3
10 files changed, 122 insertions, 145 deletions
diff --git a/nptl/sysdeps/unix/sysv/linux/ia64/__ia64_longjmp.S b/nptl/sysdeps/unix/sysv/linux/ia64/__ia64_longjmp.S
index 1ceb210c2f..a1120d4d72 100644
--- a/nptl/sysdeps/unix/sysv/linux/ia64/__ia64_longjmp.S
+++ b/nptl/sysdeps/unix/sysv/linux/ia64/__ia64_longjmp.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999, 2000, 2001, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2000, 2001, 2004, 2005 Free Software Foundation, Inc.
    Contributed by David Mosberger-Tang <davidm@hpl.hp.com>.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -102,6 +102,9 @@ LEAF(__ia64_longjmp)
 	;;
 	ld8.nta r20=[r2],16		// b4
 	ld8.nta r21=[r3],16		// b5
+#ifdef PTR_DEMANGLE
+	PTR_DEMANGLE (r16, r24)
+#endif
 	;;
 	ld8.nta r11=[r2],16		// ar.pfs
 	ld8.nta r22=[r3],56		// ar.lc
diff --git a/nptl/sysdeps/unix/sysv/linux/ia64/bits/pthreadtypes.h b/nptl/sysdeps/unix/sysv/linux/ia64/bits/pthreadtypes.h
index afb8800ac9..892769dca4 100644
--- a/nptl/sysdeps/unix/sysv/linux/ia64/bits/pthreadtypes.h
+++ b/nptl/sysdeps/unix/sysv/linux/ia64/bits/pthreadtypes.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
 
@@ -43,11 +43,18 @@ typedef union
 } pthread_attr_t;
 
 
+typedef struct __pthread_internal_list
+{
+  struct __pthread_internal_list *__prev;
+  struct __pthread_internal_list *__next;
+} __pthread_list_t;
+
+
 /* Data structures for mutex handling.  The structure of the attribute
    type is not exposed on purpose.  */
 typedef union
 {
-  struct
+  struct __pthread_mutex_s
   {
     int __lock;
     unsigned int __count;
@@ -57,6 +64,8 @@ typedef union
        binary compatibility.  */
     int __kind;
     int __spins;
+    __pthread_list_t __list;
+#define __PTHREAD_MUTEX_HAVE_PREV	1
   } __data;
   char __size[__SIZEOF_PTHREAD_MUTEX_T];
   long int __align;
diff --git a/nptl/sysdeps/unix/sysv/linux/ia64/clone2.S b/nptl/sysdeps/unix/sysv/linux/ia64/clone2.S
index 8664056f27..91f28bab37 100644
--- a/nptl/sysdeps/unix/sysv/linux/ia64/clone2.S
+++ b/nptl/sysdeps/unix/sysv/linux/ia64/clone2.S
@@ -1,2 +1,9 @@
-#define RESET_PID
-#include <sysdeps/unix/sysv/linux/ia64/clone2.S>
+/* We want an #include_next, but we are the main source file.
+   So, #include ourselves and in that incarnation we can use #include_next.  */
+#ifndef INCLUDED_SELF
+# define INCLUDED_SELF
+# include <clone2.S>
+#else
+# define RESET_PID
+# include_next <clone2.S>
+#endif
diff --git a/nptl/sysdeps/unix/sysv/linux/ia64/createthread.c b/nptl/sysdeps/unix/sysv/linux/ia64/createthread.c
index 8ac06e8101..cd5f8137d5 100644
--- a/nptl/sysdeps/unix/sysv/linux/ia64/createthread.c
+++ b/nptl/sysdeps/unix/sysv/linux/ia64/createthread.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jakub Jelinek <jakub@redhat.com>.
 
@@ -18,7 +18,7 @@
    02111-1307 USA.  */
 
 /* Value passed to 'clone' for initialization of the thread register.  */
-#define TLS_VALUE (pd + 1)
+#define TLS_VALUE ((char *) pd + TLS_PRE_TCB_SIZE)
 
 #define ARCH_CLONE __clone2
 
diff --git a/nptl/sysdeps/unix/sysv/linux/ia64/dl-sysdep.h b/nptl/sysdeps/unix/sysv/linux/ia64/dl-sysdep.h
index af835c44b1..525b622a68 100644
--- a/nptl/sysdeps/unix/sysv/linux/ia64/dl-sysdep.h
+++ b/nptl/sysdeps/unix/sysv/linux/ia64/dl-sysdep.h
@@ -1,5 +1,5 @@
 /* System-specific settings for dynamic linker code.  IA-64 version.
-   Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2004, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -57,7 +57,7 @@ extern int _dl_sysinfo_break attribute_hidden;
        ".body\n\t"				\
        "break 0x100000;\n\t"			\
        "br.ret.sptk.many b6;\n\t"		\
-       ".endp _dl_sysinfo_break"		\
+       ".endp _dl_sysinfo_break\n\t"		\
        ".previous");
 #endif
 
diff --git a/nptl/sysdeps/unix/sysv/linux/ia64/jmpbuf-unwind.h b/nptl/sysdeps/unix/sysv/linux/ia64/jmpbuf-unwind.h
deleted file mode 100644
index c6ef5f7fbd..0000000000
--- a/nptl/sysdeps/unix/sysv/linux/ia64/jmpbuf-unwind.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <setjmp.h>
-#include <stdint.h>
-#include <unwind.h>
-
-#define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \
-  ({ uintptr_t _cfa = (uintptr_t) _Unwind_GetCFA (_context) - (_adj);	\
-     (_cfa < (uintptr_t)(((long *)(_jmpbuf))[0]) - (_adj)		\
-      || (_cfa == (uintptr_t)(((long *)(_jmpbuf))[0]) - (_adj)		\
-	  && (uintptr_t) _Unwind_GetBSP (_context) - (_adj)		\
-	     >= (uintptr_t)(((long *)(_jmpbuf))[17]) - (_adj)));	\
-  })
-
-#define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \
-  ((uintptr_t)(_address) - (_adj) < (uintptr_t)(((long *)_jmpbuf)[0]) - (_adj))
-
-/* We use a longjmp() which can cross from the alternate signal-stack
-   to the normal stack.  */
-extern void __libc_unwind_longjmp (sigjmp_buf env, int val)
-          __attribute__ ((noreturn));
-hidden_proto (__libc_unwind_longjmp)
diff --git a/nptl/sysdeps/unix/sysv/linux/ia64/lowlevellock.h b/nptl/sysdeps/unix/sysv/linux/ia64/lowlevellock.h
index e13358ffef..8df997a262 100644
--- a/nptl/sysdeps/unix/sysv/linux/ia64/lowlevellock.h
+++ b/nptl/sysdeps/unix/sysv/linux/ia64/lowlevellock.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
 
@@ -31,6 +31,11 @@
 #define FUTEX_WAKE		1
 #define FUTEX_REQUEUE		3
 #define FUTEX_CMP_REQUEUE	4
+#define FUTEX_WAKE_OP		5
+#define FUTEX_OP_CLEAR_WAKE_IF_GT_ONE	((4 << 24) | 1)
+#define FUTEX_LOCK_PI		6
+#define FUTEX_UNLOCK_PI		7
+#define FUTEX_TRYLOCK_PI	8
 
 /* Delay in spinlock loop.  */
 #define BUSY_WAIT_NOP          asm ("hint @pause")
@@ -53,6 +58,15 @@
    _r10 == -1 ? -_retval : _retval;					\
 })
 
+#define lll_robust_mutex_dead(futexv)					\
+do									\
+  {									\
+    int *__futexp = &(futexv);						\
+    atomic_or (__futexp, FUTEX_OWNER_DIED);				\
+    DO_INLINE_SYSCALL(futex, 3, (long) __futexp, FUTEX_WAKE, 1);	\
+  }									\
+while (0)
+
 /* Returns non-zero if error happened, zero if success.  */
 #define lll_futex_requeue(ftx, nr_wake, nr_move, mutex, val)		     \
 ({									     \
@@ -62,18 +76,34 @@
    _r10 == -1;								     \
 })
 
+/* Returns non-zero if error happened, zero if success.  */
+#define lll_futex_wake_unlock(ftx, nr_wake, nr_wake2, ftx2)		     \
+({									     \
+   DO_INLINE_SYSCALL(futex, 6, (long) (ftx), FUTEX_WAKE_OP,		     \
+		     (int) (nr_wake), (int) (nr_wake2), (long) (ftx2),	     \
+		     FUTEX_OP_CLEAR_WAKE_IF_GT_ONE);			     \
+   _r10 == -1;								     \
+})
+
 
 #define __lll_mutex_trylock(futex) \
   (atomic_compare_and_exchange_val_acq (futex, 1, 0) != 0)
 #define lll_mutex_trylock(futex) __lll_mutex_trylock (&(futex))
 
 
+#define __lll_robust_mutex_trylock(futex, id) \
+  (atomic_compare_and_exchange_val_acq (futex, id, 0) != 0)
+#define lll_robust_mutex_trylock(futex, id) \
+  __lll_robust_mutex_trylock (&(futex), id)
+
+
 #define __lll_mutex_cond_trylock(futex) \
   (atomic_compare_and_exchange_val_acq (futex, 2, 0) != 0)
 #define lll_mutex_cond_trylock(futex) __lll_mutex_cond_trylock (&(futex))
 
 
 extern void __lll_lock_wait (int *futex) attribute_hidden;
+extern int __lll_robust_lock_wait (int *futex) attribute_hidden;
 
 
 #define __lll_mutex_lock(futex)						\
@@ -85,6 +115,18 @@ extern void __lll_lock_wait (int *futex) attribute_hidden;
 #define lll_mutex_lock(futex) __lll_mutex_lock (&(futex))
 
 
+#define __lll_robust_mutex_lock(futex, id)				\
+  ({									\
+    int *__futex = (futex);						\
+    int __val = 0;							\
+									\
+    if (atomic_compare_and_exchange_bool_acq (__futex, id, 0) != 0)	\
+      __val = __lll_robust_lock_wait (__futex);				\
+    __val;								\
+  })
+#define lll_robust_mutex_lock(futex, id) __lll_robust_mutex_lock (&(futex), id)
+
+
 #define __lll_mutex_cond_lock(futex)					\
   ((void) ({								\
     int *__futex = (futex);						\
@@ -94,8 +136,24 @@ extern void __lll_lock_wait (int *futex) attribute_hidden;
 #define lll_mutex_cond_lock(futex) __lll_mutex_cond_lock (&(futex))
 
 
+#define __lll_robust_mutex_cond_lock(futex, id)				\
+  ({									\
+    int *__futex = (futex);						\
+    int __val = 0;							\
+    int __id = (id) | FUTEX_WAITERS;					\
+									\
+    if (atomic_compare_and_exchange_bool_acq (__futex, __id, 0) != 0)	\
+      __val = __lll_robust_lock_wait (__futex);				\
+    __val;								\
+  })
+#define lll_robust_mutex_cond_lock(futex, id) \
+  __lll_robust_mutex_cond_lock (&(futex), id)
+
+
 extern int __lll_timedlock_wait (int *futex, const struct timespec *)
      attribute_hidden;
+extern int __lll_robust_timedlock_wait (int *futex, const struct timespec *)
+     attribute_hidden;
 
 
 #define __lll_mutex_timedlock(futex, abstime)				\
@@ -111,6 +169,19 @@ extern int __lll_timedlock_wait (int *futex, const struct timespec *)
   __lll_mutex_timedlock (&(futex), abstime)
 
 
+#define __lll_robust_mutex_timedlock(futex, abstime, id)		\
+  ({									\
+    int *__futex = (futex);						\
+    int __val = 0;							\
+									\
+    if (atomic_compare_and_exchange_bool_acq (__futex, id, 0) != 0)	\
+      __val = __lll_robust_timedlock_wait (__futex, abstime);		\
+    __val;								\
+  })
+#define lll_robust_mutex_timedlock(futex, abstime, id) \
+  __lll_robust_mutex_timedlock (&(futex), abstime, id)
+
+
 #define __lll_mutex_unlock(futex)			\
   ((void) ({						\
     int *__futex = (futex);				\
@@ -123,6 +194,18 @@ extern int __lll_timedlock_wait (int *futex, const struct timespec *)
   __lll_mutex_unlock(&(futex))
 
 
+#define __lll_robust_mutex_unlock(futex)		\
+  ((void) ({						\
+    int *__futex = (futex);				\
+    int __val = atomic_exchange_rel (__futex, 0);	\
+							\
+    if (__builtin_expect (__val & FUTEX_WAITERS, 0))	\
+      lll_futex_wake (__futex, 1);			\
+  }))
+#define lll_robust_mutex_unlock(futex) \
+  __lll_robust_mutex_unlock(&(futex))
+
+
 #define __lll_mutex_unlock_force(futex)		\
   ((void) ({					\
     int *__futex = (futex);			\
diff --git a/nptl/sysdeps/unix/sysv/linux/ia64/pt-initfini.c b/nptl/sysdeps/unix/sysv/linux/ia64/pt-initfini.c
index b7d4e57945..b6d2cec0d0 100644
--- a/nptl/sysdeps/unix/sysv/linux/ia64/pt-initfini.c
+++ b/nptl/sysdeps/unix/sysv/linux/ia64/pt-initfini.c
@@ -1,5 +1,5 @@
 /* Special .init and .fini section support for ia64. NPTL version.
-   Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it
@@ -38,7 +38,6 @@
 
 #include <stddef.h>
 
-#ifdef HAVE_INITFINI_ARRAY
 
 __asm__ ("\n\
 #include \"defs.h\"\n\
@@ -49,95 +48,3 @@ __asm__ ("\n\
 	.xdata8 \".init_array\",@fptr(__pthread_initialize_minimal_internal)\n\
 /*@_init_PROLOG_ENDS*/\n\
 ");
-
-#else
-
-__asm__ ("\n\
-\n\
-#include \"defs.h\"\n\
-\n\
-/*@HEADER_ENDS*/\n\
-\n\
-/*@_init_PROLOG_BEGINS*/\n\
-	.section .init\n\
-	.align 16\n\
-	.global _init#\n\
-	.proc _init#\n\
-_init:\n\
-	.prologue\n\
-	.save ar.pfs, r34\n\
-	alloc r34 = ar.pfs, 0, 3, 0, 0\n\
-	.vframe r32\n\
-	mov r32 = r12\n\
-	.save rp, r33\n\
-	mov r33 = b0\n\
-	.body\n\
-	adds r12 = -16, r12\n\
-	;;\n\
-	st8 [r12] = gp, -16\n\
-	br.call.sptk.many b0 = __pthread_initialize_minimal_internal# ;;\n\
-	;;\n\
-	adds r12 = 16, r12\n\
-	;;\n\
-	ld8 gp = [r12]\n\
-	;;\n\
-	.endp _init#\n\
-\n\
-/*@_init_PROLOG_ENDS*/\n\
-\n\
-/*@_init_EPILOG_BEGINS*/\n\
-	.section .init\n\
-	.proc _init#\n\
-	.prologue\n\
-	.save ar.pfs, r34\n\
-	.vframe r32\n\
-	.save rp, r33\n\
-	.body\n\
-	mov r12 = r32\n\
-	mov ar.pfs = r34\n\
-	mov b0 = r33\n\
-	br.ret.sptk.many b0\n\
-	.endp _init#\n\
-/*@_init_EPILOG_ENDS*/\n\
-\n\
-/*@_fini_PROLOG_BEGINS*/\n\
-	.section .fini\n\
-	.align 16\n\
-	.global _fini#\n\
-	.proc _fini#\n\
-_fini:\n\
-	.prologue\n\
-	.save ar.pfs, r34\n\
-	alloc r34 = ar.pfs, 0, 3, 0, 0\n\
-	.vframe r32\n\
-	mov r32 = r12\n\
-	.save rp, r33\n\
-	mov r33 = b0\n\
-	.body\n\
-	adds r12 = -16, r12\n\
-	;;\n\
-	.endp _fini#\n\
-\n\
-/*@_fini_PROLOG_ENDS*/\n\
-\n\
-/*@_fini_EPILOG_BEGINS*/\n\
-	.section .fini\n\
-	.proc _fini#\n\
-	.prologue\n\
-	.save ar.pfs, r34\n\
-	.vframe r32\n\
-	.save rp, r33\n\
-	.body\n\
-	mov r12 = r32\n\
-	mov ar.pfs = r34\n\
-	mov b0 = r33\n\
-	br.ret.sptk.many b0\n\
-	.endp _fini#\n\
-\n\
-/*@_fini_EPILOG_ENDS*/\n\
-\n\
-/*@TRAILER_BEGINS*/\n\
-	.weak	__gmon_start__#\n\
-");
-
-#endif
diff --git a/nptl/sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h b/nptl/sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h
index 63aaa96eb0..c4d52860dd 100644
--- a/nptl/sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h
+++ b/nptl/sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jakub Jelinek <jakub@redhat.com>, 2002.
 
@@ -220,3 +220,9 @@ __GC_##name:								      \
 # define NO_CANCELLATION 1
 
 #endif
+
+#ifndef __ASSEMBLER__
+# define RTLD_SINGLE_THREAD_P \
+  __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
+				   header.multiple_threads) == 0, 1)
+#endif
diff --git a/nptl/sysdeps/unix/sysv/linux/ia64/unwind-forcedunwind.c b/nptl/sysdeps/unix/sysv/linux/ia64/unwind-forcedunwind.c
index fb44b426bc..d0c77a62e6 100644
--- a/nptl/sysdeps/unix/sysv/linux/ia64/unwind-forcedunwind.c
+++ b/nptl/sysdeps/unix/sysv/linux/ia64/unwind-forcedunwind.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jakub Jelinek <jakub@redhat.com>.
 
@@ -34,5 +34,6 @@ _Unwind_GetBSP (struct _Unwind_Context *context)
 {
   if (__builtin_expect (libgcc_s_getbsp == NULL, 0))
     pthread_cancel_init ();
+
   return libgcc_s_getbsp (context);
 }