diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2024-10-13 11:19:19 +0200 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2024-10-13 11:19:19 +0200 |
| commit | 617fd69bcc04eedef76b41e5dba68e9c1e54f890 (patch) | |
| tree | 10f7077326da96d2d4a94c63da1298af60080cea /src/tools | |
| parent | 5fcd9d45a3e6f35a197d2c6be951b811cb1cb36c (diff) | |
| download | box64-617fd69bcc04eedef76b41e5dba68e9c1e54f890.tar.gz box64-617fd69bcc04eedef76b41e5dba68e9c1e54f890.zip | |
[BOX32] Reworked alignment for 32bits stacks
Diffstat (limited to 'src/tools')
| -rw-r--r-- | src/tools/callback.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/tools/callback.c b/src/tools/callback.c index e0df5cfc..3c58bc6e 100644 --- a/src/tools/callback.c +++ b/src/tools/callback.c @@ -25,7 +25,7 @@ uint64_t RunFunction(uintptr_t fnc, int nargs, ...) Push_32(emu, R_RBP); // push ebp R_RBP = R_ESP; // mov ebp, esp - R_ESP -= nargs*4; // need to push in reverse order + R_ESP -= nargs*4+(4-(nargs&3))*4; // need to push in reverse order ptr_t *p = (ptr_t*)from_ptrv(R_ESP); @@ -141,6 +141,7 @@ uint64_t RunFunctionFmt(uintptr_t fnc, const char* fmt, ...) Push_32(emu, R_EBP); // push ebp R_RBP = R_ESP; // mov ebp, esp sizeof_ptr = sizeof(ptr_t); + align = (4-(nargs&3))&3; } else #endif { @@ -336,7 +337,7 @@ uint64_t RunFunctionWithEmu(x64emu_t *emu, int QuitOnLongJump, uintptr_t fnc, in Push_32(emu, R_RBP); // push ebp R_RBP = R_ESP; // mov ebp, esp - R_ESP -= nargs*4; // need to push in reverse order + R_ESP -= nargs*4 + ((4-(nargs&3))&3)*4; // need to push in reverse order ptr_t *p = (ptr_t*)from_ptrv(R_ESP); |