diff options
Diffstat (limited to 'linuxthreads/sysdeps/sparc')
-rw-r--r-- | linuxthreads/sysdeps/sparc/sparc32/pt-machine.h | 5 | ||||
-rw-r--r-- | linuxthreads/sysdeps/sparc/sparc64/pt-machine.h | 8 |
2 files changed, 9 insertions, 4 deletions
diff --git a/linuxthreads/sysdeps/sparc/sparc32/pt-machine.h b/linuxthreads/sysdeps/sparc/sparc32/pt-machine.h index 69af8579aa..ddf4932af9 100644 --- a/linuxthreads/sysdeps/sparc/sparc32/pt-machine.h +++ b/linuxthreads/sysdeps/sparc/sparc32/pt-machine.h @@ -37,9 +37,8 @@ testandset (int *spinlock) } -/* Spinlock release; default is just set to zero. */ -#define RELEASE(spinlock) \ - __asm__ __volatile__("stbar; stb %1,%0" : "=m"(*(spinlock)) : "r"(0)); +/* Memory barrier; default is to do nothing */ +#define MEMORY_BARRIER() __asm__ __volatile__("stbar" : : : "memory") /* Get some notion of the current stack. Need not be exactly the top diff --git a/linuxthreads/sysdeps/sparc/sparc64/pt-machine.h b/linuxthreads/sysdeps/sparc/sparc64/pt-machine.h index 5560003fc8..02167bd601 100644 --- a/linuxthreads/sysdeps/sparc/sparc64/pt-machine.h +++ b/linuxthreads/sysdeps/sparc/sparc64/pt-machine.h @@ -37,6 +37,12 @@ testandset (int *spinlock) } +/* Memory barrier; default is to do nothing */ +/* FIXME: is stbar OK, or should we use the more general membar instruction? + If so, which mode to pass to membar? */ +#define MEMORY_BARRIER() __asm__ __volatile__("stbar" : : : "memory") + + /* Get some notion of the current stack. Need not be exactly the top of the stack, just something somewhere in the current frame. */ #define CURRENT_STACK_FRAME stack_pointer @@ -66,7 +72,7 @@ __compare_and_swap (long int *p, long int oldval, long int newval) __asm__ __volatile__ ("casx [%4], %2, %0" : "=r"(readval), "=m"(*p) : "r"(oldval), "m"(*p), "r"(p), "0"(newval)); - + MEMORY_BARRIER(); return readval == oldval; } |