From dfef32ef796146357481a6f7949ba900108c655e Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sat, 22 Jul 2000 02:26:07 +0000 Subject: Update. 2000-07-21 Ulrich Drepper * sysdeps/powerpc/strchr.S: Correct bugs introduced in BP-ification. Patch by Franz Sirl . --- linuxthreads/spinlock.h | 4 ++++ linuxthreads/sysdeps/powerpc/pt-machine.h | 8 +++++--- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'linuxthreads') diff --git a/linuxthreads/spinlock.h b/linuxthreads/spinlock.h index 703b72d65e..6d3d3433f9 100644 --- a/linuxthreads/spinlock.h +++ b/linuxthreads/spinlock.h @@ -48,6 +48,10 @@ static inline int compare_and_swap(long * ptr, long oldval, long newval, #elif defined(HAS_COMPARE_AND_SWAP) +#ifdef IMPLEMENT_TAS_WITH_CAS +#define testandset(p) !__compare_and_swap(p, 0, 1) +#endif + #ifdef HAS_COMPARE_AND_SWAP_WITH_RELEASE_SEMANTICS static inline int diff --git a/linuxthreads/sysdeps/powerpc/pt-machine.h b/linuxthreads/sysdeps/powerpc/pt-machine.h index c4af484e1b..39defcd00f 100644 --- a/linuxthreads/sysdeps/powerpc/pt-machine.h +++ b/linuxthreads/sysdeps/powerpc/pt-machine.h @@ -28,7 +28,7 @@ /* For multiprocessor systems, we want to ensure all memory accesses 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") +#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. */ @@ -36,9 +36,11 @@ register char * stack_pointer __asm__ ("r1"); /* Compare-and-swap for semaphores. */ -/* note that test-and-set(x) is the same as compare-and-swap(x, 0, 1) */ +/* note that test-and-set(x) is the same as !compare-and-swap(x, 0, 1) */ #define HAS_COMPARE_AND_SWAP +#define IMPLEMENT_TAS_WITH_CAS + #if BROKEN_PPC_ASM_CR0 static #else @@ -50,7 +52,7 @@ __compare_and_swap (long int *p, long int oldval, long int newval) int ret; MEMORY_BARRIER (); - __asm__ ( + __asm__ __volatile__ ( "0: lwarx %0,0,%1 ;" " xor. %0,%3,%0;" " bne 1f;" -- cgit v1.2.3