* 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.
This commit is contained in:
Ulrich Drepper 2007-05-26 04:49:06 +00:00
parent 3d2dd6ca71
commit 42e6c66593
7 changed files with 37 additions and 7 deletions

View File

@ -1,5 +1,13 @@
2007-05-25 Ulrich Drepper <drepper@redhat.com> 2007-05-25 Ulrich Drepper <drepper@redhat.com>
* 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.
* semaphoreP.h: Declare __old_sem_init and __old_sem_wait. * semaphoreP.h: Declare __old_sem_init and __old_sem_wait.
* sem_init.c (__new_sem_init): Rewrite to initialize all three * sem_init.c (__new_sem_init): Rewrite to initialize all three
fields in the structure. fields in the structure.

View File

@ -52,9 +52,10 @@ __new_sem_post:
cmpl $0, NWAITERS(%ebx) cmpl $0, NWAITERS(%ebx)
je 2f je 2f
movl $SYS_futex, %eax
movl $FUTEX_WAKE, %ecx movl $FUTEX_WAKE, %ecx
orl PRIVATE(%ebx), %ecx
movl $1, %edx movl $1, %edx
movl $SYS_futex, %eax
ENTER_KERNEL ENTER_KERNEL
testl %eax, %eax testl %eax, %eax

View File

@ -30,7 +30,7 @@
#define SYS_gettimeofday __NR_gettimeofday #define SYS_gettimeofday __NR_gettimeofday
#define SYS_futex 240 #define SYS_futex 240
#define FUTEX_WAKE 1 #define FUTEX_WAIT 0
#if VALUE != 0 #if VALUE != 0
@ -108,10 +108,15 @@ sem_timedwait:
movl %eax, 8(%esp) movl %eax, 8(%esp)
movl 28(%esp), %ebx /* Load semaphore address. */ 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 %esp, %esi
movl $SYS_futex, %eax
xorl %edx, %edx xorl %edx, %edx
movl $SYS_futex, %eax
ENTER_KERNEL ENTER_KERNEL
movl %eax, %esi movl %eax, %esi

View File

@ -29,7 +29,7 @@
#endif #endif
#define SYS_futex 240 #define SYS_futex 240
#define FUTEX_WAKE 1 #define FUTEX_WAIT 0
#if VALUE != 0 #if VALUE != 0
@ -76,10 +76,15 @@ __new_sem_wait:
6: call __pthread_enable_asynccancel 6: call __pthread_enable_asynccancel
movl %eax, (%esp) 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 %esi, %esi
xorl %edx, %edx
movl $SYS_futex, %eax movl $SYS_futex, %eax
movl %esi, %ecx
movl %esi, %edx
ENTER_KERNEL ENTER_KERNEL
movl %eax, %esi movl %eax, %esi

View File

@ -50,6 +50,7 @@ sem_post:
movl $SYS_futex, %eax movl $SYS_futex, %eax
movl $FUTEX_WAKE, %esi movl $FUTEX_WAKE, %esi
orl PRIVATE(%rdi), %esi
movl $1, %edx movl $1, %edx
syscall syscall

View File

@ -116,7 +116,12 @@ sem_timedwait:
#else #else
leaq VALUE(%r12), %rdi leaq VALUE(%r12), %rdi
#endif #endif
#if FUTEX_WAIT == 0
movl PRIVATE(%rdi), %esi
#else
movl $FUTEX_WAIT, %esi movl $FUTEX_WAIT, %esi
orl PRIVATE(%rdi), %esi
#endif
movl $SYS_futex, %eax movl $SYS_futex, %eax
xorl %edx, %edx xorl %edx, %edx
syscall syscall

View File

@ -82,7 +82,12 @@ sem_wait:
xorq %r10, %r10 xorq %r10, %r10
movl $SYS_futex, %eax movl $SYS_futex, %eax
movq %r13, %rdi movq %r13, %rdi
#if FUTEX_WAIT == 0
movl PRIVATE(%rdi), %esi
#else
movl $FUTEX_WAIT, %esi movl $FUTEX_WAIT, %esi
orl PRIVATE(%rdi), %esi
#endif
xorl %edx, %edx xorl %edx, %edx
syscall syscall
movq %rax, %r12 movq %rax, %r12