summaryrefslogtreecommitdiff
path: root/lib/librthread
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2012-03-03 14:42:34 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2012-03-03 14:42:34 +0000
commit6b7c51de98324f16663fd729c296ae67eb753259 (patch)
treedb73e959d206b29c2128fdccca19cd4365501af7 /lib/librthread
parentc2b9c0a5ba0b91863b2ce987f91d0c4584d48b9a (diff)
Sync the assembly statements with <machine/lock.h> for consistency.
Diffstat (limited to 'lib/librthread')
-rw-r--r--lib/librthread/arch/hppa/_atomic_lock.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/librthread/arch/hppa/_atomic_lock.c b/lib/librthread/arch/hppa/_atomic_lock.c
index a63985e10ad..c01fa9f78f7 100644
--- a/lib/librthread/arch/hppa/_atomic_lock.c
+++ b/lib/librthread/arch/hppa/_atomic_lock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: _atomic_lock.c,v 1.5 2006/01/05 22:33:23 marc Exp $ */
+/* $OpenBSD: _atomic_lock.c,v 1.6 2012/03/03 14:42:33 miod Exp $ */
/*
* Copyright (c) 2005 Marco Peereboom <marco@openbsd.org>
*
@@ -16,11 +16,15 @@
*/
#include <spinlock.h>
+#ifdef DIAGNOSTIC
+#include <stdio.h>
+#include <stdlib.h>
+#endif
int
_atomic_lock(volatile _spinlock_lock_t *lock)
{
- _spinlock_lock_t old;
+ volatile _spinlock_lock_t old;
#ifdef DIAGNOSTIC
if ((unsigned long)lock & 0xf) {
@@ -29,9 +33,9 @@ _atomic_lock(volatile _spinlock_lock_t *lock)
}
#endif
- asm volatile ("ldcw %1,%0"
- : "=r" (old), "=m" (*lock)
- : "m" (*lock));
+ asm volatile ("ldcws 0(%2),%0"
+ : "=&r" (old), "+m" (lock)
+ : "r" (lock));
return (old == _SPINLOCK_LOCKED);
}