aboutsummaryrefslogtreecommitdiff
path: root/nptl
diff options
context:
space:
mode:
Diffstat (limited to 'nptl')
-rw-r--r--nptl/ChangeLog31
-rw-r--r--nptl/descr.h8
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S72
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevelmutex.S95
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S7
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevelmutex.S5
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_barrier_wait.S12
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_broadcast.S6
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_signal.S5
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_unlock.S8
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/i486/sem_post.S6
11 files changed, 54 insertions, 201 deletions
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index ea6e5e0..113d69a 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,34 @@
+2003-03-01 Ulrich Drepper <drepper@redhat.com>
+
+ * descr.h (struct pthread): Move tid field to the front now that
+ it is often used.
+
+ * sysdeps/unix/sysv/linux/i386/i486/libc-lowlevelmutex.S
+ (__lll_mutex_timedlock_wait): Remove.
+ (__lll_mutex_unlock_wake): Don't save, load, and restore %esi.
+ * sysdeps/unix/sysv/linux/i386/i486/lowlevelmutex.S
+ (__lll_mutex_unlock_wake): Don't save, load, and restore %esi.
+ * sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S
+ (lll_unlock_wake_cb): Don't save and restore %esi.
+ (__lll_unlock_wake): Add alignment. Don't save, load, and restore
+ %esi.
+ (__lll_timedwait_tid): Add alignment.
+ * sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
+ (__lll_unlock_wake): Add alignment. Don't save, load, and restore
+ %esi.
+ (__lll_timedwait_tid): Removed.
+ * sysdeps/unix/sysv/linux/i386/i486/pthread_cond_broadcast.S
+ (__pthread_cond_broadcast): Don't save, load, and restore %esi.
+ * sysdeps/unix/sysv/linux/i386/i486/pthread_barrier_wait.S
+ (pthread_barrier_wait): Don't save, load, and restore %esi for
+ last thread.
+ * sysdeps/unix/sysv/linux/i386/i486/pthread_cond_signal.S
+ (__pthread_cond_signal): Don't save, load, and restore %esi.
+ * sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_unlock.S
+ (__pthread_rwlock_unlock): Don't save, load, and restore %esi.
+ * sysdeps/unix/sysv/linux/i386/i486/sem_post.S (__new_sem_post):
+ Don't save, load, and restore %esi.
+
2003-02-27 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_broadcast.S:
diff --git a/nptl/descr.h b/nptl/descr.h
index e96f538..121510a 100644
--- a/nptl/descr.h
+++ b/nptl/descr.h
@@ -76,6 +76,10 @@ struct pthread
void *__padding[16];
} header;
+ /* Thread ID - which is also a 'is this thread descriptor (and
+ therefore stack) used' flag. */
+ pid_t tid;
+
/* Two-level array for the thread-specific data. */
struct pthread_key_data
{
@@ -153,10 +157,6 @@ struct pthread
sigjmp_buf cancelbuf;
#define HAVE_CANCELBUF 1
- /* Thread ID - which is also a 'is this thread descriptor (and
- therefore stack) used' flag. */
- pid_t tid;
-
/* Flags. Including those copied from the thread attribute. */
int flags;
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 3484009..de0df72 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
+++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
@@ -69,8 +69,8 @@ __lll_lock_wait:
.globl __lll_unlock_wake
.type __lll_unlock_wake,@function
.hidden __lll_unlock_wake
+ .align 16
__lll_unlock_wake:
- pushl %esi
pushl %ebx
pushl %ecx
pushl %edx
@@ -78,80 +78,12 @@ __lll_unlock_wake:
movl %eax, %ebx
1: movl $FUTEX_WAKE, %ecx
movl $1, %edx /* Wake one thread. */
- xorl %esi, %esi
- movl %edx, (%ebx) /* Stores '$1'. */
movl $SYS_futex, %eax
+ movl %edx, (%ebx) /* Stores '$1'. */
ENTER_KERNEL
popl %edx
popl %ecx
popl %ebx
- popl %esi
ret
.size __lll_unlock_wake,.-__lll_unlock_wake
-
-
- .globl __lll_timedwait_tid
- .type __lll_timedwait_tid,@function
- .hidden __lll_timedwait_tid
-__lll_timedwait_tid:
- pushl %edi
- pushl %esi
- pushl %ebx
- pushl %ebp
-
- movl %eax, %ebp
- movl %edx, %edi
- subl $8, %esp
-
- /* Get current time. */
-2: movl %esp, %ebx
- xorl %ecx, %ecx
- movl $SYS_gettimeofday, %eax
- ENTER_KERNEL
-
- /* Compute relative timeout. */
- movl 4(%esp), %eax
- movl $1000, %edx
- mul %edx /* Milli seconds to nano seconds. */
- movl (%edi), %ecx
- movl 4(%edi), %edx
- subl (%esp), %ecx
- subl %eax, %edx
- jns 5f
- addl $1000000000, %edx
- decl %ecx
-5: testl %ecx, %ecx
- js 6f /* Time is already up. */
-
- movl %ecx, (%esp) /* Store relative timeout. */
- movl %edx, 4(%esp)
-
- movl (%ebp), %edx
- testl %edx, %edx
- jz 4f
-
- movl %esp, %esi
- xorl %ecx, %ecx /* movl $FUTEX_WAIT, %ecx */
- movl %ebp, %ebx
- movl $SYS_futex, %eax
- ENTER_KERNEL
-
- movl %eax, %edx
-
- cmpl $0, (%ebx)
- jne 1f
-4: xorl %eax, %eax
-
-3: addl $8, %esp
- popl %ebp
- popl %ebx
- popl %esi
- popl %edi
- ret
-
-1: cmpl $-ETIMEDOUT, %edx
- jne 2b
-6: movl $ETIMEDOUT, %eax
- jmp 3b
- .size __lll_timedwait_tid,.-__lll_timedwait_tid
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevelmutex.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevelmutex.S
index ccae01b..d17d078 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevelmutex.S
+++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevelmutex.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002 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.
@@ -68,113 +68,24 @@ __lll_mutex_lock_wait:
.size __lll_mutex_lock_wait,.-__lll_mutex_lock_wait
- .globl __lll_mutex_timedlock_wait
- .type __lll_mutex_timedlock_wait,@function
- .hidden __lll_mutex_timedlock_wait
- .align 16
-__lll_mutex_timedlock_wait:
- /* Check for a valid timeout value. */
- cmpl $1000000000, 4(%edx)
- jae 3f
-
- pushl %edi
- pushl %esi
- pushl %ebx
- pushl %ebp
-
- /* Stack frame for the timespec and timeval structs. */
- subl $8, %esp
-
- movl %ecx, %ebp
- movl %edx, %edi
- leal 1(%eax), %esi
-
- /* Get current time. */
-1:
- movl %esp, %ebx
- xorl %ecx, %ecx
- movl $SYS_gettimeofday, %eax
- ENTER_KERNEL
-
- /* Compute relative timeout. */
- movl 4(%esp), %eax
- movl $1000, %edx
- mul %edx /* Milli seconds to nano seconds. */
- movl (%edi), %ecx
- movl 4(%edi), %edx
- subl (%esp), %ecx
- subl %eax, %edx
- jns 4f
- addl $1000000000, %edx
- decl %ecx
-4: testl %ecx, %ecx
- js 5f /* Time is already up. */
-
- /* Futex call. */
- movl %ecx, (%esp) /* Store relative timeout. */
- movl %edx, 4(%esp)
- movl %esi, %edx
- movl %esp, %esi
- xorl %ecx, %ecx /* movl $FUTEX_WAIT, %ecx */
- movl %ebp, %ebx
- movl $SYS_futex, %eax
- ENTER_KERNEL
-
- movl $1, %esi
-#ifndef UP
- cmpl $0, %gs:MULTIPLE_THREADS_OFFSET
- je,pt 0f
- lock
-0:
-#endif
- xaddl %esi, (%ebx)
- testl %esi, %esi
- jne 7f
-
- movl $2, (%ebx)
- xorl %eax, %eax
-
-6: addl $8, %esp
- popl %ebp
- popl %ebx
- popl %esi
- popl %edi
- ret
-
- /* Check whether the time expired. */
-7: cmpl $-ETIMEDOUT, %eax
- je 5f
- jmp 1b
-
-3: movl $EINVAL, %eax
- ret
-
-5: movl $ETIMEDOUT, %eax
- jmp 6b
- .size __lll_mutex_timedlock_wait,.-__lll_mutex_timedlock_wait
-
-
.globl __lll_mutex_unlock_wake
.type __lll_mutex_unlock_wake,@function
.hidden __lll_mutex_unlock_wake
.align 16
__lll_mutex_unlock_wake:
- pushl %esi
pushl %ebx
pushl %ecx
pushl %edx
- movl $FUTEX_WAKE, %ecx
movl %eax, %ebx
- xorl %esi, %esi
- movl $0, (%ebx)
+ movl $FUTEX_WAKE, %ecx
movl $1, %edx /* Wake one thread. */
movl $SYS_futex, %eax
+ movl $0, (%ebx)
ENTER_KERNEL
popl %edx
popl %ecx
popl %ebx
- popl %esi
ret
.size __lll_mutex_unlock_wake,.-__lll_mutex_unlock_wake
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S
index bdfc506..a40526c 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S
+++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S
@@ -71,7 +71,6 @@ __lll_lock_wait:
.hidden lll_unlock_wake_cb
.align 16
lll_unlock_wake_cb:
- pushl %esi
pushl %ebx
pushl %ecx
pushl %edx
@@ -84,7 +83,6 @@ lll_unlock_wake_cb:
popl %edx
popl %ecx
popl %ebx
- popl %esi
ret
.size lll_unlock_wake_cb,.-lll_unlock_wake_cb
@@ -92,8 +90,8 @@ lll_unlock_wake_cb:
.globl __lll_unlock_wake
.type __lll_unlock_wake,@function
.hidden __lll_unlock_wake
+ .align 16
__lll_unlock_wake:
- pushl %esi
pushl %ebx
pushl %ecx
pushl %edx
@@ -101,7 +99,6 @@ __lll_unlock_wake:
movl %eax, %ebx
1: movl $FUTEX_WAKE, %ecx
movl $1, %edx /* Wake one thread. */
- xorl %esi, %esi
movl %edx, (%ebx) /* Stores '$1'. */
movl $SYS_futex, %eax
ENTER_KERNEL
@@ -109,7 +106,6 @@ __lll_unlock_wake:
popl %edx
popl %ecx
popl %ebx
- popl %esi
ret
.size __lll_unlock_wake,.-__lll_unlock_wake
@@ -117,6 +113,7 @@ __lll_unlock_wake:
.globl __lll_timedwait_tid
.type __lll_timedwait_tid,@function
.hidden __lll_timedwait_tid
+ .align 16
__lll_timedwait_tid:
pushl %edi
pushl %esi
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevelmutex.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevelmutex.S
index e369c65..3e6a71c 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevelmutex.S
+++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevelmutex.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002 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.
@@ -155,14 +155,12 @@ __lll_mutex_timedlock_wait:
.hidden __lll_mutex_unlock_wake
.align 16
__lll_mutex_unlock_wake:
- pushl %esi
pushl %ebx
pushl %ecx
pushl %edx
movl $FUTEX_WAKE, %ecx
movl %eax, %ebx
- xorl %esi, %esi
movl $0, (%ebx)
movl $1, %edx /* Wake one thread. */
movl $SYS_futex, %eax
@@ -171,6 +169,5 @@ __lll_mutex_unlock_wake:
popl %edx
popl %ecx
popl %ebx
- popl %esi
ret
.size __lll_mutex_unlock_wake,.-__lll_mutex_unlock_wake
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 8348f6e..d36bc7e 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
@@ -41,11 +41,9 @@
.type pthread_barrier_wait,@function
.align 16
pthread_barrier_wait:
- pushl %esi
pushl %ebx
- movl 12(%esp), %ebx
- xorl %esi, %esi
+ movl 8(%esp), %ebx
/* Get the mutex. */
orl $-1, %eax
@@ -59,6 +57,8 @@ pthread_barrier_wait:
je 3f
/* There are more threads to come. */
+ pushl %esi
+
#if CURR_EVENT == 0
movl (%ebx), %edx
#else
@@ -72,7 +72,8 @@ pthread_barrier_wait:
/* Wait for the remaining threads. The call will return immediately
if the CURR_EVENT memory has meanwhile been changed. */
-7: movl %esi, %ecx /* movl $FUTEX_WAIT, %ecx */
+7: xorl %ecx, %ecx /* movl $FUTEX_WAIT, %ecx */
+ xorl %esi, %esi
8: movl $SYS_futex, %eax
ENTER_KERNEL
@@ -89,8 +90,8 @@ pthread_barrier_wait:
/* Note: %esi is still zero. */
movl %esi, %eax /* != PTHREAD_BARRIER_SERIAL_THREAD */
- popl %ebx
popl %esi
+ popl %ebx
ret
/* The necessary number of threads arrived. */
@@ -119,7 +120,6 @@ pthread_barrier_wait:
5: orl $-1, %eax /* == PTHREAD_BARRIER_SERIAL_THREAD */
popl %ebx
- popl %esi
ret
1: leal MUTEX(%ebx), %ecx
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_broadcast.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_broadcast.S
index 34bf95a..49fe9d7 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_broadcast.S
+++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_broadcast.S
@@ -40,10 +40,9 @@
.align 16
__pthread_cond_broadcast:
- pushl %esi
pushl %ebx
- movl 12(%esp), %ebx
+ movl 8(%esp), %ebx
/* Get internal lock. */
movl $1, %eax
@@ -77,14 +76,12 @@ __pthread_cond_broadcast:
/* Wake up all threads. */
8: movl $FUTEX_WAKE, %ecx
- xorl %esi, %esi
movl $SYS_futex, %eax
movl $0x7fffffff, %edx
ENTER_KERNEL
xorl %eax, %eax
popl %ebx
- popl %esi
ret
.align 16
@@ -95,7 +92,6 @@ __pthread_cond_broadcast:
6: xorl %eax, %eax
popl %ebx
- popl %esi
ret
/* Initial locking failed. */
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_signal.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_signal.S
index 404bb4f..807d2f5 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_signal.S
+++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_signal.S
@@ -40,10 +40,9 @@
.align 16
__pthread_cond_signal:
- pushl %esi
pushl %ebx
- movl 12(%esp), %ebx
+ movl 8(%esp), %ebx
/* Get internal lock. */
movl $1, %eax
@@ -71,7 +70,6 @@ __pthread_cond_signal:
/* Wake up one thread. */
movl $FUTEX_WAKE, %ecx
- xorl %esi, %esi
movl $SYS_futex, %eax
movl %ecx, %edx /* movl $1, %edx */
ENTER_KERNEL
@@ -83,7 +81,6 @@ __pthread_cond_signal:
6: xorl %eax, %eax
popl %ebx
- popl %esi
ret
/* Initial locking failed. */
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 7dd97ba..c51c148 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
@@ -39,10 +39,9 @@
.align 16
__pthread_rwlock_unlock:
pushl %ebx
- pushl %esi
pushl %edi
- movl 16(%esp), %edi
+ movl 12(%esp), %edi
/* Get the lock. */
movl $1, %eax
@@ -84,13 +83,11 @@ __pthread_rwlock_unlock:
#endif
jne 7f
-8: xorl %esi, %esi
- movl $SYS_futex, %eax
+8: movl $SYS_futex, %eax
ENTER_KERNEL
xorl %eax, %eax
popl %edi
- popl %esi
popl %ebx
ret
@@ -105,7 +102,6 @@ __pthread_rwlock_unlock:
4: xorl %eax, %eax
popl %edi
- popl %esi
popl %ebx
ret
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 8704b79..23f3305 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_post.S
+++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_post.S
@@ -39,15 +39,13 @@
.type __new_sem_post,@function
.align 16
__new_sem_post:
- pushl %esi
pushl %ebx
- movl 12(%esp), %ebx
+ movl 8(%esp), %ebx
movl $1, %edx
LOCK
xaddl %edx, (%ebx)
- xorl %esi, %esi
movl $SYS_futex, %eax
movl $FUTEX_WAKE, %ecx
incl %edx
@@ -58,7 +56,6 @@ __new_sem_post:
xorl %eax, %eax
popl %ebx
- popl %esi
ret
1:
@@ -80,7 +77,6 @@ __new_sem_post:
orl $-1, %eax
popl %ebx
- popl %esi
ret
.size __new_sem_post,.-__new_sem_post
.symver __new_sem_post, sem_post@@GLIBC_2.1