diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2007-11-05 20:19:23 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2007-11-05 20:19:23 +0000 |
commit | abc3913425ffd4808958523bacf0ac4b936c0a21 (patch) | |
tree | 5e578980bb77cdbada2b6db0a2ed7c82cea601d3 | |
parent | ea870a332cac81d8a383c6eb2827510aee901b6e (diff) |
Sprinkle a few holy membars around memory writes.
ok kettenis@
-rw-r--r-- | sys/arch/sparc64/include/lock.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/arch/sparc64/include/lock.h b/sys/arch/sparc64/include/lock.h index f57d7ca461c..c880043998b 100644 --- a/sys/arch/sparc64/include/lock.h +++ b/sys/arch/sparc64/include/lock.h @@ -1,10 +1,12 @@ -/* $OpenBSD: lock.h,v 1.1 2007/05/01 18:56:31 miod Exp $ */ +/* $OpenBSD: lock.h,v 1.2 2007/11/05 20:19:22 miod Exp $ */ /* public domain */ #ifndef _SPARC64_LOCK_H_ #define _SPARC64_LOCK_H_ +#include <machine/ctlreg.h> + typedef volatile u_int8_t __cpu_simple_lock_t; #define __SIMPLELOCK_LOCKED 0xff @@ -25,6 +27,7 @@ __cpu_simple_lock(__cpu_simple_lock_t *l) old = __SIMPLELOCK_LOCKED; __asm__ __volatile__ ("ldstub %0, %1" : "=m" (*l), "=r" (old) : "0" (*l)); + membar(LoadLoad | LoadStore); } while (old != __SIMPLELOCK_UNLOCKED); } @@ -35,6 +38,7 @@ __cpu_simple_lock_try(__cpu_simple_lock_t *l) __asm__ __volatile__ ("ldstub %0, %1" : "=m" (*l), "=r" (old) : "0" (*l)); + membar(LoadLoad | LoadStore); return (old == __SIMPLELOCK_UNLOCKED); } @@ -42,6 +46,7 @@ __cpu_simple_lock_try(__cpu_simple_lock_t *l) static __inline__ void __cpu_simple_unlock(__cpu_simple_lock_t *l) { + membar(StoreStore | LoadStore); *l = __SIMPLELOCK_UNLOCKED; } |