From f4821744584b899c56b0724f3149d55bd627ded6 Mon Sep 17 00:00:00 2001 From: Michael Shaw Date: Tue, 19 Mar 2024 00:15:28 -0400 Subject: [PATCH] atomic: clean up atomic_cmpxchg --- init/atomic.S | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/init/atomic.S b/init/atomic.S index e57a218..fc3dcb2 100644 --- a/init/atomic.S +++ b/init/atomic.S @@ -9,10 +9,9 @@ atomic_cmpxchg: lock cmpxchg %edx, (%rdi) /* if ZF is set, the exchange was successful */ - pushfq - popq %rax - andl $0x40, %eax - shrl $6, %eax - xorl $1, %eax - + jnz nz + movq $0, %rax + ret +nz: + movq $1, %rax ret