diff --git a/src/coreclr/vm/gc_unwind_x86.inl b/src/coreclr/vm/gc_unwind_x86.inl index c5d45a6c43074c..eb08dff6cf1079 100644 --- a/src/coreclr/vm/gc_unwind_x86.inl +++ b/src/coreclr/vm/gc_unwind_x86.inl @@ -2443,7 +2443,7 @@ void UnwindEspFrameEpilog( // We have already popped off the frame (excluding the callee-saved registers) - if (epilogBase[0] == X86_INSTR_POP_ECX) + if (epilogBase[offset] == X86_INSTR_POP_ECX) { // We may use "POP ecx" for doing "ADD ESP, 4", // or we may not (in the case of JMP epilogs) @@ -2560,8 +2560,11 @@ void UnwindEbpDoubleAlignFrameEpilog( { // do nothing before popping the callee-saved registers } - else if (info->rawStkSize == sizeof(void*)) + else if (info->rawStkSize == sizeof(void*) && epilogBase[offset] == X86_INSTR_POP_ECX) { + // We may use "POP ecx" for doing "ADD ESP, 4", + // or we may not (in the case of JMP epilogs) + // "pop ecx" will make ESP point to the callee-saved registers if (!InstructionAlreadyExecuted(offset, info->epilogOffs)) ESP += sizeof(void*);