; nasm -f elf64 myprog.asm
; ld -o myprog myprog.o
global _start
section .data
target dq 1
section .text
_start:
mov qword [target], 1
mov rax, 1
mov rbp, target - 42
mov rbx, 42
lock cmpxchg [rbp + rbx], rbx
mov rdi, [target]
mov rax, 60
syscall
; echo $?
Should return 42... and it does...
What say you?
Best,
Frank