Skip to content

Commit 854ea0c

Browse files
authored
[win/asan] GetInstructionSize: Make 83 EC XX a generic entry. (#119537)
This consolidates the two different lines for x86 and x86_64 into a single line for both architectures. And adds a test line. CC: @zmodem
1 parent b1d8c60 commit 854ea0c

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

compiler-rt/lib/interception/interception_win.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,7 @@ static size_t GetInstructionSize(uptr address, size_t* rel_offset = nullptr) {
634634
case 0xD284: // 84 D2 : test dl,dl
635635
return 2;
636636

637+
case 0xEC83: // 83 EC XX : sub esp, XX
637638
case 0xC1F6: // F6 C1 XX : test cl, XX
638639
return 3;
639640

@@ -644,8 +645,6 @@ static size_t GetInstructionSize(uptr address, size_t* rel_offset = nullptr) {
644645

645646
switch (0x00FFFFFF & *(u32*)address) {
646647
case 0xF8E483: // 83 E4 F8 : and esp, 0xFFFFFFF8
647-
case 0x64EC83: // 83 EC 64 : sub esp, 64h
648-
return 3;
649648
case 0x24A48D: // 8D A4 24 XX XX XX XX : lea esp, [esp + XX XX XX XX]
650649
return 7;
651650
}
@@ -873,7 +872,6 @@ static size_t GetInstructionSize(uptr address, size_t* rel_offset = nullptr) {
873872
case 0x5D8B: // 8B 5D XX : mov ebx, dword ptr [ebp + XX]
874873
case 0x7D8B: // 8B 7D XX : mov edi, dword ptr [ebp + XX]
875874
case 0x758B: // 8B 75 XX : mov esi, dword ptr [ebp + XX]
876-
case 0xEC83: // 83 EC XX : sub esp, XX
877875
case 0x75FF: // FF 75 XX : push dword ptr [ebp + XX]
878876
return 3;
879877
case 0xC1F7: // F7 C1 XX YY ZZ WW : test ecx, WWZZYYXX

compiler-rt/lib/interception/tests/interception_win_test.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -852,6 +852,7 @@ const struct InstructionSizeData {
852852
{ 2, {0x8B, 0xC1}, 0, "8B C1 : mov eax, ecx"},
853853
{ 2, {0x8B, 0xEC}, 0, "8B EC : mov ebp, esp"},
854854
{ 2, {0x8B, 0xFF}, 0, "8B FF : mov edi, edi"},
855+
{ 3, {0x83, 0xEC, 0x72}, 0, "83 EC XX : sub esp, XX"},
855856
{ 3, {0xc2, 0x71, 0x72}, 0, "C2 XX XX : ret XX (needed for registering weak functions)"},
856857
{ 5, {0x68, 0x71, 0x72, 0x73, 0x74}, 0, "68 XX XX XX XX : push imm32"},
857858
{ 5, {0xb8, 0x71, 0x72, 0x73, 0x74}, 0, "b8 XX XX XX XX : mov eax, XX XX XX XX"},

0 commit comments

Comments
 (0)