diff options
author | Patrick Wildt <patrick@cvs.openbsd.org> | 2017-01-05 16:52:43 +0000 |
---|---|---|
committer | Patrick Wildt <patrick@cvs.openbsd.org> | 2017-01-05 16:52:43 +0000 |
commit | d8d48da2761da13ef2aae0be4fdf1e7675cb04a2 (patch) | |
tree | 30a13e8d6c25cf731c2dc6a06ccb7e0184315338 | |
parent | 227706360c647fd224c5b0fbe829c10bbef3f812 (diff) |
Now that all non-ARMv7 platforms are gone, tedu the legacy atomic
locking code.
ok kettenis@
-rw-r--r-- | lib/librthread/arch/arm/_atomic_lock.c | 13 | ||||
-rw-r--r-- | sys/arch/armv7/include/spinlock.h | 8 |
2 files changed, 5 insertions, 16 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); } diff --git a/sys/arch/armv7/include/spinlock.h b/sys/arch/armv7/include/spinlock.h index 658a10c1506..698ec4dc09d 100644 --- a/sys/arch/armv7/include/spinlock.h +++ b/sys/arch/armv7/include/spinlock.h @@ -1,7 +1,3 @@ - -/* $OpenBSD: spinlock.h,v 1.1 2013/09/04 14:38:29 patrick Exp $ */ -#ifndef _MACHINE_SPINLOCK_H_ -#define _MACHINE_SPINLOCK_H_ -#define ARM_V7PLUS_LOCKS +/* $OpenBSD: spinlock.h,v 1.2 2017/01/05 16:52:42 patrick Exp $ */ +/* public domain */ #include <arm/spinlock.h> -#endif /* _MACHINE_SPINLOCK_H_ */ |