summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDavid Leonard <d@cvs.openbsd.org>1999-03-10 09:32:02 +0000
committerDavid Leonard <d@cvs.openbsd.org>1999-03-10 09:32:02 +0000
commitb2de0ed4413b58fb2ae1a796eaf0e668083f53a5 (patch)
tree93d593f95405c4261f2fb19dd594ddf9724cefbb /lib
parent2fe5a47d63dd6275dd1a7f8ea54adcd87c83e5ed (diff)
correct asm constraints, espie@; cite m680x0 user manual
Diffstat (limited to 'lib')
-rw-r--r--lib/libc_r/arch/m68k/_atomic_lock.c14
-rw-r--r--lib/libpthread/arch/m68k/_atomic_lock.c14
2 files changed, 22 insertions, 6 deletions
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,<ea>:
+ * (<ea> - Dc) -> cc;
+ * if Z then Du -> <ea>
+ * else <ea> -> 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);
}
diff --git a/lib/libpthread/arch/m68k/_atomic_lock.c b/lib/libpthread/arch/m68k/_atomic_lock.c
index 329fdb5ca37..c91b11ce26e 100644
--- a/lib/libpthread/arch/m68k/_atomic_lock.c
+++ b/lib/libpthread/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,<ea>:
+ * (<ea> - Dc) -> cc;
+ * if Z then Du -> <ea>
+ * else <ea> -> 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);
}