1 global spinlock_acquire:function
2 global spinlock_release:function
3 global spinlock_init:function
6 ; low four bytes is ticket number
7 ; high four bytes is turn counter
16 lock xadd [rdi], eax ; eax = my ticket number
18 cmp [rdi+4], eax ; is it my turn?
23 cmp [rdi+4], eax ; is it my turn?
24 jne .retry ; keep waiting
29 lock inc dword [rdi+4]