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

20 lines
282 B
ArmAsm
Raw Normal View History

2023-02-01 01:51:25 +02:00
.global spinlock_lock_asm
spinlock_lock_asm:
2023-02-02 15:49:00 +02:00
movl 4(%esp), %eax
lock; btsl $0, (%eax)
2023-02-01 01:51:25 +02:00
jnc .done
.retry:
pause
2023-02-02 15:49:00 +02:00
testl $1, (%eax)
2023-02-01 01:51:25 +02:00
jne .retry
2023-02-02 15:49:00 +02:00
lock; btsl $0, (%eax)
2023-02-01 01:51:25 +02:00
jc .retry
.done:
ret
.global spinlock_unlock_asm
spinlock_unlock_asm:
2023-02-02 15:49:00 +02:00
movl 4(%esp), %eax
movl $0, (%eax)
ret