From b2de0ed4413b58fb2ae1a796eaf0e668083f53a5 Mon Sep 17 00:00:00 2001 From: David Leonard Date: Wed, 10 Mar 1999 09:32:02 +0000 Subject: correct asm constraints, espie@; cite m680x0 user manual --- lib/libc_r/arch/m68k/_atomic_lock.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'lib/libc_r/arch') diff --git a/lib/libc_r/arch/m68k/_atomic_lock.c b/lib/libc_r/arch/m68k/_atomic_lock.c index 329fdb5ca37..c91b11ce26e 100644 --- a/lib/libc_r/arch/m68k/_atomic_lock.c +++ b/lib/libc_r/arch/m68k/_atomic_lock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: _atomic_lock.c,v 1.4 1998/12/21 13:03:44 d Exp $ */ +/* $OpenBSD: _atomic_lock.c,v 1.5 1999/03/10 09:32:01 d Exp $ */ /* * Atomic lock for m68k */ @@ -20,10 +20,18 @@ _atomic_lock(volatile _spinlock_lock_t *lock) * old = 0; * CAS(old, 1, *lock); * if (old == 1) { lock was acquired } + * + * From the MC68030 User's Manual (Motorola), page `3-13': + * CAS Dc,Du,: + * ( - Dc) -> cc; + * if Z then Du -> + * else -> Dc; */ old = _SPINLOCK_UNLOCKED; - __asm__("casl %0, %2, %1" : "=d"(old), "=m"(*lock) - : "d"(_SPINLOCK_LOCKED), "0"(old)); + __asm__("casl %0, %2, %1" : "=d" (old), "=m" (*lock) + : "d" (_SPINLOCK_LOCKED), + "0" (old), "1" (*lock) + : "cc"); return (old != _SPINLOCK_UNLOCKED); } -- cgit v1.2.3