From c183b0f2c1cef238296c967da2cd2eb03495e54e Mon Sep 17 00:00:00 2001 From: Marcel Moolenaar Date: Mon, 30 Jul 2007 22:07:01 +0000 Subject: [PATCH] Add casts to some of the more commonly used pointer-type atomic operations. We really should be able to make those inline functions, but this would break its use for sx_locks. Approved by: re (blanket) --- sys/ia64/include/atomic.h | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/sys/ia64/include/atomic.h b/sys/ia64/include/atomic.h index f6601808a9c5..3ff05214cfcc 100644 --- a/sys/ia64/include/atomic.h +++ b/sys/ia64/include/atomic.h @@ -138,8 +138,11 @@ ATOMIC_STORE_LOAD(long, 64, "8") #undef ATOMIC_STORE_LOAD -#define atomic_load_acq_ptr atomic_load_acq_64 -#define atomic_store_rel_ptr atomic_store_rel_64 +#define atomic_load_acq_ptr(p) \ + ((void *)atomic_load_acq_64((volatile uint64_t *)p)) + +#define atomic_store_rel_ptr(p, v) \ + atomic_store_rel_64((volatile uint64_t *)p, (uint64_t)v) #define IA64_ATOMIC(sz, type, name, width, op) \ static __inline type \ @@ -258,6 +261,7 @@ IA64_ATOMIC(8, uint64_t, subtract, 64, -) #define atomic_add_rel_long atomic_add_rel_64 #define atomic_subtract_rel_long atomic_subtract_rel_64 +/* XXX Needs casting. */ #define atomic_set_ptr atomic_set_64 #define atomic_clear_ptr atomic_clear_64 #define atomic_add_ptr atomic_add_64 @@ -311,13 +315,18 @@ atomic_cmpset_rel_64(volatile uint64_t* p, uint64_t cmpval, uint64_t newval) #define atomic_cmpset_64 atomic_cmpset_acq_64 #define atomic_cmpset_int atomic_cmpset_32 #define atomic_cmpset_long atomic_cmpset_64 -#define atomic_cmpset_ptr atomic_cmpset_64 #define atomic_cmpset_acq_int atomic_cmpset_acq_32 #define atomic_cmpset_rel_int atomic_cmpset_rel_32 #define atomic_cmpset_acq_long atomic_cmpset_acq_64 #define atomic_cmpset_rel_long atomic_cmpset_rel_64 -#define atomic_cmpset_acq_ptr atomic_cmpset_acq_64 -#define atomic_cmpset_rel_ptr atomic_cmpset_rel_64 + +#define atomic_cmpset_acq_ptr(p, o, n) \ + (atomic_cmpset_acq_64((volatile uint64_t *)p, (uint64_t)o, (uint64_t)n)) + +#define atomic_cmpset_ptr atomic_cmpset_acq_ptr + +#define atomic_cmpset_rel_ptr(p, o, n) \ + (atomic_cmpset_rel_64((volatile uint64_t *)p, (uint64_t)o, (uint64_t)n)) static __inline uint32_t atomic_readandclear_32(volatile uint32_t* p)