> extern __inline__ void atomic_add(int i, atomic_t * v) > { > unsigned long temp; > > __asm__ __volatile__( > "1: ll %0, %1 # atomic_add\n" > " addu %0, %2 \n" > " sc %0, %1 \n" > " beqz %0, 1b \n" > : "=&r" (temp), "=m" (v->counter) > : "Ir" (i), "m" (v->counter)); > } > > > Beginner questions on the above code... See http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_4.html#SEC93 or any of a number of other on-line copies of the gcc documentation. Gcc has a very powerful and cool means of binding C variables to assembly-language operands. The syntax can be painful, but you can do amazing things with it - in this case, an in-line atomic add for C.