summaryrefslogtreecommitdiffstats
path: root/lib/librthread/arch
diff options
context:
space:
mode:
authorpatrick <patrick@openbsd.org>2017-01-05 16:52:42 +0000
committerpatrick <patrick@openbsd.org>2017-01-05 16:52:42 +0000
commit5459a7130418f221f2926e0de1eb359a1ca87095 (patch)
treefe4fd814f3fd0b954c60a7fc40ef70938235f759 /lib/librthread/arch
parentComplete idle PCB allocation for secondary processors so that it makes (diff)
downloadwireguard-openbsd-5459a7130418f221f2926e0de1eb359a1ca87095.tar.xz
wireguard-openbsd-5459a7130418f221f2926e0de1eb359a1ca87095.zip
Now that all non-ARMv7 platforms are gone, tedu the legacy atomic
locking code. ok kettenis@
Diffstat (limited to 'lib/librthread/arch')
-rw-r--r--lib/librthread/arch/arm/_atomic_lock.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/lib/librthread/arch/arm/_atomic_lock.c b/lib/librthread/arch/arm/_atomic_lock.c
index 9dfc4634c9c..cae72df40b8 100644
--- a/lib/librthread/arch/arm/_atomic_lock.c
+++ b/lib/librthread/arch/arm/_atomic_lock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: _atomic_lock.c,v 1.7 2016/04/09 06:03:48 jsg Exp $ */
+/* $OpenBSD: _atomic_lock.c,v 1.8 2017/01/05 16:52:42 patrick Exp $ */
/*
* Copyright (c) 2004 Dale Rahn. All rights reserved.
@@ -34,11 +34,9 @@
int
_atomic_lock(volatile _atomic_lock_t *lock)
{
- _atomic_lock_t old;
-
-#ifdef ARM_V7PLUS_LOCKS
+ _atomic_lock_t old = 0;
uint32_t scratch = 0;
- old = 0;
+
__asm__("1: ldrex %0, [%1] \n"
" strex %2, %3, [%1] \n"
" cmp %2, #0 \n"
@@ -46,11 +44,6 @@ _atomic_lock(volatile _atomic_lock_t *lock)
" dmb sy \n"
: "+r" (old), "+r" (lock), "+r" (scratch)
: "r" (_ATOMIC_LOCK_LOCKED));
-#else
- __asm__("swp %0, %2, [%1]"
- : "=r" (old), "=r" (lock)
- : "r" (_ATOMIC_LOCK_LOCKED), "1" (lock) );
-#endif
return (old != _ATOMIC_LOCK_UNLOCKED);
}