| static inline int a_ll(volatile int *p) |
| ".set push ; .set mips2\n\t" |
| static inline int a_sc(volatile int *p, int v) |
| ".set push ; .set mips2\n\t" |
| : "=r"(r), "=m"(*p) : "0"(v) : "memory"); |
| : "=r"(r), "="LLSC_M(*p) : "0"(v) : "memory"); |
| #define a_barrier a_barrier |
| static inline void a_barrier() |
| /* mips2 sync, but using too many directives causes |
| * gcc not to inline it, so encode with .long instead. */ |
| __asm__ __volatile__ (".long 0xf" : : : "memory"); |
| __asm__ __volatile__ ("sync" : : : "memory"); |
| #define a_pre_llsc a_barrier |
| #define a_post_llsc a_barrier |