From 82b62ed7f347ef96cbb6cbbbe7ff1f3e7e1e8ec7 Mon Sep 17 00:00:00 2001 From: Jonghyun Park Date: Thu, 13 Apr 2017 07:07:56 +0900 Subject: [PATCH] [x86/Linux] 16-byte aligned BackPatchWorkerAsmStub (dotnet/coreclr#10759) * [x86/Linux] 16-byte aligned BackPatchWorkerAsmStub * Use fixed alignment padding * Do NOT push ebx (no longer required) Commit migrated from https://github.com/dotnet/coreclr/commit/cebfa42d658e9ab39f189aeb01baeb266ed1190a --- src/coreclr/src/vm/i386/asmhelpers.S | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/src/coreclr/src/vm/i386/asmhelpers.S b/src/coreclr/src/vm/i386/asmhelpers.S index 2242c80..98525ac 100644 --- a/src/coreclr/src/vm/i386/asmhelpers.S +++ b/src/coreclr/src/vm/i386/asmhelpers.S @@ -1177,12 +1177,28 @@ NESTED_ENTRY BackPatchWorkerAsmStub, _TEXT, NoHandler PROLOG_PUSH edx PROLOG_END - sub esp, 4 // for 16 bytes align - push eax // push any indirect call address as the second arg to BackPatchWorker - push [ebp+8] // and push return address as the first arg to BackPatchWorker + // Call BackPatchWorkerStaticStub + // + // Here is expected stack layout at this point: + // | saved edx | + // | saved ecx | + // | saved eax | + // +-----------+ <- ebp + // | saved ebp | + // | saved eip | + // +-----------+ <- CFA of BackPatchWorkerAsmStub + // | saved eip | + // +-----------+ <- CFA of ResolveStub (16-byte aligned) + // (Please refer to ResolveStub in vm/i386/virtualcallstubcpu.hpp for details) + // + push eax // any indirect call address as the 2nd arg + push DWORD PTR [ebp + 8] // return address (of ResolveStub) as the 1st arg + CHECK_STACK_ALIGNMENT call C_FUNC(BackPatchWorkerStaticStub) - add esp, 12 + + // Clean up arguments and alignment padding + add esp, 2*4 EPILOG_BEG EPILOG_POP edx -- 2.7.4