4 #define MFENCE() __sync_synchronize()
5 #define BARRIER() __asm__ __volatile__ ("" ::: "memory")
6 #define __pause() __asm__ __volatile__ ("pause\n");
10 #define Noone ((unsigned long)-1)
14 } __attribute__ ((aligned (16))); /* support up to 128bit longs */
16 static inline unsigned long xlock_acquire(struct xlock *lock, unsigned long who)
19 for (; *(volatile unsigned long *)(&lock->owner) != Noone; )
22 if (__sync_bool_compare_and_swap(&lock->owner, Noone, who))
29 static inline unsigned long xlock_try_lock(struct xlock *lock, unsigned long who)
31 return __sync_bool_compare_and_swap(&lock->owner, Noone, who);
34 static inline void xlock_release(struct xlock *lock)
40 static inline unsigned long xlock_get_owner(struct xlock *lock)
42 return *(volatile unsigned long *)(&lock->owner);