30 (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
38 #if defined(__powerpc64__) || defined (__powerpc__)
39 #include "sasatom_powerpc.h"
40 #elif defined(__x86_64__)
41 #include "sasatom_x86_64.h"
42 #elif defined(__i386__)
43 #include "sasatom_i386.h"
45 #include "sasatom_generic.h"
51 #define sas_write_barrier() __arch_sas_write_barrier()
56 #define sas_read_barrier() __arch_sas_read_barrier()
61 #define sas_full_barrier() __arch_sas_full_barrier()
66 #define sas_code_barrier() __asm ("" ::: "memory")
79 return __arch_fetch_and_add_ptr(pointer, delta);
90 static inline long int
93 return __arch_fetch_and_add(pointer, delta);
104 static inline long int
107 #if GCC_VERSION >= 40700
108 return __atomic_fetch_and(pointer, delta, __ATOMIC_ACQ_REL);
110 return __sync_fetch_and_and(pointer, delta);
122 static inline long int
125 #if GCC_VERSION >= 40700
126 return __atomic_fetch_and(pointer, delta, __ATOMIC_ACQ_REL);
128 return __sync_fetch_and_and(pointer, delta);
140 static inline long int
143 #if GCC_VERSION >= 40700
144 return __atomic_fetch_or(pointer, delta, __ATOMIC_ACQ_REL);
146 return __sync_fetch_and_or(pointer, delta);
158 static inline long int
161 #if GCC_VERSION >= 40700
162 return __atomic_fetch_or(pointer, delta, __ATOMIC_ACQ_REL);
164 return __sync_fetch_and_or(pointer, delta);
178 return __arch_compare_and_swap(p, oldval, newval);
187 static inline long int
190 return __arch_atomic_swap(p, replace);
199 __arch_atomic_inc(p);
208 __arch_atomic_dec(p);
231 __arch_sas_spin_lock(lock);
244 return __arch_sas_spin_trylock(lock);
275 long unlocked, locked;
277 unlocked = (long)(*lock) & -2L;
278 locked = unlocked | 1;
283 return (
void*)unlocked;
295 long unlocked= (long)(*lock) & -2L;
296 long newlocked= (long)newptr | 1;
311 long locked= (long)(*lock) | 1;
312 long newlocked= (long)newptr | 1;
326 long unlocked= (long)(*lock) & -2L;
327 long locked= unlocked | 1;
345 long unlocked= (long)(*lock) & -2L;
346 long locked= unlocked | 1;
414 #if GCC_VERSION >= 40700
415 result = __atomic_fetch_add(value, delta, __ATOMIC_ACQUIRE);
417 result = __sync_fetch_and_add(value, delta);
432 #if GCC_VERSION >= 40700
433 result = __atomic_fetch_add(value, delta, __ATOMIC_ACQUIRE);
435 result = __sync_fetch_and_add(value, delta);
static long int sas_fetch_and_or_long(unsigned long *pointer, long int delta)
Definition: sasatom.h:159
static void sas_set_unlocked_ptr(volatile sas_lock_ptr_t *lock, sas_lock_ptr_t newptr)
Definition: sasatom.h:291
static void * sas_lock_ptr(volatile sas_lock_ptr_t *lock)
Definition: sasatom.h:272
static long int sas_fetch_and_and_long(unsigned long *pointer, long int delta)
Definition: sasatom.h:123
static long sas_atomic_inc_long(volatile long *value)
Definition: sasatom.h:409
static void sas_spin_lock_init(volatile sas_spin_lock_t *lock)
Definition: sasatom.h:216
static void sas_spin_lock_with_yield(volatile sas_spin_lock_t *lock)
Definition: sasatom.h:356
#define sas_write_barrier()
Definition: sasatom.h:51
static long sas_atomic_dec_long(volatile long *value)
Definition: sasatom.h:427
static void sas_lock_ptr_init(volatile sas_lock_ptr_t *lock)
Definition: sasatom.h:262
static void sas_atomic_dec(long int *p)
Definition: sasatom.h:206
static long int sas_fetch_and_add(long *pointer, long int delta)
Definition: sasatom.h:91
static void sas_spin_lock(volatile sas_spin_lock_t *lock)
Definition: sasatom.h:229
static void sas_lock_ptr_with_yield(volatile sas_lock_ptr_t *lock)
Definition: sasatom.h:382
static int sas_spin_trylock(volatile sas_spin_lock_t *lock)
Definition: sasatom.h:242
unsigned int sas_spin_lock_t
Definition: sasatom.h:34
static void * sas_fetch_and_add_ptr(void **pointer, long int delta)
Definition: sasatom.h:77
#define sas_read_barrier()
Definition: sasatom.h:56
static void sas_atomic_inc(long int *p)
Definition: sasatom.h:197
void * sas_lock_ptr_t
Definition: sasatom.h:36
static void sas_set_locked_ptr(volatile sas_lock_ptr_t *lock, sas_lock_ptr_t newptr)
Definition: sasatom.h:307
static void sas_unlock_ptr(volatile sas_lock_ptr_t *lock)
Definition: sasatom.h:339
static int sas_compare_and_swap(volatile long int *p, long int oldval, long int newval)
Definition: sasatom.h:176
static long int sas_fetch_and_or(unsigned int *pointer, int delta)
Definition: sasatom.h:141
static void sas_spin_unlock(volatile sas_spin_lock_t *lock)
Definition: sasatom.h:251
static long int sas_fetch_and_and(unsigned int *pointer, int delta)
Definition: sasatom.h:105
static int sas_trylock_ptr(volatile sas_lock_ptr_t *lock)
Definition: sasatom.h:322
static long int sas_atomic_swap(long int *p, long int replace)
Definition: sasatom.h:188