diff --git a/unittests/ASM/Secondary/09_XX_01.asm b/unittests/ASM/Secondary/09_XX_01.asm new file mode 100644 index 000000000..44af58d15 --- /dev/null +++ b/unittests/ASM/Secondary/09_XX_01.asm @@ -0,0 +1,40 @@ +%ifdef CONFIG +{ + "RegData": { + "RAX": "0x80000000", + "RDX": "0xFFFFFFFF", + "RBX": "0x41424344", + "RCX": "0x51525354", + "R13": "0x5152535441424344", + "R14": "0x1" + }, + "MemoryRegions": { + "0x100000000": "4096" + } +} +%endif + +mov r15, 0xe0000000 + +mov rax, 0xFFFFFFFF80000000 +mov [r15 + 8 * 0], rax + +mov r14, 0 +; Expected +mov eax, 0x80000000 +mov edx, 0xFFFFFFFF + +; Desired +mov ebx, 0x41424344 +mov ecx, 0x51525354 + +cmpxchg8b [r15] + +; Set r14 to 1 if if the memory location was expected +setz r14b + +; edx and eax will now contain the memory's data + +; Check memory location to ensure it contains what we want +mov r13, [r15 + 8 * 0] +hlt diff --git a/unittests/ASM/Secondary/09_XX_01_2.asm b/unittests/ASM/Secondary/09_XX_01_2.asm new file mode 100644 index 000000000..0e9fc95a2 --- /dev/null +++ b/unittests/ASM/Secondary/09_XX_01_2.asm @@ -0,0 +1,40 @@ +%ifdef CONFIG +{ + "RegData": { + "RAX": "0x80000000", + "RDX": "0xFFFFFFFF", + "RBX": "0x41424344", + "RCX": "0x51525354", + "R13": "0xFFFFFFFF80000000", + "R14": "0x0" + }, + "MemoryRegions": { + "0x100000000": "4096" + } +} +%endif + +mov r15, 0xe0000000 + +mov rax, 0xFFFFFFFF80000000 +mov [r15 + 8 * 0], rax + +mov r14, 0 +; Expected +mov eax, 0xFFFFFFFF +mov edx, 0xFFFFFFFF + +; Desired +mov ebx, 0x41424344 +mov ecx, 0x51525354 + +cmpxchg8b [r15] + +; Set r14 to 1 if if the memory location was expected +setz r14b + +; edx and eax will now contain the memory's data + +; Check memory location to ensure it contains what we want +mov r13, [r15 + 8 * 0] +hlt diff --git a/unittests/ASM/Secondary/09_XX_01_3.asm b/unittests/ASM/Secondary/09_XX_01_3.asm new file mode 100644 index 000000000..f88f9fb9a --- /dev/null +++ b/unittests/ASM/Secondary/09_XX_01_3.asm @@ -0,0 +1,45 @@ +%ifdef CONFIG +{ + "RegData": { + "RAX": "0x4142434445464748", + "RDX": "0x5152535455565758", + "RBX": "0x6162636465666768", + "RCX": "0x7172737475767778", + "R12": "0x6162636465666768", + "R13": "0x7172737475767778", + "R14": "0x1" + }, + "MemoryRegions": { + "0x100000000": "4096" + } +} +%endif + +mov r15, 0xe0000000 + +mov rax, 0x4142434445464748 +mov [r15 + 8 * 0], rax +mov rax, 0x5152535455565758 +mov [r15 + 8 * 1], rax + +mov r14, 0 +; Expected +mov rax, 0x4142434445464748 +mov rdx, 0x5152535455565758 + +; Desired +mov rbx, 0x6162636465666768 +mov rcx, 0x7172737475767778 + +cmpxchg16b [r15] + +; Set r14 to 1 if if the memory location was expected +setz r14b + +; rdx and rax will now contain the memory's data + +; Check memory location to ensure it contains what we want +mov r12, [r15 + 8 * 0] +mov r13, [r15 + 8 * 1] + +hlt diff --git a/unittests/ASM/Secondary/09_XX_01_4.asm b/unittests/ASM/Secondary/09_XX_01_4.asm new file mode 100644 index 000000000..6e2b8a1e3 --- /dev/null +++ b/unittests/ASM/Secondary/09_XX_01_4.asm @@ -0,0 +1,45 @@ +%ifdef CONFIG +{ + "RegData": { + "RAX": "0x4142434445464748", + "RDX": "0x5152535455565758", + "RBX": "0x6162636465666768", + "RCX": "0x7172737475767778", + "R12": "0x4142434445464748", + "R13": "0x5152535455565758", + "R14": "0x0" + }, + "MemoryRegions": { + "0x100000000": "4096" + } +} +%endif + +mov r15, 0xe0000000 + +mov rax, 0x4142434445464748 +mov [r15 + 8 * 0], rax +mov rax, 0x5152535455565758 +mov [r15 + 8 * 1], rax + +mov r14, 0 +; Expected +mov rax, 0x41424344FFFFFFFF +mov rdx, 0x5152535455565758 + +; Desired +mov rbx, 0x6162636465666768 +mov rcx, 0x7172737475767778 + +cmpxchg16b [r15] + +; Set r14 to 1 if if the memory location was expected +setz r14b + +; rdx and rax will now contain the memory's data + +; Check memory location to ensure it contains what we want +mov r12, [r15 + 8 * 0] +mov r13, [r15 + 8 * 1] + +hlt