Browse Source

cmpxchg tests

Fabian 3 years ago
parent
commit
ce1a742cb8
2 changed files with 54 additions and 0 deletions
  1. 32 0
      tests/nasm/cmpxchg.asm
  2. 22 0
      tests/nasm/cmpxchg8b.asm

+ 32 - 0
tests/nasm/cmpxchg.asm

@@ -0,0 +1,32 @@
+global _start
+
+section .data
+
+%include "header.inc"
+
+    mov eax, 123456789
+    mov ebx, 123456789
+    mov edx, 123456789
+
+    cmpxchg edx, ebx
+    push eax
+    push edx
+    push ebx
+    pushf
+    and dword [esp], 8ffh
+
+    cmpxchg ax, bx
+    push eax
+    push edx
+    push ebx
+    pushf
+    and dword [esp], 8ffh
+
+    cmpxchg al, bh
+    push eax
+    push edx
+    push ebx
+    pushf
+    and dword [esp], 8ffh
+
+%include "footer.inc"

+ 22 - 0
tests/nasm/cmpxchg8b.asm

@@ -0,0 +1,22 @@
+global _start
+
+section .data
+
+%include "header.inc"
+
+    mov eax, 123456789
+    mov edx, 987654321
+
+    mov dword [esp], 123456789
+    mov dword [esp+4], 987654321
+
+    cmpxchg8b [esp]
+    push eax
+    push ecx
+    push ebx
+    push edx
+    pushf
+    and dword [esp], 8ffh
+
+%include "footer.inc"
+