-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[win/asan] Populate test for function GetInstructionSize. #118204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-compiler-rt-sanitizer Author: None (bernhardu) ChangesThis puts the content of GetInstructionSize into a test. Full diff: https://github.com/llvm/llvm-project/pull/118204.diff 1 Files Affected:
diff --git a/compiler-rt/lib/interception/tests/interception_win_test.cpp b/compiler-rt/lib/interception/tests/interception_win_test.cpp
index cfa1b592f1e466..dd66dc0aa77d98 100644
--- a/compiler-rt/lib/interception/tests/interception_win_test.cpp
+++ b/compiler-rt/lib/interception/tests/interception_win_test.cpp
@@ -801,11 +801,217 @@ const struct InstructionSizeData {
size_t size; // hold instruction size or 0 for failure,
// e.g. on control instructions
u8 instr[16];
- size_t rel_offset;
+ size_t rel_offset; // filled just for instructions with two operands
+ // and displacement length of four bytes.
const char *comment;
} data[] = {
- /* sorted list */
- {1, {0x50}, 0, "50 : push eax / rax"},
+ // clang-format off
+ // sorted list
+ { 0, {0x70, 0x71}, 0, "70 XX : jo XX (short conditional jump)"},
+ { 0, {0x71, 0x71}, 0, "71 XX : jno XX (short conditional jump)"},
+ { 0, {0x72, 0x71}, 0, "72 XX : jb XX (short conditional jump)"},
+ { 0, {0x73, 0x71}, 0, "73 XX : jae XX (short conditional jump)"},
+ { 0, {0x74, 0x71}, 0, "74 XX : je XX (short conditional jump)"},
+ { 0, {0x75, 0x71}, 0, "75 XX : jne XX (short conditional jump)"},
+ { 0, {0x76, 0x71}, 0, "76 XX : jbe XX (short conditional jump)"},
+ { 0, {0x77, 0x71}, 0, "77 XX : ja XX (short conditional jump)"},
+ { 0, {0x78, 0x71}, 0, "78 XX : js XX (short conditional jump)"},
+ { 0, {0x79, 0x71}, 0, "79 XX : jns XX (short conditional jump)"},
+ { 0, {0x7A, 0x71}, 0, "7A XX : jp XX (short conditional jump)"},
+ { 0, {0x7B, 0x71}, 0, "7B XX : jnp XX (short conditional jump)"},
+ { 0, {0x7C, 0x71}, 0, "7C XX : jl XX (short conditional jump)"},
+ { 0, {0x7D, 0x71}, 0, "7D XX : jge XX (short conditional jump)"},
+ { 0, {0x7E, 0x71}, 0, "7E XX : jle XX (short conditional jump)"},
+ { 0, {0x7F, 0x71}, 0, "7F XX : jg XX (short conditional jump)"},
+ { 0, {0xE8, 0x71, 0x72, 0x73, 0x74}, 0, "E8 XX XX XX XX : call <func>"},
+ { 0, {0xE9, 0x71, 0x72, 0x73, 0x74}, 0, "E9 XX XX XX XX : jmp <label>"},
+ { 0, {0xEB, 0x71}, 0, "EB XX : jmp XX (short jump)"},
+ { 0, {0xFF, 0x25, 0x72, 0x73, 0x74, 0x75}, 0, "FF 25 XX YY ZZ WW : jmp dword ptr ds:[WWZZYYXX]"},
+ { 1, {0x50}, 0, "50 : push eax / rax"},
+ { 1, {0x51}, 0, "51 : push ecx / rcx"},
+ { 1, {0x52}, 0, "52 : push edx / rdx"},
+ { 1, {0x53}, 0, "53 : push ebx / rbx"},
+ { 1, {0x54}, 0, "54 : push esp / rsp"},
+ { 1, {0x55}, 0, "55 : push ebp / rbp"},
+ { 1, {0x56}, 0, "56 : push esi / rsi"},
+ { 1, {0x57}, 0, "57 : push edi / rdi"},
+ { 1, {0x5D}, 0, "5D : pop ebp / rbp"},
+ { 1, {0x90}, 0, "90 : nop"},
+ { 1, {0xC3}, 0, "C3 : ret (for small/empty function interception"},
+ { 1, {0xCC}, 0, "CC : int 3 i.e. registering weak functions)"},
+ { 2, {0x33, 0xC0}, 0, "33 C0 : xor eax, eax"},
+ { 2, {0x33, 0xC9}, 0, "33 C9 : xor ecx, ecx"},
+ { 2, {0x33, 0xD2}, 0, "33 D2 : xor edx, edx"},
+ { 2, {0x6A, 0x71}, 0, "6A XX : push XX"},
+ { 2, {0x84, 0xC9}, 0, "84 C9 : test cl,cl"},
+ { 2, {0x84, 0xD2}, 0, "84 D2 : test dl,dl"},
+ { 2, {0x84, 0xDB}, 0, "84 DB : test bl,bl"},
+ { 2, {0x89, 0xE5}, 0, "89 E5 : mov ebp, esp"},
+ { 2, {0x89, 0xc8}, 0, "89 C8 : mov eax, ecx"},
+ { 2, {0x8A, 0x01}, 0, "8A 01 : mov al, byte ptr [ecx]"},
+ { 2, {0x8B, 0xC1}, 0, "8B C1 : mov eax, ecx"},
+ { 2, {0x8B, 0xEC}, 0, "8B EC : mov ebp, esp"},
+ { 2, {0x8B, 0xFF}, 0, "8B FF : mov edi, edi"},
+ { 3, {0xc2, 0x71, 0x72}, 0, "C2 XX XX : ret XX (needed for registering weak functions)"},
+ { 5, {0x68, 0x71, 0x72, 0x73, 0x74}, 0, "68 XX XX XX XX : push imm32"},
+ { 5, {0xB9, 0x71, 0x72, 0x73, 0x74}, 0, "b9 XX XX XX XX : mov ecx, XX XX XX XX"},
+ { 5, {0xb8, 0x71, 0x72, 0x73, 0x74}, 0, "b8 XX XX XX XX : mov eax, XX XX XX XX"},
+#if SANITIZER_WINDOWS_x64
+ // sorted list
+ { 2, {0x40, 0x50}, 0, "40 50 : push rax"},
+ { 2, {0x40, 0x51}, 0, "40 51 : push rcx"},
+ { 2, {0x40, 0x52}, 0, "40 52 : push rdx"},
+ { 2, {0x40, 0x53}, 0, "40 53 : push rbx"},
+ { 2, {0x40, 0x54}, 0, "40 54 : push rsp"},
+ { 2, {0x40, 0x55}, 0, "40 55 : push rbp"},
+ { 2, {0x40, 0x56}, 0, "40 56 : push rsi"},
+ { 2, {0x40, 0x57}, 0, "40 57 : push rdi"},
+ { 2, {0x41, 0x54}, 0, "41 54 : push r12"},
+ { 2, {0x41, 0x55}, 0, "41 55 : push r13"},
+ { 2, {0x41, 0x56}, 0, "41 56 : push r14"},
+ { 2, {0x41, 0x57}, 0, "41 57 : push r15"},
+ { 2, {0x66, 0x90}, 0, "66 90 : Two-byte NOP"},
+ { 2, {0x84, 0xc0}, 0, "84 c0 : test al, al"},
+ { 2, {0x8a, 0x01}, 0, "8a 01 : mov al, byte ptr [rcx]"},
+ { 3, {0x0f, 0xb6, 0xc2}, 0, "0f b6 c2 : movzx eax, dl"},
+ { 3, {0x0f, 0xb6, 0xd2}, 0, "0f b6 d2 : movzx edx, dl"},
+ { 3, {0x0f, 0xb7, 0x10}, 0, "0f b7 10 : movzx edx, WORD PTR [rax]"},
+ { 3, {0x41, 0x8b, 0xc0}, 0, "41 8b c0 : mov eax, r8d"},
+ { 3, {0x41, 0x8b, 0xc1}, 0, "41 8b c1 : mov eax, r9d"},
+ { 3, {0x41, 0x8b, 0xc2}, 0, "41 8b c2 : mov eax, r10d"},
+ { 3, {0x41, 0x8b, 0xc3}, 0, "41 8b c3 : mov eax, r11d"},
+ { 3, {0x41, 0x8b, 0xc4}, 0, "41 8b c4 : mov eax, r12d"},
+ { 3, {0x45, 0x33, 0xc0}, 0, "45 33 c0 : xor r8d, r8d"},
+ { 3, {0x45, 0x33, 0xc9}, 0, "45 33 c9 : xor r9d, r9d"},
+ { 3, {0x45, 0x33, 0xdb}, 0, "45 33 db : xor r11d, r11d"},
+ { 3, {0x48, 0x2b, 0xca}, 0, "48 2b ca : sub rcx, rdx"},
+ { 3, {0x48, 0x2b, 0xd1}, 0, "48 2b d1 : sub rdx, rcx"},
+ { 3, {0x48, 0x3b, 0xca}, 0, "48 3b ca : cmp rcx, rdx"},
+ { 3, {0x48, 0x85, 0xc0}, 0, "48 85 c0 : test rax, rax"},
+ { 3, {0x48, 0x85, 0xc9}, 0, "48 85 c9 : test rcx, rcx"},
+ { 3, {0x48, 0x85, 0xd2}, 0, "48 85 d2 : test rdx, rdx"},
+ { 3, {0x48, 0x85, 0xdb}, 0, "48 85 db : test rbx, rbx"},
+ { 3, {0x48, 0x85, 0xe4}, 0, "48 85 e4 : test rsp, rsp"},
+ { 3, {0x48, 0x85, 0xed}, 0, "48 85 ed : test rbp, rbp"},
+ { 3, {0x48, 0x89, 0xe5}, 0, "48 89 e5 : mov rbp, rsp"},
+ { 3, {0x48, 0x8b, 0xc1}, 0, "48 8b c1 : mov rax, rcx"},
+ { 3, {0x48, 0x8b, 0xc4}, 0, "48 8b c4 : mov rax, rsp"},
+ { 3, {0x48, 0x8b, 0xd1}, 0, "48 8b d1 : mov rdx, rcx"},
+ { 3, {0x48, 0xf7, 0xd9}, 0, "48 f7 d9 : neg rcx"},
+ { 3, {0x48, 0xff, 0xc0}, 0, "48 ff c0 : inc rax"},
+ { 3, {0x48, 0xff, 0xc1}, 0, "48 ff c1 : inc rcx"},
+ { 3, {0x48, 0xff, 0xc2}, 0, "48 ff c2 : inc rdx"},
+ { 3, {0x48, 0xff, 0xc3}, 0, "48 ff c3 : inc rbx"},
+ { 3, {0x48, 0xff, 0xc6}, 0, "48 ff c6 : inc rsi"},
+ { 3, {0x48, 0xff, 0xc7}, 0, "48 ff c7 : inc rdi"},
+ { 3, {0x49, 0xff, 0xc0}, 0, "49 ff c0 : inc r8"},
+ { 3, {0x49, 0xff, 0xc1}, 0, "49 ff c1 : inc r9"},
+ { 3, {0x49, 0xff, 0xc2}, 0, "49 ff c2 : inc r10"},
+ { 3, {0x49, 0xff, 0xc3}, 0, "49 ff c3 : inc r11"},
+ { 3, {0x49, 0xff, 0xc4}, 0, "49 ff c4 : inc r12"},
+ { 3, {0x49, 0xff, 0xc5}, 0, "49 ff c5 : inc r13"},
+ { 3, {0x49, 0xff, 0xc6}, 0, "49 ff c6 : inc r14"},
+ { 3, {0x49, 0xff, 0xc7}, 0, "49 ff c7 : inc r15"},
+ { 3, {0x4c, 0x8b, 0xc1}, 0, "4c 8b c1 : mov r8, rcx"},
+ { 3, {0x4c, 0x8b, 0xc9}, 0, "4c 8b c9 : mov r9, rcx"},
+ { 3, {0x4c, 0x8b, 0xd1}, 0, "4c 8b d1 : mov r10, rcx"},
+ { 3, {0x4c, 0x8b, 0xd2}, 0, "4c 8b d2 : mov r10, rdx"},
+ { 3, {0x4c, 0x8b, 0xd9}, 0, "4c 8b d9 : mov r11, rcx"},
+ { 3, {0x4c, 0x8b, 0xdc}, 0, "4c 8b dc : mov r11, rsp"},
+ { 3, {0x4d, 0x0b, 0xc0}, 0, "4d 0b c0 : or r8, r8"},
+ { 3, {0x4d, 0x85, 0xc0}, 0, "4d 85 c0 : test r8, r8"},
+ { 3, {0x4d, 0x85, 0xc9}, 0, "4d 85 c9 : test r9, r9"},
+ { 3, {0x4d, 0x85, 0xd2}, 0, "4d 85 d2 : test r10, r10"},
+ { 3, {0x4d, 0x85, 0xdb}, 0, "4d 85 db : test r11, r11"},
+ { 3, {0x4d, 0x85, 0xe4}, 0, "4d 85 e4 : test r12, r12"},
+ { 3, {0x4d, 0x85, 0xed}, 0, "4d 85 ed : test r13, r13"},
+ { 3, {0x4d, 0x85, 0xf6}, 0, "4d 85 f6 : test r14, r14"},
+ { 3, {0x4d, 0x85, 0xff}, 0, "4d 85 ff : test r15, r15"},
+ { 4, {0x44, 0x0f, 0xb6, 0x1a}, 0, "44 0f b6 1a : movzx r11d, BYTE PTR [rdx]"},
+ { 4, {0x44, 0x8d, 0x42, 0x73}, 0, "44 8d 42 XX : lea r8d , [rdx + XX]"},
+ { 4, {0x48, 0x83, 0xec, 0x73}, 0, "48 83 ec XX : sub rsp, XX"},
+ { 4, {0x48, 0x89, 0x58, 0x73}, 0, "48 89 58 XX : mov QWORD PTR[rax + XX], rbx"},
+ { 4, {0x49, 0x83, 0xf8, 0x73}, 0, "49 83 f8 XX : cmp r8, XX"},
+ { 4, {0x80, 0x78, 0x72, 0x73}, 0, "80 78 YY XX : cmp BYTE PTR [rax+YY], XX"},
+ { 4, {0x80, 0x79, 0x72, 0x73}, 0, "80 79 YY XX : cmp BYTE ptr [rcx+YY], XX"},
+ { 4, {0x80, 0x7A, 0x72, 0x73}, 0, "80 7A YY XX : cmp BYTE PTR [rdx+YY], XX"},
+ { 4, {0x80, 0x7B, 0x72, 0x73}, 0, "80 7B YY XX : cmp BYTE PTR [rbx+YY], XX"},
+ { 4, {0x80, 0x7D, 0x72, 0x73}, 0, "80 7D YY XX : cmp BYTE PTR [rbp+YY], XX"},
+ { 4, {0x80, 0x7E, 0x72, 0x73}, 0, "80 7E YY XX : cmp BYTE PTR [rsi+YY], XX"},
+ { 4, {0x89, 0x54, 0x24, 0x73}, 0, "89 54 24 XX : mov DWORD PTR[rsp + XX], edx"},
+ { 5, {0x44, 0x89, 0x44, 0x24, 0x74}, 0, "44 89 44 24 XX : mov DWORD PTR [rsp + XX], r8d"},
+ { 5, {0x44, 0x89, 0x4c, 0x24, 0x74}, 0, "44 89 4c 24 XX : mov DWORD PTR [rsp + XX], r9d"},
+ { 5, {0x48, 0x89, 0x4C, 0x24, 0x74}, 0, "48 89 4C 24 XX : mov QWORD PTR [rsp + XX], rcx"},
+ { 5, {0x48, 0x89, 0x54, 0x24, 0x74}, 0, "48 89 54 24 XX : mov QWORD PTR [rsp + XX], rdx"},
+ { 5, {0x48, 0x89, 0x5c, 0x24, 0x74}, 0, "48 89 5c 24 XX : mov QWORD PTR [rsp + XX], rbx"},
+ { 5, {0x48, 0x89, 0x6c, 0x24, 0x74}, 0, "48 89 6C 24 XX : mov QWORD ptr [rsp + XX], rbp"},
+ { 5, {0x48, 0x89, 0x74, 0x24, 0x74}, 0, "48 89 74 24 XX : mov QWORD PTR [rsp + XX], rsi"},
+ { 5, {0x48, 0x89, 0x7c, 0x24, 0x74}, 0, "48 89 7c 24 XX : mov QWORD PTR [rsp + XX], rdi"},
+ { 5, {0x48, 0x8b, 0x44, 0x24, 0x74}, 0, "48 8b 44 24 XX : mov rax, QWORD ptr [rsp + XX]"},
+ { 5, {0x48, 0x8d, 0x6c, 0x24, 0x74}, 0, "48 8d 6c 24 XX : lea rbp, [rsp + XX]"},
+ { 5, {0x4c, 0x89, 0x44, 0x24, 0x74}, 0, "4c 89 44 24 XX : mov QWORD PTR [rsp + XX], r8"},
+ { 5, {0x4c, 0x89, 0x4c, 0x24, 0x74}, 0, "4c 89 4c 24 XX : mov QWORD PTR [rsp + XX], r9"},
+ { 5, {0x83, 0x44, 0x72, 0x73, 0x74}, 0, "83 44 72 XX YY : add DWORD PTR [rdx+rsi*2+XX],YY"},
+ { 5, {0x83, 0x64, 0x24, 0x73, 0x74}, 0, "83 64 24 XX YY : and DWORD PTR [rsp+XX], YY"},
+ { 6, {0x48, 0x83, 0x64, 0x24, 0x74, 0x75}, 0, "48 83 64 24 XX YY : and QWORD PTR [rsp + XX], YY"},
+ { 6, {0x66, 0x81, 0x78, 0x73, 0x74, 0x75}, 0, "66 81 78 XX YY YY : cmp WORD PTR [rax+XX], YY YY"},
+ { 6, {0x66, 0x81, 0x79, 0x73, 0x74, 0x75}, 0, "66 81 79 XX YY YY : cmp WORD PTR [rcx+XX], YY YY"},
+ { 6, {0x66, 0x81, 0x7a, 0x73, 0x74, 0x75}, 0, "66 81 7a XX YY YY : cmp WORD PTR [rdx+XX], YY YY"},
+ { 6, {0x66, 0x81, 0x7b, 0x73, 0x74, 0x75}, 0, "66 81 7b XX YY YY : cmp WORD PTR [rbx+XX], YY YY"},
+ { 6, {0x66, 0x81, 0x7e, 0x73, 0x74, 0x75}, 0, "66 81 7e XX YY YY : cmp WORD PTR [rsi+XX], YY YY"},
+ { 6, {0x66, 0x81, 0x7f, 0x73, 0x74, 0x75}, 0, "66 81 7f XX YY YY : cmp WORD PTR [rdi+XX], YY YY"},
+ { 6, {0x8A, 0x05, 0x72, 0x73, 0x74, 0x75}, 2, "8A 05 XX XX XX XX : mov al, byte ptr [XX XX XX XX]"},
+ { 6, {0x8B, 0x05, 0x72, 0x73, 0x74, 0x75}, 2, "8B 05 XX XX XX XX : mov eax, dword ptr [XX XX XX XX]"},
+ { 6, {0xF2, 0x0f, 0x11, 0x44, 0x24, 0x75}, 0, "f2 0f 11 44 24 XX : movsd QWORD PTR [rsp + XX], xmm0"},
+ { 6, {0xF2, 0x0f, 0x11, 0x4c, 0x24, 0x75}, 0, "f2 0f 11 4c 24 XX : movsd QWORD PTR [rsp + XX], xmm1"},
+ { 6, {0xF2, 0x0f, 0x11, 0x54, 0x24, 0x75}, 0, "f2 0f 11 54 24 XX : movsd QWORD PTR [rsp + XX], xmm2"},
+ { 6, {0xF2, 0x0f, 0x11, 0x5c, 0x24, 0x75}, 0, "f2 0f 11 5c 24 XX : movsd QWORD PTR [rsp + XX], xmm3"},
+ { 6, {0xF2, 0x0f, 0x11, 0x64, 0x24, 0x75}, 0, "f2 0f 11 64 24 XX : movsd QWORD PTR [rsp + XX], xmm4"},
+ { 7, {0x48, 0x81, 0xec, 0x73, 0x74, 0x75, 0x76}, 0, "48 81 EC XX XX XX XX : sub rsp, XXXXXXXX"},
+ { 7, {0x48, 0x89, 0x0d, 0x73, 0x74, 0x75, 0x76}, 3, "48 89 0d XX XX XX XX : mov QWORD PTR [rip + XXXXXXXX], rcx"},
+ { 7, {0x48, 0x89, 0x15, 0x73, 0x74, 0x75, 0x76}, 3, "48 89 15 XX XX XX XX : mov QWORD PTR [rip + XXXXXXXX], rdx"},
+ { 7, {0x48, 0x8b, 0x05, 0x73, 0x74, 0x75, 0x76}, 3, "48 8b 05 XX XX XX XX : mov rax, QWORD PTR [rip + XXXXXXXX]"},
+ { 7, {0x48, 0x8d, 0x05, 0x73, 0x74, 0x75, 0x76}, 3, "48 8d 05 XX XX XX XX : lea rax, QWORD PTR [rip + XXXXXXXX]"},
+ { 7, {0x48, 0xff, 0x25, 0x73, 0x74, 0x75, 0x76}, 3, "48 ff 25 XX XX XX XX : rex.W jmp QWORD PTR [rip + XXXXXXXX]"},
+ { 7, {0x4C, 0x8D, 0x15, 0x73, 0x74, 0x75, 0x76}, 3, "4c 8d 15 XX XX XX XX : lea r10, [rip + XX]"},
+ { 7, {0x81, 0x78, 0x72, 0x73, 0x74, 0x75, 0x76}, 0, "81 78 YY XX XX XX XX : cmp DWORD PTR [rax+YY], XX XX XX XX"},
+ { 7, {0x81, 0x79, 0x72, 0x73, 0x74, 0x75, 0x76}, 0, "81 79 YY XX XX XX XX : cmp dword ptr [rcx+YY], XX XX XX XX"},
+ { 7, {0x81, 0x7A, 0x72, 0x73, 0x74, 0x75, 0x76}, 0, "81 7A YY XX XX XX XX : cmp DWORD PTR [rdx+YY], XX XX XX XX"},
+ { 7, {0x81, 0x7B, 0x72, 0x73, 0x74, 0x75, 0x76}, 0, "81 7B YY XX XX XX XX : cmp DWORD PTR [rbx+YY], XX XX XX XX"},
+ { 7, {0x81, 0x7D, 0x72, 0x73, 0x74, 0x75, 0x76}, 0, "81 7D YY XX XX XX XX : cmp DWORD PTR [rbp+YY], XX XX XX XX"},
+ { 7, {0x81, 0x7E, 0x72, 0x73, 0x74, 0x75, 0x76}, 0, "81 7E YY XX XX XX XX : cmp DWORD PTR [rsi+YY], XX XX XX XX"},
+ { 8, {0x41, 0x81, 0x78, 0x73, 0x74, 0x75, 0x76, 0x77}, 0, "41 81 78 XX YY YY YY YY : cmp DWORD PTR [r8+YY], XX XX XX XX"},
+ { 8, {0x41, 0x81, 0x79, 0x73, 0x74, 0x75, 0x76, 0x77}, 0, "41 81 79 XX YY YY YY YY : cmp DWORD PTR [r9+YY], XX XX XX XX"},
+ { 8, {0x41, 0x81, 0x7a, 0x73, 0x74, 0x75, 0x76, 0x77}, 0, "41 81 7a XX YY YY YY YY : cmp DWORD PTR [r10+YY], XX XX XX XX"},
+ { 8, {0x41, 0x81, 0x7b, 0x73, 0x74, 0x75, 0x76, 0x77}, 0, "41 81 7b XX YY YY YY YY : cmp DWORD PTR [r11+YY], XX XX XX XX"},
+ { 8, {0x41, 0x81, 0x7d, 0x73, 0x74, 0x75, 0x76, 0x77}, 0, "41 81 7d XX YY YY YY YY : cmp DWORD PTR [r13+YY], XX XX XX XX"},
+ { 8, {0x41, 0x81, 0x7e, 0x73, 0x74, 0x75, 0x76, 0x77}, 0, "41 81 7e XX YY YY YY YY : cmp DWORD PTR [r14+YY], XX XX XX XX"},
+ { 8, {0x41, 0x81, 0x7f, 0x73, 0x74, 0x75, 0x76, 0x77}, 0, "41 81 7f YY XX XX XX XX : cmp DWORD PTR [r15+YY], XX XX XX XX"},
+ { 8, {0x81, 0x7c, 0x24, 0x73, 0x74, 0x75, 0x76, 0x77}, 0, "81 7c 24 YY XX XX XX XX : cmp DWORD PTR [rsp+YY], XX XX XX XX"},
+ { 8, {0xc7, 0x44, 0x24, 0x73, 0x74, 0x75, 0x76, 0x77}, 0, "C7 44 24 XX YY YY YY YY : mov dword ptr [rsp + XX], YYYYYYYY"},
+ { 9, {0xA1, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78}, 0, "A1 XX XX XX XX XX XX XX XX : movabs eax, dword ptr ds:[XXXXXXXX]"},
+#else
+ // sorted list
+ { 3, {0x8B, 0x45, 0x72}, 0, "8B 45 XX : mov eax, dword ptr [ebp + XX]"},
+ { 3, {0x8B, 0x5D, 0x72}, 0, "8B 5D XX : mov ebx, dword ptr [ebp + XX]"},
+ { 3, {0x8B, 0x75, 0x72}, 0, "8B 75 XX : mov esi, dword ptr [ebp + XX]"},
+ { 3, {0x8B, 0x7D, 0x72}, 0, "8B 7D XX : mov edi, dword ptr [ebp + XX]"},
+ { 3, {0xFF, 0x75, 0x72}, 0, "FF 75 XX : push dword ptr [ebp + XX]"},
+ { 4, {0x83, 0x7D, 0x72, 0x73}, 0, "83 7D XX YY : cmp dword ptr [ebp + XX], YY"},
+ { 4, {0x8A, 0x44, 0x24, 0x73}, 0, "8A 44 24 XX : mov eal, dword ptr [esp + XX]"},
+ { 4, {0x8B, 0x44, 0x24, 0x73}, 0, "8B 44 24 XX : mov eax, dword ptr [esp + XX]"},
+ { 4, {0x8B, 0x4C, 0x24, 0x73}, 0, "8B 4C 24 XX : mov ecx, dword ptr [esp + XX]"},
+ { 4, {0x8B, 0x54, 0x24, 0x73}, 0, "8B 54 24 XX : mov edx, dword ptr [esp + XX]"},
+ { 4, {0x8B, 0x5C, 0x24, 0x73}, 0, "8B 5C 24 XX : mov ebx, dword ptr [esp + XX]"},
+ { 4, {0x8B, 0x6C, 0x24, 0x73}, 0, "8B 6C 24 XX : mov ebp, dword ptr [esp + XX]"},
+ { 4, {0x8B, 0x74, 0x24, 0x73}, 0, "8B 74 24 XX : mov esi, dword ptr [esp + XX]"},
+ { 4, {0x8B, 0x7C, 0x24, 0x73}, 0, "8B 7C 24 XX : mov edi, dword ptr [esp + XX]"},
+ { 5, {0x0F, 0xB6, 0x44, 0x24, 0x74}, 0, "0F B6 44 24 XX : movzx eax, byte ptr [esp + XX]"},
+ { 5, {0xA1, 0x71, 0x72, 0x73, 0x74}, 0, "A1 XX XX XX XX : mov eax, dword ptr ds:[XXXXXXXX]"},
+ { 6, {0xF7, 0xC1, 0x72, 0x73, 0x74, 0x75}, 0, "F7 C1 XX YY ZZ WW : test ecx, WWZZYYXX"},
+ { 7, {0x83, 0x3D, 0x72, 0x73, 0x74, 0x75, 0x76}, 0, "83 3D XX YY ZZ WW TT : cmp TT, WWZZYYXX"},
+#endif
+ // clang-format on
};
std::string dumpInstruction(unsigned arrayIndex,
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
cc5d5c1
to
81344e2
Compare
Sorry for the force push again - no functional change, it just fixes case insensitive sorting of the test cases. |
Still lgtm. Should I push the "Squash and merge" button, or is it available for you now? |
This puts the content of GetInstructionSize into a test.
There are 5 cases missing, which I have already or would like to propose a fix later.