diff --git a/rtemsbsd/include/machine/atomic.h b/rtemsbsd/include/machine/atomic.h index 347ea2e3..a4b6b488 100644 --- a/rtemsbsd/include/machine/atomic.h +++ b/rtemsbsd/include/machine/atomic.h @@ -1477,6 +1477,27 @@ atomic_readandclear_long(volatile long *p) return (tmp); } +static inline long +atomic_load_long(volatile long *p) +{ + long tmp; + +#if defined(_RTEMS_BSD_MACHINE_ATOMIC_USE_ATOMIC) + std::atomic_long *q = + reinterpret_cast(const_cast(p)); + + tmp = q->load(std::memory_order_relaxed); +#elif defined(_RTEMS_BSD_MACHINE_ATOMIC_USE_STDATOMIC) + atomic_long *q = (atomic_long *)RTEMS_DEVOLATILE(long *, p); + + tmp = atomic_load_explicit(q, memory_order_relaxed); +#else + tmp = *p; +#endif + + return (tmp); +} + static inline long atomic_load_acq_long(volatile long *p) {