Changeset View
Changeset View
Standalone View
Standalone View
sys/arm/include/atomic-v4.h
| Show First 20 Lines • Show All 107 Lines • ▼ Show 20 Lines | |||||
| static __inline void | static __inline void | ||||
| atomic_clear_64(volatile uint64_t *address, uint64_t clearmask) | atomic_clear_64(volatile uint64_t *address, uint64_t clearmask) | ||||
| { | { | ||||
| __with_interrupts_disabled(*address &= ~clearmask); | __with_interrupts_disabled(*address &= ~clearmask); | ||||
| } | } | ||||
| static __inline int | static __inline int | ||||
| atomic_fcmpset_8(volatile uint8_t *p, volatile uint8_t *cmpval, volatile uint8_t newval) | |||||
| { | |||||
| int ret; | |||||
| __with_interrupts_disabled( | |||||
| { | |||||
| ret = *p; | |||||
| if (*p == *cmpval) { | |||||
| *p = newval; | |||||
| ret = 1; | |||||
| } else { | |||||
| *cmpval = *p; | |||||
| ret = 0; | |||||
| } | |||||
| }); | |||||
| return (ret); | |||||
| } | |||||
| static __inline int | |||||
| atomic_fcmpset_16(volatile uint16_t *p, volatile uint16_t *cmpval, volatile uint16_t newval) | |||||
| { | |||||
| int ret; | |||||
| __with_interrupts_disabled( | |||||
| { | |||||
| ret = *p; | |||||
| if (*p == *cmpval) { | |||||
| *p = newval; | |||||
| ret = 1; | |||||
| } else { | |||||
| *cmpval = *p; | |||||
| ret = 0; | |||||
| } | |||||
| }); | |||||
| return (ret); | |||||
| } | |||||
| static __inline int | |||||
| atomic_fcmpset_32(volatile u_int32_t *p, volatile u_int32_t *cmpval, volatile u_int32_t newval) | atomic_fcmpset_32(volatile u_int32_t *p, volatile u_int32_t *cmpval, volatile u_int32_t newval) | ||||
| { | { | ||||
| int ret; | int ret; | ||||
| __with_interrupts_disabled( | __with_interrupts_disabled( | ||||
| { | { | ||||
| ret = *p; | ret = *p; | ||||
| if (*p == *cmpval) { | if (*p == *cmpval) { | ||||
| Show All 21 Lines | __with_interrupts_disabled( | ||||
| *cmpval = *p; | *cmpval = *p; | ||||
| ret = 0; | ret = 0; | ||||
| } | } | ||||
| }); | }); | ||||
| return (ret); | return (ret); | ||||
| } | } | ||||
| static __inline int | static __inline int | ||||
| atomic_cmpset_8(volatile uint8_t *p, volatile uint8_t cmpval, volatile uint8_t newval) | |||||
| { | |||||
| int ret; | |||||
| __with_interrupts_disabled( | |||||
| { | |||||
| if (*p == cmpval) { | |||||
| *p = newval; | |||||
| ret = 1; | |||||
| } else { | |||||
| ret = 0; | |||||
| } | |||||
| }); | |||||
| return (ret); | |||||
| } | |||||
| static __inline int | |||||
| atomic_cmpset_16(volatile uint16_t *p, volatile uint16_t cmpval, volatile uint16_t newval) | |||||
| { | |||||
| int ret; | |||||
| __with_interrupts_disabled( | |||||
| { | |||||
| if (*p == cmpval) { | |||||
| *p = newval; | |||||
| ret = 1; | |||||
| } else { | |||||
| ret = 0; | |||||
| } | |||||
| }); | |||||
| return (ret); | |||||
| } | |||||
| static __inline int | |||||
| atomic_cmpset_32(volatile u_int32_t *p, volatile u_int32_t cmpval, volatile u_int32_t newval) | atomic_cmpset_32(volatile u_int32_t *p, volatile u_int32_t cmpval, volatile u_int32_t newval) | ||||
| { | { | ||||
| int ret; | int ret; | ||||
| __with_interrupts_disabled( | __with_interrupts_disabled( | ||||
| { | { | ||||
| if (*p == cmpval) { | if (*p == cmpval) { | ||||
| *p = newval; | *p = newval; | ||||
| ▲ Show 20 Lines • Show All 284 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| return (__swp(v, p)); | return (__swp(v, p)); | ||||
| } | } | ||||
| #define atomic_fcmpset_rel_32 atomic_fcmpset_32 | #define atomic_fcmpset_rel_32 atomic_fcmpset_32 | ||||
| #define atomic_fcmpset_acq_32 atomic_fcmpset_32 | #define atomic_fcmpset_acq_32 atomic_fcmpset_32 | ||||
| #ifdef _KERNEL | #ifdef _KERNEL | ||||
| #define atomic_fcmpset_rel_8 atomic_fcmpset_8 | |||||
| #define atomic_fcmpset_acq_8 atomic_fcmpset_8 | |||||
| #define atomic_fcmpset_rel_16 atomic_fcmpset_16 | |||||
| #define atomic_fcmpset_acq_16 atomic_fcmpset_16 | |||||
| #define atomic_fcmpset_rel_64 atomic_fcmpset_64 | #define atomic_fcmpset_rel_64 atomic_fcmpset_64 | ||||
| #define atomic_fcmpset_acq_64 atomic_fcmpset_64 | #define atomic_fcmpset_acq_64 atomic_fcmpset_64 | ||||
| #endif | #endif | ||||
| #define atomic_fcmpset_acq_long atomic_fcmpset_long | #define atomic_fcmpset_acq_long atomic_fcmpset_long | ||||
| #define atomic_fcmpset_rel_long atomic_fcmpset_long | #define atomic_fcmpset_rel_long atomic_fcmpset_long | ||||
| #define atomic_cmpset_rel_32 atomic_cmpset_32 | #define atomic_cmpset_rel_32 atomic_cmpset_32 | ||||
| #define atomic_cmpset_acq_32 atomic_cmpset_32 | #define atomic_cmpset_acq_32 atomic_cmpset_32 | ||||
| #ifdef _KERNEL | #ifdef _KERNEL | ||||
| #define atomic_cmpset_rel_8 atomic_cmpset_8 | |||||
| #define atomic_cmpset_acq_8 atomic_cmpset_8 | |||||
| #define atomic_cmpset_rel_16 atomic_cmpset_16 | |||||
| #define atomic_cmpset_acq_16 atomic_cmpset_16 | |||||
| #define atomic_cmpset_rel_64 atomic_cmpset_64 | #define atomic_cmpset_rel_64 atomic_cmpset_64 | ||||
| #define atomic_cmpset_acq_64 atomic_cmpset_64 | #define atomic_cmpset_acq_64 atomic_cmpset_64 | ||||
| #endif | #endif | ||||
| #define atomic_set_rel_32 atomic_set_32 | #define atomic_set_rel_32 atomic_set_32 | ||||
| #define atomic_set_acq_32 atomic_set_32 | #define atomic_set_acq_32 atomic_set_32 | ||||
| #define atomic_clear_rel_32 atomic_clear_32 | #define atomic_clear_rel_32 atomic_clear_32 | ||||
| #define atomic_clear_acq_32 atomic_clear_32 | #define atomic_clear_acq_32 atomic_clear_32 | ||||
| #define atomic_add_rel_32 atomic_add_32 | #define atomic_add_rel_32 atomic_add_32 | ||||
| ▲ Show 20 Lines • Show All 111 Lines • Show Last 20 Lines | |||||