diff --git a/unittests/32Bit_ASM/CMakeLists.txt b/unittests/32Bit_ASM/CMakeLists.txt index 462b319d4..187a5a675 100644 --- a/unittests/32Bit_ASM/CMakeLists.txt +++ b/unittests/32Bit_ASM/CMakeLists.txt @@ -30,7 +30,7 @@ foreach(ASM_SRC ${ASM_SOURCES}) add_custom_command(OUTPUT ${TMP_FILE} DEPENDS "${ASM_SRC}" COMMAND "cp" ARGS "${ASM_SRC}" "${TMP_FILE}" - COMMAND "sed" ARGS "-i" "-e" "\'1s;^;BITS 32\\norg 10000h\\nmov eax, 0x17\\nmov ds, ax\\n;\'" "-e" "\'\$\$a\\ret\\n\'" "${TMP_FILE}" + COMMAND "sed" ARGS "-i" "-e" "\'1s;^;BITS 32\\norg 10000h\\nmov eax, 0x17\\nmov ds, ax\\nmov es, ax\\n;\'" "-e" "\'\$\$a\\ret\\n\'" "${TMP_FILE}" ) set(OUTPUT_NAME "${OUTPUT_ASM_FOLDER}/${ASM_NAME}.bin") diff --git a/unittests/32Bit_ASM/FEX_bugs/GOT_calculation.asm b/unittests/32Bit_ASM/FEX_bugs/GOT_calculation.asm index 967729bae..2feeb992a 100644 --- a/unittests/32Bit_ASM/FEX_bugs/GOT_calculation.asm +++ b/unittests/32Bit_ASM/FEX_bugs/GOT_calculation.asm @@ -1,12 +1,15 @@ %ifdef CONFIG { "RegData": { - "RAX": "0x10011" + "RAX": "0x10013" }, "Mode": "32BIT" } %endif +; Preamble (32Bit_ASM/CMakeLists.txt) sets ES and changes expectation. +; Originally 0x10011, now 0x10013. + mov esp, 0xe0000010 ; This is a common pattern in 32-bit PIE code. diff --git a/unittests/32Bit_ASM/Primary/Primary_A6.asm b/unittests/32Bit_ASM/Primary/Primary_A6.asm new file mode 100644 index 000000000..30fa8005f --- /dev/null +++ b/unittests/32Bit_ASM/Primary/Primary_A6.asm @@ -0,0 +1,40 @@ +%ifdef CONFIG +{ + "RegData": { + "RAX": "0x8300", + "RDI": "0xE0000009", + "RSI": "0xE0000001" + }, + "Mode": "32BIT" +} +%endif + +mov edx, 0xe0000000 + +mov eax, 0x47 +mov [edx + 8 * 0], eax +mov eax, 0x61 +mov [edx + 8 * 1], eax + +lea edi, [edx + 8 * 1] +lea esi, [edx + 8 * 0] + +cld +cmpsb +; cmp = 0x47 - 0x61 = 0xE6 +; 0: CF - 00000001 +; 1: - 00000010 +; 2: PF - 00000000 +; 3: 0 - 00000000 +; 4: AF - 00000000 +; 5: 0 - 00000000 +; 6: ZF - 00000000 +; 7: SF - 10000000 +; ================ +; 10000011 +; OF: LAHF doesn't load - 0 + +mov eax, 0 +lahf + +hlt diff --git a/unittests/32Bit_ASM/Primary/Primary_A6_REP.asm b/unittests/32Bit_ASM/Primary/Primary_A6_REP.asm new file mode 100644 index 000000000..2645c6122 --- /dev/null +++ b/unittests/32Bit_ASM/Primary/Primary_A6_REP.asm @@ -0,0 +1,53 @@ +%ifdef CONFIG +{ + "RegData": { + "RAX": "0x0200", + "RCX": "0x5", + "RDX": "0x0", + "RDI": "0xE0000005", + "RSI": "0xE0000015" + }, + "Mode": "32BIT" +} +%endif + +%macro copy 3 + ; Dest, Src, Size + mov edi, %1 + mov esi, %2 + mov ecx, %3 + + mov eax, 0x17 + mov es, eax + mov ds, eax + + cld + rep movsb +%endmacro + +mov edx, 0xe0000000 + +lea ebx, [edx + 8 * 0] +lea ebp, .StringOne +copy ebx, ebp, 11 + +lea ebx, [edx + 8 * 2] +lea ebp, .StringTwo +copy ebx, ebp, 14 + +lea edi, [edx + 8 * 0] +lea esi, [edx + 8 * 2] + +cld +mov ecx, 10 +repe cmpsb +mov eax, 0 +lahf + +mov edx, 0 +sete dl + +hlt + +.StringOne: db "TestString\0" +.StringTwo: db "TestUnmatched\0" diff --git a/unittests/32Bit_ASM/Primary/Primary_A6_REPNE.asm b/unittests/32Bit_ASM/Primary/Primary_A6_REPNE.asm new file mode 100644 index 000000000..3e8d7ea13 --- /dev/null +++ b/unittests/32Bit_ASM/Primary/Primary_A6_REPNE.asm @@ -0,0 +1,53 @@ +%ifdef CONFIG +{ + "RegData": { + "RAX": "0x4600", + "RCX": "0x3", + "RDX": "0x1", + "RDI": "0xE0000007", + "RSI": "0xE0000017" + }, + "Mode": "32BIT" +} +%endif + +%macro copy 3 + ; Dest, Src, Size + mov edi, %1 + mov esi, %2 + mov ecx, %3 + + mov eax, 0x17 + mov es, eax + mov ds, eax + + cld + rep movsb +%endmacro + +mov edx, 0xe0000000 + +lea ebx, [edx + 8 * 0] +lea ebp, .StringOne +copy ebx, ebp, 11 + +lea ebx, [edx + 8 * 2] +lea ebp, .StringTwo +copy ebx, ebp, 11 + +lea edi, [edx + 8 * 0] +lea esi, [edx + 8 * 2] + +cld +mov ecx, 10 +repne cmpsb +mov eax, 0 +lahf + +mov edx, 0 +sete dl + +hlt + +.StringOne: db "StringTest\0" +.StringTwo: db "UnmatcTest\0" diff --git a/unittests/32Bit_ASM/Primary/Primary_A6_REPNE_Equal.asm b/unittests/32Bit_ASM/Primary/Primary_A6_REPNE_Equal.asm new file mode 100644 index 000000000..a340d99a0 --- /dev/null +++ b/unittests/32Bit_ASM/Primary/Primary_A6_REPNE_Equal.asm @@ -0,0 +1,53 @@ +%ifdef CONFIG +{ + "RegData": { + "RAX": "0x4600", + "RCX": "0x0", + "RDX": "0x1", + "RDI": "0xE000000A", + "RSI": "0xE000001A" + }, + "Mode": "32BIT" +} +%endif + +%macro copy 3 + ; Dest, Src, Size + mov edi, %1 + mov esi, %2 + mov ecx, %3 + + mov eax, 0x17 + mov es, eax + mov ds, eax + + cld + repne movsb +%endmacro + +mov edx, 0xe0000000 + +lea ebx, [edx + 8 * 0] +lea ebp, .StringOne +copy ebx, ebp, 11 + +lea ebx, [edx + 8 * 2] +lea ebp, .StringTwo +copy ebx, ebp, 11 + +lea edi, [edx + 8 * 0] +lea esi, [edx + 8 * 2] + +cld +mov ecx, 10 +repe cmpsb +mov eax, 0 +lahf + +mov edx, 0 +sete dl + +hlt + +.StringOne: db "TestString\0" +.StringTwo: db "TestString\0" diff --git a/unittests/32Bit_ASM/Primary/Primary_A6_REP_Equal.asm b/unittests/32Bit_ASM/Primary/Primary_A6_REP_Equal.asm new file mode 100644 index 000000000..baba625c2 --- /dev/null +++ b/unittests/32Bit_ASM/Primary/Primary_A6_REP_Equal.asm @@ -0,0 +1,53 @@ +%ifdef CONFIG +{ + "RegData": { + "RAX": "0x4600", + "RCX": "0x0", + "RDX": "0x1", + "RDI": "0xE000000A", + "RSI": "0xE000001A" + }, + "Mode": "32BIT" +} +%endif + +%macro copy 3 + ; Dest, Src, Size + mov edi, %1 + mov esi, %2 + mov ecx, %3 + + mov eax, 0x17 + mov es, eax + mov ds, eax + + cld + rep movsb +%endmacro + +mov edx, 0xe0000000 + +lea ebx, [edx + 8 * 0] +lea ebp, .StringOne +copy ebx, ebp, 11 + +lea ebx, [edx + 8 * 2] +lea ebp, .StringTwo +copy ebx, ebp, 11 + +lea edi, [edx + 8 * 0] +lea esi, [edx + 8 * 2] + +cld +mov ecx, 10 +repe cmpsb +mov eax, 0 +lahf + +mov edx, 0 +sete dl + +hlt + +.StringOne: db "TestString\0" +.StringTwo: db "TestString\0" diff --git a/unittests/32Bit_ASM/Primary/Primary_A6_REP_Smaller.asm b/unittests/32Bit_ASM/Primary/Primary_A6_REP_Smaller.asm new file mode 100644 index 000000000..7e0aeba4d --- /dev/null +++ b/unittests/32Bit_ASM/Primary/Primary_A6_REP_Smaller.asm @@ -0,0 +1,53 @@ +%ifdef CONFIG +{ + "RegData": { + "RAX": "0x0600", + "RCX": "0x5", + "RDX": "0x0", + "RDI": "0xE0000005", + "RSI": "0xE0000015" + }, + "Mode": "32BIT" +} +%endif + +%macro copy 3 + ; Dest, Src, Size + mov edi, %1 + mov esi, %2 + mov ecx, %3 + + mov eax, 0x17 + mov es, eax + mov ds, eax + + cld + rep movsb +%endmacro + +mov edx, 0xe0000000 + +lea ebx, [edx + 8 * 0] +lea ebp, .StringOne +copy ebx, ebp, 11 + +lea ebx, [edx + 8 * 2] +lea ebp, .StringTwo +copy ebx, ebp, 14 + +lea edi, [edx + 8 * 0] +lea esi, [edx + 8 * 2] + +cld +mov ecx, 10 +repe cmpsb +mov eax, 0 +lahf + +mov edx, 0 +sete dl + +hlt + +.StringOne: db "TestString\0" +.StringTwo: db "Test\0" diff --git a/unittests/32Bit_ASM/Primary/Primary_A6_REP_down.asm b/unittests/32Bit_ASM/Primary/Primary_A6_REP_down.asm new file mode 100644 index 000000000..78c5a4ecc --- /dev/null +++ b/unittests/32Bit_ASM/Primary/Primary_A6_REP_down.asm @@ -0,0 +1,53 @@ +%ifdef CONFIG +{ + "RegData": { + "RAX": "0x8300", + "RCX": "0x9", + "RDX": "0x0", + "RDI": "0xE000000C", + "RSI": "0xE000001C" + }, + "Mode": "32BIT" +} +%endif + +%macro copy 3 + ; Dest, Src, Size + mov edi, %1 + mov esi, %2 + mov ecx, %3 + + mov eax, 0x17 + mov es, eax + mov ds, eax + + cld + rep movsb +%endmacro + +mov edx, 0xe0000000 + +lea ebx, [edx + 8 * 0] +lea ebp, .StringOne +copy ebx, ebp, 14 + +lea ebx, [edx + 8 * 2] +lea ebp, .StringTwo +copy ebx, ebp, 14 + +lea edi, [edx + 8 * 0 + 13] +lea esi, [edx + 8 * 2 + 13] + +std +mov ecx, 10 +repe cmpsb +mov eax, 0 +lahf + +mov edx, 0 +sete dl + +hlt + +.StringOne: db "\0\0\0\0TestString" +.StringTwo: db "\0TestUnmatched" diff --git a/unittests/32Bit_ASM/Primary/Primary_A6_REP_down_Equal.asm b/unittests/32Bit_ASM/Primary/Primary_A6_REP_down_Equal.asm new file mode 100644 index 000000000..9a3a9f3d8 --- /dev/null +++ b/unittests/32Bit_ASM/Primary/Primary_A6_REP_down_Equal.asm @@ -0,0 +1,53 @@ +%ifdef CONFIG +{ + "RegData": { + "RAX": "0x4600", + "RCX": "0x0", + "RDX": "0x1", + "RDI": "0xDFFFFFFF", + "RSI": "0xE000000F" + }, + "Mode": "32BIT" +} +%endif + +%macro copy 3 + ; Dest, Src, Size + mov edi, %1 + mov esi, %2 + mov ecx, %3 + + mov eax, 0x17 + mov es, eax + mov ds, eax + + cld + rep movsb +%endmacro + +mov edx, 0xe0000000 + +lea ebx, [edx + 8 * 0] +lea ebp, .StringOne +copy ebx, ebp, 11 + +lea ebx, [edx + 8 * 2] +lea ebp, .StringTwo +copy ebx, ebp, 11 + +lea edi, [edx + 8 * 0 + 10] +lea esi, [edx + 8 * 2 + 10] + +std +mov ecx, 11 +repe cmpsb +mov eax, 0 +lahf + +mov edx, 0 +sete dl + +hlt + +.StringOne: db "\0TestString" +.StringTwo: db "\0TestString" diff --git a/unittests/32Bit_ASM/Primary/Primary_A6_down.asm b/unittests/32Bit_ASM/Primary/Primary_A6_down.asm new file mode 100644 index 000000000..073106367 --- /dev/null +++ b/unittests/32Bit_ASM/Primary/Primary_A6_down.asm @@ -0,0 +1,40 @@ +%ifdef CONFIG +{ + "RegData": { + "RAX": "0x1200", + "RDI": "0xE0000007", + "RSI": "0xDFFFFFFF" + }, + "Mode": "32BIT" +} +%endif + +mov edx, 0xe0000000 + +mov eax, 0x61 +mov [edx + 8 * 0], eax +mov eax, 0x47 +mov [edx + 8 * 1], eax + +lea edi, [edx + 8 * 1] +lea esi, [edx + 8 * 0] + +std +cmpsb +; cmp = 0x47 - 0x61 = 0xE6 +; 0: CF - 00000001 +; 1: - 00000010 +; 2: PF - 00000000 +; 3: 0 - 00000000 +; 4: AF - 00000000 +; 5: 0 - 00000000 +; 6: ZF - 00000000 +; 7: SF - 10000000 +; ================ +; 10000011 +; OF: LAHF doesn't load - 0 + +mov eax, 0 +lahf + +hlt diff --git a/unittests/32Bit_ASM/Primary/Primary_A7_dword.asm b/unittests/32Bit_ASM/Primary/Primary_A7_dword.asm new file mode 100644 index 000000000..eed3ad414 --- /dev/null +++ b/unittests/32Bit_ASM/Primary/Primary_A7_dword.asm @@ -0,0 +1,39 @@ +%ifdef CONFIG +{ + "RegData": { + "RAX": "0x1600", + "RDI": "0xE000000C", + "RSI": "0xE0000004" + }, + "Mode": "32BIT" +} +%endif + +mov edx, 0xe0000000 + +mov eax, 0x61626364 +mov [edx + 8 * 0], eax +mov eax, 0x55565758 +mov [edx + 8 * 1], eax + +lea edi, [edx + 8 * 1] +lea esi, [edx + 8 * 0] + +cld +cmpsd +; cmp = 0x55565758 - 0x61626364 = 0xF3F3F3F4 +; 0: CF - 00000001 +; 1: - 00000010 +; 2: PF - 00000000 +; 3: 0 - 00000000 +; 4: AF - 00000000 +; 5: 0 - 00000000 +; 6: ZF - 00000000 +; 7: SF - 10000000 +; ================ +; 10000011 +; OF: LAHF doesn't load - 0 +mov eax, 0 +lahf + +hlt diff --git a/unittests/32Bit_ASM/Primary/Primary_A7_dword_down.asm b/unittests/32Bit_ASM/Primary/Primary_A7_dword_down.asm new file mode 100644 index 000000000..9404171d4 --- /dev/null +++ b/unittests/32Bit_ASM/Primary/Primary_A7_dword_down.asm @@ -0,0 +1,39 @@ +%ifdef CONFIG +{ + "RegData": { + "RAX": "0x1600", + "RDI": "0xE0000004", + "RSI": "0xDFFFFFFC" + }, + "Mode": "32BIT" +} +%endif + +mov edx, 0xe0000000 + +mov eax, 0x61626364 +mov [edx + 8 * 0], eax +mov eax, 0x55565758 +mov [edx + 8 * 1], eax + +lea edi, [edx + 8 * 1] +lea esi, [edx + 8 * 0] + +std +cmpsd +; cmp = 0x55565758 - 0x61626364 = 0xF3F3F3F4 +; 0: CF - 00000001 +; 1: - 00000010 +; 2: PF - 00000000 +; 3: 0 - 00000000 +; 4: AF - 00000000 +; 5: 0 - 00000000 +; 6: ZF - 00000000 +; 7: SF - 10000000 +; ================ +; 10000011 +; OF: LAHF doesn't load - 0 +mov eax, 0 +lahf + +hlt diff --git a/unittests/32Bit_ASM/Primary/Primary_A7_word.asm b/unittests/32Bit_ASM/Primary/Primary_A7_word.asm new file mode 100644 index 000000000..bc207eb30 --- /dev/null +++ b/unittests/32Bit_ASM/Primary/Primary_A7_word.asm @@ -0,0 +1,40 @@ +%ifdef CONFIG +{ + "RegData": { + "RAX": "0x1200", + "RDI": "0xE000000A", + "RSI": "0xE0000002" + }, + "Mode": "32BIT" +} +%endif + +mov edx, 0xe0000000 + +mov eax, 0x6162 +mov [edx + 8 * 0], eax +mov eax, 0x4546 +mov [edx + 8 * 1], eax + +lea edi, [edx + 8 * 1] +lea esi, [edx + 8 * 0] + +cld +cmpsw +; cmp = 0x4546 - 0x6162 = 0xE3E4 +; 0: CF - 00000001 +; 1: - 00000010 +; 2: PF - 00000100 +; 3: 0 - 00000000 +; 4: AF - 00000000 +; 5: 0 - 00000000 +; 6: ZF - 00000000 +; 7: SF - 10000000 +; ================ +; 10000111 +; OF: LAHF doesn't load - 0 + +mov eax, 0 +lahf + +hlt diff --git a/unittests/32Bit_ASM/Primary/Primary_A7_word_down.asm b/unittests/32Bit_ASM/Primary/Primary_A7_word_down.asm new file mode 100644 index 000000000..475f7fc39 --- /dev/null +++ b/unittests/32Bit_ASM/Primary/Primary_A7_word_down.asm @@ -0,0 +1,40 @@ +%ifdef CONFIG +{ + "RegData": { + "RAX": "0x1200", + "RDI": "0xE0000006", + "RSI": "0xDFFFFFFE" + }, + "Mode": "32BIT" +} +%endif + +mov edx, 0xe0000000 + +mov eax, 0x6162 +mov [edx + 8 * 0], eax +mov eax, 0x4546 +mov [edx + 8 * 1], eax + +lea edi, [edx + 8 * 1] +lea esi, [edx + 8 * 0] + +std +cmpsw +; cmp = 0x4546 - 0x6162 = 0xE3E4 +; 0: CF - 00000001 +; 1: - 00000010 +; 2: PF - 00000100 +; 3: 0 - 00000000 +; 4: AF - 00000000 +; 5: 0 - 00000000 +; 6: ZF - 00000000 +; 7: SF - 10000000 +; ================ +; 10000111 +; OF: LAHF doesn't load - 0 + +mov eax, 0 +lahf + +hlt diff --git a/unittests/32Bit_ASM/Primary/Primary_AE.asm b/unittests/32Bit_ASM/Primary/Primary_AE.asm new file mode 100644 index 000000000..66a6a0930 --- /dev/null +++ b/unittests/32Bit_ASM/Primary/Primary_AE.asm @@ -0,0 +1,45 @@ +%ifdef CONFIG +{ + "RegData": { + "RAX": "0x1200", + "RDI": "0xE0000001" + }, + "Mode": "32BIT" +} +%endif + +mov edx, 0xe0000000 + +mov eax, 0x45464748 +mov [edx + 8 * 0], eax +mov eax, 0x41424344 +mov [edx + 8 * 0 + 4], eax +mov eax, 0x55565758 +mov [edx + 8 * 1], eax +mov eax, 0x51525354 +mov [edx + 8 * 1 + 4], eax +mov eax, 0x0 +mov [edx + 8 * 2], eax + +lea edi, [edx + 8 * 0] + +cld +mov eax, 0x61 +scasb +; cmp = 0x61 - 0x48 = 0x19 +; 0: CF - 00000000 +; 1: - 00000010 +; 2: PF - 00000000 +; 3: 0 - 00000000 +; 4: AF - 00010000 +; 5: 0 - 00000000 +; 6: ZF - 00000000 +; 7: SF - 00000000 +; ================ +; 00010010 +; OF: LAHF doesn't load - 0 + +mov eax, 0 +lahf + +hlt diff --git a/unittests/32Bit_ASM/Primary/Primary_AE_REP.asm b/unittests/32Bit_ASM/Primary/Primary_AE_REP.asm new file mode 100644 index 000000000..9b904fbe4 --- /dev/null +++ b/unittests/32Bit_ASM/Primary/Primary_AE_REP.asm @@ -0,0 +1,33 @@ +%ifdef CONFIG +{ + "RegData": { + "RCX": "5", + "RDI": "0xE0000003" + }, + "Mode": "32BIT" +} +%endif + +mov edx, 0xe0000000 + +mov eax, 0x45466161 +mov [edx + 8 * 0], eax +mov eax, 0x41424344 +mov [edx + 8 * 0 + 4], eax +mov eax, 0x55565758 +mov [edx + 8 * 1], eax +mov eax, 0x51525354 +mov [edx + 8 * 1 + 4], eax +mov eax, 0x0 +mov [edx + 8 * 2], eax + +lea edi, [edx + 8 * 0] + +cld +mov eax, 0x61 +mov ecx, 8 +cmp eax, 0x61 + +rep scasb + +hlt diff --git a/unittests/32Bit_ASM/Primary/Primary_AE_REPNE.asm b/unittests/32Bit_ASM/Primary/Primary_AE_REPNE.asm new file mode 100644 index 000000000..1d90c464a --- /dev/null +++ b/unittests/32Bit_ASM/Primary/Primary_AE_REPNE.asm @@ -0,0 +1,33 @@ +%ifdef CONFIG +{ + "RegData": { + "RCX": "1", + "RDI": "0xE0000007" + }, + "Mode": "32BIT" +} +%endif + +mov edx, 0xe0000000 + +mov eax, 0x45464748 +mov [edx + 8 * 0], eax +mov eax, 0x41614344 +mov [edx + 8 * 0 + 4], eax +mov eax, 0x55565758 +mov [edx + 8 * 1], eax +mov eax, 0x51525354 +mov [edx + 8 * 1 + 4], eax +mov eax, 0x0 +mov [edx + 8 * 2], eax + +lea edi, [edx + 8 * 0] + +cld +mov eax, 0x61 +mov ecx, 8 +cmp eax, 0 + +repne scasb + +hlt diff --git a/unittests/32Bit_ASM/Primary/Primary_AE_REPNE_down.asm b/unittests/32Bit_ASM/Primary/Primary_AE_REPNE_down.asm new file mode 100644 index 000000000..df998c736 --- /dev/null +++ b/unittests/32Bit_ASM/Primary/Primary_AE_REPNE_down.asm @@ -0,0 +1,33 @@ +%ifdef CONFIG +{ + "RegData": { + "RCX": "5", + "RDI": "0xE000000D" + }, + "Mode": "32BIT" +} +%endif + +mov edx, 0xe0000000 + +mov eax, 0x45464748 +mov [edx + 8 * 0], eax +mov eax, 0x41424344 +mov [edx + 8 * 0 + 4], eax +mov eax, 0x55565758 +mov [edx + 8 * 1], eax +mov eax, 0x51615354 +mov [edx + 8 * 1 + 4], eax +mov eax, 0x0 +mov [edx + 8 * 2], eax + +lea edi, [edx + 8 * 2] + +std +mov eax, 0x61 +mov ecx, 8 +cmp eax, 0 + +repne scasb + +hlt diff --git a/unittests/32Bit_ASM/Primary/Primary_AE_REP_down.asm b/unittests/32Bit_ASM/Primary/Primary_AE_REP_down.asm new file mode 100644 index 000000000..2eb2bb612 --- /dev/null +++ b/unittests/32Bit_ASM/Primary/Primary_AE_REP_down.asm @@ -0,0 +1,33 @@ +%ifdef CONFIG +{ + "RegData": { + "RCX": "7", + "RDI": "0xE000000F" + }, + "Mode": "32BIT" +} +%endif + +mov edx, 0xe0000000 + +mov eax, 0x45466161 +mov [edx + 8 * 0], eax +mov eax, 0x41424344 +mov [edx + 8 * 0 + 4], eax +mov eax, 0x55565758 +mov [edx + 8 * 1], eax +mov eax, 0x51525354 +mov [edx + 8 * 1 + 4], eax +mov eax, 0x0 +mov [edx + 8 * 2], eax + +lea edi, [edx + 8 * 2] + +std +mov eax, 0x61 +mov ecx, 8 +cmp eax, 0x61 + +rep scasb + +hlt diff --git a/unittests/32Bit_ASM/Primary/Primary_AF_REP_dword.asm b/unittests/32Bit_ASM/Primary/Primary_AF_REP_dword.asm new file mode 100644 index 000000000..4792623f5 --- /dev/null +++ b/unittests/32Bit_ASM/Primary/Primary_AF_REP_dword.asm @@ -0,0 +1,33 @@ +%ifdef CONFIG +{ + "RegData": { + "RCX": "6", + "RDI": "0xE0000008" + }, + "Mode": "32BIT" +} +%endif + +mov edx, 0xe0000000 + +mov eax, 0x61626364 +mov [edx + 8 * 0], eax +mov eax, 0x41424344 +mov [edx + 8 * 0 + 4], eax +mov eax, 0x55565758 +mov [edx + 8 * 1], eax +mov eax, 0x51525354 +mov [edx + 8 * 1 + 4], eax +mov eax, 0x0 +mov [edx + 8 * 2], eax + +lea edi, [edx + 8 * 0] + +cld +mov eax, 0x61626364 +mov ecx, 8 +cmp eax, 0x61626364 + +rep scasd + +hlt diff --git a/unittests/32Bit_ASM/Primary/Primary_AF_REP_word.asm b/unittests/32Bit_ASM/Primary/Primary_AF_REP_word.asm new file mode 100644 index 000000000..b473a9ed5 --- /dev/null +++ b/unittests/32Bit_ASM/Primary/Primary_AF_REP_word.asm @@ -0,0 +1,33 @@ +%ifdef CONFIG +{ + "RegData": { + "RCX": "6", + "RDI": "0xE0000004" + }, + "Mode": "32BIT" +} +%endif + +mov edx, 0xe0000000 + +mov eax, 0x45466162 +mov [edx + 8 * 0], eax +mov eax, 0x41424344 +mov [edx + 8 * 0 + 4], eax +mov eax, 0x55565758 +mov [edx + 8 * 1], eax +mov eax, 0x51525354 +mov [edx + 8 * 1 + 4], eax +mov eax, 0x0 +mov [edx + 8 * 2], eax + +lea edi, [edx + 8 * 0] + +cld +mov eax, 0x6162 +mov ecx, 8 +cmp eax, 0x6162 + +rep scasw + +hlt