Skip to content

Commit

Permalink
x86_64: avoid locking bus when unnecessary
Browse files Browse the repository at this point in the history
  • Loading branch information
jewelcodes committed Oct 8, 2024
1 parent b0e006a commit 2c004a5
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/platform/x86_64/lock.asm
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,15 @@ acquireLockBlocking:
global releaseLock
align 16
releaseLock:
pushfq
cli

xor rax, rax
test dword [rdi], 1
jz .done

mov [rdi], eax

.done:
popfq
ret

0 comments on commit 2c004a5

Please sign in to comment.