banan-os/kernel/arch/x86_64/SpinLock.S

17 lines
241 B
ArmAsm
Raw Normal View History

2023-02-01 01:51:25 +02:00
.global spinlock_lock_asm
spinlock_lock_asm:
lock; btsq $0, (%rdi)
jnc .done
.retry:
pause
testq $1, (%rdi)
jne .retry
lock; btsq $0, (%rdi)
jc .retry
.done:
ret
.global spinlock_unlock_asm
spinlock_unlock_asm:
movq $0, (%rdi)
ret