Fix ThunkManager::ProtectFunction on x86.

This commit is contained in:
comex 2013-10-01 22:37:17 -04:00 committed by Pierre Bourdon
parent 25c52b0b69
commit e137e3711e
1 changed files with 5 additions and 2 deletions

View File

@ -105,9 +105,12 @@ void *ThunkManager::ProtectFunction(void *function, int num_params)
// trickery : we simply re-push the parameters. might not be optimal, but that doesn't really // trickery : we simply re-push the parameters. might not be optimal, but that doesn't really
// matter. // matter.
ABI_AlignStack(num_params * 4, true); ABI_AlignStack(num_params * 4, true);
unsigned int alignedSize = ABI_GetAlignedFrameSize(num_params * 4); unsigned int alignedSize = ABI_GetAlignedFrameSize(num_params * 4, true);
for (int i = 0; i < num_params; i++) { for (int i = 0; i < num_params; i++) {
// ESP is changing, so we do not need i // dst-arg1 dst-arg2 | dst-arg3 padding return-addr orig-arg1 | orig-arg2 orig-arg3
// ^ ESP ^ target
// The offset is just alignedSize (return address makes up for the
// missing argument).
PUSH(32, MDisp(ESP, alignedSize)); PUSH(32, MDisp(ESP, alignedSize));
} }
CALL(function); CALL(function);