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:
|
2023-03-07 18:47:13 +02:00
|
|
|
movl $0, (%rdi)
|
2023-02-01 01:51:25 +02:00
|
|
|
ret
|