Skip to content

Instantly share code, notes, and snippets.

@heechul
Created June 29, 2012 15:32
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save heechul/3018642 to your computer and use it in GitHub Desktop.
Save heechul/3018642 to your computer and use it in GitHub Desktop.
static inline void arch_spin_lock(arch_spinlock_t *lock)
{
unsigned long tmp;
__asm__ __volatile__(
1: "1: ldrex %0, [%1]\n"
2: " teq %0, #0\n"
3: WFE("ne")
4: " strexeq %0, %2, [%1]\n"
5: " teqeq %0, #0\n"
6: " bne 1b"
: "=&r" (tmp)
: "r" (&lock->lock), "r" (1)
: "cc");
7: smp_mb();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment