summaryrefslogtreecommitdiffstats
path: root/lib/libpthread/arch/hppa64/_atomic_lock.c
diff options
context:
space:
mode:
authorkettenis <kettenis@openbsd.org>2011-08-04 14:23:36 +0000
committerkettenis <kettenis@openbsd.org>2011-08-04 14:23:36 +0000
commitd8a5dcf244bc6a9a4204db054719a117ab7856dc (patch)
treefec71237a5e4b9f88fccecc5b69774778cb061ce /lib/libpthread/arch/hppa64/_atomic_lock.c
parentIn `string' state, accept bell (^G) as an end of sequence in addition to (diff)
downloadwireguard-openbsd-d8a5dcf244bc6a9a4204db054719a117ab7856dc.tar.xz
wireguard-openbsd-d8a5dcf244bc6a9a4204db054719a117ab7856dc.zip
Initial hppa64 code drop; not finished yet, but this at least allows us to
build stuff. ok deraadt@
Diffstat (limited to 'lib/libpthread/arch/hppa64/_atomic_lock.c')
-rw-r--r--lib/libpthread/arch/hppa64/_atomic_lock.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/libpthread/arch/hppa64/_atomic_lock.c b/lib/libpthread/arch/hppa64/_atomic_lock.c
new file mode 100644
index 00000000000..3fbd67cf82c
--- /dev/null
+++ b/lib/libpthread/arch/hppa64/_atomic_lock.c
@@ -0,0 +1,15 @@
+/* $OpenBSD: _atomic_lock.c,v 1.1 2011/08/04 14:23:36 kettenis Exp $ */
+/*
+ * Atomic lock for hppa
+ */
+#include "spinlock.h"
+
+int
+_atomic_lock(volatile register_t *lock)
+{
+ register register_t old;
+
+ __asm__("ldcws 0(%1), %0" : "=r" (old): "r" (lock));
+
+ return (old == _SPINLOCK_LOCKED);
+}