mirror of
https://github.com/opnsense/src.git
synced 2026-06-12 10:10:24 -04:00
atomic(9): Remove fcmpset-based fallback for atomic_testand(clear|set)
All architectures implement a MD version Reviewed by: kib Sponsored by: AFRL, DARPA Differential Revision: https://reviews.freebsd.org/D47629
This commit is contained in:
parent
987c5a1944
commit
fa2091d757
3 changed files with 0 additions and 74 deletions
|
|
@ -892,8 +892,6 @@ atomic_testandclear_long(volatile u_long *p, u_int v)
|
|||
|
||||
return (atomic_testandclear_32((volatile uint32_t *)p, v));
|
||||
}
|
||||
#define atomic_testandclear_long atomic_testandclear_long
|
||||
|
||||
|
||||
static __inline int
|
||||
atomic_testandclear_64(volatile uint64_t *p, u_int v)
|
||||
|
|
@ -952,7 +950,6 @@ atomic_testandset_long(volatile u_long *p, u_int v)
|
|||
|
||||
return (atomic_testandset_32((volatile uint32_t *)p, v));
|
||||
}
|
||||
#define atomic_testandset_long atomic_testandset_long
|
||||
|
||||
static __inline int
|
||||
atomic_testandset_acq_long(volatile u_long *p, u_int v)
|
||||
|
|
@ -963,7 +960,6 @@ atomic_testandset_acq_long(volatile u_long *p, u_int v)
|
|||
dmb();
|
||||
return (ret);
|
||||
}
|
||||
#define atomic_testandset_acq_long atomic_testandset_acq_long
|
||||
|
||||
static __inline int
|
||||
atomic_testandset_64(volatile uint64_t *p, u_int v)
|
||||
|
|
|
|||
|
|
@ -1093,12 +1093,6 @@ atomic_testandset_acq_long(volatile u_long *p, u_int v)
|
|||
return (a);
|
||||
}
|
||||
|
||||
#define atomic_testandclear_int atomic_testandclear_int
|
||||
#define atomic_testandset_int atomic_testandset_int
|
||||
#define atomic_testandclear_long atomic_testandclear_long
|
||||
#define atomic_testandset_long atomic_testandset_long
|
||||
#define atomic_testandset_acq_long atomic_testandset_acq_long
|
||||
|
||||
static __inline void
|
||||
atomic_thread_fence_acq(void)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -205,68 +205,4 @@ atomic_load_acq_16(volatile uint16_t *p)
|
|||
#undef _ATOMIC_BYTE_SHIFT
|
||||
#undef _ATOMIC_HWORD_SHIFT
|
||||
|
||||
/*
|
||||
* Provide generic testandset_long implementation based on fcmpset long
|
||||
* primitive. It may not be ideal for any given arch, so machine/atomic.h
|
||||
* should define the macro atomic_testandset_long to override with an
|
||||
* MD-specific version.
|
||||
*
|
||||
* (Organizationally, this isn't really subword atomics. But atomic_common is
|
||||
* included too early in machine/atomic.h, so it isn't a good place for derived
|
||||
* primitives like this.)
|
||||
*/
|
||||
#ifndef atomic_testandset_acq_long
|
||||
static __inline int
|
||||
atomic_testandset_acq_long(volatile u_long *p, u_int v)
|
||||
{
|
||||
u_long bit, old;
|
||||
bool ret;
|
||||
|
||||
bit = (1ul << (v % (sizeof(*p) * NBBY)));
|
||||
|
||||
old = atomic_load_acq_long(p);
|
||||
ret = false;
|
||||
while (!ret && (old & bit) == 0)
|
||||
ret = atomic_fcmpset_acq_long(p, &old, old | bit);
|
||||
|
||||
return (!ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef atomic_testandset_long
|
||||
static __inline int
|
||||
atomic_testandset_long(volatile u_long *p, u_int v)
|
||||
{
|
||||
u_long bit, old;
|
||||
bool ret;
|
||||
|
||||
bit = (1ul << (v % (sizeof(*p) * NBBY)));
|
||||
|
||||
old = atomic_load_long(p);
|
||||
ret = false;
|
||||
while (!ret && (old & bit) == 0)
|
||||
ret = atomic_fcmpset_long(p, &old, old | bit);
|
||||
|
||||
return (!ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef atomic_testandclear_long
|
||||
static __inline int
|
||||
atomic_testandclear_long(volatile u_long *p, u_int v)
|
||||
{
|
||||
u_long bit, old;
|
||||
bool ret;
|
||||
|
||||
bit = (1ul << (v % (sizeof(*p) * NBBY)));
|
||||
|
||||
old = atomic_load_long(p);
|
||||
ret = false;
|
||||
while (!ret && (old & bit) != 0)
|
||||
ret = atomic_fcmpset_long(p, &old, old & ~bit);
|
||||
|
||||
return (ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _SYS__ATOMIC_SUBWORD_H_ */
|
||||
|
|
|
|||
Loading…
Reference in a new issue