diff options
author | Jonghyun Park <parjong@gmail.com> | 2017-03-06 20:31:37 +0900 |
---|---|---|
committer | Jan Vorlicek <janvorli@microsoft.com> | 2017-03-06 12:31:37 +0100 |
commit | ccf4cb343f6b9f47fc4b08d8811ead1caa3c706c (patch) | |
tree | ab670133bed6f9752c2cabd169e17fb2aaa89ef5 | |
parent | 93d8ee3cb97f4071503f4e9e59d26f110c62200b (diff) | |
download | coreclr-ccf4cb343f6b9f47fc4b08d8811ead1caa3c706c.tar.gz coreclr-ccf4cb343f6b9f47fc4b08d8811ead1caa3c706c.tar.bz2 coreclr-ccf4cb343f6b9f47fc4b08d8811ead1caa3c706c.zip |
[x86/Linux] Stack align aware unwinder (#9928)
-rw-r--r-- | src/unwinder/i386/unwinder_i386.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/unwinder/i386/unwinder_i386.cpp b/src/unwinder/i386/unwinder_i386.cpp index 4de23790e6..2c184d1e66 100644 --- a/src/unwinder/i386/unwinder_i386.cpp +++ b/src/unwinder/i386/unwinder_i386.cpp @@ -105,8 +105,19 @@ OOPStackUnwinderX86::VirtualUnwind( ENUM_CALLEE_SAVED_REGISTERS(); #undef CALLEE_SAVED_REGISTER - ContextRecord->Esp = rd.SP - codeInfo.GetCodeManager()->GetStackParameterSize(&codeInfo); - ContextRecord->ResumeEsp = rd.SP; + SIZE_T paramSize = codeInfo.GetCodeManager()->GetStackParameterSize(&codeInfo); + SIZE_T paddingSize = 0; + +#ifdef UNIX_X86_ABI + // On UNIX_X86_ABI, function call may have stack alignment padding. + if (paramSize % 16 != 0) + { + paddingSize += 16 - (paramSize % 16); + } +#endif // UNIX_X86_ABI + + ContextRecord->Esp = rd.SP - paramSize; + ContextRecord->ResumeEsp = rd.SP + paddingSize; ContextRecord->Eip = rd.ControlPC; // For x86, the value of Establisher Frame Pointer is Caller SP |