diff options
author | ian <ian@FreeBSD.org> | 2015-02-26 23:05:46 +0000 |
---|---|---|
committer | ian <ian@FreeBSD.org> | 2015-02-26 23:05:46 +0000 |
commit | 2c469d5dc197be18d184b76127cc02ae2ba5e8fd (patch) | |
tree | 07d84826190d47a992bde4f06c2d13d393777424 /sys | |
parent | a505e5ab7a8b81060a8af49d239c3db17783cc32 (diff) | |
download | FreeBSD-src-2c469d5dc197be18d184b76127cc02ae2ba5e8fd.zip FreeBSD-src-2c469d5dc197be18d184b76127cc02ae2ba5e8fd.tar.gz |
Add casting to make atomic ops work for pointers. (Apparently nobody has
ever done atomic ops on pointers before now on arm).
Submitted by: Svatopluk Kraus <onwahe@gmail.com>
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arm/include/atomic.h | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/sys/arm/include/atomic.h b/sys/arm/include/atomic.h index 57fdf71..54835a1 100644 --- a/sys/arm/include/atomic.h +++ b/sys/arm/include/atomic.h @@ -1103,13 +1103,23 @@ atomic_store_long(volatile u_long *dst, u_long src) *dst = src; } -#define atomic_clear_ptr atomic_clear_32 -#define atomic_set_ptr atomic_set_32 -#define atomic_cmpset_ptr atomic_cmpset_32 -#define atomic_cmpset_rel_ptr atomic_cmpset_rel_32 -#define atomic_cmpset_acq_ptr atomic_cmpset_acq_32 -#define atomic_store_ptr atomic_store_32 -#define atomic_store_rel_ptr atomic_store_rel_32 +#define atomic_clear_ptr(p, v) \ + atomic_clear_32((volatile uint32_t *)(p), (uint32_t)(v)) +#define atomic_set_ptr(p, v) \ + atomic_set_32((volatile uint32_t *)(p), (uint32_t)(v)) +#define atomic_cmpset_ptr(p, cmpval, newval) \ + atomic_cmpset_32((volatile u_int32_t *)(p), (u_int32_t)(cmpval), \ + (u_int32_t)(newval)) +#define atomic_cmpset_rel_ptr(p, cmpval, newval) \ + atomic_cmpset_rel_32((volatile u_int32_t *)(p), (u_int32_t)(cmpval), \ + (u_int32_t)(newval)) +#define atomic_cmpset_acq_ptr(p, cmpval, newval) \ + atomic_cmpset_acq_32((volatile u_int32_t *)(p), (u_int32_t)(cmpval), \ + (u_int32_t)(newval)) +#define atomic_store_ptr(p, v) \ + atomic_store_32((volatile uint32_t *)(p), (uint32_t)(v)) +#define atomic_store_rel_ptr(p, v) \ + atomic_store_rel_32((volatile uint32_t *)(p), (uint32_t)(v)) #define atomic_add_int atomic_add_32 #define atomic_add_acq_int atomic_add_acq_32 |