Changeset View
Changeset View
Standalone View
Standalone View
sys/arm64/include/atomic.h
Show First 20 Lines • Show All 232 Lines • ▼ Show 20 Lines | atomic_fcmpset_##bar##64(volatile uint64_t *p, uint64_t *cmpval, \ | ||||
*cmpval = tmp; \ | *cmpval = tmp; \ | ||||
\ | \ | ||||
return (!res); \ | return (!res); \ | ||||
} | } | ||||
ATOMIC_FCMPSET( , , ) | ATOMIC_FCMPSET( , , ) | ||||
ATOMIC_FCMPSET(acq_, a, ) | ATOMIC_FCMPSET(acq_, a, ) | ||||
ATOMIC_FCMPSET(rel_, ,l) | ATOMIC_FCMPSET(rel_, ,l) | ||||
#define atomic_fcmpset_8 atomic_fcmpset_8 | |||||
#define atomic_fcmpset_16 atomic_fcmpset_16 | |||||
#undef ATOMIC_FCMPSET | #undef ATOMIC_FCMPSET | ||||
#define ATOMIC_CMPSET(bar, a, l) \ | #define ATOMIC_CMPSET(bar, a, l) \ | ||||
static __inline int \ | static __inline int \ | ||||
atomic_cmpset_##bar##8(volatile uint8_t *p, uint8_t cmpval, \ | atomic_cmpset_##bar##8(volatile uint8_t *p, uint8_t cmpval, \ | ||||
uint8_t newval) \ | uint8_t newval) \ | ||||
{ \ | { \ | ||||
▲ Show 20 Lines • Show All 83 Lines • ▼ Show 20 Lines | atomic_cmpset_##bar##64(volatile uint64_t *p, uint64_t cmpval, \ | ||||
); \ | ); \ | ||||
\ | \ | ||||
return (!res); \ | return (!res); \ | ||||
} | } | ||||
ATOMIC_CMPSET( , , ) | ATOMIC_CMPSET( , , ) | ||||
ATOMIC_CMPSET(acq_, a, ) | ATOMIC_CMPSET(acq_, a, ) | ||||
ATOMIC_CMPSET(rel_, ,l) | ATOMIC_CMPSET(rel_, ,l) | ||||
#define atomic_cmpset_8 atomic_cmpset_8 | |||||
#define atomic_cmpset_16 atomic_cmpset_16 | |||||
static __inline uint32_t | static __inline uint32_t | ||||
atomic_fetchadd_32(volatile uint32_t *p, uint32_t val) | atomic_fetchadd_32(volatile uint32_t *p, uint32_t val) | ||||
{ | { | ||||
uint32_t tmp, ret; | uint32_t tmp, ret; | ||||
int res; | int res; | ||||
__asm __volatile( | __asm __volatile( | ||||
▲ Show 20 Lines • Show All 108 Lines • ▼ Show 20 Lines | atomic_load_acq_8(volatile uint8_t *p) | ||||
__asm __volatile( | __asm __volatile( | ||||
"ldarb %w0, [%1] \n" | "ldarb %w0, [%1] \n" | ||||
: "=&r" (ret) | : "=&r" (ret) | ||||
: "r" (p) | : "r" (p) | ||||
: "memory"); | : "memory"); | ||||
return (ret); | return (ret); | ||||
} | } | ||||
#define atomic_load_acq_8 atomic_load_acq_8 | |||||
static __inline uint16_t | static __inline uint16_t | ||||
atomic_load_acq_16(volatile uint16_t *p) | atomic_load_acq_16(volatile uint16_t *p) | ||||
{ | { | ||||
uint16_t ret; | uint16_t ret; | ||||
__asm __volatile( | __asm __volatile( | ||||
"ldarh %w0, [%1] \n" | "ldarh %w0, [%1] \n" | ||||
: "=&r" (ret) | : "=&r" (ret) | ||||
: "r" (p) | : "r" (p) | ||||
: "memory"); | : "memory"); | ||||
return (ret); | return (ret); | ||||
} | } | ||||
#define atomic_load_acq_16 atomic_load_acq_16 | |||||
static __inline uint32_t | static __inline uint32_t | ||||
atomic_load_acq_32(volatile uint32_t *p) | atomic_load_acq_32(volatile uint32_t *p) | ||||
{ | { | ||||
uint32_t ret; | uint32_t ret; | ||||
__asm __volatile( | __asm __volatile( | ||||
"ldar %w0, [%1] \n" | "ldar %w0, [%1] \n" | ||||
Show All 23 Lines | |||||
{ | { | ||||
__asm __volatile( | __asm __volatile( | ||||
"stlrb %w0, [%1] \n" | "stlrb %w0, [%1] \n" | ||||
: | : | ||||
: "r" (val), "r" (p) | : "r" (val), "r" (p) | ||||
: "memory"); | : "memory"); | ||||
} | } | ||||
#define atomic_store_rel_8 atomic_store_rel_8 | |||||
static __inline void | static __inline void | ||||
atomic_store_rel_16(volatile uint16_t *p, uint16_t val) | atomic_store_rel_16(volatile uint16_t *p, uint16_t val) | ||||
{ | { | ||||
__asm __volatile( | __asm __volatile( | ||||
"stlrh %w0, [%1] \n" | "stlrh %w0, [%1] \n" | ||||
: | : | ||||
: "r" (val), "r" (p) | : "r" (val), "r" (p) | ||||
: "memory"); | : "memory"); | ||||
} | } | ||||
#define atomic_store_rel_16 atomic_store_rel_16 | |||||
static __inline void | static __inline void | ||||
atomic_store_rel_32(volatile uint32_t *p, uint32_t val) | atomic_store_rel_32(volatile uint32_t *p, uint32_t val) | ||||
{ | { | ||||
__asm __volatile( | __asm __volatile( | ||||
"stlr %w0, [%1] \n" | "stlr %w0, [%1] \n" | ||||
: | : | ||||
▲ Show 20 Lines • Show All 85 Lines • ▼ Show 20 Lines | |||||
#define atomic_add_rel_ptr atomic_add_rel_64 | #define atomic_add_rel_ptr atomic_add_rel_64 | ||||
#define atomic_fcmpset_rel_ptr atomic_fcmpset_rel_64 | #define atomic_fcmpset_rel_ptr atomic_fcmpset_rel_64 | ||||
#define atomic_clear_rel_ptr atomic_clear_rel_64 | #define atomic_clear_rel_ptr atomic_clear_rel_64 | ||||
#define atomic_cmpset_rel_ptr atomic_cmpset_rel_64 | #define atomic_cmpset_rel_ptr atomic_cmpset_rel_64 | ||||
#define atomic_set_rel_ptr atomic_set_rel_64 | #define atomic_set_rel_ptr atomic_set_rel_64 | ||||
#define atomic_subtract_rel_ptr atomic_subtract_rel_64 | #define atomic_subtract_rel_ptr atomic_subtract_rel_64 | ||||
#define atomic_store_rel_ptr atomic_store_rel_64 | #define atomic_store_rel_ptr atomic_store_rel_64 | ||||
#include <sys/_atomic_subword.h> | |||||
andrew: Is this still needed after rS356550? | |||||
cemAuthorUnsubmitted Done Inline ActionsNo, it isn’t. The patch hasn’t been rebased passed that revision yet. cem: No, it isn’t. The patch hasn’t been rebased passed that revision yet. | |||||
static __inline void | static __inline void | ||||
atomic_thread_fence_acq(void) | atomic_thread_fence_acq(void) | ||||
{ | { | ||||
dmb(ld); | dmb(ld); | ||||
} | } | ||||
Show All 25 Lines |
Is this still needed after rS356550?