2 * This file is under no copyright claims due to its
6 #ifndef _WSBM_ATOMIC_H_
7 #define _WSBM_ATOMIC_H_
16 #define wsbmAtomicInit(_i) {(i)}
17 #define wsbmAtomicSet(_v, _i) (((_v)->count) = (_i))
18 #define wsbmAtomicRead(_v) ((_v)->count)
21 wsbmAtomicIncZero(struct _WsbmAtomic *v)
24 __asm__ __volatile__("lock; incl %0; sete %1":"+m"(v->count), "=qm"(c)
31 wsbmAtomicDecNegative(struct _WsbmAtomic *v)
35 __asm__ __volatile__("lock; addl %2,%0; sets %1":"+m"(v->count), "=qm"(c)
42 wsbmAtomicDecZero(struct _WsbmAtomic *v)
46 __asm__ __volatile__("lock; decl %0; sete %1":"+m"(v->count), "=qm"(c)
53 wsbmAtomicInc(struct _WsbmAtomic *v)
55 __asm__ __volatile__("lock; incl %0":"+m"(v->count));
59 wsbmAtomicDec(struct _WsbmAtomic *v)
61 __asm__ __volatile__("lock; decl %0":"+m"(v->count));
65 wsbmAtomicCmpXchg(volatile struct _WsbmAtomic *v, int32_t old, int32_t new)
69 __asm__ __volatile__("lock; cmpxchgl %k1,%2":"=a"(previous)
70 :"r"(new), "m"(v->count), "0"(old)