This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Add memory clobber to s390 locking primitives.


Hi,
the locking primitives in the nptl for s390 need a memory clobber
otherwise the compiler might move variable assignments outside of
the critical section.

blue skies,
  Martin.

nptl ChangeLog:
2004-06-11  Martin Schwidefsky  <schwidefsky@de.ibm.com>

	* sysdeps/unix/sysv/linux/s390/lowlevellock.h (lll_compare_and_swap): 
	Add memory clobber to inline assembly.
	(__lll_mutex_trylock): Likewise.
	(__lll_mutex_cond_trylock): Likewise.

diff -urN libc/nptl/sysdeps/unix/sysv/linux/s390/lowlevellock.h libc-s390/nptl/sysdeps/unix/sysv/linux/s390/lowlevellock.h
--- libc/nptl/sysdeps/unix/sysv/linux/s390/lowlevellock.h	2004-06-11 11:05:55.000000000 +0200
+++ libc-s390/nptl/sysdeps/unix/sysv/linux/s390/lowlevellock.h	2004-06-11 11:08:15.000000000 +0200
@@ -112,7 +112,7 @@
 		      "	  jl  0b\n"					      \
 		      "1:"						      \
 		      : "=Q" (*__futex), "=&d" (oldval), "=&d" (newval)	      \
-		      : "m" (*__futex) : "cc" );			      \
+		      : "m" (*__futex) : "cc", "memory" );		      \
   } while (0)
 
 
@@ -124,7 +124,7 @@
 
     __asm __volatile ("cs %0,%3,%1"
 		       : "=d" (old), "=Q" (*futex)
-		       : "0" (0), "d" (1), "m" (*futex) : "cc" );
+		       : "0" (0), "d" (1), "m" (*futex) : "cc", "memory" );
     return old != 0;
 }
 #define lll_mutex_trylock(futex) __lll_mutex_trylock (&(futex))
@@ -138,7 +138,7 @@
 
     __asm __volatile ("cs %0,%3,%1"
 		       : "=d" (old), "=Q" (*futex)
-		       : "0" (0), "d" (2), "m" (*futex) : "cc" );
+		       : "0" (0), "d" (2), "m" (*futex) : "cc", "memory" );
     return old != 0;
 }
 #define lll_mutex_cond_trylock(futex) __lll_mutex_cond_trylock (&(futex))


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]