diff options
author | David Leonard <d@cvs.openbsd.org> | 1999-05-26 00:11:28 +0000 |
---|---|---|
committer | David Leonard <d@cvs.openbsd.org> | 1999-05-26 00:11:28 +0000 |
commit | d777af456a4a86720dc4b83e32882584bb331833 (patch) | |
tree | a14a64583609877296c751554896d6e9134d20cd /lib | |
parent | 3060ca6ff8355c31736c7dba4431bd3a590bb5fa (diff) |
add mb (memory barrier) instruction. from FreeBSD
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc_r/arch/alpha/_atomic_lock.c | 16 | ||||
-rw-r--r-- | lib/libpthread/arch/alpha/_atomic_lock.c | 16 |
2 files changed, 20 insertions, 12 deletions
diff --git a/lib/libc_r/arch/alpha/_atomic_lock.c b/lib/libc_r/arch/alpha/_atomic_lock.c index c496aee5002..5f11655ab1f 100644 --- a/lib/libc_r/arch/alpha/_atomic_lock.c +++ b/lib/libc_r/arch/alpha/_atomic_lock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: _atomic_lock.c,v 1.4 1998/12/21 13:03:43 d Exp $ */ +/* $OpenBSD: _atomic_lock.c,v 1.5 1999/05/26 00:11:27 d Exp $ */ /* * Atomic lock for alpha */ @@ -23,12 +23,16 @@ _atomic_lock(volatile _spinlock_lock_t * lock) success = 0; /* store the new value of the thrd-lock (unlock mem on store) */ /* - * XXX may need to add large branch forward for main line - * branch prediction to be right :( [note from linux] + * XXX may need to add *large* branch forward for main line + * branch prediction to be right :( [this note from linux] */ - __asm__( "stq_c %2, %0; beq %2, 1f; mov 1,%1; 1:" - : "=m"(*lock), "=r"(success) - : "r"(new) ); + __asm__( "stq_c %2, %0\n" + "beq %2, 1f\n" + "mb\n" + "mov 1, %1\n" + "1:" + : "=m"(*lock), "=r"(success) + : "r"(new) ); } while (!success); return (old != _SPINLOCK_UNLOCKED); diff --git a/lib/libpthread/arch/alpha/_atomic_lock.c b/lib/libpthread/arch/alpha/_atomic_lock.c index c496aee5002..5f11655ab1f 100644 --- a/lib/libpthread/arch/alpha/_atomic_lock.c +++ b/lib/libpthread/arch/alpha/_atomic_lock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: _atomic_lock.c,v 1.4 1998/12/21 13:03:43 d Exp $ */ +/* $OpenBSD: _atomic_lock.c,v 1.5 1999/05/26 00:11:27 d Exp $ */ /* * Atomic lock for alpha */ @@ -23,12 +23,16 @@ _atomic_lock(volatile _spinlock_lock_t * lock) success = 0; /* store the new value of the thrd-lock (unlock mem on store) */ /* - * XXX may need to add large branch forward for main line - * branch prediction to be right :( [note from linux] + * XXX may need to add *large* branch forward for main line + * branch prediction to be right :( [this note from linux] */ - __asm__( "stq_c %2, %0; beq %2, 1f; mov 1,%1; 1:" - : "=m"(*lock), "=r"(success) - : "r"(new) ); + __asm__( "stq_c %2, %0\n" + "beq %2, 1f\n" + "mb\n" + "mov 1, %1\n" + "1:" + : "=m"(*lock), "=r"(success) + : "r"(new) ); } while (!success); return (old != _SPINLOCK_UNLOCKED); |