aboutsummaryrefslogtreecommitdiff
path: root/nptl/sysdeps/unix/sysv/linux/i386
diff options
context:
space:
mode:
Diffstat (limited to 'nptl/sysdeps/unix/sysv/linux/i386')
-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
16 files changed, 193 insertions, 694 deletions
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