about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2002-12-12 12:54:18 +0000
committerRoland McGrath <roland@gnu.org>2002-12-12 12:54:18 +0000
commitbe180f6f3b27fd0a7701858be27591a9b6e7d9a9 (patch)
treeffb25171941fdae42af0a3f9e5e2d9748cd41cce
parent14e7aeceff58b18f970126e1562b0dbf340e2d6c (diff)
downloadglibc-be180f6f3b27fd0a7701858be27591a9b6e7d9a9.tar.gz
glibc-be180f6f3b27fd0a7701858be27591a9b6e7d9a9.tar.xz
glibc-be180f6f3b27fd0a7701858be27591a9b6e7d9a9.zip
2002-12-12 Roland McGrath <roland@redhat.com>
	* sysdeps/unix/sysv/linux/i386/lowlevellock.h: Use asm operand with
	"m" constraint to refer to __libc_locking_needed.  Declare it here.
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h17
1 files changed, 11 insertions, 6 deletions
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h b/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h
index 470dcf6108..94c0314c12 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h
+++ b/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h
@@ -183,21 +183,25 @@ extern int lll_unlock_wake_cb (int *__futex) attribute_hidden;
 
    XXX In future we might even want to avoid it on UP machines.  */
 
+/* Nonzero if locking is needed.  */
+extern int __libc_locking_needed attribute_hidden;
+
 # define lll_trylock(futex) \
   ({ unsigned char ret;							      \
-     __asm __volatile ("cmpl $0, __libc_locking_needed\n\t"		      \
+     __asm __volatile ("cmpl $0, %5\n\t"				      \
 		       "je,pt 0f\n\t"					      \
 		       "lock\n"						      \
 		       "0:\tcmpxchgl %2, %1; setne %0"			      \
 		       : "=a" (ret), "=m" (futex)			      \
-		       : "r" (0), "1" (futex), "0" (1)			      \
+		       : "r" (0), "1" (futex), "0" (1),			      \
+		         "m" (__libc_locking_needed)			      \
 		       : "memory");					      \
      ret; })
 
 
 # define lll_lock(futex) \
   (void) ({ int ignore1, ignore2;					      \
-	    __asm __volatile ("cmpl $0, __libc_locking_needed\n\t"	      \
+	    __asm __volatile ("cmpl $0, %5\n\t"				      \
 			      "je,pt 0f\n\t"				      \
 			      "lock\n"					      \
 			      "0:\txaddl %0, %2\n\t"			      \
@@ -209,13 +213,14 @@ extern int lll_unlock_wake_cb (int *__futex) attribute_hidden;
 			      ".previous\n"				      \
 			      "2:"					      \
 			      : "=a" (ignore1), "=&c" (ignore2), "=m" (futex) \
-			      : "0" (-1), "2" (futex)			      \
+			      : "0" (-1), "2" (futex),			      \
+		                "m" (__libc_locking_needed)		      \
 			      : "memory"); })
 
 
 # define lll_unlock(futex) \
   (void) ({ int ignore;							      \
-            __asm __volatile ("cmpl $0, __libc_locking_needed\n\t"	      \
+            __asm __volatile ("cmpl $0, %3\n\t"				      \
 			      "je,pt 0f\n\t"				      \
 			      "lock\n"					      \
 			      "0:\tincl %0\n\t"				      \
@@ -227,7 +232,7 @@ extern int lll_unlock_wake_cb (int *__futex) attribute_hidden;
 			      ".previous\n"				      \
 			      "2:"					      \
 			      : "=m" (futex), "=&a" (ignore)		      \
-			      : "0" (futex)				      \
+			      : "0" (futex), "m" (__libc_locking_needed)      \
 			      : "memory"); })
 #endif