Kernel: fix spinlock for i386

This commit is contained in:
Bananymous 2023-02-02 15:49:00 +02:00
parent 0d2d6e5348
commit 01f267a321
1 changed files with 6 additions and 4 deletions

View File

@ -1,17 +1,19 @@
.global spinlock_lock_asm
spinlock_lock_asm:
lock; btsl $0, (%edi)
movl 4(%esp), %eax
lock; btsl $0, (%eax)
jnc .done
.retry:
pause
testl $1, (%edi)
testl $1, (%eax)
jne .retry
lock; btsl $0, (%edi)
lock; btsl $0, (%eax)
jc .retry
.done:
ret
.global spinlock_unlock_asm
spinlock_unlock_asm:
movl $0, (%edi)
movl 4(%esp), %eax
movl $0, (%eax)
ret