40 #include "../../rtt-config.h" 41 #ifndef __ORO_ARCH_x86_64__ 42 #define __ORO_ARCH_x86_64__ 44 #ifndef CONFIG_FORCE_UP 45 #define ORO_LOCK "lock ; " 52 #define ORO_ATOMIC_SETUP oro_atomic_set 53 #define ORO_ATOMIC_CLEANUP(v) 55 #define oro_atomic_read(v) ((v)->counter) 57 #define oro_atomic_set(v,i) (((v)->counter) = (i)) 82 :
"ir" (i),
"m" (v->
counter) :
"memory");
106 __asm__ __volatile__(
117 __asm__ __volatile__(
128 __asm__ __volatile__(
131 :
"ir" (i),
"m" (v->
counter) :
"memory");
135 #ifndef CONFIG_FORCE_UP 136 #define ORO_LOCK_PREFIX "lock ; " 138 #define ORO_LOCK_PREFIX "" 142 #define oro__xg(x) ((struct oro__xchg_dummy *)(x)) 144 static inline unsigned long __oro_cmpxchg(
volatile void *ptr,
unsigned long old,
145 unsigned long _new,
int size)
152 :
"q"(_new),
"m"(*
oro__xg(ptr)),
"0"(old)
158 :
"q"(_new),
"m"(*
oro__xg(ptr)),
"0"(old)
164 :
"q"(_new),
"m"(*
oro__xg(ptr)),
"0"(old)
170 :
"q"(_new),
"m"(*
oro__xg(ptr)),
"0"(old)
178 #define oro_cmpxchg(ptr,o,n)\ 179 ((__typeof__(*(ptr)))__oro_cmpxchg((ptr),(unsigned long)(o),\ 180 (unsigned long)(n),sizeof(*(ptr)))) 182 #undef ORO_LOCK_PREFIX
int oro_atomic_inc_and_test(oro_atomic_t *a)
Increment a atomically and test for zero.
void oro_atomic_inc(oro_atomic_t *a)
Increment a atomically.
volatile long oro_atomic_t
void oro_atomic_sub(int n, oro_atomic_t *a, int n)
Substract n from a.
int oro_atomic_dec_and_test(oro_atomic_t *a)
Decrement a atomically and test for zero.
int oro_atomic_sub_and_test(oro_atomic_t *a, int n)
Substract n from a and test for zero.
#define oro_atomic_add_negative(a, v)
void oro_atomic_dec(oro_atomic_t *a)
Decrement a atomically.
Structure that contains an int for atomic operations.
void oro_atomic_add(oro_atomic_t *a, int n)
Add n to a.