summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Guenthe <guenther@cvs.openbsd.org>2011-10-13 05:41:07 +0000
committerPhilip Guenthe <guenther@cvs.openbsd.org>2011-10-13 05:41:07 +0000
commit06be69949fdaac5748c26bac9c34d64e4dd539a6 (patch)
tree3a77dd655c6ce0a7c94608c83d1098c74c0974f6
parentba0ca07557c34cd6389858f21be40f0aeaabd733 (diff)
Deal with the horror that is gcc asm constraints by copying the
known good version of ldstub in the kernel. (It's finally in, aja!) ok kettenis@
-rw-r--r--lib/librthread/arch/sparc/_atomic_lock.c6
-rw-r--r--lib/librthread/arch/sparc64/_atomic_lock.c6
2 files changed, 4 insertions, 8 deletions
diff --git a/lib/librthread/arch/sparc/_atomic_lock.c b/lib/librthread/arch/sparc/_atomic_lock.c
index 4d7b0397743..036a7abb6e9 100644
--- a/lib/librthread/arch/sparc/_atomic_lock.c
+++ b/lib/librthread/arch/sparc/_atomic_lock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: _atomic_lock.c,v 1.3 2008/10/02 23:29:26 deraadt Exp $ */
+/* $OpenBSD: _atomic_lock.c,v 1.4 2011/10/13 05:41:06 guenther Exp $ */
/* David Leonard, <d@csee.uq.edu.au>. Public domain. */
/*
@@ -35,9 +35,7 @@ _atomic_lock(volatile _spinlock_lock_t * lock)
*
* (No change to the condition codes are documented.)
*/
- __asm__("ldstub %0,%1"
- : "=m" (*lock), "=r" (old)
- : "0" (*lock));
+ __asm__("ldstub [%1], %0" : "=&r" (old) : "r" (lock) : "memory");
return (old == _SPINLOCK_LOCKED);
}
diff --git a/lib/librthread/arch/sparc64/_atomic_lock.c b/lib/librthread/arch/sparc64/_atomic_lock.c
index 3ccb2d34fd4..750d9e5aa14 100644
--- a/lib/librthread/arch/sparc64/_atomic_lock.c
+++ b/lib/librthread/arch/sparc64/_atomic_lock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: _atomic_lock.c,v 1.3 2008/10/02 23:29:26 deraadt Exp $ */
+/* $OpenBSD: _atomic_lock.c,v 1.4 2011/10/13 05:41:06 guenther Exp $ */
/* David Leonard, <d@csee.uq.edu.au>. Public domain. */
/*
@@ -35,9 +35,7 @@ _atomic_lock(volatile _spinlock_lock_t * lock)
*
* (No change to the condition codes are documented.)
*/
- __asm__("ldstub %0,%1"
- : "=m" (*lock), "=r" (old)
- : "0" (*lock));
+ __asm__("ldstub [%1], %0" : "=&r" (old) : "r" (lock) : "memory");
return (old == _SPINLOCK_LOCKED);
}