2 static inline int a_ll(volatile int *p)
5 __asm__ __volatile__ ("lwarx %0, 0, %2" : "=r"(v) : "m"(*p), "r"(p));
10 static inline int a_sc(volatile int *p, int v)
13 __asm__ __volatile__ (
14 "stwcx. %2, 0, %3 ; mfcr %0"
15 : "=r"(r), "=m"(*p) : "r"(v), "r"(p) : "memory", "cc");
16 return r & 0x20000000; /* "bit 2" of "cr0" (backwards bit order) */
19 #define a_barrier a_barrier
20 static inline void a_barrier()
22 __asm__ __volatile__ ("sync" : : : "memory");
25 #define a_pre_llsc a_barrier
27 #define a_post_llsc a_post_llsc
28 static inline void a_post_llsc()
30 __asm__ __volatile__ ("isync" : : : "memory");
33 #define a_clz_32 a_clz_32
34 static inline int a_clz_32(uint32_t x)
36 __asm__ ("cntlzw %0, %1" : "=r"(x) : "r"(x));