mirror of
https://github.com/opnsense/src.git
synced 2026-06-11 01:30:30 -04:00
Implement atomic_fetchadd_64() for i386. This function is needed by the
atomic64 header file in the LinuxKPI for i386. Reviewed by: kib MFC after: 1 week Sponsored by: Mellanox Technologies
This commit is contained in:
parent
a3bbbd5e40
commit
322f006ecc
1 changed files with 12 additions and 0 deletions
|
|
@ -129,6 +129,7 @@ int atomic_cmpset_64(volatile uint64_t *, uint64_t, uint64_t);
|
|||
uint64_t atomic_load_acq_64(volatile uint64_t *);
|
||||
void atomic_store_rel_64(volatile uint64_t *, uint64_t);
|
||||
uint64_t atomic_swap_64(volatile uint64_t *, uint64_t);
|
||||
uint64_t atomic_fetchadd_64(volatile uint64_t *, uint64_t);
|
||||
|
||||
#else /* !KLD_MODULE && __GNUCLIKE_ASM */
|
||||
|
||||
|
|
@ -565,6 +566,17 @@ atomic_swap_64(volatile uint64_t *p, uint64_t v)
|
|||
return (atomic_swap_64_i586(p, v));
|
||||
}
|
||||
|
||||
static __inline uint64_t
|
||||
atomic_fetchadd_64(volatile uint64_t *p, uint64_t v)
|
||||
{
|
||||
|
||||
for (;;) {
|
||||
uint64_t t = *p;
|
||||
if (atomic_cmpset_64(p, t, t + v))
|
||||
return (t);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* _KERNEL */
|
||||
|
||||
#endif /* KLD_MODULE || !__GNUCLIKE_ASM */
|
||||
|
|
|
|||
Loading…
Reference in a new issue