+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:
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
{
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;
.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
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
-/* 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.
.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
.hidden lll_unlock_wake_cb
.align 16
lll_unlock_wake_cb:
- pushl %esi
pushl %ebx
pushl %ecx
pushl %edx
popl %edx
popl %ecx
popl %ebx
- popl %esi
ret
.size lll_unlock_wake_cb,.-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
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
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
+ .align 16
__lll_timedwait_tid:
pushl %edi
pushl %esi
-/* 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.
.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
popl %edx
popl %ecx
popl %ebx
- popl %esi
ret
.size __lll_mutex_unlock_wake,.-__lll_mutex_unlock_wake
.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
je 3f
/* There are more threads to come. */
+ pushl %esi
+
#if CURR_EVENT == 0
movl (%ebx), %edx
#else
/* 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
/* 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. */
5: orl $-1, %eax /* == PTHREAD_BARRIER_SERIAL_THREAD */
popl %ebx
- popl %esi
ret
1: leal MUTEX(%ebx), %ecx
.align 16
__pthread_cond_broadcast:
- pushl %esi
pushl %ebx
- movl 12(%esp), %ebx
+ movl 8(%esp), %ebx
/* Get internal lock. */
movl $1, %eax
/* 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
6: xorl %eax, %eax
popl %ebx
- popl %esi
ret
/* Initial locking failed. */
.align 16
__pthread_cond_signal:
- pushl %esi
pushl %ebx
- movl 12(%esp), %ebx
+ movl 8(%esp), %ebx
/* Get internal lock. */
movl $1, %eax
/* Wake up one thread. */
movl $FUTEX_WAKE, %ecx
- xorl %esi, %esi
movl $SYS_futex, %eax
movl %ecx, %edx /* movl $1, %edx */
ENTER_KERNEL
6: xorl %eax, %eax
popl %ebx
- popl %esi
ret
/* Initial locking failed. */
.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
#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
4: xorl %eax, %eax
popl %edi
- popl %esi
popl %ebx
ret
.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
xorl %eax, %eax
popl %ebx
- popl %esi
ret
1:
orl $-1, %eax
popl %ebx
- popl %esi
ret
.size __new_sem_post,.-__new_sem_post
.symver __new_sem_post, sem_post@@GLIBC_2.1