Luna/kernel/src/thread/Spinlock.asm

20 lines
353 B
NASM
Raw Normal View History

2022-09-18 18:15:19 +00:00
global spinlock_lock_acquire
spinlock_lock_acquire:
lock bts qword [rdi], 0
jc .spin
ret
.spin:
pause
test qword [rdi], 1
jnz .spin
jmp spinlock_lock_acquire
global spinlock_lock_release
spinlock_lock_release:
mov qword [rdi], 0
ret
global spinlock_lock_is_locked
spinlock_lock_is_locked:
2022-09-19 14:36:34 +00:00
mov rax, [rdi]
2022-09-18 18:15:19 +00:00
ret