1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#include <sysdep.h> .text .align 4 ENTRY (pthread_spin_lock) mov a2, a0 1: movi a0, 0 movi a1, 1 trap 2 // trap 2 use to cmpxchg cmpnei a0, 0 bt 1b movi a0, 0 jmp r15 /* TODO */ END (pthread_spin_lock)