about summary refs log tree commit diff
path: root/linuxthreads/sysdeps
diff options
context:
space:
mode:
authorGeoff Keating <geoffk@cygnus.com>2000-04-11 17:34:36 +0000
committerGeoff Keating <geoffk@cygnus.com>2000-04-11 17:34:36 +0000
commit4a1a3c2158dd9eda0711469d4dd855f61f492667 (patch)
treecc8da6072ac827a7d1f544956a0a8aae35e0f7ae /linuxthreads/sysdeps
parentde26253715b91e7fd4a9854fe836baef86dbc7af (diff)
downloadglibc-4a1a3c2158dd9eda0711469d4dd855f61f492667.tar.gz
glibc-4a1a3c2158dd9eda0711469d4dd855f61f492667.tar.xz
glibc-4a1a3c2158dd9eda0711469d4dd855f61f492667.zip
* sysdeps/powerpc/pt-machine.h (MEMORY_BARRIER): Don't be __volatile__. (__compare_and_swap): Replace other 'sync' with MEMORY_BARRIER. Don't have the 'asm' __volatile__.
2000-04-11  Geoff Keating  <geoffk@cygnus.com>

	* sysdeps/powerpc/pt-machine.h (MEMORY_BARRIER): Don't be
	__volatile__.
	(__compare_and_swap): Replace other 'sync' with MEMORY_BARRIER.
	Don't have the 'asm' __volatile__.
Diffstat (limited to 'linuxthreads/sysdeps')
-rw-r--r--linuxthreads/sysdeps/powerpc/pt-machine.h25
1 files changed, 13 insertions, 12 deletions
diff --git a/linuxthreads/sysdeps/powerpc/pt-machine.h b/linuxthreads/sysdeps/powerpc/pt-machine.h
index c7d0670d82..c4af484e1b 100644
--- a/linuxthreads/sysdeps/powerpc/pt-machine.h
+++ b/linuxthreads/sysdeps/powerpc/pt-machine.h
@@ -1,6 +1,6 @@
 /* Machine-dependent pthreads configuration and inline functions.
    powerpc version.
-   Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -26,8 +26,9 @@
 #endif
 
 /* For multiprocessor systems, we want to ensure all memory accesses
-   are completed before we reset a lock.  */
-#define MEMORY_BARRIER() __asm__ __volatile__ ("sync" : : : "memory")
+   are completed before we reset a lock.  On other systems, we still
+   need to make sure that the compiler has flushed everything to memory.  */
+#define MEMORY_BARRIER() __asm__ ("sync" : : : "memory")
 
 /* Get some notion of the current stack.  Need not be exactly the top
    of the stack, just something somewhere in the current frame.  */
@@ -48,17 +49,17 @@ __compare_and_swap (long int *p, long int oldval, long int newval)
 {
   int ret;
 
-  sync();
-  __asm__ __volatile__(
-		       "0:    lwarx %0,0,%1 ;"
-		       "      xor. %0,%3,%0;"
-		       "      bne 1f;"
-		       "      stwcx. %2,0,%1;"
-		       "      bne- 0b;"
-		       "1:    "
+  MEMORY_BARRIER ();
+  __asm__ (
+	   "0:    lwarx %0,0,%1 ;"
+	   "      xor. %0,%3,%0;"
+	   "      bne 1f;"
+	   "      stwcx. %2,0,%1;"
+	   "      bne- 0b;"
+	   "1:    "
 	: "=&r"(ret)
 	: "r"(p), "r"(newval), "r"(oldval)
 	: "cr0", "memory");
-  MEMORY_BARRIER();
+  MEMORY_BARRIER ();
   return ret == 0;
 }