aboutsummaryrefslogtreecommitdiff
path: root/nptl/sysdeps/unix/sysv/linux
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2007-07-12 13:29:44 +0000
committerJakub Jelinek <jakub@redhat.com>2007-07-12 13:29:44 +0000
commit13a4ee0bb4ccb6691729bde67233f5ca66209c7c (patch)
tree72d62fed4d091a1f38c021d9c3eab5e50044e8c4 /nptl/sysdeps/unix/sysv/linux
parent0923a2c896f09795cca4a6d800a336a56b0ee42c (diff)
downloadglibc-13a4ee0bb4ccb6691729bde67233f5ca66209c7c.tar
glibc-13a4ee0bb4ccb6691729bde67233f5ca66209c7c.tar.gz
glibc-13a4ee0bb4ccb6691729bde67233f5ca66209c7c.tar.bz2
glibc-13a4ee0bb4ccb6691729bde67233f5ca66209c7c.zip
[BZ #4745]
[BZ #4586] [BZ #4702] [BZ #4525] [BZ #4514] [BZ #4512] Merge selected bugfixes from the trunk.
Diffstat (limited to 'nptl/sysdeps/unix/sysv/linux')
-rw-r--r--nptl/sysdeps/unix/sysv/linux/Makefile5
-rw-r--r--nptl/sysdeps/unix/sysv/linux/alpha/lowlevellock.h4
-rw-r--r--nptl/sysdeps/unix/sysv/linux/fork.c2
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/bits/pthreadtypes.h7
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S23
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S57
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_barrier_wait.S11
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S14
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S12
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_rdlock.S18
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_timedrdlock.S16
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_timedwrlock.S14
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_unlock.S16
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_wrlock.S16
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/i486/sem_post.S21
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/i486/sem_timedwait.S241
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/i486/sem_wait.S291
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h99
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/pthread_once.S31
-rw-r--r--nptl/sysdeps/unix/sysv/linux/ia64/lowlevellock.h4
-rw-r--r--nptl/sysdeps/unix/sysv/linux/internaltypes.h22
-rw-r--r--nptl/sysdeps/unix/sysv/linux/libc_pthread_init.c1
-rw-r--r--nptl/sysdeps/unix/sysv/linux/lowlevelbarrier.sym1
-rw-r--r--nptl/sysdeps/unix/sysv/linux/lowlevelcond.sym2
-rw-r--r--nptl/sysdeps/unix/sysv/linux/lowlevellock.c30
-rw-r--r--nptl/sysdeps/unix/sysv/linux/lowlevelrobustlock.c8
-rw-r--r--nptl/sysdeps/unix/sysv/linux/lowlevelrwlock.sym2
-rw-r--r--nptl/sysdeps/unix/sysv/linux/powerpc/bits/pthreadtypes.h11
-rw-r--r--nptl/sysdeps/unix/sysv/linux/powerpc/lowlevellock.h4
-rw-r--r--nptl/sysdeps/unix/sysv/linux/powerpc/pthread_attr_setstacksize.c1
-rw-r--r--nptl/sysdeps/unix/sysv/linux/rtld-lowlevel.h115
-rw-r--r--nptl/sysdeps/unix/sysv/linux/s390/lowlevellock.h4
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sem_post.c33
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sem_timedwait.c60
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sem_wait.c69
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sh/bits/pthreadtypes.h19
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sh/libc-lowlevellock.S30
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S61
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.h90
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sh/pthread_barrier_wait.S10
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S14
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_wait.S12
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sh/pthread_once.S72
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_rdlock.S33
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedrdlock.S32
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedwrlock.S29
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_unlock.S27
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_wrlock.S29
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sh/sem_post.S15
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sh/sem_timedwait.S254
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sh/sem_wait.S254
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sparc/lowlevellock.h4
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sparc/pthread_once.c6
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sparc/sparc32/lowlevellock.c17
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sparc/sparc32/pthread_barrier_wait.c10
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_post.c6
-rw-r--r--nptl/sysdeps/unix/sysv/linux/structsem.sym10
-rw-r--r--nptl/sysdeps/unix/sysv/linux/unregister-atfork.c4
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/bits/pthreadtypes.h11
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/libc-lowlevellock.S23
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S55
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h84
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/pthread_barrier_wait.S6
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S10
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S12
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/pthread_once.S30
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_rdlock.S18
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedrdlock.S13
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S13
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_unlock.S16
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_wrlock.S16
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/sem_post.S18
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S228
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/sem_trywait.S4
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S227
75 files changed, 800 insertions, 2287 deletions
diff --git a/nptl/sysdeps/unix/sysv/linux/Makefile b/nptl/sysdeps/unix/sysv/linux/Makefile
index ad5ae6ad12..cfcdb6d97f 100644
--- a/nptl/sysdeps/unix/sysv/linux/Makefile
+++ b/nptl/sysdeps/unix/sysv/linux/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 2002,2003,2004,2005,2006,2007 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -25,8 +25,7 @@ libpthread-sysdep_routines += pt-fork pthread_mutex_cond_lock
gen-as-const-headers += lowlevelcond.sym lowlevelrwlock.sym \
lowlevelbarrier.sym unwindbuf.sym \
- lowlevelrobustlock.sym pthread-pi-defines.sym \
- structsem.sym
+ lowlevelrobustlock.sym pthread-pi-defines.sym
endif
ifeq ($(subdir),posix)
diff --git a/nptl/sysdeps/unix/sysv/linux/alpha/lowlevellock.h b/nptl/sysdeps/unix/sysv/linux/alpha/lowlevellock.h
index 04ac006400..58b4806eb2 100644
--- a/nptl/sysdeps/unix/sysv/linux/alpha/lowlevellock.h
+++ b/nptl/sysdeps/unix/sysv/linux/alpha/lowlevellock.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004, 2006, 2007 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
@@ -237,6 +237,8 @@ typedef int lll_lock_t;
#define LLL_LOCK_INITIALIZER (0)
#define LLL_LOCK_INITIALIZER_LOCKED (1)
+extern int lll_unlock_wake_cb (int *__futex) attribute_hidden;
+
/* The states of a lock are:
0 - untaken
1 - taken by one user
diff --git a/nptl/sysdeps/unix/sysv/linux/fork.c b/nptl/sysdeps/unix/sysv/linux/fork.c
index c6dadb5683..98bb237c06 100644
--- a/nptl/sysdeps/unix/sysv/linux/fork.c
+++ b/nptl/sysdeps/unix/sysv/linux/fork.c
@@ -203,7 +203,7 @@ __libc_fork (void)
if (atomic_decrement_and_test (&allp->handler->refcntr)
&& allp->handler->need_signal)
- lll_private_futex_wake (allp->handler->refcntr, 1);
+ lll_futex_wake (allp->handler->refcntr, 1);
allp = allp->next;
}
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/bits/pthreadtypes.h b/nptl/sysdeps/unix/sysv/linux/i386/bits/pthreadtypes.h
index 9e3e016fb8..f53d0e5a72 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/bits/pthreadtypes.h
+++ b/nptl/sysdeps/unix/sysv/linux/i386/bits/pthreadtypes.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002,2003,2004,2005,2006,2007 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2004, 2005, 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
@@ -128,10 +128,7 @@ typedef union
unsigned int __nr_writers_queued;
/* FLAGS must stay at this position in the structure to maintain
binary compatibility. */
- unsigned char __flags;
- unsigned char __shared;
- unsigned char __pad1;
- unsigned char __pad2;
+ unsigned int __flags;
int __writer;
} __data;
char __size[__SIZEOF_PTHREAD_RWLOCK_T];
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
index 830f628578..88885b735d 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
+++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -17,19 +17,14 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#include <kernel-features.h>
-
-/* All locks in libc are private. Use the kernel feature if possible. */
-#define FUTEX_PRIVATE_FLAG 128
-#ifdef __ASSUME_PRIVATE_FUTEX
-# define FUTEX_WAIT (0 | FUTEX_PRIVATE_FLAG)
-# define FUTEX_WAKE (1 | FUTEX_PRIVATE_FLAG)
-#else
-# define LOAD_FUTEX_WAIT(reg) \
- movl %gs:PRIVATE_FUTEX, reg
-# define LOAD_FUTEX_WAKE(reg) \
- movl %gs:PRIVATE_FUTEX, reg ; \
- orl $FUTEX_WAKE, reg
+/* In libc.so we do not unconditionally use the lock prefix. Only if
+ the application is using threads. */
+#ifndef UP
+# define LOCK \
+ cmpl $0, %gs:MULTIPLE_THREADS_OFFSET; \
+ je 0f; \
+ lock; \
+0:
#endif
#include "lowlevellock.S"
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S
index cfcc7dafc4..e2da5b04cf 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S
+++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004, 2006, 2007 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 Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -32,22 +32,8 @@
#define SYS_gettimeofday __NR_gettimeofday
#define SYS_futex 240
-#ifndef FUTEX_WAIT
-# define FUTEX_WAIT 0
-# define FUTEX_WAKE 1
-#endif
-
-#ifndef LOAD_FUTEX_WAIT
-# if FUTEX_WAIT == 0
-# define LOAD_FUTEX_WAIT(reg) \
- xorl reg, reg
-# else
-# define LOAD_FUTEX_WAIT(reg) \
- movl $FUTEX_WAIT, reg
-# endif
-# define LOAD_FUTEX_WAKE(reg) \
- movl $FUTEX_WAKE, reg
-#endif
+#define FUTEX_WAIT 0
+#define FUTEX_WAKE 1
.globl __lll_mutex_lock_wait
@@ -69,7 +55,7 @@ __lll_mutex_lock_wait:
movl $2, %edx
movl %ecx, %ebx
xorl %esi, %esi /* No timeout. */
- LOAD_FUTEX_WAIT (%ecx)
+ xorl %ecx, %ecx /* movl $FUTEX_WAIT, %ecx */
cmpl %edx, %eax /* NB: %edx == 2 */
jne 2f
@@ -165,7 +151,7 @@ __lll_mutex_timedlock_wait:
/* Futex call. */
movl %esp, %esi
- LOAD_FUTEX_WAIT (%ecx)
+ xorl %ecx, %ecx /* movl $FUTEX_WAIT, %ecx */
movl $SYS_futex, %eax
ENTER_KERNEL
movl %eax, %ecx
@@ -219,6 +205,35 @@ __lll_mutex_timedlock_wait:
#endif
+#ifdef NOT_IN_libc
+ .globl lll_unlock_wake_cb
+ .type lll_unlock_wake_cb,@function
+ .hidden lll_unlock_wake_cb
+ .align 16
+lll_unlock_wake_cb:
+ pushl %ebx
+ pushl %ecx
+ pushl %edx
+
+ movl 20(%esp), %ebx
+ LOCK
+ subl $1, (%ebx)
+ je 1f
+
+ movl $FUTEX_WAKE, %ecx
+ movl $1, %edx /* Wake one thread. */
+ movl $SYS_futex, %eax
+ movl $0, (%ebx)
+ ENTER_KERNEL
+
+1: popl %edx
+ popl %ecx
+ popl %ebx
+ ret
+ .size lll_unlock_wake_cb,.-lll_unlock_wake_cb
+#endif
+
+
.globl __lll_mutex_unlock_wake
.type __lll_mutex_unlock_wake,@function
.hidden __lll_mutex_unlock_wake
@@ -237,7 +252,7 @@ __lll_mutex_unlock_wake:
movl %eax, %ebx
movl $0, (%eax)
- LOAD_FUTEX_WAKE (%ecx)
+ movl $FUTEX_WAKE, %ecx
movl $1, %edx /* Wake one thread. */
movl $SYS_futex, %eax
ENTER_KERNEL
@@ -299,8 +314,6 @@ __lll_timedwait_tid:
jz 4f
movl %esp, %esi
- /* XXX The kernel so far uses global futex for the wakeup at
- all times. */
xorl %ecx, %ecx /* movl $FUTEX_WAIT, %ecx */
movl %ebp, %ebx
movl $SYS_futex, %eax
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_barrier_wait.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_barrier_wait.S
index 29857195f0..fe7a8b9c66 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_barrier_wait.S
+++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_barrier_wait.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -69,13 +69,7 @@ pthread_barrier_wait:
/* Wait for the remaining threads. The call will return immediately
if the CURR_EVENT memory has meanwhile been changed. */
-7:
-#if FUTEX_WAIT == 0
- movl PRIVATE(%ebx), %ecx
-#else
- movl $FUTEX_WAIT, %ecx
- orl PRIVATE(%ebx), %ecx
-#endif
+7: xorl %ecx, %ecx /* movl $FUTEX_WAIT, %ecx */
xorl %esi, %esi
8: movl $SYS_futex, %eax
ENTER_KERNEL
@@ -126,7 +120,6 @@ pthread_barrier_wait:
so 0x7fffffff is the highest value. */
movl $0x7fffffff, %edx
movl $FUTEX_WAKE, %ecx
- orl PRIVATE(%ebx), %ecx
movl $SYS_futex, %eax
ENTER_KERNEL
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S
index 93f4d56b32..f481a8e43c 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S
+++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004, 2006, 2007 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 Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -87,7 +87,7 @@ __pthread_cond_timedwait:
addl $1, total_seq(%ebx)
adcl $0, total_seq+4(%ebx)
addl $1, cond_futex(%ebx)
- addl $(1 << nwaiters_shift), cond_nwaiters(%ebx)
+ addl $(1 << clock_bits), cond_nwaiters(%ebx)
#define FRAME_SIZE 24
subl $FRAME_SIZE, %esp
@@ -106,7 +106,7 @@ __pthread_cond_timedwait:
#ifdef __NR_clock_gettime
/* Get the clock number. */
movl cond_nwaiters(%ebx), %ebx
- andl $((1 << nwaiters_shift) - 1), %ebx
+ andl $((1 << clock_bits) - 1), %ebx
/* Only clocks 0 and 1 are allowed so far. Both are handled in the
kernel. */
leal 4(%esp), %ecx
@@ -228,7 +228,7 @@ __pthread_cond_timedwait:
14: addl $1, woken_seq(%ebx)
adcl $0, woken_seq+4(%ebx)
-24: subl $(1 << nwaiters_shift), cond_nwaiters(%ebx)
+24: subl $(1 << clock_bits), cond_nwaiters(%ebx)
/* Wake up a thread which wants to destroy the condvar object. */
movl total_seq(%ebx), %eax
@@ -236,7 +236,7 @@ __pthread_cond_timedwait:
cmpl $0xffffffff, %eax
jne 25f
movl cond_nwaiters(%ebx), %eax
- andl $~((1 << nwaiters_shift) - 1), %eax
+ andl $~((1 << clock_bits) - 1), %eax
jne 25f
addl $cond_nwaiters, %ebx
@@ -424,7 +424,7 @@ __condvar_tw_cleanup:
7: addl $1, woken_seq(%ebx)
adcl $0, woken_seq+4(%ebx)
-3: subl $(1 << nwaiters_shift), cond_nwaiters(%ebx)
+3: subl $(1 << clock_bits), cond_nwaiters(%ebx)
/* Wake up a thread which wants to destroy the condvar object. */
xorl %edi, %edi
@@ -433,7 +433,7 @@ __condvar_tw_cleanup:
cmpl $0xffffffff, %eax
jne 4f
movl cond_nwaiters(%ebx), %eax
- andl $~((1 << nwaiters_shift) - 1), %eax
+ andl $~((1 << clock_bits) - 1), %eax
jne 4f
addl $cond_nwaiters, %ebx
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S
index c92cfbc718..f16c7d9198 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S
+++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004, 2006, 2007 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 Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -80,7 +80,7 @@ __pthread_cond_wait:
addl $1, total_seq(%ebx)
adcl $0, total_seq+4(%ebx)
addl $1, cond_futex(%ebx)
- addl $(1 << nwaiters_shift), cond_nwaiters(%ebx)
+ addl $(1 << clock_bits), cond_nwaiters(%ebx)
#define FRAME_SIZE 16
subl $FRAME_SIZE, %esp
@@ -157,7 +157,7 @@ __pthread_cond_wait:
adcl $0, woken_seq+4(%ebx)
/* Unlock */
-16: subl $(1 << nwaiters_shift), cond_nwaiters(%ebx)
+16: subl $(1 << clock_bits), cond_nwaiters(%ebx)
/* Wake up a thread which wants to destroy the condvar object. */
movl total_seq(%ebx), %eax
@@ -165,7 +165,7 @@ __pthread_cond_wait:
cmpl $0xffffffff, %eax
jne 17f
movl cond_nwaiters(%ebx), %eax
- andl $~((1 << nwaiters_shift) - 1), %eax
+ andl $~((1 << clock_bits) - 1), %eax
jne 17f
addl $cond_nwaiters, %ebx
@@ -315,7 +315,7 @@ __condvar_w_cleanup:
7: addl $1, woken_seq(%ebx)
adcl $0, woken_seq+4(%ebx)
-3: subl $(1 << nwaiters_shift), cond_nwaiters(%ebx)
+3: subl $(1 << clock_bits), cond_nwaiters(%ebx)
/* Wake up a thread which wants to destroy the condvar object. */
xorl %edi, %edi
@@ -324,7 +324,7 @@ __condvar_w_cleanup:
cmpl $0xffffffff, %eax
jne 4f
movl cond_nwaiters(%ebx), %eax
- andl $~((1 << nwaiters_shift) - 1), %eax
+ andl $~((1 << clock_bits) - 1), %eax
jne 4f
addl $cond_nwaiters, %ebx
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_rdlock.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_rdlock.S
index c61c697985..db0639d21c 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_rdlock.S
+++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_rdlock.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -61,7 +61,7 @@ __pthread_rwlock_rdlock:
jne 14f
cmpl $0, WRITERS_QUEUED(%ebx)
je 5f
- cmpb $0, FLAGS(%ebx)
+ cmpl $0, FLAGS(%ebx)
je 5f
3: addl $1, READERS_QUEUED(%ebx)
@@ -77,18 +77,8 @@ __pthread_rwlock_rdlock:
#endif
jne 10f
-11:
-#if __ASSUME_PRIVATE_FUTEX
- movzbl PSHARED(%ebx), %ecx
- xorl $FUTEX_PRIVATE_FLAG|FUTEX_WAIT, %ecx
-#else
- movzbl PSHARED(%ebx), %ecx
-# if FUTEX_WAIT != 0
- orl $FUTEX_WAIT, %ecx
-# endif
- xorl %gs:PRIVATE_FUTEX, %ecx
-#endif
- addl $READERS_WAKEUP, %ebx
+11: addl $READERS_WAKEUP, %ebx
+ movl %esi, %ecx /* movl $FUTEX_WAIT, %ecx */
movl $SYS_futex, %eax
ENTER_KERNEL
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_timedrdlock.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_timedrdlock.S
index c6a584fed0..eb5665b432 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_timedrdlock.S
+++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_timedrdlock.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -65,7 +65,7 @@ pthread_rwlock_timedrdlock:
jne 14f
cmpl $0, WRITERS_QUEUED(%ebp)
je 5f
- cmpb $0, FLAGS(%ebp)
+ cmpl $0, FLAGS(%ebp)
je 5f
/* Check the value of the timeout parameter. */
@@ -108,18 +108,8 @@ pthread_rwlock_timedrdlock:
/* Futex call. */
movl %ecx, (%esp) /* Store relative timeout. */
movl %edx, 4(%esp)
-
movl %esi, %edx
-#if __ASSUME_PRIVATE_FUTEX
- movzbl PSHARED(%ebp), %ecx
- xorl $FUTEX_PRIVATE_FLAG|FUTEX_WAIT, %ecx
-#else
- movzbl PSHARED(%ebp), %ecx
-# if FUTEX_WAIT != 0
- orl $FUTEX_WAIT, %ecx
-# endif
- xorl %gs:PRIVATE_FUTEX, %ecx
-#endif
+ xorl %ecx, %ecx /* movl $FUTEX_WAIT, %ecx */
movl %esp, %esi
leal READERS_WAKEUP(%ebp), %ebx
movl $SYS_futex, %eax
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_timedwrlock.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_timedwrlock.S
index 5e9faf93fb..d9db77ba05 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_timedwrlock.S
+++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_timedwrlock.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -106,18 +106,8 @@ pthread_rwlock_timedwrlock:
/* Futex call. */
movl %ecx, (%esp) /* Store relative timeout. */
movl %edx, 4(%esp)
-
movl %esi, %edx
-#if __ASSUME_PRIVATE_FUTEX
- movzbl PSHARED(%ebp), %ecx
- xorl $FUTEX_PRIVATE_FLAG|FUTEX_WAIT, %ecx
-#else
- movzbl PSHARED(%ebp), %ecx
-# if FUTEX_WAIT != 0
- orl $FUTEX_WAIT, %ecx
-# endif
- xorl %gs:PRIVATE_FUTEX, %ecx
-#endif
+ xorl %ecx, %ecx /* movl $FUTEX_WAIT, %ecx */
movl %esp, %esi
leal WRITERS_WAKEUP(%ebp), %ebx
movl $SYS_futex, %eax
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_unlock.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_unlock.S
index 35c40c2c1c..64aac3255a 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_unlock.S
+++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_unlock.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -61,8 +61,9 @@ __pthread_rwlock_unlock:
5: movl $0, WRITER(%edi)
- movl $1, %edx
+ movl $1, %ecx
leal WRITERS_WAKEUP(%edi), %ebx
+ movl %ecx, %edx
cmpl $0, WRITERS_QUEUED(%edi)
jne 0f
@@ -82,16 +83,7 @@ __pthread_rwlock_unlock:
#endif
jne 7f
-8:
-#if __ASSUME_PRIVATE_FUTEX
- movzbl PSHARED(%edi), %ecx
- xorl $FUTEX_PRIVATE_FLAG|FUTEX_WAKE, %ecx
-#else
- movzbl PSHARED(%edi), %ecx
- orl $FUTEX_WAKE, %ecx
- xorl %gs:PRIVATE_FUTEX, %ecx
-#endif
- movl $SYS_futex, %eax
+8: movl $SYS_futex, %eax
ENTER_KERNEL
xorl %eax, %eax
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_wrlock.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_wrlock.S
index 88044c040b..ea9cc170db 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_wrlock.S
+++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_wrlock.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -75,18 +75,8 @@ __pthread_rwlock_wrlock:
#endif
jne 10f
-11:
-#if __ASSUME_PRIVATE_FUTEX
- movzbl PSHARED(%ebx), %ecx
- xorl $FUTEX_PRIVATE_FLAG|FUTEX_WAIT, %ecx
-#else
- movzbl PSHARED(%ebx), %ecx
-# if FUTEX_WAIT != 0
- orl $FUTEX_WAIT, %ecx
-# endif
- xorl %gs:PRIVATE_FUTEX, %ecx
-#endif
- addl $WRITERS_WAKEUP, %ebx
+11: addl $WRITERS_WAKEUP, %ebx
+ movl %esi, %ecx /* movl $FUTEX_WAIT, %ecx */
movl $SYS_futex, %eax
ENTER_KERNEL
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_post.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_post.S
index 280dc2fe27..71e96d2228 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_post.S
+++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_post.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2005, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -20,7 +20,6 @@
#include <sysdep.h>
#include <shlib-compat.h>
#include <pthread-errnos.h>
-#include <structsem.h>
#ifndef UP
# define LOCK lock
@@ -41,27 +40,19 @@ __new_sem_post:
pushl %ebx
movl 8(%esp), %ebx
-
+ movl $1, %edx
LOCK
-#if VALUE == 0
- addl $1, (%ebx)
-#else
- addl $1, VALUE(%ebx)
-#endif
+ xaddl %edx, (%ebx)
- cmpl $0, NWAITERS(%ebx)
- je 2f
-
- movl $FUTEX_WAKE, %ecx
- orl PRIVATE(%ebx), %ecx
- movl $1, %edx
movl $SYS_futex, %eax
+ movl $FUTEX_WAKE, %ecx
+ addl $1, %edx
ENTER_KERNEL
testl %eax, %eax
js 1f
-2: xorl %eax, %eax
+ xorl %eax, %eax
popl %ebx
ret
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_timedwait.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_timedwait.S
index 57b5b58186..bf70e17fca 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_timedwait.S
+++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_timedwait.S
@@ -20,7 +20,6 @@
#include <sysdep.h>
#include <shlib-compat.h>
#include <pthread-errnos.h>
-#include <structsem.h>
#ifndef UP
# define LOCK lock
@@ -30,12 +29,7 @@
#define SYS_gettimeofday __NR_gettimeofday
#define SYS_futex 240
-#define FUTEX_WAIT 0
-
-
-#if VALUE != 0
-# error "code needs to be rewritten for VALUE != 0"
-#endif
+#define FUTEX_WAKE 1
.text
@@ -43,8 +37,14 @@
.globl sem_timedwait
.type sem_timedwait,@function
.align 16
+ cfi_startproc
sem_timedwait:
-.LSTARTCODE:
+ /* First check for cancellation. */
+ movl %gs:CANCELHANDLING, %eax
+ andl $0xfffffff9, %eax
+ cmpl $8, %eax
+ je 10f
+
movl 4(%esp), %ecx
movl (%ecx), %eax
@@ -61,24 +61,24 @@ sem_timedwait:
/* Check whether the timeout value is valid. */
1: pushl %esi
-.Lpush_esi:
+ cfi_adjust_cfa_offset(4)
pushl %edi
-.Lpush_edi:
+ cfi_adjust_cfa_offset(4)
pushl %ebx
-.Lpush_ebx:
+ cfi_adjust_cfa_offset(4)
subl $12, %esp
-.Lsub_esp:
+ cfi_adjust_cfa_offset(12)
movl 32(%esp), %edi
+ cfi_offset(7, -12) /* %edi */
/* Check for invalid nanosecond field. */
cmpl $1000000000, 4(%edi)
movl $EINVAL, %esi
+ cfi_offset(6, -8) /* %esi */
jae 6f
- LOCK
- incl NWAITERS(%ecx)
-
+ cfi_offset(3, -16) /* %ebx */
7: xorl %ecx, %ecx
movl %esp, %ebx
movl %ecx, %edx
@@ -103,26 +103,19 @@ sem_timedwait:
movl %ecx, (%esp) /* Store relative timeout. */
movl %edx, 4(%esp)
-.LcleanupSTART:
call __pthread_enable_asynccancel
movl %eax, 8(%esp)
- movl 28(%esp), %ebx /* Load semaphore address. */
-#if FUTEX_WAIT == 0
- movl PRIVATE(%ebx), %ecx
-#else
- movl $FUTEX_WAIT, %ecx
- orl PRIVATE(%ebx), %ecx
-#endif
+ movl 28(%esp), %ebx
+ xorl %ecx, %ecx
movl %esp, %esi
- xorl %edx, %edx
movl $SYS_futex, %eax
+ xorl %edx, %edx
ENTER_KERNEL
movl %eax, %esi
movl 8(%esp), %eax
call __pthread_disable_asynccancel
-.LcleanupEND:
testl %esi, %esi
je 9f
@@ -138,22 +131,24 @@ sem_timedwait:
cmpxchgl %ecx, (%ebx)
jne 8b
- xorl %eax, %eax
-
-10: LOCK
- decl NWAITERS(%ebx)
-
addl $12, %esp
-.Ladd_esp:
+ cfi_adjust_cfa_offset(-12)
+ xorl %eax, %eax
popl %ebx
-.Lpop_ebx:
+ cfi_adjust_cfa_offset(-4)
+ cfi_restore(3)
popl %edi
-.Lpop_edi:
+ cfi_adjust_cfa_offset(-4)
+ cfi_restore(7)
popl %esi
-.Lpop_esi:
+ cfi_adjust_cfa_offset(-4)
+ cfi_restore(6)
ret
-.Lafter_ret:
+ cfi_adjust_cfa_offset(24)
+ cfi_offset(6, -8) /* %esi */
+ cfi_offset(7, -12) /* %edi */
+ cfi_offset(3, -16) /* %ebx */
3: negl %esi
6:
#ifdef PIC
@@ -177,163 +172,25 @@ sem_timedwait:
movl %esi, (%eax)
#endif
- movl 28(%esp), %ebx /* Load semaphore address. */
+ addl $12, %esp
+ cfi_adjust_cfa_offset(-12)
orl $-1, %eax
- jmp 10b
- .size sem_timedwait,.-sem_timedwait
-
+ popl %ebx
+ cfi_adjust_cfa_offset(-4)
+ cfi_restore(3)
+ popl %edi
+ cfi_adjust_cfa_offset(-4)
+ cfi_restore(7)
+ popl %esi
+ cfi_adjust_cfa_offset(-4)
+ cfi_restore(6)
+ ret
- .type sem_wait_cleanup,@function
-sem_wait_cleanup:
+10: /* Canceled. */
+ movl $0xffffffff, %gs:RESULT
LOCK
- decl NWAITERS(%ebx)
- movl %eax, (%esp)
-.LcallUR:
- call _Unwind_Resume@PLT
- hlt
-.LENDCODE:
- .size sem_wait_cleanup,.-sem_wait_cleanup
-
-
- .section .gcc_except_table,"a",@progbits
-.LexceptSTART:
- .byte 0xff # @LPStart format (omit)
- .byte 0xff # @TType format (omit)
- .byte 0x01 # call-site format
- # DW_EH_PE_uleb128
- .uleb128 .Lcstend-.Lcstbegin
-.Lcstbegin:
- .uleb128 .LcleanupSTART-.LSTARTCODE
- .uleb128 .LcleanupEND-.LcleanupSTART
- .uleb128 sem_wait_cleanup-.LSTARTCODE
- .uleb128 0
- .uleb128 .LcallUR-.LSTARTCODE
- .uleb128 .LENDCODE-.LcallUR
- .uleb128 0
- .uleb128 0
-.Lcstend:
-
-
- .section .eh_frame,"a",@progbits
-.LSTARTFRAME:
- .long .LENDCIE-.LSTARTCIE # Length of the CIE.
-.LSTARTCIE:
- .long 0 # CIE ID.
- .byte 1 # Version number.
-#ifdef SHARED
- .string "zPLR" # NUL-terminated augmentation
- # string.
-#else
- .string "zPL" # NUL-terminated augmentation
- # string.
-#endif
- .uleb128 1 # Code alignment factor.
- .sleb128 -4 # Data alignment factor.
- .byte 8 # Return address register
- # column.
-#ifdef SHARED
- .uleb128 7 # Augmentation value length.
- .byte 0x9b # Personality: DW_EH_PE_pcrel
- # + DW_EH_PE_sdata4
- # + DW_EH_PE_indirect
- .long DW.ref.__gcc_personality_v0-.
- .byte 0x1b # LSDA Encoding: DW_EH_PE_pcrel
- # + DW_EH_PE_sdata4.
- .byte 0x1b # FDE Encoding: DW_EH_PE_pcrel
- # + DW_EH_PE_sdata4.
-#else
- .uleb128 6 # Augmentation value length.
- .byte 0x0 # Personality: absolute
- .long __gcc_personality_v0
- .byte 0x0 # LSDA Encoding: absolute
-#endif
- .byte 0x0c # DW_CFA_def_cfa
- .uleb128 4
- .uleb128 4
- .byte 0x88 # DW_CFA_offset, column 0x10
- .uleb128 1
- .align 4
-.LENDCIE:
-
- .long .LENDFDE-.LSTARTFDE # Length of the FDE.
-.LSTARTFDE:
- .long .LSTARTFDE-.LSTARTFRAME # CIE pointer.
-#ifdef SHARED
- .long .LSTARTCODE-. # PC-relative start address
- # of the code.
-#else
- .long .LSTARTCODE # Start address of the code.
-#endif
- .long .LENDCODE-.LSTARTCODE # Length of the code.
- .uleb128 4 # Augmentation size
-#ifdef SHARED
- .long .LexceptSTART-.
-#else
- .long .LexceptSTART
-#endif
-
- .byte 4 # DW_CFA_advance_loc4
- .long .Lpush_esi-.LSTARTCODE
- .byte 14 # DW_CFA_def_cfa_offset
- .uleb128 8
- .byte 0x86 # DW_CFA_offset %esi
- .uleb128 2
- .byte 4 # DW_CFA_advance_loc4
- .long .Lpush_edi-.Lpush_esi
- .byte 14 # DW_CFA_def_cfa_offset
- .uleb128 12
- .byte 0x87 # DW_CFA_offset %edi
- .uleb128 3
- .byte 4 # DW_CFA_advance_loc4
- .long .Lpush_ebx-.Lpush_edi
- .byte 14 # DW_CFA_def_cfa_offset
- .uleb128 16
- .byte 0x83 # DW_CFA_offset %ebx
- .uleb128 4
- .byte 4 # DW_CFA_advance_loc4
- .long .Lsub_esp-.Lpush_ebx
- .byte 14 # DW_CFA_def_cfa_offset
- .uleb128 28
- .byte 4 # DW_CFA_advance_loc4
- .long .Ladd_esp-.Lsub_esp
- .byte 14 # DW_CFA_def_cfa_offset
- .uleb128 16
- .byte 4 # DW_CFA_advance_loc4
- .long .Lpop_ebx-.Ladd_esp
- .byte 14 # DW_CFA_def_cfa_offset
- .uleb128 12
- .byte 0xc3 # DW_CFA_restore %ebx
- .byte 4 # DW_CFA_advance_loc4
- .long .Lpop_edi-.Lpop_ebx
- .byte 14 # DW_CFA_def_cfa_offset
- .uleb128 8
- .byte 0xc7 # DW_CFA_restore %edi
- .byte 4 # DW_CFA_advance_loc4
- .long .Lpop_esi-.Lpop_edi
- .byte 14 # DW_CFA_def_cfa_offset
- .uleb128 4
- .byte 0xc6 # DW_CFA_restore %esi
- .byte 4 # DW_CFA_advance_loc4
- .long .Lafter_ret-.Lpop_esi
- .byte 14 # DW_CFA_def_cfa_offset
- .uleb128 28
- .byte 0x86 # DW_CFA_offset %esi
- .uleb128 2
- .byte 0x87 # DW_CFA_offset %edi
- .uleb128 3
- .byte 0x83 # DW_CFA_offset %ebx
- .uleb128 4
- .align 4
-.LENDFDE:
-
-
-#ifdef SHARED
- .hidden DW.ref.__gcc_personality_v0
- .weak DW.ref.__gcc_personality_v0
- .section .gnu.linkonce.d.DW.ref.__gcc_personality_v0,"aw",@progbits
- .align 4
- .type DW.ref.__gcc_personality_v0, @object
- .size DW.ref.__gcc_personality_v0, 4
-DW.ref.__gcc_personality_v0:
- .long __gcc_personality_v0
-#endif
+ orl $0x10, %gs:CANCELHANDLING
+ movl %gs:CLEANUP_JMP_BUF, %eax
+ jmp HIDDEN_JUMPTARGET (__pthread_unwind)
+ cfi_endproc
+ .size sem_timedwait,.-sem_timedwait
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_wait.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_wait.S
index d0eef75144..b1296275d0 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_wait.S
+++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_wait.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2005, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -20,7 +20,6 @@
#include <sysdep.h>
#include <shlib-compat.h>
#include <pthread-errnos.h>
-#include <structsem.h>
#ifndef UP
# define LOCK lock
@@ -29,261 +28,22 @@
#endif
#define SYS_futex 240
-#define FUTEX_WAIT 0
+#define FUTEX_WAKE 1
-#if VALUE != 0
-# error "code needs to be rewritten for VALUE != 0"
-#endif
-
.text
.globl __new_sem_wait
.type __new_sem_wait,@function
.align 16
+ cfi_startproc
__new_sem_wait:
-.LSTARTCODE:
- pushl %ebx
-.Lpush_ebx:
- pushl %esi
-.Lpush_esi:
- subl $4, %esp
-.Lsub_esp:
-
- movl 16(%esp), %ebx
-
- movl (%ebx), %eax
-2: testl %eax, %eax
- je 1f
-
- leal -1(%eax), %edx
- LOCK
- cmpxchgl %edx, (%ebx)
- jne 2b
-7: xorl %eax, %eax
-
-9: movl 4(%esp), %esi
- movl 8(%esp), %ebx
- addl $12, %esp
-.Ladd_esp:
- ret
-
-.Lafter_ret:
-1: LOCK
- incl NWAITERS(%ebx)
-
-.LcleanupSTART:
-6: call __pthread_enable_asynccancel
- movl %eax, (%esp)
-
-#if FUTEX_WAIT == 0
- movl PRIVATE(%ebx), %ecx
-#else
- movl $FUTEX_WAIT, %ecx
- orl PRIVATE(%ebx), %ecx
-#endif
- xorl %esi, %esi
- xorl %edx, %edx
- movl $SYS_futex, %eax
- ENTER_KERNEL
- movl %eax, %esi
-
- movl (%esp), %eax
- call __pthread_disable_asynccancel
-.LcleanupEND:
-
- testl %esi, %esi
- je 3f
- cmpl $-EWOULDBLOCK, %esi
- jne 4f
-
-3:
- movl (%ebx), %eax
-5: testl %eax, %eax
- je 6b
-
- leal -1(%eax), %edx
- LOCK
- cmpxchgl %edx, (%ebx)
- jne 5b
-
- LOCK
- decl NWAITERS(%ebx)
- jmp 7b
-
-4: LOCK
- decl NWAITERS(%ebx)
-
- negl %esi
-#ifdef PIC
- call __i686.get_pc_thunk.bx
-#else
- movl $8f, %ebx
-8:
-#endif
- addl $_GLOBAL_OFFSET_TABLE_, %ebx
-#if USE___THREAD
-# ifdef NO_TLS_DIRECT_SEG_REFS
- movl errno@gotntpoff(%ebx), %edx
- addl %gs:0, %edx
- movl %esi, (%edx)
-# else
- movl errno@gotntpoff(%ebx), %edx
- movl %esi, %gs:(%edx)
-# endif
-#else
- call __errno_location@plt
- movl %esi, (%eax)
-#endif
- orl $-1, %eax
-
- jmp 9b
- .size __new_sem_wait,.-__new_sem_wait
- versioned_symbol(libpthread, __new_sem_wait, sem_wait, GLIBC_2_1)
-
-
- .type sem_wait_cleanup,@function
-sem_wait_cleanup:
- LOCK
- decl NWAITERS(%ebx)
- movl %eax, (%esp)
-.LcallUR:
- call _Unwind_Resume@PLT
- hlt
-.LENDCODE:
- .size sem_wait_cleanup,.-sem_wait_cleanup
-
-
- .section .gcc_except_table,"a",@progbits
-.LexceptSTART:
- .byte 0xff # @LPStart format (omit)
- .byte 0xff # @TType format (omit)
- .byte 0x01 # call-site format
- # DW_EH_PE_uleb128
- .uleb128 .Lcstend-.Lcstbegin
-.Lcstbegin:
- .uleb128 .LcleanupSTART-.LSTARTCODE
- .uleb128 .LcleanupEND-.LcleanupSTART
- .uleb128 sem_wait_cleanup-.LSTARTCODE
- .uleb128 0
- .uleb128 .LcallUR-.LSTARTCODE
- .uleb128 .LENDCODE-.LcallUR
- .uleb128 0
- .uleb128 0
-.Lcstend:
-
-
- .section .eh_frame,"a",@progbits
-.LSTARTFRAME:
- .long .LENDCIE-.LSTARTCIE # Length of the CIE.
-.LSTARTCIE:
- .long 0 # CIE ID.
- .byte 1 # Version number.
-#ifdef SHARED
- .string "zPLR" # NUL-terminated augmentation
- # string.
-#else
- .string "zPL" # NUL-terminated augmentation
- # string.
-#endif
- .uleb128 1 # Code alignment factor.
- .sleb128 -4 # Data alignment factor.
- .byte 8 # Return address register
- # column.
-#ifdef SHARED
- .uleb128 7 # Augmentation value length.
- .byte 0x9b # Personality: DW_EH_PE_pcrel
- # + DW_EH_PE_sdata4
- # + DW_EH_PE_indirect
- .long DW.ref.__gcc_personality_v0-.
- .byte 0x1b # LSDA Encoding: DW_EH_PE_pcrel
- # + DW_EH_PE_sdata4.
- .byte 0x1b # FDE Encoding: DW_EH_PE_pcrel
- # + DW_EH_PE_sdata4.
-#else
- .uleb128 6 # Augmentation value length.
- .byte 0x0 # Personality: absolute
- .long __gcc_personality_v0
- .byte 0x0 # LSDA Encoding: absolute
-#endif
- .byte 0x0c # DW_CFA_def_cfa
- .uleb128 4
- .uleb128 4
- .byte 0x88 # DW_CFA_offset, column 0x10
- .uleb128 1
- .align 4
-.LENDCIE:
-
- .long .LENDFDE-.LSTARTFDE # Length of the FDE.
-.LSTARTFDE:
- .long .LSTARTFDE-.LSTARTFRAME # CIE pointer.
-#ifdef SHARED
- .long .LSTARTCODE-. # PC-relative start address
- # of the code.
-#else
- .long .LSTARTCODE # Start address of the code.
-#endif
- .long .LENDCODE-.LSTARTCODE # Length of the code.
- .uleb128 4 # Augmentation size
-#ifdef SHARED
- .long .LexceptSTART-.
-#else
- .long .LexceptSTART
-#endif
+ /* First check for cancellation. */
+ movl %gs:CANCELHANDLING, %eax
+ andl $0xfffffff9, %eax
+ cmpl $8, %eax
+ je 5f
- .byte 4 # DW_CFA_advance_loc4
- .long .Lpush_ebx-.LSTARTCODE
- .byte 14 # DW_CFA_def_cfa_offset
- .uleb128 8
- .byte 0x83 # DW_CFA_offset %ebx
- .uleb128 2
- .byte 4 # DW_CFA_advance_loc4
- .long .Lpush_esi-.Lpush_ebx
- .byte 14 # DW_CFA_def_cfa_offset
- .uleb128 12
- .byte 0x86 # DW_CFA_offset %esi
- .uleb128 3
- .byte 4 # DW_CFA_advance_loc4
- .long .Lsub_esp-.Lpush_esi
- .byte 14 # DW_CFA_def_cfa_offset
- .uleb128 16
- .byte 4 # DW_CFA_advance_loc4
- .long .Ladd_esp-.Lsub_esp
- .byte 14 # DW_CFA_def_cfa_offset
- .uleb128 4
- .byte 0xc3 # DW_CFA_restore %ebx
- .byte 0xc6 # DW_CFA_restore %esi
- .byte 4 # DW_CFA_advance_loc4
- .long .Lafter_ret-.Ladd_esp
- .byte 14 # DW_CFA_def_cfa_offset
- .uleb128 16
- .byte 0x83 # DW_CFA_offset %ebx
- .uleb128 2
- .byte 0x86 # DW_CFA_offset %esi
- .uleb128 3
- .align 4
-.LENDFDE:
-
-
-#ifdef SHARED
- .hidden DW.ref.__gcc_personality_v0
- .weak DW.ref.__gcc_personality_v0
- .section .gnu.linkonce.d.DW.ref.__gcc_personality_v0,"aw",@progbits
- .align 4
- .type DW.ref.__gcc_personality_v0, @object
- .size DW.ref.__gcc_personality_v0, 4
-DW.ref.__gcc_personality_v0:
- .long __gcc_personality_v0
-#endif
-
-
-#if SHLIB_COMPAT(libpthread, GLIBC_2_0, GLIBC_2_1)
- .section ".text.compat", "ax"
- .global __old_sem_wait
- .type __old_sem_wait,@function
- .align 16
- cfi_startproc
-__old_sem_wait:
pushl %ebx
cfi_adjust_cfa_offset(4)
pushl %esi
@@ -292,9 +52,9 @@ __old_sem_wait:
cfi_adjust_cfa_offset(4)
movl 16(%esp), %ebx
- cfi_offset(ebx, -8)
+ cfi_offset(3, -8) /* %ebx */
- cfi_offset(esi, -12)
+ cfi_offset(6, -12) /* %esi */
3: movl (%ebx), %eax
2: testl %eax, %eax
je 1f
@@ -305,17 +65,17 @@ __old_sem_wait:
jne 2b
xorl %eax, %eax
-5: movl 4(%esp), %esi
+ movl 4(%esp), %esi
+ cfi_restore(6)
movl 8(%esp), %ebx
+ cfi_restore(3)
addl $12, %esp
- cfi_restore(ebx)
- cfi_restore(esi)
cfi_adjust_cfa_offset(-12)
ret
cfi_adjust_cfa_offset(12)
- cfi_offset(ebx, -8)
- cfi_offset(esi, -12)
+ cfi_offset(3, -8) /* %ebx */
+ cfi_offset(6, -12) /* %esi */
1: call __pthread_enable_asynccancel
movl %eax, (%esp)
@@ -355,8 +115,25 @@ __old_sem_wait:
movl %esi, (%eax)
#endif
orl $-1, %eax
- jmp 5b
+ movl 4(%esp), %esi
+ cfi_restore(6)
+ movl 8(%esp), %ebx
+ cfi_restore(3)
+ addl $12, %esp
+ cfi_adjust_cfa_offset(-12)
+ ret
+
+5: /* Canceled. */
+ movl $0xffffffff, %gs:RESULT
+ LOCK
+ orl $0x10, %gs:CANCELHANDLING
+ movl %gs:CLEANUP_JMP_BUF, %eax
+ jmp HIDDEN_JUMPTARGET (__pthread_unwind)
cfi_endproc
- .size __old_sem_wait,.-__old_sem_wait
+ .size __new_sem_wait,.-__new_sem_wait
+ versioned_symbol(libpthread, __new_sem_wait, sem_wait, GLIBC_2_1)
+#if SHLIB_COMPAT(libpthread, GLIBC_2_0, GLIBC_2_1)
+ .global __old_sem_wait
+__old_sem_wait = __new_sem_wait
compat_symbol(libpthread, __old_sem_wait, sem_wait, GLIBC_2_0)
#endif
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h b/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h
index 474b39ae18..21de09fe91 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h
+++ b/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004, 2006, 2007 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 Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -23,8 +23,6 @@
#include <time.h>
#include <sys/param.h>
#include <bits/pthreadtypes.h>
-#include <kernel-features.h>
-#include <tcb-offsets.h>
#ifndef LOCK_INSTR
# ifdef UP
@@ -40,14 +38,6 @@
#define FUTEX_LOCK_PI 6
#define FUTEX_UNLOCK_PI 7
#define FUTEX_TRYLOCK_PI 8
-#define FUTEX_PRIVATE_FLAG 128
-
-
-/* Values for 'private' parameter of locking macros. Yes, the
- definition seems to be backwards. But it is not. The bit will be
- reversed before passing to the system call. */
-#define LLL_PRIVATE 0
-#define LLL_SHARED FUTEX_PRIVATE_FLAG
/* Initializer for compatibility lock. */
@@ -154,11 +144,7 @@ LLL_STUB_UNWIND_INFO_START \
LLL_STUB_UNWIND_INFO_END
-#define lll_futex_wait(futex, val, private) \
- lll_futex_timed_wait (futex, val, NULL, private)
-
-
-#define lll_futex_timed_wait(futex, val, timeout, private) \
+#define lll_futex_wait(futex, val) \
({ \
int __status; \
register __typeof (val) _val asm ("edx") = (val); \
@@ -166,7 +152,7 @@ LLL_STUB_UNWIND_INFO_END
LLL_ENTER_KERNEL \
LLL_EBX_LOAD \
: "=a" (__status) \
- : "0" (SYS_futex), LLL_EBX_REG (futex), "S" (timeout), \
+ : "0" (SYS_futex), LLL_EBX_REG (futex), "S" (0), \
"c" (FUTEX_WAIT), "d" (_val), \
"i" (offsetof (tcbhead_t, sysinfo)) \
: "memory"); \
@@ -174,27 +160,7 @@ LLL_STUB_UNWIND_INFO_END
})
-#define lll_futex_wake(futex, nr, private) \
- do { \
- int __ignore; \
- register __typeof (nr) _nr asm ("edx") = (nr); \
- __asm __volatile (LLL_EBX_LOAD \
- LLL_ENTER_KERNEL \
- LLL_EBX_LOAD \
- : "=a" (__ignore) \
- : "0" (SYS_futex), LLL_EBX_REG (futex), \
- "c" (FUTEX_WAKE), "d" (_nr), \
- "i" (0) /* phony, to align next arg's number */, \
- "i" (offsetof (tcbhead_t, sysinfo))); \
- } while (0)
-
-
-#define lll_private_futex_wait(futex, val) \
- lll_private_futex_timed_wait (futex, val, NULL)
-
-
-#ifdef __ASSUME_PRIVATE_FUTEX
-# define lll_private_futex_timed_wait(futex, val, timeout) \
+#define lll_futex_timed_wait(futex, val, timeout) \
({ \
int __status; \
register __typeof (val) _val asm ("edx") = (val); \
@@ -203,14 +169,14 @@ LLL_STUB_UNWIND_INFO_END
LLL_EBX_LOAD \
: "=a" (__status) \
: "0" (SYS_futex), LLL_EBX_REG (futex), "S" (timeout), \
- "c" (FUTEX_WAIT | FUTEX_PRIVATE_FLAG)), "d" (_val), \
+ "c" (FUTEX_WAIT), "d" (_val), \
"i" (offsetof (tcbhead_t, sysinfo)) \
: "memory"); \
__status; \
})
-# define lll_private_futex_wake(futex, nr) \
+#define lll_futex_wake(futex, nr) \
do { \
int __ignore; \
register __typeof (nr) _nr asm ("edx") = (nr); \
@@ -219,45 +185,10 @@ LLL_STUB_UNWIND_INFO_END
LLL_EBX_LOAD \
: "=a" (__ignore) \
: "0" (SYS_futex), LLL_EBX_REG (futex), \
- "c" (FUTEX_WAKE | FUTEX_PRIVATE_FLAG), "d" (_nr), \
+ "c" (FUTEX_WAKE), "d" (_nr), \
"i" (0) /* phony, to align next arg's number */, \
"i" (offsetof (tcbhead_t, sysinfo))); \
} while (0)
-#else
-# define lll_private_futex_timed_wait(futex, val, timeout) \
- ({ \
- int __status; \
- int __ignore; \
- register __typeof (val) _val asm ("edx") = (val); \
- __asm __volatile ("movl %%gs:%P7, %%ecx\n\t" \
- LLL_EBX_LOAD \
- LLL_ENTER_KERNEL \
- LLL_EBX_LOAD \
- : "=a" (__status), "=c" (__ignore) \
- : LLL_EBX_REG (futex), "0" (SYS_futex), "S" (timeout), \
- "d" (_val), "i" (offsetof (tcbhead_t, sysinfo)), \
- "i" (PRIVATE_FUTEX) \
- : "memory"); \
- __status; \
- })
-
-
-# define lll_private_futex_wake(futex, nr) \
- do { \
- int __ignore; \
- int __ignore2; \
- register __typeof (nr) _nr asm ("edx") = (nr); \
- __asm __volatile ("orl %%gs:%P7, %%ecx\n\t" \
- LLL_EBX_LOAD \
- LLL_ENTER_KERNEL \
- LLL_EBX_LOAD \
- : "=a" (__ignore), "=c" (__ignore2) \
- : LLL_EBX_REG (futex), "0" (SYS_futex), \
- "1" (FUTEX_WAKE), "d" (_nr), \
- "i" (offsetof (tcbhead_t, sysinfo)), \
- "i" (PRIVATE_FUTEX)); \
- } while (0)
-#endif
/* Does not preserve %eax and %ecx. */
@@ -483,6 +414,21 @@ extern int __lll_mutex_unlock_wake (int *__futex)
"i" (offsetof (tcbhead_t, sysinfo))); })
+#define lll_futex_wake(futex, nr) \
+ do { \
+ int __ignore; \
+ register __typeof (nr) _nr asm ("edx") = (nr); \
+ __asm __volatile (LLL_EBX_LOAD \
+ LLL_ENTER_KERNEL \
+ LLL_EBX_LOAD \
+ : "=a" (__ignore) \
+ : "0" (SYS_futex), LLL_EBX_REG (futex), \
+ "c" (FUTEX_WAKE), "d" (_nr), \
+ "i" (0) /* phony, to align next arg's number */, \
+ "i" (offsetof (tcbhead_t, sysinfo))); \
+ } while (0)
+
+
#define lll_mutex_islocked(futex) \
(futex != 0)
@@ -502,6 +448,7 @@ extern int __lll_lock_wait (int val, int *__futex)
__attribute ((regparm (2))) attribute_hidden;
extern int __lll_unlock_wake (int *__futex)
__attribute ((regparm (1))) attribute_hidden;
+extern int lll_unlock_wake_cb (int *__futex) attribute_hidden;
/* The states of a lock are:
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/pthread_once.S b/nptl/sysdeps/unix/sysv/linux/i386/pthread_once.S
index 8ff0dad27f..312933c5e4 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/pthread_once.S
+++ b/nptl/sysdeps/unix/sysv/linux/i386/pthread_once.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -19,8 +19,6 @@
#include <unwindbuf.h>
#include <sysdep.h>
-#include <kernel-features.h>
-
#ifndef UP
# define LOCK lock
@@ -28,10 +26,8 @@
# define LOCK
#endif
-#define SYS_futex 240
-#define FUTEX_WAIT 0
-#define FUTEX_WAKE 1
-#define FUTEX_PRIVATE_FLAG 128
+#define SYS_futex 240
+#define FUTEX_WAKE 1
.comm __fork_generation, 4, 4
@@ -94,16 +90,7 @@ __pthread_once:
jnz 3f /* Different for generation -> run initializer. */
/* Somebody else got here first. Wait. */
-#ifdef __ASSUME_PRIVATE_FUTEX
- movl $FUTEX_WAIT|FUTEX_PRIVATE_FLAG, %ecx
-#else
-# if FUTEX_WAIT == 0
- movl %gs:PRIVATE_FUTEX, %ecx
-# else
- movl $FUTEX_WAIT, %ecx
- orl %gs:PRIVATE_FUTEX, %ecx
-# endif
-#endif
+ movl %esi, %ecx /* movl $FUTEX_WAIT, %ecx */
movl $SYS_futex, %eax
ENTER_KERNEL
jmp 6b
@@ -144,12 +131,7 @@ __pthread_once:
/* Wake up all other threads. */
movl $0x7fffffff, %edx
-#ifdef __ASSUME_PRIVATE_FUTEX
- movl $FUTEX_WAKE|FUTEX_PRIVATE_FLAG, %ecx
-#else
movl $FUTEX_WAKE, %ecx
- orl %gs:PRIVATE_FUTEX, %ecx
-#endif
movl $SYS_futex, %eax
ENTER_KERNEL
@@ -170,12 +152,7 @@ __pthread_once:
movl $0, (%ebx)
movl $0x7fffffff, %edx
-#ifdef __ASSUME_PRIVATE_FUTEX
- movl $FUTEX_WAKE|FUTEX_PRIVATE_FLAG, %ecx
-#else
movl $FUTEX_WAKE, %ecx
- orl %gs:PRIVATE_FUTEX, %ecx
-#endif
movl $SYS_futex, %eax
ENTER_KERNEL
diff --git a/nptl/sysdeps/unix/sysv/linux/ia64/lowlevellock.h b/nptl/sysdeps/unix/sysv/linux/ia64/lowlevellock.h
index 17093471d3..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, 2006, 2007 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.
@@ -226,6 +226,8 @@ extern int __lll_robust_timedlock_wait (int *futex, const struct timespec *)
/* Type for lock object. */
typedef int lll_lock_t;
+extern int lll_unlock_wake_cb (int *__futex) attribute_hidden;
+
/* Initializers for lock. */
#define LLL_LOCK_INITIALIZER (0)
#define LLL_LOCK_INITIALIZER_LOCKED (1)
diff --git a/nptl/sysdeps/unix/sysv/linux/internaltypes.h b/nptl/sysdeps/unix/sysv/linux/internaltypes.h
index add20b6f72..1dec19e57d 100644
--- a/nptl/sysdeps/unix/sysv/linux/internaltypes.h
+++ b/nptl/sysdeps/unix/sysv/linux/internaltypes.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -76,11 +76,9 @@ struct pthread_condattr
/* The __NWAITERS field is used as a counter and to house the number
- of bits for other purposes. COND_CLOCK_BITS is the number
- of bits needed to represent the ID of the clock. COND_NWAITERS_SHIFT
- is the number of bits reserved for other purposes like the clock. */
-#define COND_CLOCK_BITS 1
-#define COND_NWAITERS_SHIFT 1
+ of bits which represent the clock. COND_CLOCK_BITS is the number
+ of bits reserved for the clock. */
+#define COND_CLOCK_BITS 1
/* Read-write lock variable attribute data structure. */
@@ -98,7 +96,6 @@ struct pthread_barrier
int lock;
unsigned int left;
unsigned int init_count;
- int private;
};
@@ -140,16 +137,9 @@ struct pthread_key_struct
/* Semaphore variable structure. */
-struct new_sem
+struct sem
{
- unsigned int value;
- int private;
- unsigned long int nwaiters;
-};
-
-struct old_sem
-{
- unsigned int value;
+ unsigned int count;
};
diff --git a/nptl/sysdeps/unix/sysv/linux/libc_pthread_init.c b/nptl/sysdeps/unix/sysv/linux/libc_pthread_init.c
index 4b614bd1a6..92a188a2f3 100644
--- a/nptl/sysdeps/unix/sysv/linux/libc_pthread_init.c
+++ b/nptl/sysdeps/unix/sysv/linux/libc_pthread_init.c
@@ -26,7 +26,6 @@
#include <pthreadP.h>
#include <bits/libc-lock.h>
#include <sysdep.h>
-#include <ldsodefs.h>
#ifdef TLS_MULTIPLE_THREADS_IN_TCB
diff --git a/nptl/sysdeps/unix/sysv/linux/lowlevelbarrier.sym b/nptl/sysdeps/unix/sysv/linux/lowlevelbarrier.sym
index cfe22b0892..36e28eb2a6 100644
--- a/nptl/sysdeps/unix/sysv/linux/lowlevelbarrier.sym
+++ b/nptl/sysdeps/unix/sysv/linux/lowlevelbarrier.sym
@@ -9,4 +9,3 @@ CURR_EVENT offsetof (struct pthread_barrier, curr_event)
MUTEX offsetof (struct pthread_barrier, lock)
LEFT offsetof (struct pthread_barrier, left)
INIT_COUNT offsetof (struct pthread_barrier, init_count)
-PRIVATE offsetof (struct pthread_barrier, private)
diff --git a/nptl/sysdeps/unix/sysv/linux/lowlevelcond.sym b/nptl/sysdeps/unix/sysv/linux/lowlevelcond.sym
index 18e1adad43..c5e7978069 100644
--- a/nptl/sysdeps/unix/sysv/linux/lowlevelcond.sym
+++ b/nptl/sysdeps/unix/sysv/linux/lowlevelcond.sym
@@ -13,4 +13,4 @@ wakeup_seq offsetof (pthread_cond_t, __data.__wakeup_seq)
woken_seq offsetof (pthread_cond_t, __data.__woken_seq)
dep_mutex offsetof (pthread_cond_t, __data.__mutex)
broadcast_seq offsetof (pthread_cond_t, __data.__broadcast_seq)
-nwaiters_shift COND_NWAITERS_SHIFT
+clock_bits COND_CLOCK_BITS
diff --git a/nptl/sysdeps/unix/sysv/linux/lowlevellock.c b/nptl/sysdeps/unix/sysv/linux/lowlevellock.c
index ab7f605f0c..932e27300f 100644
--- a/nptl/sysdeps/unix/sysv/linux/lowlevellock.c
+++ b/nptl/sysdeps/unix/sysv/linux/lowlevellock.c
@@ -1,5 +1,5 @@
/* low level locking for pthread library. Generic futex-using version.
- Copyright (C) 2003, 2007 Free Software Foundation, Inc.
+ Copyright (C) 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Paul Mackerras <paulus@au.ibm.com>, 2003.
@@ -31,9 +31,7 @@ __lll_lock_wait (int *futex)
{
int oldval = atomic_compare_and_exchange_val_acq (futex, 2, 1);
if (oldval != 0)
- lll_futex_wait (futex, 2,
- // XYZ check mutex flag
- LLL_SHARED);
+ lll_futex_wait (futex, 2);
}
while (atomic_compare_and_exchange_bool_acq (futex, 2, 0) != 0);
}
@@ -70,9 +68,7 @@ __lll_timedlock_wait (int *futex, const struct timespec *abstime)
/* Wait. */
int oldval = atomic_compare_and_exchange_val_acq (futex, 2, 1);
if (oldval != 0)
- lll_futex_timed_wait (futex, 2, &rt,
- // XYZ check mutex flag
- LLL_SHARED);
+ lll_futex_timed_wait (futex, 2, &rt);
}
while (atomic_compare_and_exchange_bool_acq (futex, 2, 0) != 0);
@@ -80,9 +76,21 @@ __lll_timedlock_wait (int *futex, const struct timespec *abstime)
}
-/* This function doesn't get included in libc.so */
+/* These don't get included in libc.so */
#ifdef IS_IN_libpthread
int
+lll_unlock_wake_cb (int *futex)
+{
+ int val = atomic_exchange_rel (futex, 0);
+
+ if (__builtin_expect (val > 1, 0))
+ lll_futex_wake (futex, 1);
+
+ return 0;
+}
+
+
+int
__lll_timedwait_tid (int *tidp, const struct timespec *abstime)
{
int tid;
@@ -112,12 +120,12 @@ __lll_timedwait_tid (int *tidp, const struct timespec *abstime)
if (rt.tv_sec < 0)
return ETIMEDOUT;
- /* Wait until thread terminates. The kernel so far does not use
- the private futex operations for this. */
- if (lll_futex_timed_wait (tidp, tid, &rt, LLL_SHARED) == -ETIMEDOUT)
+ /* Wait until thread terminates. */
+ if (lll_futex_timed_wait (tidp, tid, &rt) == -ETIMEDOUT)
return ETIMEDOUT;
}
return 0;
}
+
#endif
diff --git a/nptl/sysdeps/unix/sysv/linux/lowlevelrobustlock.c b/nptl/sysdeps/unix/sysv/linux/lowlevelrobustlock.c
index 54cee0859b..30ef991bd0 100644
--- a/nptl/sysdeps/unix/sysv/linux/lowlevelrobustlock.c
+++ b/nptl/sysdeps/unix/sysv/linux/lowlevelrobustlock.c
@@ -44,9 +44,7 @@ __lll_robust_lock_wait (int *futex)
&& atomic_compare_and_exchange_bool_acq (futex, newval, oldval))
continue;
- lll_futex_wait (futex, newval,
- // XYZ check mutex flag
- LLL_SHARED);
+ lll_futex_wait (futex, newval);
try:
;
@@ -102,9 +100,7 @@ __lll_robust_timedlock_wait (int *futex, const struct timespec *abstime)
&& atomic_compare_and_exchange_bool_acq (futex, newval, oldval))
continue;
- lll_futex_timed_wait (futex, newval, &rt,
- // XYZ check mutex flag
- LLL_SHARED);
+ lll_futex_timed_wait (futex, newval, &rt);
try:
;
diff --git a/nptl/sysdeps/unix/sysv/linux/lowlevelrwlock.sym b/nptl/sysdeps/unix/sysv/linux/lowlevelrwlock.sym
index f50b25bfb8..e82c878d39 100644
--- a/nptl/sysdeps/unix/sysv/linux/lowlevelrwlock.sym
+++ b/nptl/sysdeps/unix/sysv/linux/lowlevelrwlock.sym
@@ -1,7 +1,6 @@
#include <stddef.h>
#include <stdio.h>
#include <bits/pthreadtypes.h>
-#include <bits/wordsize.h>
--
@@ -13,4 +12,3 @@ READERS_QUEUED offsetof (pthread_rwlock_t, __data.__nr_readers_queued)
WRITERS_QUEUED offsetof (pthread_rwlock_t, __data.__nr_writers_queued)
FLAGS offsetof (pthread_rwlock_t, __data.__flags)
WRITER offsetof (pthread_rwlock_t, __data.__writer)
-PSHARED offsetof (pthread_rwlock_t, __data.__shared)
diff --git a/nptl/sysdeps/unix/sysv/linux/powerpc/bits/pthreadtypes.h b/nptl/sysdeps/unix/sysv/linux/powerpc/bits/pthreadtypes.h
index c0b59c336f..a7150f6aef 100644
--- a/nptl/sysdeps/unix/sysv/linux/powerpc/bits/pthreadtypes.h
+++ b/nptl/sysdeps/unix/sysv/linux/powerpc/bits/pthreadtypes.h
@@ -1,5 +1,5 @@
/* Machine-specific pthread type layouts. PowerPC version.
- Copyright (C) 2003, 2004, 2005, 2006, 2007 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 Paul Mackerras <paulus@au.ibm.com>, 2003.
@@ -160,9 +160,9 @@ typedef union
unsigned int __nr_readers_queued;
unsigned int __nr_writers_queued;
int __writer;
- int __shared;
- unsigned long int __pad1;
+ int __pad1;
unsigned long int __pad2;
+ unsigned long int __pad3;
/* FLAGS must stay at this position in the structure to maintain
binary compatibility. */
unsigned int __flags;
@@ -176,12 +176,9 @@ typedef union
unsigned int __writer_wakeup;
unsigned int __nr_readers_queued;
unsigned int __nr_writers_queued;
- unsigned char __pad1;
- unsigned char __pad2;
- unsigned char __shared;
/* FLAGS must stay at this position in the structure to maintain
binary compatibility. */
- unsigned char __flags;
+ unsigned int __flags;
int __writer;
} __data;
# endif
diff --git a/nptl/sysdeps/unix/sysv/linux/powerpc/lowlevellock.h b/nptl/sysdeps/unix/sysv/linux/powerpc/lowlevellock.h
index 20547f94f2..239f4ddf55 100644
--- a/nptl/sysdeps/unix/sysv/linux/powerpc/lowlevellock.h
+++ b/nptl/sysdeps/unix/sysv/linux/powerpc/lowlevellock.h
@@ -37,8 +37,6 @@
#define FUTEX_LOCK_PI 6
#define FUTEX_UNLOCK_PI 7
#define FUTEX_TRYLOCK_PI 8
-#define FUTEX_PRIVATE_FLAG 128
-
/* Initializer for compatibility lock. */
#define LLL_MUTEX_LOCK_INITIALIZER (0)
@@ -263,6 +261,8 @@ typedef int lll_lock_t;
#define LLL_LOCK_INITIALIZER (0)
#define LLL_LOCK_INITIALIZER_LOCKED (1)
+extern int lll_unlock_wake_cb (int *__futex) attribute_hidden;
+
/* The states of a lock are:
0 - untaken
1 - taken by one user
diff --git a/nptl/sysdeps/unix/sysv/linux/powerpc/pthread_attr_setstacksize.c b/nptl/sysdeps/unix/sysv/linux/powerpc/pthread_attr_setstacksize.c
index 6fedac1b33..9472dd17ef 100644
--- a/nptl/sysdeps/unix/sysv/linux/powerpc/pthread_attr_setstacksize.c
+++ b/nptl/sysdeps/unix/sysv/linux/powerpc/pthread_attr_setstacksize.c
@@ -1,4 +1,3 @@
-#include <unistd.h> /* For __getpagesize. */
#define NEW_VERNUM GLIBC_2_6
#define STACKSIZE_ADJUST \
do { \
diff --git a/nptl/sysdeps/unix/sysv/linux/rtld-lowlevel.h b/nptl/sysdeps/unix/sysv/linux/rtld-lowlevel.h
index 1aeff8fb39..6b3d3682da 100644
--- a/nptl/sysdeps/unix/sysv/linux/rtld-lowlevel.h
+++ b/nptl/sysdeps/unix/sysv/linux/rtld-lowlevel.h
@@ -1,5 +1,5 @@
/* Defintions for lowlevel handling in ld.so.
- Copyright (C) 2006, 2007 Free Software Foundation, Inc.
+ Copyright (C) 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
@@ -24,6 +24,115 @@
#include <lowlevellock.h>
+/* Special multi-reader lock used in ld.so. */
+#define __RTLD_MRLOCK_WRITER 1
+#define __RTLD_MRLOCK_RWAIT 2
+#define __RTLD_MRLOCK_WWAIT 4
+#define __RTLD_MRLOCK_RBITS \
+ ~(__RTLD_MRLOCK_WRITER | __RTLD_MRLOCK_RWAIT | __RTLD_MRLOCK_WWAIT)
+#define __RTLD_MRLOCK_INC 8
+#define __RTLD_MRLOCK_TRIES 5
+
+
+typedef int __rtld_mrlock_t;
+
+
+#define __rtld_mrlock_define(CLASS,NAME) \
+ CLASS __rtld_mrlock_t NAME;
+
+
+#define _RTLD_MRLOCK_INITIALIZER 0
+#define __rtld_mrlock_initialize(NAME) \
+ (void) ((NAME) = 0)
+
+
+#define __rtld_mrlock_lock(lock) \
+ do { \
+ __label__ out; \
+ while (1) \
+ { \
+ int oldval; \
+ for (int tries = 0; tries < __RTLD_MRLOCK_TRIES; ++tries) \
+ { \
+ oldval = lock; \
+ while (__builtin_expect ((oldval \
+ & (__RTLD_MRLOCK_WRITER \
+ | __RTLD_MRLOCK_WWAIT)) \
+ == 0, 1)) \
+ { \
+ int newval = ((oldval & __RTLD_MRLOCK_RBITS) \
+ + __RTLD_MRLOCK_INC); \
+ int ret = atomic_compare_and_exchange_val_acq (&(lock), \
+ newval, \
+ oldval); \
+ if (__builtin_expect (ret == oldval, 1)) \
+ goto out; \
+ oldval = ret; \
+ } \
+ atomic_delay (); \
+ } \
+ if ((oldval & __RTLD_MRLOCK_RWAIT) == 0) \
+ { \
+ atomic_or (&(lock), __RTLD_MRLOCK_RWAIT); \
+ oldval |= __RTLD_MRLOCK_RWAIT; \
+ } \
+ lll_futex_wait (lock, oldval); \
+ } \
+ out:; \
+ } while (0)
+
+
+#define __rtld_mrlock_unlock(lock) \
+ do { \
+ int oldval = atomic_exchange_and_add (&(lock), -__RTLD_MRLOCK_INC); \
+ if (__builtin_expect ((oldval \
+ & (__RTLD_MRLOCK_RBITS | __RTLD_MRLOCK_WWAIT)) \
+ == (__RTLD_MRLOCK_INC | __RTLD_MRLOCK_WWAIT), 0)) \
+ /* We have to wake all threads since there might be some queued \
+ readers already. */ \
+ lll_futex_wake (&(lock), 0x7fffffff); \
+ } while (0)
+
+
+/* There can only ever be one thread trying to get the exclusive lock. */
+#define __rtld_mrlock_change(lock) \
+ do { \
+ __label__ out; \
+ while (1) \
+ { \
+ int oldval; \
+ for (int tries = 0; tries < __RTLD_MRLOCK_TRIES; ++tries) \
+ { \
+ oldval = lock; \
+ while (__builtin_expect ((oldval & __RTLD_MRLOCK_RBITS) == 0, 1)) \
+ { \
+ int newval = ((oldval & __RTLD_MRLOCK_RWAIT) \
+ + __RTLD_MRLOCK_WRITER); \
+ int ret = atomic_compare_and_exchange_val_acq (&(lock), \
+ newval, \
+ oldval); \
+ if (__builtin_expect (ret == oldval, 1)) \
+ goto out; \
+ oldval = ret; \
+ } \
+ atomic_delay (); \
+ } \
+ atomic_or (&(lock), __RTLD_MRLOCK_WWAIT); \
+ oldval |= __RTLD_MRLOCK_WWAIT; \
+ lll_futex_wait (lock, oldval); \
+ } \
+ out:; \
+ } while (0)
+
+
+#define __rtld_mrlock_done(lock) \
+ do { \
+ int oldval = atomic_exchange_and_add (&(lock), -__RTLD_MRLOCK_WRITER); \
+ if (__builtin_expect ((oldval & __RTLD_MRLOCK_RWAIT) != 0, 0)) \
+ lll_futex_wake (&(lock), 0x7fffffff); \
+ } while (0)
+
+
/* Function to wait for variable become zero. Used in ld.so for
reference counters. */
#define __rtld_waitzero(word) \
@@ -33,12 +142,12 @@
int val = word; \
if (val == 0) \
break; \
- lll_private_futex_wait (&(word), val); \
+ lll_futex_wait (&(word), val); \
} \
} while (0)
#define __rtld_notify(word) \
- lll_private_futex_wake (&(word), 1)
+ lll_futex_wake (&(word), 1)
#endif
diff --git a/nptl/sysdeps/unix/sysv/linux/s390/lowlevellock.h b/nptl/sysdeps/unix/sysv/linux/s390/lowlevellock.h
index d915facba1..38d9f2ac41 100644
--- a/nptl/sysdeps/unix/sysv/linux/s390/lowlevellock.h
+++ b/nptl/sysdeps/unix/sysv/linux/s390/lowlevellock.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004, 2006, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>, 2003.
@@ -321,6 +321,8 @@ typedef int lll_lock_t;
#define lll_unlock(futex) lll_mutex_unlock (futex)
#define lll_islocked(futex) lll_mutex_islocked (futex)
+extern int lll_unlock_wake_cb (int *__futex) attribute_hidden;
+
/* The states of a lock are:
1 - untaken
0 - taken by one user
diff --git a/nptl/sysdeps/unix/sysv/linux/sem_post.c b/nptl/sysdeps/unix/sysv/linux/sem_post.c
index 7f90325585..671b43f7f7 100644
--- a/nptl/sysdeps/unix/sysv/linux/sem_post.c
+++ b/nptl/sysdeps/unix/sysv/linux/sem_post.c
@@ -1,5 +1,5 @@
/* sem_post -- post to a POSIX semaphore. Generic futex-using version.
- Copyright (C) 2003, 2004, 2007 Free Software Foundation, Inc.
+ 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.
@@ -29,36 +29,10 @@
int
__new_sem_post (sem_t *sem)
{
- struct new_sem *isem = (struct new_sem *) sem;
-
- int nr = atomic_increment_val (&isem->value);
- atomic_full_barrier ();
- if (isem->nwaiters > 0)
- {
- int err = lll_futex_wake (&isem->value, 1,
- // XYZ check mutex flag
- LLL_SHARED);
- if (__builtin_expect (err, 0) < 0)
- {
- __set_errno (-err);
- return -1;
- }
- }
- return 0;
-}
-versioned_symbol (libpthread, __new_sem_post, sem_post, GLIBC_2_1);
-
-
-#if SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_1)
-int
-attribute_compat_text_section
-__old_sem_post (sem_t *sem)
-{
int *futex = (int *) sem;
int nr = atomic_increment_val (futex);
- /* We always have to assume it is a shared semaphore. */
- int err = lll_futex_wake (futex, 1, LLL_SHARED);
+ int err = lll_futex_wake (futex, nr);
if (__builtin_expect (err, 0) < 0)
{
__set_errno (-err);
@@ -66,5 +40,8 @@ __old_sem_post (sem_t *sem)
}
return 0;
}
+versioned_symbol (libpthread, __new_sem_post, sem_post, GLIBC_2_1);
+#if SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_1)
+strong_alias (__new_sem_post, __old_sem_post)
compat_symbol (libpthread, __old_sem_post, sem_post, GLIBC_2_0);
#endif
diff --git a/nptl/sysdeps/unix/sysv/linux/sem_timedwait.c b/nptl/sysdeps/unix/sysv/linux/sem_timedwait.c
index 8f92d78abe..ef897c1e93 100644
--- a/nptl/sysdeps/unix/sysv/linux/sem_timedwait.c
+++ b/nptl/sysdeps/unix/sysv/linux/sem_timedwait.c
@@ -1,5 +1,5 @@
/* sem_timedwait -- wait on a semaphore. Generic futex-using version.
- Copyright (C) 2003, 2007 Free Software Foundation, Inc.
+ Copyright (C) 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Paul Mackerras <paulus@au.ibm.com>, 2003.
@@ -28,29 +28,28 @@
#include <shlib-compat.h>
-extern void __sem_wait_cleanup (void *arg) attribute_hidden;
-
-
int
sem_timedwait (sem_t *sem, const struct timespec *abstime)
{
- struct new_sem *isem = (struct new_sem *) sem;
- int err;
+ /* First check for cancellation. */
+ CANCELLATION_P (THREAD_SELF);
- if (atomic_decrement_if_positive (&isem->value) > 0)
- return 0;
+ int *futex = (int *) sem;
+ int val;
+ int err;
- if (abstime->tv_nsec < 0 || abstime->tv_nsec >= 1000000000)
+ if (*futex > 0)
{
- __set_errno (EINVAL);
- return -1;
+ val = atomic_decrement_if_positive (futex);
+ if (val > 0)
+ return 0;
}
- atomic_increment (&isem->nwaiters);
-
- pthread_cleanup_push (__sem_wait_cleanup, isem);
+ err = -EINVAL;
+ if (abstime->tv_nsec < 0 || abstime->tv_nsec >= 1000000000)
+ goto error_return;
- while (1)
+ do
{
struct timeval tv;
struct timespec rt;
@@ -71,11 +70,7 @@ sem_timedwait (sem_t *sem, const struct timespec *abstime)
/* Already timed out? */
err = -ETIMEDOUT;
if (sec < 0)
- {
- __set_errno (ETIMEDOUT);
- err = -1;
- break;
- }
+ goto error_return;
/* Do wait. */
rt.tv_sec = sec;
@@ -84,30 +79,21 @@ sem_timedwait (sem_t *sem, const struct timespec *abstime)
/* Enable asynchronous cancellation. Required by the standard. */
int oldtype = __pthread_enable_asynccancel ();
- err = lll_futex_timed_wait (&isem->value, 0, &rt,
- // XYZ check mutex flag
- LLL_SHARED);
+ err = lll_futex_timed_wait (futex, 0, &rt);
/* Disable asynchronous cancellation. */
__pthread_disable_asynccancel (oldtype);
if (err != 0 && err != -EWOULDBLOCK)
- {
- __set_errno (-err);
- err = -1;
- break;
- }
+ goto error_return;
- if (atomic_decrement_if_positive (&isem->value) > 0)
- {
- err = 0;
- break;
- }
+ val = atomic_decrement_if_positive (futex);
}
+ while (val <= 0);
- pthread_cleanup_pop (0);
-
- atomic_decrement (&isem->nwaiters);
+ return 0;
- return err;
+ error_return:
+ __set_errno (-err);
+ return -1;
}
diff --git a/nptl/sysdeps/unix/sysv/linux/sem_wait.c b/nptl/sysdeps/unix/sysv/linux/sem_wait.c
index 12f3f16c2d..e6733e88a3 100644
--- a/nptl/sysdeps/unix/sysv/linux/sem_wait.c
+++ b/nptl/sysdeps/unix/sysv/linux/sem_wait.c
@@ -1,5 +1,5 @@
/* sem_wait -- wait on a semaphore. Generic futex-using version.
- Copyright (C) 2003, 2007 Free Software Foundation, Inc.
+ Copyright (C) 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Paul Mackerras <paulus@au.ibm.com>, 2003.
@@ -28,69 +28,12 @@
#include <shlib-compat.h>
-void
-attribute_hidden
-__sem_wait_cleanup (void *arg)
-{
- struct new_sem *isem = (struct new_sem *) arg;
-
- atomic_decrement (&isem->nwaiters);
-}
-
-
int
__new_sem_wait (sem_t *sem)
{
- struct new_sem *isem = (struct new_sem *) sem;
- int err;
-
- if (atomic_decrement_if_positive (&isem->value) > 0)
- return 0;
-
- atomic_increment (&isem->nwaiters);
+ /* First check for cancellation. */
+ CANCELLATION_P (THREAD_SELF);
- pthread_cleanup_push (__sem_wait_cleanup, isem);
-
- while (1)
- {
- /* Enable asynchronous cancellation. Required by the standard. */
- int oldtype = __pthread_enable_asynccancel ();
-
- err = lll_futex_wait (&isem->value, 0,
- // XYZ check mutex flag
- LLL_SHARED);
-
- /* Disable asynchronous cancellation. */
- __pthread_disable_asynccancel (oldtype);
-
- if (err != 0 && err != -EWOULDBLOCK)
- {
- __set_errno (-err);
- err = -1;
- break;
- }
-
- if (atomic_decrement_if_positive (&isem->value) > 0)
- {
- err = 0;
- break;
- }
- }
-
- pthread_cleanup_pop (0);
-
- atomic_decrement (&isem->nwaiters);
-
- return err;
-}
-versioned_symbol (libpthread, __new_sem_wait, sem_wait, GLIBC_2_1);
-
-
-#if SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_1)
-int
-attribute_compat_text_section
-__old_sem_wait (sem_t *sem)
-{
int *futex = (int *) sem;
int err;
@@ -102,8 +45,7 @@ __old_sem_wait (sem_t *sem)
/* Enable asynchronous cancellation. Required by the standard. */
int oldtype = __pthread_enable_asynccancel ();
- /* Always assume the semaphore is shared. */
- err = lll_futex_wait (futex, 0, LLL_SHARED);
+ err = lll_futex_wait (futex, 0);
/* Disable asynchronous cancellation. */
__pthread_disable_asynccancel (oldtype);
@@ -114,5 +56,8 @@ __old_sem_wait (sem_t *sem)
return -1;
}
+versioned_symbol (libpthread, __new_sem_wait, sem_wait, GLIBC_2_1);
+#if SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_1)
+strong_alias (__new_sem_wait, __old_sem_wait)
compat_symbol (libpthread, __old_sem_wait, sem_wait, GLIBC_2_0);
#endif
diff --git a/nptl/sysdeps/unix/sysv/linux/sh/bits/pthreadtypes.h b/nptl/sysdeps/unix/sysv/linux/sh/bits/pthreadtypes.h
index badcda5701..969686dd5a 100644
--- a/nptl/sysdeps/unix/sysv/linux/sh/bits/pthreadtypes.h
+++ b/nptl/sysdeps/unix/sysv/linux/sh/bits/pthreadtypes.h
@@ -1,5 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007
- Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -21,8 +20,6 @@
#ifndef _BITS_PTHREADTYPES_H
#define _BITS_PTHREADTYPES_H 1
-#include <endian.h>
-
#define __SIZEOF_PTHREAD_ATTR_T 36
#define __SIZEOF_PTHREAD_MUTEX_T 24
#define __SIZEOF_PTHREAD_MUTEXATTR_T 4
@@ -130,21 +127,9 @@ typedef union
unsigned int __writer_wakeup;
unsigned int __nr_readers_queued;
unsigned int __nr_writers_queued;
-#if __BYTE_ORDER == __BIG_ENDIAN
- unsigned char __pad1;
- unsigned char __pad2;
- unsigned char __shared;
- /* FLAGS must stay at this position in the structure to maintain
- binary compatibility. */
- unsigned char __flags;
-#else
/* FLAGS must stay at this position in the structure to maintain
binary compatibility. */
- unsigned char __flags;
- unsigned char __shared;
- unsigned char __pad1;
- unsigned char __pad2;
-#endif
+ unsigned int __flags;
pthread_t __writer;
} __data;
char __size[__SIZEOF_PTHREAD_RWLOCK_T];
diff --git a/nptl/sysdeps/unix/sysv/linux/sh/libc-lowlevellock.S b/nptl/sysdeps/unix/sysv/linux/sh/libc-lowlevellock.S
index be85ab7414..94a24b46ee 100644
--- a/nptl/sysdeps/unix/sysv/linux/sh/libc-lowlevellock.S
+++ b/nptl/sysdeps/unix/sysv/linux/sh/libc-lowlevellock.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2003 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
@@ -16,32 +16,4 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#include <kernel-features.h>
-
-/* All locks in libc are private. Use the kernel feature if possible. */
-#define FUTEX_PRIVATE_FLAG 128
-#ifdef __ASSUME_PRIVATE_FUTEX
-# define FUTEX_WAIT (0 | FUTEX_PRIVATE_FLAG)
-# define FUTEX_WAKE (1 | FUTEX_PRIVATE_FLAG)
-#else
-# define LOAD_FUTEX_WAIT(reg,tmp) \
- stc gbr, tmp ; \
- mov.w 99f, reg ; \
- add reg, tmp ; \
- bra 98f ; \
- mov.l @tmp, reg ; \
-99: .word PRIVATE_FUTEX - TLS_PRE_TCB_SIZE ; \
-98:
-
-# define LOAD_FUTEX_WAKE(reg,tmp) \
- stc gbr, tmp ; \
- mov.w 99f, reg ; \
- add reg, tmp ; \
- mov.l @tmp, reg ; \
- bra 98f ; \
- mov #FUTEX_WAKE, tmp ; \
-99: .word PRIVATE_FUTEX - TLS_PRE_TCB_SIZE ; \
-98: or tmp, reg
-#endif
-
#include "lowlevellock.S"
diff --git a/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S b/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S
index b10903bcd7..ac3169889f 100644
--- a/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S
+++ b/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 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 and/or
@@ -24,24 +24,8 @@
#define SYS_gettimeofday __NR_gettimeofday
#define SYS_futex 240
-#ifndef FUTEX_WAIT
-# define FUTEX_WAIT 0
-# define FUTEX_WAKE 1
-#endif
-
-#ifndef LOAD_FUTEX_WAIT
-# if FUTEX_WAIT == 0
-# define LOAD_FUTEX_WAIT(reg,tmp) \
- xor reg, reg
-# else
-# define LOAD_FUTEX_WAIT(reg,tmp) \
- mov #FUTEX_WAIT, reg; \
- extu.b reg, reg
-# endif
-# define LOAD_FUTEX_WAKE(reg,tmp) \
- mov #FUTEX_WAKE, reg; \
- extu.b reg, reg
-#endif
+#define FUTEX_WAIT 0
+#define FUTEX_WAKE 1
.globl __lll_mutex_lock_wait
@@ -56,7 +40,7 @@ __lll_mutex_lock_wait:
mov r4, r6
mov r5, r8
mov #0, r7 /* No timeout. */
- LOAD_FUTEX_WAIT (r5, r0)
+ mov #FUTEX_WAIT, r5
mov #2, r4
cmp/eq r4, r6
@@ -149,7 +133,7 @@ __lll_mutex_timedlock_wait:
bt 8f
mov r8, r4
- LOAD_FUTEX_WAIT (r5, r0)
+ mov #FUTEX_WAIT, r5
mov r10, r6
mov r15, r7
mov #SYS_futex, r3
@@ -202,13 +186,41 @@ __lll_mutex_timedlock_wait:
#endif
+#ifdef NOT_IN_libc
+ .globl lll_unlock_wake_cb
+ .type lll_unlock_wake_cb,@function
+ .hidden lll_unlock_wake_cb
+ .align 5
+ cfi_startproc
+lll_unlock_wake_cb:
+ DEC (@r4, r2)
+ tst r2, r2
+ bt 1f
+
+ mov #FUTEX_WAKE, r5
+ mov #1, r6 /* Wake one thread. */
+ mov #0, r7
+ mov.l r7, @r4 /* Stores 0. */
+ mov #SYS_futex, r3
+ extu.b r3, r3
+ trapa #0x14
+ SYSCALL_INST_PAD
+
+1:
+ rts
+ nop
+ cfi_endproc
+ .size lll_unlock_wake_cb,.-lll_unlock_wake_cb
+#endif
+
+
.globl __lll_mutex_unlock_wake
.type __lll_mutex_unlock_wake,@function
.hidden __lll_mutex_unlock_wake
.align 5
cfi_startproc
__lll_mutex_unlock_wake:
- LOAD_FUTEX_WAKE (r5, r0)
+ mov #FUTEX_WAKE, r5
mov #1, r6 /* Wake one thread. */
mov #0, r7
mov.l r7, @r4 /* Stores 0. */
@@ -277,10 +289,7 @@ __lll_timedwait_tid:
bt 4f
mov r8, r4
- /* XXX The kernel so far uses global futex for the wakeup at
- all times. */
- mov #0, r5
- extu.b r5, r5
+ mov #FUTEX_WAIT, r5
mov r2, r6
mov r15, r7
mov #SYS_futex, r3
diff --git a/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.h b/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.h
index 3092b27642..0eb1f0114c 100644
--- a/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.h
+++ b/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004, 2006, 2007 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
@@ -22,7 +22,6 @@
#include <time.h>
#include <sys/param.h>
#include <bits/pthreadtypes.h>
-#include <kernel-features.h>
#define SYS_futex 240
#define FUTEX_WAIT 0
@@ -30,14 +29,6 @@
#define FUTEX_LOCK_PI 6
#define FUTEX_UNLOCK_PI 7
#define FUTEX_TRYLOCK_PI 8
-#define FUTEX_PRIVATE_FLAG 128
-
-
-/* Values for 'private' parameter of locking macros. Yes, the
- definition seems to be backwards. But it is not. The bit will be
- reversed before passing to the system call. */
-#define LLL_PRIVATE 0
-#define LLL_SHARED FUTEX_PRIVATE_FLAG
/* Initializer for compatibility lock. */
@@ -260,7 +251,7 @@ extern int __lll_mutex_unlock_wake (int *__futex) attribute_hidden;
and %2,%0\n\
mov.l %0,@%1\n\
1: mov r1,r15"\
- : "=&r" (__result) : "r" (__futex), "r" (FUTEX_WAITERS) \
+ : "=&r" (__result) : "r" (__futex), "r" (FUTEX_TID_MASK) \
: "r0", "r1", "memory"); \
if (__result) \
__lll_mutex_unlock_wake (__futex); })
@@ -278,7 +269,7 @@ extern int __lll_mutex_unlock_wake (int *__futex) attribute_hidden;
1: mov r1,r15"\
: "=&r" (__ignore) : "r" (__futex), "r" (FUTEX_OWNER_DIED) \
: "r0", "r1", "memory"); \
- lll_futex_wake (__futex, 1, 0); })
+ lll_futex_wake (__futex, 1); })
#define lll_mutex_islocked(futex) \
(futex != 0)
@@ -303,57 +294,15 @@ typedef int lll_lock_t;
trapa #0x14"
# endif
-#define lll_futex_wait(futex, val, private) \
- lll_futex_timed_wait (futex, val, NULL, private)
-
-
-#define lll_futex_timed_wait(futex, val, timeout, private) \
+#define lll_futex_wait(futex, val) \
({ \
int __status; \
register unsigned long __r3 asm ("r3") = SYS_futex; \
register unsigned long __r4 asm ("r4") = (unsigned long) (futex); \
register unsigned long __r5 asm ("r5") = FUTEX_WAIT; \
register unsigned long __r6 asm ("r6") = (unsigned long) (val); \
- register unsigned long __r7 asm ("r7") = (timeout); \
- __asm __volatile (SYSCALL_WITH_INST_PAD \
- : "=z" (__status) \
- : "r" (__r3), "r" (__r4), "r" (__r5), \
- "r" (__r6), "r" (__r7) \
- : "memory", "t"); \
- __status; \
- })
-
-
-#define lll_futex_wake(futex, nr, private) \
- do { \
- int __ignore; \
- register unsigned long __r3 asm ("r3") = SYS_futex; \
- register unsigned long __r4 asm ("r4") = (unsigned long) (futex); \
- register unsigned long __r5 asm ("r5") = FUTEX_WAKE; \
- register unsigned long __r6 asm ("r6") = (unsigned long) (nr); \
register unsigned long __r7 asm ("r7") = 0; \
__asm __volatile (SYSCALL_WITH_INST_PAD \
- : "=z" (__ignore) \
- : "r" (__r3), "r" (__r4), "r" (__r5), \
- "r" (__r6), "r" (__r7) \
- : "memory", "t"); \
- } while (0)
-
-
-#define lll_private_futex_wait(futex, val) \
- lll_private_futex_timed_wait (futex, val, NULL)
-
-
-#ifdef __ASSUME_PRIVATE_FUTEX
-# define lll_private_futex_timed_wait(futex, val, timeout) \
- ({ \
- int __status; \
- register unsigned long __r3 asm ("r3") = SYS_futex; \
- register unsigned long __r4 asm ("r4") = (unsigned long) (futex); \
- register unsigned long __r5 asm ("r5") = FUTEX_WAIT | FUTEX_PRIVATE_FLAG; \
- register unsigned long __r6 asm ("r6") = (unsigned long) (val); \
- register unsigned long __r7 asm ("r7") = (timeout); \
- __asm __volatile (SYSCALL_WITH_INST_PAD \
: "=z" (__status) \
: "r" (__r3), "r" (__r4), "r" (__r5), \
"r" (__r6), "r" (__r7) \
@@ -362,32 +311,14 @@ typedef int lll_lock_t;
})
-# define lll_private_futex_wake(futex, nr) \
- do { \
- int __ignore; \
- register unsigned long __r3 asm ("r3") = SYS_futex; \
- register unsigned long __r4 asm ("r4") = (unsigned long) (futex); \
- register unsigned long __r5 asm ("r5") = FUTEX_WAKE | FUTEX_PRIVATE_FLAG; \
- register unsigned long __r6 asm ("r6") = (unsigned long) (nr); \
- register unsigned long __r7 asm ("r7") = 0; \
- __asm __volatile (SYSCALL_WITH_INST_PAD \
- : "=z" (__ignore) \
- : "r" (__r3), "r" (__r4), "r" (__r5), \
- "r" (__r6), "r" (__r7) \
- : "memory", "t"); \
- } while (0)
-
-
-#else
-# define lll_private_futex_timed_wait(futex, val, timeout) \
+#define lll_futex_timed_wait(futex, val, timeout) \
({ \
int __status; \
register unsigned long __r3 asm ("r3") = SYS_futex; \
register unsigned long __r4 asm ("r4") = (unsigned long) (futex); \
- register unsigned long __r5 asm ("r5"); \
+ register unsigned long __r5 asm ("r5") = FUTEX_WAIT; \
register unsigned long __r6 asm ("r6") = (unsigned long) (val); \
register unsigned long __r7 asm ("r7") = (timeout); \
- __r5 = THREAD_GETMEM (THREAD_SELF, header.private_futex); \
__asm __volatile (SYSCALL_WITH_INST_PAD \
: "=z" (__status) \
: "r" (__r3), "r" (__r4), "r" (__r5), \
@@ -397,7 +328,7 @@ typedef int lll_lock_t;
})
-# define lll_private_futex_wake(futex, nr) \
+#define lll_futex_wake(futex, nr) \
do { \
int __ignore; \
register unsigned long __r3 asm ("r3") = SYS_futex; \
@@ -405,14 +336,15 @@ typedef int lll_lock_t;
register unsigned long __r5 asm ("r5") = FUTEX_WAKE; \
register unsigned long __r6 asm ("r6") = (unsigned long) (nr); \
register unsigned long __r7 asm ("r7") = 0; \
- __r5 |= THREAD_GETMEM (THREAD_SELF, header.private_futex); \
__asm __volatile (SYSCALL_WITH_INST_PAD \
: "=z" (__ignore) \
: "r" (__r3), "r" (__r4), "r" (__r5), \
"r" (__r6), "r" (__r7) \
: "memory", "t"); \
} while (0)
-#endif
+
+
+extern int lll_unlock_wake_cb (int *__futex) attribute_hidden;
/* The states of a lock are:
@@ -438,7 +370,7 @@ extern int __lll_wait_tid (int *tid) attribute_hidden;
do { \
__typeof (tid) *__tid = &(tid); \
while (*__tid != 0) \
- lll_futex_wait (__tid, *__tid, 0); \
+ lll_futex_wait (__tid, *__tid); \
} while (0)
extern int __lll_timedwait_tid (int *tid, const struct timespec *abstime)
diff --git a/nptl/sysdeps/unix/sysv/linux/sh/pthread_barrier_wait.S b/nptl/sysdeps/unix/sysv/linux/sh/pthread_barrier_wait.S
index 35dd607fc1..1fbb23a5a6 100644
--- a/nptl/sysdeps/unix/sysv/linux/sh/pthread_barrier_wait.S
+++ b/nptl/sysdeps/unix/sysv/linux/sh/pthread_barrier_wait.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004 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
@@ -65,13 +65,7 @@ pthread_barrier_wait:
#if CURR_EVENT != 0
add #CURR_EVENT, r4
#endif
-#if FUTEX_WAIT == 0
- mov.l @(PRIVATE,r8), r5
-#else
mov #FUTEX_WAIT, r5
- mov.l @(PRIVATE,r8), r0
- or r0, r5
-#endif
mov #0, r7
8:
mov #SYS_futex, r3
@@ -124,8 +118,6 @@ pthread_barrier_wait:
#endif
mov #0, r7
mov #FUTEX_WAKE, r5
- mov.l @(PRIVATE,r8), r0
- or r0, r5
mov #SYS_futex, r3
extu.b r3, r3
trapa #0x14
diff --git a/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S b/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S
index 0173cfb7d8..6c782c8a76 100644
--- a/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S
+++ b/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004, 2006, 2007 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
@@ -120,7 +120,7 @@ __pthread_cond_timedwait:
mov.l @(cond_futex,r8), r0
add r2, r0
mov.l r0, @(cond_futex,r8)
- mov #(1 << nwaiters_shift), r2
+ mov #(1 << clock_bits), r2
mov.l @(cond_nwaiters,r8), r0
add r2, r0
mov.l r0, @(cond_nwaiters,r8)
@@ -136,7 +136,7 @@ __pthread_cond_timedwait:
#ifdef __NR_clock_gettime
/* Get the clock number. */
mov.l @(cond_nwaiters,r8), r4
- mov #((1 << nwaiters_shift) - 1), r0
+ mov #((1 << clock_bits) - 1), r0
and r0, r4
/* Only clocks 0 and 1 are allowed. Both are handled in the
kernel. */
@@ -323,7 +323,7 @@ __pthread_cond_timedwait:
mov.l r1,@(woken_seq+4,r8)
24:
- mov #(1 << nwaiters_shift), r2
+ mov #(1 << clock_bits), r2
mov.l @(cond_nwaiters,r8),r0
sub r2, r0
mov.l r0,@(cond_nwaiters,r8)
@@ -335,7 +335,7 @@ __pthread_cond_timedwait:
not r0, r0
cmp/eq #0, r0
bf/s 25f
- mov #((1 << nwaiters_shift) - 1), r1
+ mov #((1 << clock_bits) - 1), r1
not r1, r1
mov.l @(cond_nwaiters,r8),r0
tst r1, r0
@@ -557,7 +557,7 @@ __condvar_tw_cleanup:
mov.l r1,@(woken_seq+4,r8)
3:
- mov #(1 << nwaiters_shift), r2
+ mov #(1 << clock_bits), r2
mov.l @(cond_nwaiters,r8),r0
sub r2, r0
mov.l r0,@(cond_nwaiters,r8)
@@ -570,7 +570,7 @@ __condvar_tw_cleanup:
not r0, r0
cmp/eq #0, r0
bf/s 4f
- mov #((1 << nwaiters_shift) - 1), r1
+ mov #((1 << clock_bits) - 1), r1
not r1, r1
mov.l @(cond_nwaiters,r8),r0
tst r1, r0
diff --git a/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_wait.S b/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_wait.S
index 5eb332e484..6c59f3e6c0 100644
--- a/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_wait.S
+++ b/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_wait.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004, 2006, 2007 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
@@ -107,7 +107,7 @@ __pthread_cond_wait:
mov.l @(cond_futex,r8),r0
add r2, r0
mov.l r0,@(cond_futex,r8)
- mov #(1 << nwaiters_shift), r2
+ mov #(1 << clock_bits), r2
mov.l @(cond_nwaiters,r8), r0
add r2, r0
mov.l r0, @(cond_nwaiters,r8)
@@ -197,7 +197,7 @@ __pthread_cond_wait:
mov.l r1,@(woken_seq+4,r8)
16:
- mov #(1 << nwaiters_shift), r2
+ mov #(1 << clock_bits), r2
mov.l @(cond_nwaiters,r8),r0
sub r2, r0
mov.l r0,@(cond_nwaiters,r8)
@@ -209,7 +209,7 @@ __pthread_cond_wait:
not r0, r0
cmp/eq #0, r0
bf/s 17f
- mov #((1 << nwaiters_shift) - 1), r1
+ mov #((1 << clock_bits) - 1), r1
not r1, r1
mov.l @(cond_nwaiters,r8),r0
tst r1, r0
@@ -421,7 +421,7 @@ __condvar_w_cleanup:
mov.l r1,@(woken_seq+4,r8)
3:
- mov #(1 << nwaiters_shift), r2
+ mov #(1 << clock_bits), r2
mov.l @(cond_nwaiters,r8),r0
sub r2, r0
mov.l r0,@(cond_nwaiters,r8)
@@ -434,7 +434,7 @@ __condvar_w_cleanup:
not r0, r0
cmp/eq #0, r0
bf/s 4f
- mov #((1 << nwaiters_shift) - 1), r1
+ mov #((1 << clock_bits) - 1), r1
not r1, r1
mov.l @(cond_nwaiters,r8),r0
tst r1, r0
diff --git a/nptl/sysdeps/unix/sysv/linux/sh/pthread_once.S b/nptl/sysdeps/unix/sysv/linux/sh/pthread_once.S
index 3d694d8376..02af56b4c7 100644
--- a/nptl/sysdeps/unix/sysv/linux/sh/pthread_once.S
+++ b/nptl/sysdeps/unix/sysv/linux/sh/pthread_once.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004 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
@@ -18,13 +18,11 @@
#include <unwindbuf.h>
#include <sysdep.h>
-#include <kernel-features.h>
#include "lowlevel-atomic.h"
-#define SYS_futex 240
-#define FUTEX_WAIT 0
-#define FUTEX_WAKE 1
-#define FUTEX_PRIVATE_FLAG 128
+#define SYS_futex 240
+#define FUTEX_WAIT 0
+#define FUTEX_WAKE 1
.comm __fork_generation, 4, 4
@@ -97,19 +95,7 @@ __pthread_once:
bf 3f /* Different for generation -> run initializer. */
/* Somebody else got here first. Wait. */
-#if __ASSUME_PRIVATE_FUTEX
- mov #(FUTEX_PRIVATE_FLAG|FUTEX_WAIT), r5
- extu.b r5, r5
-#else
- stc gbr, r1
- mov.w .Lpfoff, r2
- add r2, r1
- mov.l @r1, r5
-# if FUTEX_WAIT != 0
- mov #FUTEX_WAIT, r0
- or r0, r5
-# endif
-#endif
+ mov #FUTEX_WAIT, r5
mov r3, r6
mov #0, r7
mov #SYS_futex, r3
@@ -171,17 +157,7 @@ __pthread_once:
INC (@r9, r2)
/* Wake up all other threads. */
mov r9, r4
-#if __ASSUME_PRIVATE_FUTEX
- mov #(FUTEX_PRIVATE_FLAG|FUTEX_WAKE), r5
- extu.b r5, r5
-#else
- stc gbr, r1
- mov.w .Lpfoff, r2
- add r2, r1
- mov.l @r1, r5
- mov #FUTEX_WAKE, r0
- or r0, r5
-#endif
+ mov #FUTEX_WAKE, r5
mov #-1, r6
shlr r6 /* r6 = 0x7fffffff */
mov #0, r7
@@ -216,17 +192,7 @@ __pthread_once:
mov #0, r7
mov.l r7, @r9
mov r9, r4
-#if __ASSUME_PRIVATE_FUTEX
- mov #(FUTEX_PRIVATE_FLAG|FUTEX_WAKE), r5
-#else
- stc gbr, r1
- mov.w .Lpfoff, r2
- add r2, r1
- mov.l @r1, r5
- mov #FUTEX_WAKE, r0
- or r0, r5
-#endif
- extu.b r5, r5
+ mov #FUTEX_WAKE, r5
mov #-1, r6
shlr r6 /* r6 = 0x7fffffff */
mov #SYS_futex, r3
@@ -242,10 +208,6 @@ __pthread_once:
sleep
cfi_endproc
-#if !__ASSUME_PRIVATE_FUTEX
-.Lpfoff:
- .word PRIVATE_FUTEX - TLS_PRE_TCB_SIZE
-#endif
.align 2
.Lsigsetjmp:
.long __sigsetjmp@PLT-(.Lsigsetjmp0-.)
@@ -262,3 +224,23 @@ __pthread_once_internal = __pthread_once
.globl pthread_once
pthread_once = __pthread_once
+
+
+ .type clear_once_control,@function
+ .align 5
+clear_once_control:
+ mov #0, r0
+ mov.l r0, @r4
+
+ mov #FUTEX_WAKE, r5
+ mov #-1, r6
+ shlr r6 /* r6 = 0x7fffffff */
+ mov #0, r7
+ mov #SYS_futex, r3
+ extu.b r3, r3
+ trapa #0x14
+ SYSCALL_INST_PAD
+
+ rts
+ nop
+ .size clear_once_control,.-clear_once_control
diff --git a/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_rdlock.S b/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_rdlock.S
index f1795131f8..f64c7217c9 100644
--- a/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_rdlock.S
+++ b/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_rdlock.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2003 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
@@ -20,13 +20,11 @@
#include <lowlevelrwlock.h>
#include <pthread-errnos.h>
#include <tcb-offsets.h>
-#include <kernel-features.h>
#include "lowlevel-atomic.h"
#define SYS_futex 240
#define FUTEX_WAIT 0
#define FUTEX_WAKE 1
-#define FUTEX_PRIVATE_FLAG 128
.text
@@ -57,8 +55,7 @@ __pthread_rwlock_rdlock:
mov.l @(WRITERS_QUEUED,r8), r0
tst r0, r0
bt 5f
- mov #FLAGS, r0
- mov.b @(r0,r8), r0
+ mov.l @(FLAGS,r8), r0
tst r0, r0
bt 5f
3:
@@ -78,28 +75,9 @@ __pthread_rwlock_rdlock:
tst r2, r2
bf 10f
11:
-#if __ASSUME_PRIVATE_FUTEX
- mov #PSHARED, r0
- mov.b @(r0,r8), r5
- mov #(FUTEX_PRIVATE_FLAG|FUTEX_WAIT), r0
- xor r0, r5
- extu.b r5, r5
-#else
- mov #PSHARED, r0
- mov.b @(r0,r8), r5
- extu.b r5, r5
-# if FUTEX_WAIT != 0
- mov #FUTEX_WAIT, r0
- or r0, r5
-# endif
- stc gbr, r1
- mov.w .Lpfoff, r2
- add r2, r1
- mov.l @r1, r0
- xor r0, r5
-#endif
mov r8, r4
add #READERS_WAKEUP, r4
+ mov #FUTEX_WAIT, r5
mov r9, r6
mov #0, r7
mov #SYS_futex, r3
@@ -146,11 +124,6 @@ __pthread_rwlock_rdlock:
rts
mov r3, r0
-#if !__ASSUME_PRIVATE_FUTEX
-.Lpfoff:
- .word PRIVATE_FUTEX - TLS_PRE_TCB_SIZE
-#endif
-
1:
mov r8, r5
#if MUTEX != 0
diff --git a/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedrdlock.S b/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedrdlock.S
index e87326e9bd..633a14b1aa 100644
--- a/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedrdlock.S
+++ b/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedrdlock.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2003 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
@@ -20,14 +20,12 @@
#include <lowlevelrwlock.h>
#include <pthread-errnos.h>
#include <tcb-offsets.h>
-#include <kernel-features.h>
#include "lowlevel-atomic.h"
#define SYS_gettimeofday __NR_gettimeofday
#define SYS_futex 240
#define FUTEX_WAIT 0
#define FUTEX_WAKE 1
-#define FUTEX_PRIVATE_FLAG 128
.text
@@ -61,8 +59,7 @@ pthread_rwlock_timedrdlock:
mov.l @(WRITERS_QUEUED,r8), r0
tst r0, r0
bt 5f
- mov #FLAGS, r0
- mov.b @(r0,r8), r0
+ mov.l @(FLAGS,r8), r0
tst r0, r0
bt 5f
3:
@@ -120,26 +117,7 @@ pthread_rwlock_timedrdlock:
/* Futex call. */
mov r15, r7
-#if __ASSUME_PRIVATE_FUTEX
- mov #PSHARED, r0
- mov.b @(r0,r8), r5
- mov #(FUTEX_PRIVATE_FLAG|FUTEX_WAIT), r0
- xor r0, r5
- extu.b r5, r5
-#else
- mov #PSHARED, r0
- mov.b @(r0,r8), r5
- extu.b r5, r5
-# if FUTEX_WAIT != 0
- mov #FUTEX_WAIT, r0
- or r0, r5
-# endif
- stc gbr, r1
- mov.w .Lpfoff, r2
- add r2, r1
- mov.l @r1, r0
- xor r0, r5
-#endif
+ mov #FUTEX_WAIT, r5
mov r10, r6
mov r8, r4
add #READERS_WAKEUP, r4
@@ -198,10 +176,6 @@ pthread_rwlock_timedrdlock:
rts
mov r3, r0
-#if !__ASSUME_PRIVATE_FUTEX
-.Lpfoff:
- .word PRIVATE_FUTEX - TLS_PRE_TCB_SIZE
-#endif
.align 2
.L1k0:
.long 1000
diff --git a/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedwrlock.S b/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedwrlock.S
index 18641fe9df..29e29b6f65 100644
--- a/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedwrlock.S
+++ b/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedwrlock.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2003 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
@@ -20,14 +20,12 @@
#include <lowlevelrwlock.h>
#include <pthread-errnos.h>
#include <tcb-offsets.h>
-#include <kernel-features.h>
#include "lowlevel-atomic.h"
#define SYS_gettimeofday __NR_gettimeofday
#define SYS_futex 240
#define FUTEX_WAIT 0
#define FUTEX_WAKE 1
-#define FUTEX_PRIVATE_FLAG 128
.text
@@ -116,26 +114,7 @@ pthread_rwlock_timedwrlock:
/* Futex call. */
mov r15, r7
-#if __ASSUME_PRIVATE_FUTEX
- mov #PSHARED, r0
- mov.b @(r0,r8), r5
- mov #(FUTEX_PRIVATE_FLAG|FUTEX_WAIT), r0
- xor r0, r5
- extu.b r5, r5
-#else
- mov #PSHARED, r0
- mov.b @(r0,r8), r5
- extu.b r5, r5
-# if FUTEX_WAIT != 0
- mov #FUTEX_WAIT, r0
- or r0, r5
-# endif
- stc gbr, r1
- mov.w .Lpfoff, r2
- add r2, r1
- mov.l @r1, r0
- xor r0, r5
-#endif
+ mov #FUTEX_WAIT, r5
mov r10, r6
mov r8, r4
add #WRITERS_WAKEUP, r4
@@ -196,10 +175,6 @@ pthread_rwlock_timedwrlock:
rts
mov r3, r0
-#if !__ASSUME_PRIVATE_FUTEX
-.Lpfoff:
- .word PRIVATE_FUTEX - TLS_PRE_TCB_SIZE
-#endif
.L1k1:
.word 1000
.align 2
diff --git a/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_unlock.S b/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_unlock.S
index df4df60d7f..172689bec3 100644
--- a/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_unlock.S
+++ b/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_unlock.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2003 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
@@ -18,13 +18,11 @@
#include <sysdep.h>
#include <lowlevelrwlock.h>
-#include <kernel-features.h>
#include "lowlevel-atomic.h"
#define SYS_futex 240
#define FUTEX_WAIT 0
#define FUTEX_WAKE 1
-#define FUTEX_PRIVATE_FLAG 128
.text
@@ -89,24 +87,7 @@ __pthread_rwlock_unlock:
bf 7f
8:
-#if __ASSUME_PRIVATE_FUTEX
- mov #PSHARED, r0
- mov.b @(r0,r8), r5
- mov #(FUTEX_PRIVATE_FLAG|FUTEX_WAKE), r0
- xor r0, r5
- extu.b r5, r5
-#else
- mov #PSHARED, r0
- mov.b @(r0,r8), r5
- extu.b r5, r5
- mov #FUTEX_WAKE, r0
- or r0, r5
- stc gbr, r1
- mov.w .Lpfoff, r2
- add r2, r1
- mov.l @r1, r0
- xor r0, r5
-#endif
+ mov #FUTEX_WAKE, r5
mov #SYS_futex, r3
mov #0, r7
extu.b r3, r3
@@ -173,10 +154,6 @@ __pthread_rwlock_unlock:
bra 8b
mov.l @r15+, r4
-#if !__ASSUME_PRIVATE_FUTEX
-.Lpfoff:
- .word PRIVATE_FUTEX - TLS_PRE_TCB_SIZE
-#endif
.align 2
.Lwait8:
.long __lll_mutex_lock_wait-.Lwait8b
diff --git a/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_wrlock.S b/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_wrlock.S
index 13a2fda9fd..995d823e80 100644
--- a/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_wrlock.S
+++ b/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_wrlock.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2003 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
@@ -20,13 +20,11 @@
#include <lowlevelrwlock.h>
#include <pthread-errnos.h>
#include <tcb-offsets.h>
-#include <kernel-features.h>
#include "lowlevel-atomic.h"
#define SYS_futex 240
#define FUTEX_WAIT 0
#define FUTEX_WAKE 1
-#define FUTEX_PRIVATE_FLAG 128
.text
@@ -76,26 +74,7 @@ __pthread_rwlock_wrlock:
11:
mov r8, r4
add #WRITERS_WAKEUP, r4
-#if __ASSUME_PRIVATE_FUTEX
- mov #PSHARED, r0
- mov.b @(r0,r8), r5
- mov #(FUTEX_PRIVATE_FLAG|FUTEX_WAIT), r0
- xor r0, r5
- extu.b r5, r5
-#else
- mov #PSHARED, r0
- mov.b @(r0,r8), r5
- extu.b r5, r5
-# if FUTEX_WAIT != 0
- mov #FUTEX_WAIT, r0
- or r0, r5
-# endif
- stc gbr, r1
- mov.w .Lpfoff, r2
- add r2, r1
- mov.l @r1, r0
- xor r0, r5
-#endif
+ mov #FUTEX_WAIT, r5
mov r9, r6
mov #0, r7
mov #SYS_futex, r3
@@ -173,10 +152,6 @@ __pthread_rwlock_wrlock:
bra 7b
mov #0, r3
-#if !__ASSUME_PRIVATE_FUTEX
-.Lpfoff:
- .word PRIVATE_FUTEX - TLS_PRE_TCB_SIZE
-#endif
.Ltidoff:
.word TID - TLS_PRE_TCB_SIZE
diff --git a/nptl/sysdeps/unix/sysv/linux/sh/sem_post.S b/nptl/sysdeps/unix/sysv/linux/sh/sem_post.S
index a63233feab..9bc12da7e0 100644
--- a/nptl/sysdeps/unix/sysv/linux/sh/sem_post.S
+++ b/nptl/sysdeps/unix/sysv/linux/sh/sem_post.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004 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
@@ -19,7 +19,6 @@
#include <sysdep.h>
#include <shlib-compat.h>
#include <pthread-errnos.h>
-#include <structsem.h>
#include "lowlevel-atomic.h"
@@ -35,14 +34,11 @@
.align 5
__new_sem_post:
mov #1, r3
- XADD (r3, @(VALUE,r4), r2)
- mov.l @(NWAITERS,r4), r2
- tst r2, r2
- bt 2f
+ XADD (r3, @r4, r2)
+
mov #FUTEX_WAKE, r5
- mov.l @(PRIVATE,r4), r1
- or r1, r5
- mov #1, r6
+ mov r2, r6
+ add #1, r6
mov #0, r7
mov #SYS_futex, r3
extu.b r3, r3
@@ -51,7 +47,6 @@ __new_sem_post:
cmp/pz r0
bf 1f
-2:
rts
mov #0, r0
diff --git a/nptl/sysdeps/unix/sysv/linux/sh/sem_timedwait.S b/nptl/sysdeps/unix/sysv/linux/sh/sem_timedwait.S
index e5e064b3a5..acb7d0f78b 100644
--- a/nptl/sysdeps/unix/sysv/linux/sh/sem_timedwait.S
+++ b/nptl/sysdeps/unix/sysv/linux/sh/sem_timedwait.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004 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
@@ -20,25 +20,32 @@
#include <shlib-compat.h>
#include <pthread-errnos.h>
#include <tcb-offsets.h>
-#include <structsem.h>
#include "lowlevel-atomic.h"
#define SYS_gettimeofday __NR_gettimeofday
#define SYS_futex 240
#define FUTEX_WAIT 0
-
-#if VALUE != 0
-# error "code needs to be rewritten for VALUE != 0"
-#endif
+#define FUTEX_WAKE 1
.text
.globl sem_timedwait
.type sem_timedwait,@function
.align 5
+ cfi_startproc
sem_timedwait:
-.LSTARTCODE:
+ /* First check for cancellation. */
+ stc gbr, r0
+ mov.w .Lchand, r1
+ mov.l @(r0,r1), r0
+ mov #0xf9, r1
+ and r1, r0
+ cmp/eq #8, r0
+ bf 0f
+ bra 10f
+ stc gbr, r0
+0:
mov.l @r4, r0
2:
tst r0, r0
@@ -55,17 +62,22 @@ sem_timedwait:
1:
/* Check whether the timeout value is valid. */
mov.l r8, @-r15
-.Lpush_r8:
+ cfi_adjust_cfa_offset(4)
+ cfi_rel_offset (r8, 0)
mov.l r9, @-r15
-.Lpush_r9:
+ cfi_adjust_cfa_offset(4)
+ cfi_rel_offset (r9, 0)
mov.l r10, @-r15
-.Lpush_r10:
+ cfi_adjust_cfa_offset(4)
+ cfi_rel_offset (r10, 0)
mov.l r12, @-r15
-.Lpush_r12:
+ cfi_adjust_cfa_offset(4)
+ cfi_rel_offset (r12, 0)
sts.l pr, @-r15
-.Lpush_pr:
+ cfi_adjust_cfa_offset(4)
+ cfi_rel_offset (pr, 0)
add #-8, r15
-.Lalloc:
+ cfi_adjust_cfa_offset(8)
mov r4, r8
mov r5, r9
@@ -75,9 +87,13 @@ sem_timedwait:
cmp/hs r1, r0
bt/s 6f
mov #EINVAL, r0
- INC (@(NWAITERS,r8),r2)
-
7:
+ mov.l .Lenable0, r1
+ bsrf r1
+ nop
+.Lenable0b:
+ mov r0, r10
+
/* Compute relative timeout. */
mov r15, r4
mov #0, r5
@@ -108,21 +124,9 @@ sem_timedwait:
mov.l r2, @r15
mov.l r3, @(4,r15)
-.LcleanupSTART:
- mov.l .Lenable0, r1
- bsrf r1
- nop
-.Lenable0b:
- mov r0, r10
-
+ /* Futex call. */
mov r8, r4
-#if FUTEX_WAIT == 0
- mov.l @(PRIVATE,r8), r5
-#else
- mov.l @(PRIVATE,r8), r5
- mov #FUTEX_WAIT, r0
- or r0, r5
-#endif
+ mov #FUTEX_WAIT, r5
mov #0, r6
mov r15, r7
mov #SYS_futex, r3
@@ -136,7 +140,6 @@ sem_timedwait:
mov r0, r10
.Ldisable0b:
mov r10, r0
-.LcleanupEND:
tst r0, r0
bt 9f
@@ -155,10 +158,6 @@ sem_timedwait:
bf/s 8b
mov r2, r0
- DEC (@(NWAITERS,r8), r2)
- mov #0, r0
-
-10:
add #8, r15
lds.l @r15+, pr
mov.l @r15+, r12
@@ -166,12 +165,12 @@ sem_timedwait:
mov.l @r15+, r9
mov.l @r15+, r8
rts
- nop
+ mov #0, r0
3:
neg r0, r0
6:
- mov r0, r10
+ mov r0, r8
mova .Lgot2, r0
mov.l .Lgot2, r12
add r0, r12
@@ -181,20 +180,46 @@ sem_timedwait:
stc gbr, r1
mov.l @(r0, r12), r0
add r1, r0
- mov.l r10, @r0
+ mov.l r8, @r0
#else
mov.l .Lerrloc2, r1
bsrf r1
nop
.Lerrloc2b:
- mov.l r10, @r0
+ mov.l r8, @r0
#endif
- DEC (@(NWAITERS,r8), r2)
- bra 10b
+ add #8, r15
+ lds.l @r15+, pr
+ mov.l @r15+, r12
+ mov.l @r15+, r10
+ mov.l @r15+, r9
+ mov.l @r15+, r8
+ rts
mov #-1, r0
+10:
+ /* Canceled. */
+ mov.w .Lresult, r1
+ mov #-1, r2
+ mov.l r2, @(r0,r1)
+ mov.w .Lchand, r0
+ or.b #0x10, @(r0,gbr)
+ stc gbr, r0
+ mov.w .Lclbuf, r1
+ mov.l .Lunwind, r2
+ braf r2
+ mov.l @(r0,r1), r4
+.Lunwindb:
+ cfi_endproc
+
.L1k:
.word 1000
+.Lchand:
+ .word CANCELHANDLING - TLS_PRE_TCB_SIZE
+.Lresult:
+ .word RESULT - TLS_PRE_TCB_SIZE
+.Lclbuf:
+ .word CLEANUP_JMP_BUF - TLS_PRE_TCB_SIZE
.align 2
.L1g:
.long 1000000000
@@ -211,151 +236,6 @@ sem_timedwait:
.long __pthread_enable_asynccancel-.Lenable0b
.Ldisable0:
.long __pthread_disable_asynccancel-.Ldisable0b
+.Lunwind:
+ .long HIDDEN_JUMPTARGET (__pthread_unwind)-.Lunwindb
.size sem_timedwait,.-sem_timedwait
-
- .type sem_wait_cleanup,@function
-sem_wait_cleanup:
- DEC (@(NWAITERS,r8), r2)
-.LcallUR:
- mov.l .Lresume, r1
-#ifdef PIC
- add r12, r1
-#endif
- jsr @r1
- nop
- sleep
-
- .align 2
-.Lresume:
-#ifdef PIC
- .long _Unwind_Resume@GOTOFF
-#else
- .long _Unwind_Resume
-#endif
-.LENDCODE:
- .size sem_wait_cleanup,.-sem_wait_cleanup
-
-
- .section .gcc_except_table,"a",@progbits
-.LexceptSTART:
- .byte 0xff ! @LPStart format (omit)
- .byte 0xff ! @TType format (omit)
- .byte 0x01 ! call-site format
- ! DW_EH_PE_uleb128
- .uleb128 .Lcstend-.Lcstbegin
-.Lcstbegin:
- .uleb128 .LcleanupSTART-.LSTARTCODE
- .uleb128 .LcleanupEND-.LcleanupSTART
- .uleb128 sem_wait_cleanup-.LSTARTCODE
- .uleb128 0
- .uleb128 .LcallUR-.LSTARTCODE
- .uleb128 .LENDCODE-.LcallUR
- .uleb128 0
- .uleb128 0
-.Lcstend:
-
-
- .section .eh_frame,"a",@progbits
-.LSTARTFRAME:
- .ualong .LENDCIE-.LSTARTCIE ! Length of the CIE.
-.LSTARTCIE:
- .ualong 0 ! CIE ID.
- .byte 1 ! Version number.
-#ifdef SHARED
- .string "zPLR" ! NUL-terminated augmentation
- ! string.
-#else
- .string "zPL" ! NUL-terminated augmentation
- ! string.
-#endif
- .uleb128 1 ! Code alignment factor.
- .sleb128 -4 ! Data alignment factor.
- .byte 0x11 ! Return address register
- ! column.
-#ifdef SHARED
- .uleb128 7 ! Augmentation value length.
- .byte 0x9b ! Personality: DW_EH_PE_pcrel
- ! + DW_EH_PE_sdata4
- ! + DW_EH_PE_indirect
- .ualong DW.ref.__gcc_personality_v0-.
- .byte 0x1b ! LSDA Encoding: DW_EH_PE_pcrel
- ! + DW_EH_PE_sdata4.
- .byte 0x1b ! FDE Encoding: DW_EH_PE_pcrel
- ! + DW_EH_PE_sdata4.
-#else
- .uleb128 6 ! Augmentation value length.
- .byte 0x0 ! Personality: absolute
- .ualong __gcc_personality_v0
- .byte 0x0 ! LSDA Encoding: absolute
-#endif
- .byte 0x0c ! DW_CFA_def_cfa
- .uleb128 0xf
- .uleb128 0
- .align 4
-.LENDCIE:
-
- .ualong .LENDFDE-.LSTARTFDE ! Length of the FDE.
-.LSTARTFDE:
- .ualong .LSTARTFDE-.LSTARTFRAME ! CIE pointer.
-#ifdef SHARED
- .ualong .LSTARTCODE-. ! PC-relative start address
- ! of the code.
-#else
- .ualong .LSTARTCODE ! Start address of the code.
-#endif
- .ualong .LENDCODE-.LSTARTCODE ! Length of the code.
- .uleb128 4 ! Augmentation size
-#ifdef SHARED
- .ualong .LexceptSTART-.
-#else
- .ualong .LexceptSTART
-#endif
-
- .byte 4 ! DW_CFA_advance_loc4
- .ualong .Lpush_r8-.LSTARTCODE
- .byte 14 ! DW_CFA_def_cfa_offset
- .uleb128 4
- .byte 0x88 ! DW_CFA_offset r8
- .uleb128 1
- .byte 4 ! DW_CFA_advance_loc4
- .ualong .Lpush_r9-.Lpush_r8
- .byte 14 ! DW_CFA_def_cfa_offset
- .uleb128 8
- .byte 0x89 ! DW_CFA_offset r9
- .uleb128 2
- .byte 4 ! DW_CFA_advance_loc4
- .ualong .Lpush_r10-.Lpush_r9
- .byte 14 ! DW_CFA_def_cfa_offset
- .uleb128 12
- .byte 0x8a ! DW_CFA_offset r10
- .uleb128 3
- .byte 4 ! DW_CFA_advance_loc4
- .ualong .Lpush_r12-.Lpush_r10
- .byte 14 ! DW_CFA_def_cfa_offset
- .uleb128 16
- .byte 0x8c ! DW_CFA_offset r12
- .uleb128 4
- .byte 4 ! DW_CFA_advance_loc4
- .ualong .Lpush_pr-.Lpush_r12
- .byte 14 ! DW_CFA_def_cfa_offset
- .uleb128 20
- .byte 0x91 ! DW_CFA_offset pr
- .uleb128 5
- .byte 4 ! DW_CFA_advance_loc4
- .ualong .Lalloc-.Lpush_pr
- .byte 14 ! DW_CFA_def_cfa_offset
- .uleb128 28
- .align 4
-.LENDFDE:
-
-
-#ifdef SHARED
- .hidden DW.ref.__gcc_personality_v0
- .weak DW.ref.__gcc_personality_v0
- .section .gnu.linkonce.d.DW.ref.__gcc_personality_v0,"aw",@progbits
- .align 4
- .type DW.ref.__gcc_personality_v0, @object
- .size DW.ref.__gcc_personality_v0, 4
-DW.ref.__gcc_personality_v0:
- .long __gcc_personality_v0
-#endif
diff --git a/nptl/sysdeps/unix/sysv/linux/sh/sem_wait.S b/nptl/sysdeps/unix/sysv/linux/sh/sem_wait.S
index 85ce909259..9ceb8f1c24 100644
--- a/nptl/sysdeps/unix/sysv/linux/sh/sem_wait.S
+++ b/nptl/sysdeps/unix/sysv/linux/sh/sem_wait.S
@@ -20,35 +20,44 @@
#include <shlib-compat.h>
#include <pthread-errnos.h>
#include <tcb-offsets.h>
-#include <structsem.h>
#include "lowlevel-atomic.h"
#define SYS_gettimeofday __NR_gettimeofday
#define SYS_futex 240
#define FUTEX_WAIT 0
-
-#if VALUE != 0
-# error "code needs to be rewritten for VALUE != 0"
-#endif
+#define FUTEX_WAKE 1
.text
.globl __new_sem_wait
.type __new_sem_wait,@function
.align 5
+ cfi_startproc
__new_sem_wait:
-.LSTARTCODE:
+ /* First check for cancellation. */
+ stc gbr, r0
+ mov.w .Lchand, r1
+ mov.l @(r0,r1), r0
+ mov #0xf9, r1
+ and r1, r0
+ cmp/eq #8, r0
+ bt 5f
+
mov.l r8, @-r15
-.Lpush_r8:
+ cfi_adjust_cfa_offset(4)
+ cfi_rel_offset (r8, 0)
mov.l r10, @-r15
-.Lpush_r10:
+ cfi_adjust_cfa_offset(4)
+ cfi_rel_offset (r10, 0)
mov.l r12, @-r15
-.Lpush_r12:
+ cfi_adjust_cfa_offset(4)
+ cfi_rel_offset (r12, 0)
sts.l pr, @-r15
-.Lpush_pr:
+ cfi_adjust_cfa_offset(4)
+ cfi_rel_offset (pr, 0)
mov r4, r8
-
+3:
mov.l @r8, r0
2:
tst r0, r0
@@ -59,21 +68,10 @@ __new_sem_wait:
CMPXCHG (r4, @r8, r3, r2)
bf/s 2b
mov r2, r0
-7:
- mov #0, r0
-9:
- lds.l @r15+, pr
- mov.l @r15+, r12
- mov.l @r15+, r10
- rts
- mov.l @r15+, r8
+ bra 9f
+ mov #0, r0
-.Lafter_ret:
1:
- INC (@(NWAITERS,r8),r2)
-
-.LcleanupSTART:
-6:
mov.l .Lenable0, r1
bsrf r1
nop
@@ -81,13 +79,7 @@ __new_sem_wait:
mov r0, r10
mov r8, r4
-#if FUTEX_WAIT == 0
- mov.l @(PRIVATE,r8), r5
-#else
- mov.l @(PRIVATE,r8), r5
- mov #FUTEX_WAIT, r0
- or r0, r5
-#endif
+ mov #FUTEX_WAIT, r5
mov #0, r6
mov #0, r7
mov #SYS_futex, r3
@@ -101,35 +93,14 @@ __new_sem_wait:
mov r0, r10
.Ldisable0b:
mov r10, r0
-.LcleanupEND:
tst r0, r0
- bt 3f
+ bt 3b
cmp/eq #-EWOULDBLOCK, r0
- bf 4f
-
-3:
- mov.l @r8, r0
-5:
- tst r0, r0
- bt 6b
-
- mov r0, r3
- mov r0, r4
- add #-1, r3
- CMPXCHG (r4, @r8, r3, r2)
- bf/s 5b
- mov r2, r0
-
- DEC (@(NWAITERS,r8), r2)
- bra 7b
- nop
-
-4:
+ bt 3b
neg r0, r0
- mov r0, r4
- DEC (@(NWAITERS,r8), r2)
- mov r4, r8
+
+ mov r0, r8
mova .Lgot0, r0
mov.l .Lgot0, r12
add r0, r12
@@ -147,9 +118,36 @@ __new_sem_wait:
.Lerrloc0b:
mov.l r8, @r0
#endif
- bra 9b
- mov #-1, r0
+ mov #-1, r0
+9:
+ lds.l @r15+, pr
+ mov.l @r15+, r12
+ mov.l @r15+, r10
+ rts
+ mov.l @r15+, r8
+5:
+ /* Canceled. */
+ stc gbr, r0
+ mov.w .Lresult, r1
+ mov #-1, r2
+ mov.l r2, @(r0,r1)
+ mov.w .Lchand, r0
+ or.b #0x10, @(r0,gbr)
+ stc gbr, r0
+ mov.w .Lclbuf, r1
+ mov.l .Lunwind, r2
+ braf r2
+ mov.l @(r0,r1), r4
+.Lunwindb:
+ cfi_endproc
+.Lchand:
+ .word CANCELHANDLING - TLS_PRE_TCB_SIZE
+.Lresult:
+ .word RESULT - TLS_PRE_TCB_SIZE
+.Lclbuf:
+ .word CLEANUP_JMP_BUF - TLS_PRE_TCB_SIZE
+ .align 2
.Lgot0:
.long _GLOBAL_OFFSET_TABLE_
#if USE___THREAD
@@ -163,143 +161,7 @@ __new_sem_wait:
.long __pthread_enable_asynccancel-.Lenable0b
.Ldisable0:
.long __pthread_disable_asynccancel-.Ldisable0b
+.Lunwind:
+ .long HIDDEN_JUMPTARGET (__pthread_unwind)-.Lunwindb
.size __new_sem_wait,.-__new_sem_wait
versioned_symbol(libpthread, __new_sem_wait, sem_wait, GLIBC_2_1)
-
-
- .type sem_wait_cleanup,@function
-sem_wait_cleanup:
- DEC (@(NWAITERS,r8), r2)
-.LcallUR:
- mov.l .Lresume, r1
-#ifdef PIC
- add r12, r1
-#endif
- jsr @r1
- nop
- sleep
-
- .align 2
-.Lresume:
-#ifdef PIC
- .long _Unwind_Resume@GOTOFF
-#else
- .long _Unwind_Resume
-#endif
-.LENDCODE:
- .size sem_wait_cleanup,.-sem_wait_cleanup
-
-
- .section .gcc_except_table,"a",@progbits
-.LexceptSTART:
- .byte 0xff ! @LPStart format (omit)
- .byte 0xff ! @TType format (omit)
- .byte 0x01 ! call-site format
- ! DW_EH_PE_uleb128
- .uleb128 .Lcstend-.Lcstbegin
-.Lcstbegin:
- .uleb128 .LcleanupSTART-.LSTARTCODE
- .uleb128 .LcleanupEND-.LcleanupSTART
- .uleb128 sem_wait_cleanup-.LSTARTCODE
- .uleb128 0
- .uleb128 .LcallUR-.LSTARTCODE
- .uleb128 .LENDCODE-.LcallUR
- .uleb128 0
- .uleb128 0
-.Lcstend:
-
-
- .section .eh_frame,"a",@progbits
-.LSTARTFRAME:
- .ualong .LENDCIE-.LSTARTCIE ! Length of the CIE.
-.LSTARTCIE:
- .ualong 0 ! CIE ID.
- .byte 1 ! Version number.
-#ifdef SHARED
- .string "zPLR" ! NUL-terminated augmentation
- ! string.
-#else
- .string "zPL" ! NUL-terminated augmentation
- ! string.
-#endif
- .uleb128 1 ! Code alignment factor.
- .sleb128 -4 ! Data alignment factor.
- .byte 0x11 ! Return address register
- ! column.
-#ifdef SHARED
- .uleb128 7 ! Augmentation value length.
- .byte 0x9b ! Personality: DW_EH_PE_pcrel
- ! + DW_EH_PE_sdata4
- ! + DW_EH_PE_indirect
- .ualong DW.ref.__gcc_personality_v0-.
- .byte 0x1b ! LSDA Encoding: DW_EH_PE_pcrel
- ! + DW_EH_PE_sdata4.
- .byte 0x1b ! FDE Encoding: DW_EH_PE_pcrel
- ! + DW_EH_PE_sdata4.
-#else
- .uleb128 6 ! Augmentation value length.
- .byte 0x0 ! Personality: absolute
- .ualong __gcc_personality_v0
- .byte 0x0 ! LSDA Encoding: absolute
-#endif
- .byte 0x0c ! DW_CFA_def_cfa
- .uleb128 0xf
- .uleb128 0
- .align 4
-.LENDCIE:
-
- .ualong .LENDFDE-.LSTARTFDE ! Length of the FDE.
-.LSTARTFDE:
- .ualong .LSTARTFDE-.LSTARTFRAME ! CIE pointer.
-#ifdef SHARED
- .ualong .LSTARTCODE-. ! PC-relative start address
- ! of the code.
-#else
- .ualong .LSTARTCODE ! Start address of the code.
-#endif
- .ualong .LENDCODE-.LSTARTCODE ! Length of the code.
- .uleb128 4 ! Augmentation size
-#ifdef SHARED
- .ualong .LexceptSTART-.
-#else
- .ualong .LexceptSTART
-#endif
-
- .byte 4 ! DW_CFA_advance_loc4
- .ualong .Lpush_r8-.LSTARTCODE
- .byte 14 ! DW_CFA_def_cfa_offset
- .uleb128 4
- .byte 0x88 ! DW_CFA_offset r8
- .uleb128 1
- .byte 4 ! DW_CFA_advance_loc4
- .ualong .Lpush_r10-.Lpush_r8
- .byte 14 ! DW_CFA_def_cfa_offset
- .uleb128 8
- .byte 0x8a ! DW_CFA_offset r10
- .uleb128 2
- .byte 4 ! DW_CFA_advance_loc4
- .ualong .Lpush_r12-.Lpush_r10
- .byte 14 ! DW_CFA_def_cfa_offset
- .uleb128 12
- .byte 0x8c ! DW_CFA_offset r12
- .uleb128 3
- .byte 4 ! DW_CFA_advance_loc4
- .ualong .Lpush_pr-.Lpush_r12
- .byte 14 ! DW_CFA_def_cfa_offset
- .uleb128 16
- .byte 0x91 ! DW_CFA_offset pr
- .uleb128 4
- .align 4
-.LENDFDE:
-
-
-#ifdef SHARED
- .hidden DW.ref.__gcc_personality_v0
- .weak DW.ref.__gcc_personality_v0
- .section .gnu.linkonce.d.DW.ref.__gcc_personality_v0,"aw",@progbits
- .align 4
- .type DW.ref.__gcc_personality_v0, @object
- .size DW.ref.__gcc_personality_v0, 4
-DW.ref.__gcc_personality_v0:
- .long __gcc_personality_v0
-#endif
diff --git a/nptl/sysdeps/unix/sysv/linux/sparc/lowlevellock.h b/nptl/sysdeps/unix/sysv/linux/sparc/lowlevellock.h
index 6548970663..5013922a2f 100644
--- a/nptl/sysdeps/unix/sysv/linux/sparc/lowlevellock.h
+++ b/nptl/sysdeps/unix/sysv/linux/sparc/lowlevellock.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004, 2006, 2007 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.
@@ -240,6 +240,8 @@ __lll_robust_mutex_timedlock (int *futex, const struct timespec *abstime,
/* Type for lock object. */
typedef int lll_lock_t;
+extern int lll_unlock_wake_cb (int *__futex) attribute_hidden;
+
/* Initializers for lock. */
#define LLL_LOCK_INITIALIZER (0)
#define LLL_LOCK_INITIALIZER_LOCKED (1)
diff --git a/nptl/sysdeps/unix/sysv/linux/sparc/pthread_once.c b/nptl/sysdeps/unix/sysv/linux/sparc/pthread_once.c
index 83fedef8e8..3b07cc127d 100644
--- a/nptl/sysdeps/unix/sysv/linux/sparc/pthread_once.c
+++ b/nptl/sysdeps/unix/sysv/linux/sparc/pthread_once.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004, 2007 Free Software Foundation, Inc.
+/* 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.
@@ -30,7 +30,7 @@ clear_once_control (void *arg)
pthread_once_t *once_control = (pthread_once_t *) arg;
*once_control = 0;
- lll_private_futex_wake (once_control, INT_MAX);
+ lll_futex_wake (once_control, INT_MAX);
}
@@ -84,7 +84,7 @@ __pthread_once (once_control, init_routine)
atomic_increment (once_control);
/* Wake up all other threads. */
- lll_private_futex_wake (once_control, INT_MAX);
+ lll_futex_wake (once_control, INT_MAX);
break;
}
diff --git a/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/lowlevellock.c b/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/lowlevellock.c
index cb9578b47b..a7611d6a88 100644
--- a/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/lowlevellock.c
+++ b/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/lowlevellock.c
@@ -1,5 +1,5 @@
/* low level locking for pthread library. SPARC version.
- Copyright (C) 2003, 2006, 2007 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Paul Mackerras <paulus@au.ibm.com>, 2003.
@@ -76,9 +76,21 @@ __lll_timedlock_wait (int *futex, const struct timespec *abstime)
}
-/* This function doesn't get included in libc.so */
+/* These don't get included in libc.so */
#ifdef IS_IN_libpthread
int
+lll_unlock_wake_cb (int *futex)
+{
+ int val = atomic_exchange_24_rel (futex, 0);
+
+ if (__builtin_expect (val > 1, 0))
+ lll_futex_wake (futex, 1);
+
+ return 0;
+}
+
+
+int
__lll_timedwait_tid (int *tidp, const struct timespec *abstime)
{
int tid;
@@ -115,4 +127,5 @@ __lll_timedwait_tid (int *tidp, const struct timespec *abstime)
return 0;
}
+
#endif
diff --git a/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/pthread_barrier_wait.c b/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/pthread_barrier_wait.c
index 868e0d2819..4dfd11dcbe 100644
--- a/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/pthread_barrier_wait.c
+++ b/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/pthread_barrier_wait.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004, 2006, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>, 2003.
@@ -52,9 +52,7 @@ pthread_barrier_wait (barrier)
++ibarrier->b.curr_event;
/* Wake up everybody. */
- lll_futex_wake (&ibarrier->b.curr_event, INT_MAX,
- // XYZ check mutex flag
- LLL_SHARED);
+ lll_futex_wake (&ibarrier->b.curr_event, INT_MAX);
/* This is the thread which finished the serialization. */
result = PTHREAD_BARRIER_SERIAL_THREAD;
@@ -70,9 +68,7 @@ pthread_barrier_wait (barrier)
/* Wait for the event counter of the barrier to change. */
do
- lll_futex_wait (&ibarrier->b.curr_event, event,
- // XYZ check mutex flag
- LLL_SHARED);
+ lll_futex_wait (&ibarrier->b.curr_event, event);
while (event == ibarrier->b.curr_event);
}
diff --git a/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_post.c b/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_post.c
index 527aedfdc7..be1cc60b11 100644
--- a/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_post.c
+++ b/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_post.c
@@ -1,5 +1,5 @@
/* sem_post -- post to a POSIX semaphore. SPARC version.
- Copyright (C) 2003, 2004, 2006, 2007 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.
@@ -39,9 +39,7 @@ __new_sem_post (sem_t *sem)
nr = ++*futex;
__sparc32_atomic_do_unlock24 (futex + 1);
}
- int err = lll_futex_wake (futex, nr,
- // XYZ check mutex flag
- LLL_SHARED);
+ int err = lll_futex_wake (futex, nr);
if (__builtin_expect (err, 0) < 0)
{
__set_errno (-err);
diff --git a/nptl/sysdeps/unix/sysv/linux/structsem.sym b/nptl/sysdeps/unix/sysv/linux/structsem.sym
deleted file mode 100644
index 4f32c68da5..0000000000
--- a/nptl/sysdeps/unix/sysv/linux/structsem.sym
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <stddef.h>
-#include <sched.h>
-#include <bits/pthreadtypes.h>
-#include "internaltypes.h"
-
---
-
-VALUE offsetof (struct new_sem, value)
-PRIVATE offsetof (struct new_sem, private)
-NWAITERS offsetof (struct new_sem, nwaiters)
diff --git a/nptl/sysdeps/unix/sysv/linux/unregister-atfork.c b/nptl/sysdeps/unix/sysv/linux/unregister-atfork.c
index 240ce597f9..964f5b7094 100644
--- a/nptl/sysdeps/unix/sysv/linux/unregister-atfork.c
+++ b/nptl/sysdeps/unix/sysv/linux/unregister-atfork.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2005, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -104,7 +104,7 @@ __unregister_atfork (dso_handle)
atomic_decrement (&deleted->handler->refcntr);
unsigned int val;
while ((val = deleted->handler->refcntr) != 0)
- lll_private_futex_wait (&deleted->handler->refcntr, val);
+ lll_futex_wait (&deleted->handler->refcntr, val);
deleted = deleted->next;
}
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/bits/pthreadtypes.h b/nptl/sysdeps/unix/sysv/linux/x86_64/bits/pthreadtypes.h
index 7a09c81194..693387a266 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/bits/pthreadtypes.h
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/bits/pthreadtypes.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002,2003,2004,2005,2006,2007 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -159,9 +159,9 @@ typedef union
unsigned int __nr_readers_queued;
unsigned int __nr_writers_queued;
int __writer;
- int __shared;
- unsigned long int __pad1;
+ int __pad1;
unsigned long int __pad2;
+ unsigned long int __pad3;
/* FLAGS must stay at this position in the structure to maintain
binary compatibility. */
unsigned int __flags;
@@ -177,10 +177,7 @@ typedef union
unsigned int __nr_writers_queued;
/* FLAGS must stay at this position in the structure to maintain
binary compatibility. */
- unsigned char __flags;
- unsigned char __shared;
- unsigned char __pad1;
- unsigned char __pad2;
+ unsigned int __flags;
int __writer;
} __data;
# endif
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/libc-lowlevellock.S b/nptl/sysdeps/unix/sysv/linux/x86_64/libc-lowlevellock.S
index 3265eee0ed..3621efa4fc 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/libc-lowlevellock.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/libc-lowlevellock.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -17,19 +17,14 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#include <kernel-features.h>
-
-/* All locks in libc are private. Use the kernel feature if possible. */
-#define FUTEX_PRIVATE_FLAG 128
-#ifdef __ASSUME_PRIVATE_FUTEX
-# define FUTEX_WAIT (0 | FUTEX_PRIVATE_FLAG)
-# define FUTEX_WAKE (1 | FUTEX_PRIVATE_FLAG)
-#else
-# define LOAD_FUTEX_WAIT(reg) \
- movl %fs:PRIVATE_FUTEX, reg
-# define LOAD_FUTEX_WAKE(reg) \
- movl %fs:PRIVATE_FUTEX, reg ; \
- orl $FUTEX_WAKE, reg
+/* In libc.so we do not unconditionally use the lock prefix. Only if
+ the application is using threads. */
+#ifndef UP
+# define LOCK \
+ cmpl $0, __libc_multiple_threads(%rip); \
+ je 0f; \
+ lock; \
+0:
#endif
#include "lowlevellock.S"
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S b/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S
index 502f1d442f..6724ded762 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S
@@ -31,23 +31,8 @@
#endif
#define SYS_futex 202
-#ifndef FUTEX_WAIT
-# define FUTEX_WAIT 0
-# define FUTEX_WAKE 1
-#endif
-
-#ifndef LOAD_FUTEX_WAIT
-# if FUTEX_WAIT == 0
-# define LOAD_FUTEX_WAIT(reg) \
- xorl reg, reg
-# else
-# define LOAD_FUTEX_WAIT(reg) \
- movl $FUTEX_WAIT, reg
-# endif
-# define LOAD_FUTEX_WAKE(reg) \
- movl $FUTEX_WAKE, reg
-#endif
-
+#define FUTEX_WAIT 0
+#define FUTEX_WAKE 1
/* For the calculation see asm/vsyscall.h. */
#define VSYSCALL_ADDR_vgettimeofday 0xffffffffff600000
@@ -67,7 +52,11 @@ __lll_mutex_lock_wait:
cfi_offset(%rdx, -24)
xorq %r10, %r10 /* No timeout. */
movl $2, %edx
- LOAD_FUTEX_WAIT (%esi)
+#if FUTEX_WAIT == 0
+ xorl %esi, %esi
+#else
+ movl $FUTEX_WAIT, %esi
+#endif
cmpl %edx, %eax /* NB: %edx == 2 */
jne 2f
@@ -162,7 +151,11 @@ __lll_mutex_timedlock_wait:
je 8f
movq %rsp, %r10
- LOAD_FUTEX_WAIT (%esi)
+#if FUTEX_WAIT == 0
+ xorl %esi, %esi
+#else
+ movl $FUTEX_WAIT, %esi
+#endif
movq %r12, %rdi
movl $SYS_futex, %eax
syscall
@@ -220,6 +213,26 @@ __lll_mutex_timedlock_wait:
#endif
+#ifdef NOT_IN_libc
+ .globl lll_unlock_wake_cb
+ .type lll_unlock_wake_cb,@function
+ .hidden lll_unlock_wake_cb
+ .align 16
+lll_unlock_wake_cb:
+ pushq %rsi
+ pushq %rdx
+
+ LOCK
+ addl $1, (%rdi)
+ jng 1f
+
+ popq %rdx
+ popq %rsi
+ retq
+ .size lll_unlock_wake_cb,.-lll_unlock_wake_cb
+#endif
+
+
.globl __lll_mutex_unlock_wake
.type __lll_mutex_unlock_wake,@function
.hidden __lll_mutex_unlock_wake
@@ -234,7 +247,7 @@ __lll_mutex_unlock_wake:
cfi_offset(%rdx, -24)
movl $0, (%rdi)
- LOAD_FUTEX_WAKE (%esi)
+ movl $FUTEX_WAKE, %esi
movl $1, %edx /* Wake one thread. */
movl $SYS_futex, %eax
syscall
@@ -298,8 +311,6 @@ __lll_timedwait_tid:
jz 4f
movq %rsp, %r10
- /* XXX The kernel so far uses global futex for the wakeup at
- all times. */
#if FUTEX_WAIT == 0
xorl %esi, %esi
#else
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h b/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h
index b86d95e93d..bb988f3b2b 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h
@@ -23,8 +23,6 @@
#include <time.h>
#include <sys/param.h>
#include <bits/pthreadtypes.h>
-#include <kernel-features.h>
-#include <tcb-offsets.h>
#ifndef LOCK_INSTR
# ifdef UP
@@ -41,14 +39,6 @@
#define FUTEX_LOCK_PI 6
#define FUTEX_UNLOCK_PI 7
#define FUTEX_TRYLOCK_PI 8
-#define FUTEX_PRIVATE_FLAG 128
-
-
-/* Values for 'private' parameter of locking macros. Yes, the
- definition seems to be backwards. But it is not. The bit will be
- reversed before passing to the system call. */
-#define LLL_PRIVATE 0
-#define LLL_SHARED FUTEX_PRIVATE_FLAG
/* Initializer for compatibility lock. */
@@ -158,97 +148,44 @@ LLL_STUB_UNWIND_INFO_START \
LLL_STUB_UNWIND_INFO_END
-#define lll_futex_wait(futex, val, private) \
- lll_futex_timed_wait(futex, val, NULL, private)
-
-
-#define lll_futex_timed_wait(futex, val, timeout, private) \
+#define lll_futex_wait(futex, val) \
({ \
- register const struct timespec *__to __asm ("r10") = timeout; \
int __status; \
register __typeof (val) _val __asm ("edx") = (val); \
- __asm __volatile ("syscall" \
+ __asm __volatile ("xorq %%r10, %%r10\n\t" \
+ "syscall" \
: "=a" (__status) \
: "0" (SYS_futex), "D" (futex), "S" (FUTEX_WAIT), \
- "d" (_val), "r" (__to) \
- : "memory", "cc", "r11", "cx"); \
+ "d" (_val) \
+ : "memory", "cc", "r10", "r11", "cx"); \
__status; \
})
-#define lll_futex_wake(futex, nr, private) \
- do { \
- int __ignore; \
- register __typeof (nr) _nr __asm ("edx") = (nr); \
- __asm __volatile ("syscall" \
- : "=a" (__ignore) \
- : "0" (SYS_futex), "D" (futex), "S" (FUTEX_WAKE), \
- "d" (_nr) \
- : "memory", "cc", "r10", "r11", "cx"); \
- } while (0)
-
-
-#define lll_private_futex_wait(futex, val) \
- lll_private_futex_timed_wait (futex, val, NULL)
-
-
-#ifdef __ASSUME_PRIVATE_FUTEX
-# define lll_private_futex_timed_wait(futex, val, timeout) \
+#define lll_futex_timed_wait(futex, val, timeout) \
({ \
register const struct timespec *__to __asm ("r10") = timeout; \
int __status; \
register __typeof (val) _val __asm ("edx") = (val); \
__asm __volatile ("syscall" \
: "=a" (__status) \
- : "0" (SYS_futex), "D" (futex), \
- "S" (FUTEX_WAIT | FUTEX_PRIVATE_FLAG), \
+ : "0" (SYS_futex), "D" (futex), "S" (FUTEX_WAIT), \
"d" (_val), "r" (__to) \
: "memory", "cc", "r11", "cx"); \
__status; \
})
-# define lll_private_futex_wake(futex, nr) \
+#define lll_futex_wake(futex, nr) \
do { \
int __ignore; \
register __typeof (nr) _nr __asm ("edx") = (nr); \
__asm __volatile ("syscall" \
: "=a" (__ignore) \
- : "0" (SYS_futex), "D" (futex), \
- "S" (FUTEX_WAKE | FUTEX_PRIVATE_FLAG), \
+ : "0" (SYS_futex), "D" (futex), "S" (FUTEX_WAKE), \
"d" (_nr) \
: "memory", "cc", "r10", "r11", "cx"); \
} while (0)
-#else
-# define lll_private_futex_timed_wait(futex, val, timeout) \
- ({ \
- register const struct timespec *__to __asm ("r10") = timeout; \
- int __status; \
- int __ignore; \
- register __typeof (val) _val __asm ("edx") = (val); \
- __asm __volatile ("movl %%fs:%P3, %%esi\n\t" \
- "syscall" \
- : "=a" (__status), "=S" (__ignore) \
- : "0" (SYS_futex), "i" (PRIVATE_FUTEX), "D" (futex), \
- "d" (_val), "r" (__to) \
- : "memory", "cc", "r11", "cx"); \
- __status; \
- })
-
-
-# define lll_private_futex_wake(futex, nr) \
- do { \
- int __ignore; \
- int __ignore2; \
- register __typeof (nr) _nr __asm ("edx") = (nr); \
- __asm __volatile ("orl %%fs:%P3, %%esi\n\t" \
- "syscall" \
- : "=a" (__ignore), "=S" (__ignore2) \
- : "0" (SYS_futex), "i" (PRIVATE_FUTEX), "D" (futex), \
- "1" (FUTEX_WAKE), "d" (_nr) \
- : "memory", "cc", "r10", "r11", "cx"); \
- } while (0)
-#endif
/* Does not preserve %eax and %ecx. */
@@ -517,6 +454,9 @@ typedef int lll_lock_t;
#define LLL_LOCK_INITIALIZER_LOCKED (1)
+extern int lll_unlock_wake_cb (int *__futex) attribute_hidden;
+
+
/* The states of a lock are:
0 - untaken
1 - taken by one user
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_barrier_wait.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_barrier_wait.S
index 63771b3840..fa8125dd87 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_barrier_wait.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_barrier_wait.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -65,10 +65,9 @@ pthread_barrier_wait:
if the CURR_EVENT memory has meanwhile been changed. */
7:
#if FUTEX_WAIT == 0
- movl PRIVATE(%rdi), %esi
+ xorl %esi, %esi
#else
movl $FUTEX_WAIT, %esi
- orl PRIVATE(%rdi), %esi
#endif
xorq %r10, %r10
8: movl $SYS_futex, %eax
@@ -117,7 +116,6 @@ pthread_barrier_wait:
so 0x7fffffff is the highest value. */
movl $0x7fffffff, %edx
movl $FUTEX_WAKE, %esi
- orl PRIVATE(%rdi), %esi
movl $SYS_futex, %eax
syscall
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
index 2afd601b8c..ad3ae1e76e 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -111,7 +111,7 @@ __pthread_cond_timedwait:
movq 8(%rsp), %rdi
incq total_seq(%rdi)
incl cond_futex(%rdi)
- addl $(1 << nwaiters_shift), cond_nwaiters(%rdi)
+ addl $(1 << clock_bits), cond_nwaiters(%rdi)
/* Install cancellation handler. */
#ifdef PIC
@@ -137,7 +137,7 @@ __pthread_cond_timedwait:
structure stores the number minus 1. */
movq 8(%rsp), %rdi
movl cond_nwaiters(%rdi), %edi
- andl $((1 << nwaiters_shift) - 1), %edi
+ andl $((1 << clock_bits) - 1), %edi
/* Only clocks 0 and 1 are allowed so far. Both are handled in the
kernel. */
leaq 24(%rsp), %rsi
@@ -250,13 +250,13 @@ __pthread_cond_timedwait:
9: xorq %r14, %r14
14: incq woken_seq(%rdi)
-24: subl $(1 << nwaiters_shift), cond_nwaiters(%rdi)
+24: subl $(1 << clock_bits), cond_nwaiters(%rdi)
/* Wake up a thread which wants to destroy the condvar object. */
cmpq $0xffffffffffffffff, total_seq(%rdi)
jne 25f
movl cond_nwaiters(%rdi), %eax
- andl $~((1 << nwaiters_shift) - 1), %eax
+ andl $~((1 << clock_bits) - 1), %eax
jne 25f
addq $cond_nwaiters, %rdi
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S
index aaad22e020..969e80da2a 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002,2003,2004,2005,2006,2007 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -77,14 +77,14 @@ __condvar_cleanup:
incl cond_futex(%rdi)
6: incq woken_seq(%rdi)
-3: subl $(1 << nwaiters_shift), cond_nwaiters(%rdi)
+3: subl $(1 << clock_bits), cond_nwaiters(%rdi)
/* Wake up a thread which wants to destroy the condvar object. */
xorq %r12, %r12
cmpq $0xffffffffffffffff, total_seq(%rdi)
jne 4f
movl cond_nwaiters(%rdi), %eax
- andl $~((1 << nwaiters_shift) - 1), %eax
+ andl $~((1 << clock_bits) - 1), %eax
jne 4f
addq $cond_nwaiters, %rdi
@@ -185,7 +185,7 @@ __pthread_cond_wait:
movq 8(%rsp), %rdi
incq total_seq(%rdi)
incl cond_futex(%rdi)
- addl $(1 << nwaiters_shift), cond_nwaiters(%rdi)
+ addl $(1 << clock_bits), cond_nwaiters(%rdi)
/* Install cancellation handler. */
#ifdef PIC
@@ -262,13 +262,13 @@ __pthread_cond_wait:
incq woken_seq(%rdi)
/* Unlock */
-16: subl $(1 << nwaiters_shift), cond_nwaiters(%rdi)
+16: subl $(1 << clock_bits), cond_nwaiters(%rdi)
/* Wake up a thread which wants to destroy the condvar object. */
cmpq $0xffffffffffffffff, total_seq(%rdi)
jne 17f
movl cond_nwaiters(%rdi), %eax
- andl $~((1 << nwaiters_shift) - 1), %eax
+ andl $~((1 << clock_bits) - 1), %eax
jne 17f
addq $cond_nwaiters, %rdi
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_once.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_once.S
index 7740c599d1..9db5516913 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_once.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_once.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2005, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -17,19 +17,14 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#include <kernel-features.h>
-#include <tcb-offsets.h>
-
#ifndef UP
# define LOCK lock
#else
# define LOCK
#endif
-#define SYS_futex 202
-#define FUTEX_WAIT 0
-#define FUTEX_WAKE 1
-#define FUTEX_PRIVATE_FLAG 128
+#define SYS_futex 202
+#define FUTEX_WAKE 1
.comm __fork_generation, 4, 4
@@ -79,15 +74,10 @@ __pthread_once:
jnz 3f /* Different for generation -> run initializer. */
/* Somebody else got here first. Wait. */
-#ifdef __ASSUME_PRIVATE_FUTEX
- movl $FUTEX_WAIT|FUTEX_PRIVATE_FLAG, %esi
+#if FUTEX_WAIT == 0
+ xorl %esi, %esi
#else
-# if FUTEX_WAIT == 0
- movl %fs:PRIVATE_FUTEX, %esi
-# else
movl $FUTEX_WAIT, %esi
- orl %fs:PRIVATE_FUTEX, %esi
-# endif
#endif
movl $SYS_futex, %eax
syscall
@@ -116,12 +106,7 @@ __pthread_once:
/* Wake up all other threads. */
movl $0x7fffffff, %edx
-#ifdef __ASSUME_PRIVATE_FUTEX
- movl $FUTEX_WAKE|FUTEX_PRIVATE_FLAG, %esi
-#else
movl $FUTEX_WAKE, %esi
- orl %fs:PRIVATE_FUTEX, %esi
-#endif
movl $SYS_futex, %eax
syscall
@@ -148,12 +133,7 @@ clear_once_control:
movl $0, (%rdi)
movl $0x7fffffff, %edx
-#ifdef __ASSUME_PRIVATE_FUTEX
- movl $FUTEX_WAKE|FUTEX_PRIVATE_FLAG, %esi
-#else
movl $FUTEX_WAKE, %esi
- orl %fs:PRIVATE_FUTEX, %esi
-#endif
movl $SYS_futex, %eax
syscall
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_rdlock.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_rdlock.S
index da98ab3d49..5e9d8fb1d6 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_rdlock.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_rdlock.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2005, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -20,13 +20,11 @@
#include <sysdep.h>
#include <lowlevelrwlock.h>
#include <pthread-errnos.h>
-#include <kernel-features.h>
#define SYS_futex 202
#define FUTEX_WAIT 0
#define FUTEX_WAKE 1
-#define FUTEX_PRIVATE_FLAG 128
#ifndef UP
# define LOCK lock
@@ -75,20 +73,12 @@ __pthread_rwlock_rdlock:
#endif
jne 10f
-11:
-#if __ASSUME_PRIVATE_FUTEX
- movl $FUTEX_PRIVATE_FLAG|FUTEX_WAIT, %esi
- xorl PSHARED(%rdi), %esi
+11: addq $READERS_WAKEUP, %rdi
+#if FUTEX_WAIT == 0
+ xorl %esi, %esi
#else
-# if FUTEX_WAIT == 0
- movl PSHARED(%rdi), %esi
-# else
movl $FUTEX_WAIT, %esi
- orl PSHARED(%rdi), %esi
-# endif
- xorl %fs:PRIVATE_FUTEX, %esi
#endif
- addq $READERS_WAKEUP, %rdi
movl $SYS_futex, %eax
syscall
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedrdlock.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedrdlock.S
index 19ad27aab8..b44660418a 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedrdlock.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedrdlock.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -112,17 +112,10 @@ pthread_rwlock_timedrdlock:
movq %rcx, (%rsp) /* Store relative timeout. */
movq %rdi, 8(%rsp)
-#if __ASSUME_PRIVATE_FUTEX
- movl $FUTEX_PRIVATE_FLAG|FUTEX_WAIT, %esi
- xorl PSHARED(%rdi), %esi
+#if FUTEX_WAIT == 0
+ xorl %esi, %esi
#else
-# if FUTEX_WAIT == 0
- movl PSHARED(%r12), %esi
-# else
movl $FUTEX_WAIT, %esi
- orl PSHARED(%r12), %esi
-# endif
- xorl %fs:PRIVATE_FUTEX, %esi
#endif
movq %rsp, %r10
movl %r14d, %edx
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S
index 4c3e7413a8..525e5b6b93 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2005, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -108,17 +108,10 @@ pthread_rwlock_timedwrlock:
movq %rcx, (%rsp) /* Store relative timeout. */
movq %rdi, 8(%rsp)
-#if __ASSUME_PRIVATE_FUTEX
- movl $FUTEX_PRIVATE_FLAG|FUTEX_WAIT, %esi
- xorl PSHARED(%rdi), %esi
+#if FUTEX_WAIT == 0
+ xorl %esi, %esi
#else
-# if FUTEX_WAIT == 0
- movl PSHARED(%r12), %esi
-# else
movl $FUTEX_WAIT, %esi
- orl PSHARED(%r12), %esi
-# endif
- xorl %fs:PRIVATE_FUTEX, %esi
#endif
movq %rsp, %r10
movl %r14d, %edx
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_unlock.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_unlock.S
index bf688252c8..3a6b9f0bad 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_unlock.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_unlock.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2005, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -56,8 +56,9 @@ __pthread_rwlock_unlock:
5: movl $0, WRITER(%rdi)
- movl $1, %edx
+ movl $1, %esi
leaq WRITERS_WAKEUP(%rdi), %r10
+ movq %rsi, %rdx
cmpl $0, WRITERS_QUEUED(%rdi)
jne 0f
@@ -77,16 +78,7 @@ __pthread_rwlock_unlock:
#endif
jne 7f
-8:
-#if __ASSUME_PRIVATE_FUTEX
- movl $FUTEX_PRIVATE_FLAG|FUTEX_WAKE, %esi
- xorl PSHARED(%rdi), %esi
-#else
- movl $FUTEX_WAKE, %esi
- orl PSHARED(%rdi), %esi
- xorl %fs:PRIVATE_FUTEX, %esi
-#endif
- movl $SYS_futex, %eax
+8: movl $SYS_futex, %eax
movq %r10, %rdi
syscall
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_wrlock.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_wrlock.S
index 46d97e033e..0e82f890aa 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_wrlock.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_wrlock.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2005, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -71,20 +71,12 @@ __pthread_rwlock_wrlock:
#endif
jne 10f
-11:
-#if __ASSUME_PRIVATE_FUTEX
- movl $FUTEX_PRIVATE_FLAG|FUTEX_WAIT, %esi
- xorl PSHARED(%rdi), %esi
+11: addq $WRITERS_WAKEUP, %rdi
+#if FUTEX_WAIT == 0
+ xorl %esi, %esi
#else
-# if FUTEX_WAIT == 0
- movl PSHARED(%rdi), %esi
-# else
movl $FUTEX_WAIT, %esi
- orl PSHARED(%rdi), %esi
-# endif
- xorl %fs:PRIVATE_FUTEX, %esi
#endif
- addq $WRITERS_WAKEUP, %rdi
movl $SYS_futex, %eax
syscall
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/sem_post.S b/nptl/sysdeps/unix/sysv/linux/x86_64/sem_post.S
index 4919c11fd2..7f608a5974 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/sem_post.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/sem_post.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2005, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -20,7 +20,6 @@
#include <sysdep.h>
#include <shlib-compat.h>
#include <pthread-errnos.h>
-#include <structsem.h>
#ifndef UP
# define LOCK lock
@@ -38,26 +37,19 @@
.type sem_post,@function
.align 16
sem_post:
+ movl $1, %edx
LOCK
-#if VALUE == 0
- addl $1, (%rdi)
-#else
- addl $1, VALUE(%rdi)
-#endif
-
- cmpq $0, NWAITERS(%rdi)
- je 2f
+ xaddl %edx, (%rdi)
movl $SYS_futex, %eax
movl $FUTEX_WAKE, %esi
- orl PRIVATE(%rdi), %esi
- movl $1, %edx
+ incl %edx
syscall
testq %rax, %rax
js 1f
-2: xorl %eax, %eax
+ xorl %eax, %eax
retq
1:
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S b/nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S
index 4068a1b6b8..8c5c2a6974 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S
@@ -20,7 +20,6 @@
#include <sysdep.h>
#include <shlib-compat.h>
#include <pthread-errnos.h>
-#include <structsem.h>
#ifndef UP
# define LOCK lock
@@ -29,7 +28,6 @@
#endif
#define SYS_futex 202
-#define FUTEX_WAIT 0
/* For the calculation see asm/vsyscall.h. */
#define VSYSCALL_ADDR_vgettimeofday 0xffffffffff600000
@@ -40,23 +38,15 @@
.globl sem_timedwait
.type sem_timedwait,@function
.align 16
+ cfi_startproc
sem_timedwait:
-.LSTARTCODE:
-#if VALUE == 0
movl (%rdi), %eax
-#else
- movl VALUE(%rdi), %eax
-#endif
2: testl %eax, %eax
je 1f
leaq -1(%rax), %rdx
LOCK
-#if VALUE == 0
cmpxchgl %edx, (%rdi)
-#else
- cmpxchgl %edx, VALUE(%rdi)
-#endif
jne 2b
xorl %eax, %eax
@@ -64,25 +54,25 @@ sem_timedwait:
/* Check whether the timeout value is valid. */
1: pushq %r12
-.Lpush_r12:
+ cfi_adjust_cfa_offset(8)
pushq %r13
-.Lpush_r13:
+ cfi_adjust_cfa_offset(8)
pushq %r14
-.Lpush_r14:
+ cfi_adjust_cfa_offset(8)
subq $24, %rsp
-.Lsubq:
+ cfi_adjust_cfa_offset(24)
movq %rdi, %r12
+ cfi_offset(12, -16) /* %r12 */
movq %rsi, %r13
+ cfi_offset(13, -24) /* %r13 */
/* Check for invalid nanosecond field. */
cmpq $1000000000, 8(%r13)
movl $EINVAL, %r14d
+ cfi_offset(14, -24) /* %r14 */
jae 6f
- LOCK
- addq $1, NWAITERS(%r12)
-
7: xorl %esi, %esi
movq %rsp, %rdi
movq $VSYSCALL_ADDR_vgettimeofday, %rax
@@ -106,22 +96,12 @@ sem_timedwait:
movq %rdi, (%rsp) /* Store relative timeout. */
movq %rsi, 8(%rsp)
-.LcleanupSTART:
call __pthread_enable_asynccancel
movl %eax, 16(%rsp)
movq %rsp, %r10
-#if VALUE == 0
movq %r12, %rdi
-#else
- leaq VALUE(%r12), %rdi
-#endif
-#if FUTEX_WAIT == 0
- movl PRIVATE(%rdi), %esi
-#else
- movl $FUTEX_WAIT, %esi
- orl PRIVATE(%rdi), %esi
-#endif
+ xorl %esi, %esi
movl $SYS_futex, %eax
xorl %edx, %edx
syscall
@@ -129,47 +109,39 @@ sem_timedwait:
movl 16(%rsp), %edi
call __pthread_disable_asynccancel
-.LcleanupEND:
testq %r14, %r14
je 9f
cmpq $-EWOULDBLOCK, %r14
jne 3f
-9:
-#if VALUE == 0
- movl (%r12), %eax
-#else
- movl VALUE(%r12), %eax
-#endif
+9: movl (%r12), %eax
8: testl %eax, %eax
je 7b
leaq -1(%rax), %rcx
LOCK
-#if VALUE == 0
cmpxchgl %ecx, (%r12)
-#else
- cmpxchgl %ecx, VALUE(%r12)
-#endif
jne 8b
xorl %eax, %eax
-
-10: LOCK
- subq $1, NWAITERS(%r12)
-
- addq $24, %rsp
-.Laddq:
+10: addq $24, %rsp
+ cfi_adjust_cfa_offset(-24)
popq %r14
-.Lpop_r14:
+ cfi_adjust_cfa_offset(-8)
+ cfi_restore(14)
popq %r13
-.Lpop_r13:
+ cfi_adjust_cfa_offset(-8)
+ cfi_restore(13)
popq %r12
-.Lpop_r12:
+ cfi_adjust_cfa_offset(-8)
+ cfi_restore(12)
retq
-.Lafter_retq:
+ cfi_adjust_cfa_offset(48)
+ cfi_offset(12, -16) /* %r12 */
+ cfi_offset(13, -24) /* %r13 */
+ cfi_offset(14, -32) /* %r14 */
3: negq %r14
6:
#if USE___THREAD
@@ -182,159 +154,5 @@ sem_timedwait:
orl $-1, %eax
jmp 10b
+ cfi_endproc
.size sem_timedwait,.-sem_timedwait
-
-
- .type sem_timedwait_cleanup,@function
-sem_timedwait_cleanup:
- LOCK
- subq $1, NWAITERS(%r12)
- movq %rax, %rdi
-.LcallUR:
- call _Unwind_Resume@PLT
- hlt
-.LENDCODE:
- .size sem_timedwait_cleanup,.-sem_timedwait_cleanup
-
-
- .section .gcc_except_table,"a",@progbits
-.LexceptSTART:
- .byte 0xff # @LPStart format (omit)
- .byte 0xff # @TType format (omit)
- .byte 0x01 # call-site format
- # DW_EH_PE_uleb128
- .uleb128 .Lcstend-.Lcstbegin
-.Lcstbegin:
- .uleb128 .LcleanupSTART-.LSTARTCODE
- .uleb128 .LcleanupEND-.LcleanupSTART
- .uleb128 sem_timedwait_cleanup-.LSTARTCODE
- .uleb128 0
- .uleb128 .LcallUR-.LSTARTCODE
- .uleb128 .LENDCODE-.LcallUR
- .uleb128 0
- .uleb128 0
-.Lcstend:
-
-
- .section .eh_frame,"a",@progbits
-.LSTARTFRAME:
- .long .LENDCIE-.LSTARTCIE # Length of the CIE.
-.LSTARTCIE:
- .long 0 # CIE ID.
- .byte 1 # Version number.
-#ifdef SHARED
- .string "zPLR" # NUL-terminated augmentation
- # string.
-#else
- .string "zPL" # NUL-terminated augmentation
- # string.
-#endif
- .uleb128 1 # Code alignment factor.
- .sleb128 -8 # Data alignment factor.
- .byte 16 # Return address register
- # column.
-#ifdef SHARED
- .uleb128 7 # Augmentation value length.
- .byte 0x9b # Personality: DW_EH_PE_pcrel
- # + DW_EH_PE_sdata4
- # + DW_EH_PE_indirect
- .long DW.ref.__gcc_personality_v0-.
- .byte 0x1b # LSDA Encoding: DW_EH_PE_pcrel
- # + DW_EH_PE_sdata4.
- .byte 0x1b # FDE Encoding: DW_EH_PE_pcrel
- # + DW_EH_PE_sdata4.
-#else
- .uleb128 10 # Augmentation value length.
- .byte 0x0 # Personality: absolute
- .quad __gcc_personality_v0
- .byte 0x0 # LSDA Encoding: absolute
-#endif
- .byte 0x0c # DW_CFA_def_cfa
- .uleb128 7
- .uleb128 8
- .byte 0x90 # DW_CFA_offset, column 0x10
- .uleb128 1
- .align 8
-.LENDCIE:
-
- .long .LENDFDE-.LSTARTFDE # Length of the FDE.
-.LSTARTFDE:
- .long .LSTARTFDE-.LSTARTFRAME # CIE pointer.
-#ifdef SHARED
- .long .LSTARTCODE-. # PC-relative start address
- # of the code.
- .long .LENDCODE-.LSTARTCODE # Length of the code.
- .uleb128 4 # Augmentation size
- .long .LexceptSTART-.
-#else
- .quad .LSTARTCODE # Start address of the code.
- .quad .LENDCODE-.LSTARTCODE # Length of the code.
- .uleb128 8 # Augmentation size
- .quad .LexceptSTART
-#endif
-
- .byte 4 # DW_CFA_advance_loc4
- .long .Lpush_r12-.LSTARTCODE
- .byte 14 # DW_CFA_def_cfa_offset
- .uleb128 16
- .byte 0x8c # DW_CFA_offset %r12
- .uleb128 2
- .byte 4 # DW_CFA_advance_loc4
- .long .Lpush_r13-.Lpush_r12
- .byte 14 # DW_CFA_def_cfa_offset
- .uleb128 24
- .byte 0x8d # DW_CFA_offset %r13
- .uleb128 3
- .byte 4 # DW_CFA_advance_loc4
- .long .Lpush_r14-.Lpush_r13
- .byte 14 # DW_CFA_def_cfa_offset
- .uleb128 32
- .byte 0x8e # DW_CFA_offset %r14
- .uleb128 4
- .byte 4 # DW_CFA_advance_loc4
- .long .Lsubq-.Lpush_r14
- .byte 14 # DW_CFA_def_cfa_offset
- .uleb128 56
- .byte 4 # DW_CFA_advance_loc4
- .long .Laddq-.Lsubq
- .byte 14 # DW_CFA_def_cfa_offset
- .uleb128 32
- .byte 4 # DW_CFA_advance_loc4
- .long .Lpop_r14-.Laddq
- .byte 14 # DW_CFA_def_cfa_offset
- .uleb128 24
- .byte 0xce # DW_CFA_restore %r14
- .byte 4 # DW_CFA_advance_loc4
- .long .Lpop_r13-.Lpop_r14
- .byte 14 # DW_CFA_def_cfa_offset
- .uleb128 16
- .byte 0xcd # DW_CFA_restore %r13
- .byte 4 # DW_CFA_advance_loc4
- .long .Lpop_r12-.Lpop_r13
- .byte 14 # DW_CFA_def_cfa_offset
- .uleb128 8
- .byte 0xcc # DW_CFA_restore %r12
- .byte 4 # DW_CFA_advance_loc4
- .long .Lafter_retq-.Lpop_r12
- .byte 14 # DW_CFA_def_cfa_offset
- .uleb128 56
- .byte 0x8c # DW_CFA_offset %r12
- .uleb128 2
- .byte 0x8d # DW_CFA_offset %r13
- .uleb128 3
- .byte 0x8e # DW_CFA_offset %r14
- .uleb128 4
- .align 8
-.LENDFDE:
-
-
-#ifdef SHARED
- .hidden DW.ref.__gcc_personality_v0
- .weak DW.ref.__gcc_personality_v0
- .section .gnu.linkonce.d.DW.ref.__gcc_personality_v0,"aw",@progbits
- .align 8
- .type DW.ref.__gcc_personality_v0, @object
- .size DW.ref.__gcc_personality_v0, 8
-DW.ref.__gcc_personality_v0:
- .quad __gcc_personality_v0
-#endif
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/sem_trywait.S b/nptl/sysdeps/unix/sysv/linux/x86_64/sem_trywait.S
index 643090f065..6b77dfc0d8 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/sem_trywait.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/sem_trywait.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2005, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -37,7 +37,7 @@ sem_trywait:
2: testl %eax, %eax
jz 1f
- leal -1(%rax), %edx
+ leaq -1(%rax), %rdx
LOCK
cmpxchgl %edx, (%rdi)
jne 2b
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S b/nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S
index e099ede029..5bd78eb944 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S
@@ -20,7 +20,6 @@
#include <sysdep.h>
#include <shlib-compat.h>
#include <pthread-errnos.h>
-#include <structsem.h>
#ifndef UP
# define LOCK lock
@@ -29,7 +28,6 @@
#endif
#define SYS_futex 202
-#define FUTEX_WAIT 0
.text
@@ -37,93 +35,57 @@
.globl sem_wait
.type sem_wait,@function
.align 16
+ cfi_startproc
sem_wait:
-.LSTARTCODE:
pushq %r12
-.Lpush_r12:
+ cfi_adjust_cfa_offset(8)
+ cfi_offset(12, -16)
pushq %r13
-.Lpush_r13:
+ cfi_adjust_cfa_offset(8)
movq %rdi, %r13
+ cfi_offset(13, -24)
-#if VALUE == 0
- movl (%r13), %eax
-#else
- movl VALUE(%r13), %eax
-#endif
+3: movl (%r13), %eax
2: testl %eax, %eax
je 1f
- leal -1(%rax), %edx
+ leaq -1(%rax), %rdx
LOCK
-#if VALUE == 0
cmpxchgl %edx, (%r13)
-#else
- cmpxchgl %edx, VALUE(%r13)
-#endif
jne 2b
+ xorl %eax, %eax
-7: xorl %eax, %eax
-
-9: popq %r13
-.Lpop_r13:
+ popq %r13
+ cfi_adjust_cfa_offset(-8)
+ cfi_restore(13)
popq %r12
-.Lpop_r12:
+ cfi_adjust_cfa_offset(-8)
+ cfi_restore(12)
retq
-.Lafter_retq:
-1: LOCK
- addq $1, NWAITERS(%r13)
-
-.LcleanupSTART:
-6: call __pthread_enable_asynccancel
+ cfi_adjust_cfa_offset(16)
+ cfi_offset(12, -16)
+ cfi_offset(13, -24)
+1: call __pthread_enable_asynccancel
movl %eax, %r8d
xorq %r10, %r10
movl $SYS_futex, %eax
movq %r13, %rdi
-#if FUTEX_WAIT == 0
- movl PRIVATE(%rdi), %esi
-#else
- movl $FUTEX_WAIT, %esi
- orl PRIVATE(%rdi), %esi
-#endif
- xorl %edx, %edx
+ movq %r10, %rsi
+ movq %r10, %rdx
syscall
movq %rax, %r12
movl %r8d, %edi
call __pthread_disable_asynccancel
-.LcleanupEND:
testq %r12, %r12
- je 3f
+ je 3b
cmpq $-EWOULDBLOCK, %r12
- jne 4f
-
-3:
-#if VALUE == 0
- movl (%r13), %eax
-#else
- movl VALUE(%r13), %eax
-#endif
-5: testl %eax, %eax
- je 6b
-
- leal -1(%rax), %edx
- LOCK
-#if VALUE == 0
- cmpxchgl %edx, (%r13)
-#else
- cmpxchgl %edx, VALUE(%r13)
-#endif
- jne 5b
-
- LOCK
- subq $1, NWAITERS(%r13)
- jmp 7b
-
-4: negq %r12
+ je 3b
+ negq %r12
#if USE___THREAD
movq errno@gottpoff(%rip), %rdx
movl %r12d, %fs:(%rdx)
@@ -133,142 +95,13 @@ sem_wait:
#endif
orl $-1, %eax
- LOCK
- subq $1, NWAITERS(%r13)
+ popq %r13
+ cfi_adjust_cfa_offset(-8)
+ cfi_restore(13)
+ popq %r12
+ cfi_adjust_cfa_offset(-8)
+ cfi_restore(12)
- jmp 9b
+ retq
+ cfi_endproc
.size sem_wait,.-sem_wait
-
-
- .type sem_wait_cleanup,@function
-sem_wait_cleanup:
- LOCK
- subq $1, NWAITERS(%r13)
- movq %rax, %rdi
-.LcallUR:
- call _Unwind_Resume@PLT
- hlt
-.LENDCODE:
- .size sem_wait_cleanup,.-sem_wait_cleanup
-
-
- .section .gcc_except_table,"a",@progbits
-.LexceptSTART:
- .byte 0xff # @LPStart format (omit)
- .byte 0xff # @TType format (omit)
- .byte 0x01 # call-site format
- # DW_EH_PE_uleb128
- .uleb128 .Lcstend-.Lcstbegin
-.Lcstbegin:
- .uleb128 .LcleanupSTART-.LSTARTCODE
- .uleb128 .LcleanupEND-.LcleanupSTART
- .uleb128 sem_wait_cleanup-.LSTARTCODE
- .uleb128 0
- .uleb128 .LcallUR-.LSTARTCODE
- .uleb128 .LENDCODE-.LcallUR
- .uleb128 0
- .uleb128 0
-.Lcstend:
-
-
- .section .eh_frame,"a",@progbits
-.LSTARTFRAME:
- .long .LENDCIE-.LSTARTCIE # Length of the CIE.
-.LSTARTCIE:
- .long 0 # CIE ID.
- .byte 1 # Version number.
-#ifdef SHARED
- .string "zPLR" # NUL-terminated augmentation
- # string.
-#else
- .string "zPL" # NUL-terminated augmentation
- # string.
-#endif
- .uleb128 1 # Code alignment factor.
- .sleb128 -8 # Data alignment factor.
- .byte 16 # Return address register
- # column.
-#ifdef SHARED
- .uleb128 7 # Augmentation value length.
- .byte 0x9b # Personality: DW_EH_PE_pcrel
- # + DW_EH_PE_sdata4
- # + DW_EH_PE_indirect
- .long DW.ref.__gcc_personality_v0-.
- .byte 0x1b # LSDA Encoding: DW_EH_PE_pcrel
- # + DW_EH_PE_sdata4.
- .byte 0x1b # FDE Encoding: DW_EH_PE_pcrel
- # + DW_EH_PE_sdata4.
-#else
- .uleb128 10 # Augmentation value length.
- .byte 0x0 # Personality: absolute
- .quad __gcc_personality_v0
- .byte 0x0 # LSDA Encoding: absolute
-#endif
- .byte 0x0c # DW_CFA_def_cfa
- .uleb128 7
- .uleb128 8
- .byte 0x90 # DW_CFA_offset, column 0x10
- .uleb128 1
- .align 8
-.LENDCIE:
-
- .long .LENDFDE-.LSTARTFDE # Length of the FDE.
-.LSTARTFDE:
- .long .LSTARTFDE-.LSTARTFRAME # CIE pointer.
-#ifdef SHARED
- .long .LSTARTCODE-. # PC-relative start address
- # of the code.
- .long .LENDCODE-.LSTARTCODE # Length of the code.
- .uleb128 4 # Augmentation size
- .long .LexceptSTART-.
-#else
- .quad .LSTARTCODE # Start address of the code.
- .quad .LENDCODE-.LSTARTCODE # Length of the code.
- .uleb128 8 # Augmentation size
- .quad .LexceptSTART
-#endif
-
- .byte 4 # DW_CFA_advance_loc4
- .long .Lpush_r12-.LSTARTCODE
- .byte 14 # DW_CFA_def_cfa_offset
- .uleb128 16
- .byte 0x8c # DW_CFA_offset %r12
- .uleb128 2
- .byte 4 # DW_CFA_advance_loc4
- .long .Lpush_r13-.Lpush_r12
- .byte 14 # DW_CFA_def_cfa_offset
- .uleb128 24
- .byte 0x8d # DW_CFA_offset %r13
- .uleb128 3
- .byte 4 # DW_CFA_advance_loc4
- .long .Lpop_r13-.Lpush_r13
- .byte 14 # DW_CFA_def_cfa_offset
- .uleb128 16
- .byte 0xcd # DW_CFA_restore %r13
- .byte 4 # DW_CFA_advance_loc4
- .long .Lpop_r12-.Lpop_r13
- .byte 14 # DW_CFA_def_cfa_offset
- .uleb128 8
- .byte 0xcc # DW_CFA_restore %r12
- .byte 4 # DW_CFA_advance_loc4
- .long .Lafter_retq-.Lpop_r12
- .byte 14 # DW_CFA_def_cfa_offset
- .uleb128 24
- .byte 0x8c # DW_CFA_offset %r12
- .uleb128 2
- .byte 0x8d # DW_CFA_offset %r13
- .uleb128 3
- .align 8
-.LENDFDE:
-
-
-#ifdef SHARED
- .hidden DW.ref.__gcc_personality_v0
- .weak DW.ref.__gcc_personality_v0
- .section .gnu.linkonce.d.DW.ref.__gcc_personality_v0,"aw",@progbits
- .align 8
- .type DW.ref.__gcc_personality_v0, @object
- .size DW.ref.__gcc_personality_v0, 8
-DW.ref.__gcc_personality_v0:
- .quad __gcc_personality_v0
-#endif