summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjsg <jsg@openbsd.org>2016-02-09 23:10:37 +0000
committerjsg <jsg@openbsd.org>2016-02-09 23:10:37 +0000
commit46cccbb443e8c523762a6d9c0a62fc3c598a58eb (patch)
treeced0b183e1e8f1082cb6a24d508ead0f6e1bd91e
parentsync (diff)
downloadwireguard-openbsd-46cccbb443e8c523762a6d9c0a62fc3c598a58eb.tar.xz
wireguard-openbsd-46cccbb443e8c523762a6d9c0a62fc3c598a58eb.zip
bring in dlg's fix from rev 1.10 of the equivalent hppa file:
make __cpu_simple_lock provide serialisation of the critical section. that in turn makes atomic sequences actually atomic, which in turn means the refcnt api asserts wont fire erronously when if_get and if_put are actually used correctly.
-rw-r--r--sys/arch/hppa64/include/atomic.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/sys/arch/hppa64/include/atomic.h b/sys/arch/hppa64/include/atomic.h
index e1c122ea09e..df59356fb75 100644
--- a/sys/arch/hppa64/include/atomic.h
+++ b/sys/arch/hppa64/include/atomic.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: atomic.h,v 1.7 2014/10/12 20:39:46 miod Exp $ */
+/* $OpenBSD: atomic.h,v 1.8 2016/02/09 23:10:37 jsg Exp $ */
/* Public Domain */
@@ -28,13 +28,6 @@ __cpu_simple_lock_ldcws(__cpu_simple_lock_t *l)
return (o);
}
-static inline void
-__cpu_simple_lock(__cpu_simple_lock_t *l)
-{
- while (__cpu_simple_lock_ldcws(l) == __SIMPLELOCK_UNLOCKED)
- ;
-}
-
static inline int
__cpu_simple_lock_try(__cpu_simple_lock_t *l)
{
@@ -42,6 +35,13 @@ __cpu_simple_lock_try(__cpu_simple_lock_t *l)
}
static inline void
+__cpu_simple_lock(__cpu_simple_lock_t *l)
+{
+ while (!__cpu_simple_lock_ldcws(l))
+ ;
+}
+
+static inline void
__cpu_simple_unlock(__cpu_simple_lock_t *l)
{
*l = __SIMPLELOCK_UNLOCKED;