From 42e6c66593eb7a07afd58e70bef9aeed9f910548 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sat, 26 May 2007 04:49:06 +0000 Subject: * sysdeps/unix/sysv/linux/i386/i486/sem_post.S: Add private futex support. * sysdeps/unix/sysv/linux/i386/i486/sem_timedwait.S: Likewise. * sysdeps/unix/sysv/linux/i386/i486/sem_wait.S: Likewise. * sysdeps/unix/sysv/linux/x86_64/sem_post.S: Likewise. * sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S: Likewise. * sysdeps/unix/sysv/linux/x86_64/sem_wait.S: Likewise. --- nptl/sysdeps/unix/sysv/linux/i386/i486/sem_post.S | 3 ++- nptl/sysdeps/unix/sysv/linux/i386/i486/sem_timedwait.S | 11 ++++++++--- nptl/sysdeps/unix/sysv/linux/i386/i486/sem_wait.S | 11 ++++++++--- nptl/sysdeps/unix/sysv/linux/x86_64/sem_post.S | 1 + nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S | 5 +++++ nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S | 5 +++++ 6 files changed, 29 insertions(+), 7 deletions(-) (limited to 'nptl/sysdeps') 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 e66db146ec..280dc2fe27 100644 --- a/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_post.S +++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_post.S @@ -52,9 +52,10 @@ __new_sem_post: cmpl $0, NWAITERS(%ebx) je 2f - movl $SYS_futex, %eax movl $FUTEX_WAKE, %ecx + orl PRIVATE(%ebx), %ecx movl $1, %edx + movl $SYS_futex, %eax ENTER_KERNEL testl %eax, %eax 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 3677ab3bf9..57b5b58186 100644 --- a/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_timedwait.S +++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_timedwait.S @@ -30,7 +30,7 @@ #define SYS_gettimeofday __NR_gettimeofday #define SYS_futex 240 -#define FUTEX_WAKE 1 +#define FUTEX_WAIT 0 #if VALUE != 0 @@ -108,10 +108,15 @@ sem_timedwait: movl %eax, 8(%esp) movl 28(%esp), %ebx /* Load semaphore address. */ - xorl %ecx, %ecx +#if FUTEX_WAIT == 0 + movl PRIVATE(%ebx), %ecx +#else + movl $FUTEX_WAIT, %ecx + orl PRIVATE(%ebx), %ecx +#endif movl %esp, %esi - movl $SYS_futex, %eax xorl %edx, %edx + movl $SYS_futex, %eax ENTER_KERNEL movl %eax, %esi 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 bb4d6443e9..d0eef75144 100644 --- a/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_wait.S +++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_wait.S @@ -29,7 +29,7 @@ #endif #define SYS_futex 240 -#define FUTEX_WAKE 1 +#define FUTEX_WAIT 0 #if VALUE != 0 @@ -76,10 +76,15 @@ __new_sem_wait: 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 - movl %esi, %ecx - movl %esi, %edx ENTER_KERNEL movl %eax, %esi 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 1f5d0bba34..4919c11fd2 100644 --- a/nptl/sysdeps/unix/sysv/linux/x86_64/sem_post.S +++ b/nptl/sysdeps/unix/sysv/linux/x86_64/sem_post.S @@ -50,6 +50,7 @@ sem_post: movl $SYS_futex, %eax movl $FUTEX_WAKE, %esi + orl PRIVATE(%rdi), %esi movl $1, %edx syscall 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 1bb74c0368..4068a1b6b8 100644 --- a/nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S +++ b/nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S @@ -116,7 +116,12 @@ sem_timedwait: #else leaq VALUE(%r12), %rdi #endif +#if FUTEX_WAIT == 0 + movl PRIVATE(%rdi), %esi +#else movl $FUTEX_WAIT, %esi + orl PRIVATE(%rdi), %esi +#endif movl $SYS_futex, %eax xorl %edx, %edx syscall 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 e958d63f55..e099ede029 100644 --- a/nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S +++ b/nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S @@ -82,7 +82,12 @@ sem_wait: 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 syscall movq %rax, %r12 -- cgit 1.4.1