about summary refs log tree commit diff
path: root/nptl
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-02-22 19:37:31 +0000
committerUlrich Drepper <drepper@redhat.com>2004-02-22 19:37:31 +0000
commita8fd5a02d94dcbe9a75252a66d2d73b41b9a2c83 (patch)
tree25310d8d27f7cd221a2d7450d0b4d0e23b2791e7 /nptl
parentc91b8752c35d0d6b59419e3d39a7bd3dc1b45cc0 (diff)
downloadglibc-a8fd5a02d94dcbe9a75252a66d2d73b41b9a2c83.tar.gz
glibc-a8fd5a02d94dcbe9a75252a66d2d73b41b9a2c83.tar.xz
glibc-a8fd5a02d94dcbe9a75252a66d2d73b41b9a2c83.zip
Update.
2004-02-22  Ulrich Drepper  <drepper@redhat.com>

	* sysdeps/unix/sysv/linux/i386/posix_fadvise64.S: Pop register
	content also in case of an overflow in the parameter.
	Reported by Momchil Velikov <velco@fadata.bg>.
Diffstat (limited to 'nptl')
-rw-r--r--nptl/ChangeLog8
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S21
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S21
3 files changed, 29 insertions, 21 deletions
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index bb7fe88cfe..6ad2f615c8 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,11 @@
+2004-02-22  Ulrich Drepper  <drepper@redhat.com>
+
+	* sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S
+	(__lll_mutex_lock_wait): Rewrite so that only one locked memory
+	operation per round is needed.
+	* sysdeps/unix/sysv/linux/x86_64/lowlevellock.S
+	(__lll_mutex_lock_wait): Likewise.
+
 2004-02-20  Ulrich Drepper  <drepper@redhat.com>
 
 	* tst-cancel9.c (cleanup): Don't print to stderr.
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S
index c5ec154af2..600ba75874 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 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.
 
@@ -50,26 +50,25 @@ __lll_mutex_lock_wait:
 	xorl	%esi, %esi	/* No timeout.  */
 	xorl	%ecx, %ecx	/* movl $FUTEX_WAIT, %ecx */
 
-1:	cmpl	%edx, %eax	/* NB:	 %edx == 2 */
-	je 3f
+	cmpl	%edx, %eax	/* NB:	 %edx == 2 */
+	je 1f
 
-	movl	$1, %eax
-	LOCK
-	cmpxchgl %edx, (%ebx)
+	movl	%edx, %eax
+	xchgl	%eax, (%ebx)	/* NB:	 lock is implied */
 
 	testl	%eax, %eax
 	je	2f
 
-3:	movl	$SYS_futex, %eax
+1:	movl	$SYS_futex, %eax
 	ENTER_KERNEL
 
-	xorl	%eax, %eax
-2:	LOCK
-	cmpxchgl %edx, (%ebx)
+	movl	%edx, %eax
+	xchgl	%eax, (%ebx)	/* NB:	 lock is implied */
 
+	testl	%eax, %eax
 	jnz,pn	1b
 
-	popl	%esi
+2:	popl	%esi
 	popl	%ebx
 	popl	%edx
 	ret
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S b/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S
index a56c714aeb..3c56daecf5 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003 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.
 
@@ -50,24 +50,25 @@ __lll_mutex_lock_wait:
 	movl	$2, %edx
 	movq	%r10, %rsi	/* movq $FUTEX_WAIT, %rsi */
 
-1:
-	movl	$1, %eax
-	LOCK
-	cmpxchgl %edx, (%rdi)
+	cmpl	%edx, %eax	/* NB:	 %edx == 2 */
+	je	1f
+
+	movl	%edx, %eax
+	xchgl	%eax, (%rdi)	/* NB:	 lock is implied */
 
 	testl	%eax, %eax
 	je	2f
 
-	movq	$SYS_futex, %rax
+1:	movq	$SYS_futex, %rax
 	syscall
 
-	xorl	%eax, %eax
-2:	LOCK
-	cmpxchgl %edx, (%rdi)
+	movl	%edx, %eax
+	xchgl	%eax, (%rdi)	/* NB:	 lock is implied */
 
+	testl	%eax, %eax
 	jnz	1b
 
-	popq	%rdx
+2:	popq	%rdx
 	popq	%r10
 	retq
 	.size	__lll_mutex_lock_wait,.-__lll_mutex_lock_wait