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) */
20 static inline void *a_ll_p(volatile void *p)
23 __asm__ __volatile__ ("ldarx %0, 0, %2" : "=r"(v) : "m"(*(void *volatile *)p), "r"(p));
28 static inline int a_sc_p(volatile void *p, void *v)
31 __asm__ __volatile__ (
32 "stdcx. %2, 0, %3 ; mfcr %0"
33 : "=r"(r), "=m"(*(void *volatile *)p) : "r"(v), "r"(p) : "memory", "cc");
34 return r & 0x20000000; /* "bit 2" of "cr0" (backwards bit order) */
37 #define a_barrier a_barrier
38 static inline void a_barrier()
40 __asm__ __volatile__ ("sync" : : : "memory");
43 #define a_pre_llsc a_barrier
45 #define a_post_llsc a_post_llsc
46 static inline void a_post_llsc()
48 __asm__ __volatile__ ("isync" : : : "memory");
51 #define a_store a_store
52 static inline void a_store(volatile int *p, int v)
59 #define a_crash a_crash
60 static inline void a_crash()
62 __asm__ __volatile__ (".long 0");