From de26253715b91e7fd4a9854fe836baef86dbc7af Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Tue, 11 Apr 2000 17:03:03 +0000 Subject: Upadte. 2000-04-11 Ulrich Drepper * internals.h: Define MEMORY_BARRIER as empty if not defined already. * spinlock.c (__pthread_lock): Add memory barriers. (__pthread_unlock): Likewise. * sysdeps/alpha/pt-machine.h (MEMORY_BARRIER): Define using mb instruction. (RELEASE): Not needed anymore. (__compare_and_swap): Mark asm as modifying memory. * sysdeps/powerpc/pt-machine.h (sync): Remove. Replace with definition of MEMORY_BARRIER. (__compare_and_swap): Use MEMORY_BARRIER instead of sync. * sysdeps/sparc/sparc32/pt-machine.h (RELEASE): Not needed anymore. (MEMORY_BARRIER): Define using stbar. * sysdeps/sparc/sparc64/pt-machine.h (MEMORY_BARRIER): Define using stbar. (__compare_and_swap): Use MEMORY_BARRIER to ensure ordering. Patch by Xavier Leroy based on comments by Mike Burrows . --- linuxthreads/sysdeps/powerpc/pt-machine.h | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'linuxthreads/sysdeps/powerpc') diff --git a/linuxthreads/sysdeps/powerpc/pt-machine.h b/linuxthreads/sysdeps/powerpc/pt-machine.h index 578369a7fe..c7d0670d82 100644 --- a/linuxthreads/sysdeps/powerpc/pt-machine.h +++ b/linuxthreads/sysdeps/powerpc/pt-machine.h @@ -27,12 +27,7 @@ /* For multiprocessor systems, we want to ensure all memory accesses are completed before we reset a lock. */ -#if 0 -/* on non multiprocessor systems, you can just: */ -#define sync() /* nothing */ -#else -#define sync() __asm__ __volatile__ ("sync") -#endif +#define MEMORY_BARRIER() __asm__ __volatile__ ("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. */ @@ -64,6 +59,6 @@ __compare_and_swap (long int *p, long int oldval, long int newval) : "=&r"(ret) : "r"(p), "r"(newval), "r"(oldval) : "cr0", "memory"); - sync(); + MEMORY_BARRIER(); return ret == 0; } -- cgit v1.2.3