From 960ce86289fd35069ce417b0ed6e9556da5a1bb7 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Sun, 19 Sep 2021 19:00:19 +0200 Subject: Fixed some nasty copypasta on EmuCall --- src/libtools/signals.c | 4 ++-- src/tools/callback.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/libtools/signals.c b/src/libtools/signals.c index d4c88c01..1ac0dd4f 100755 --- a/src/libtools/signals.c +++ b/src/libtools/signals.c @@ -290,7 +290,7 @@ uint64_t RunFunctionHandler(int* exit, x64_ucontext_t* sigcontext, uintptr_t fnc emu->segs_serial[i] = 0; if(nargs>6) - R_RSP -= (nargs-6)*4; // need to push in reverse order + R_RSP -= (nargs-6)*sizeof(void*); // need to push in reverse order uint64_t *p = (uint64_t*)R_RSP; @@ -313,7 +313,7 @@ uint64_t RunFunctionHandler(int* exit, x64_ucontext_t* sigcontext, uintptr_t fnc //EmuCall(emu, fnc); // avoid DynaCall for now DynaCall(emu, fnc); if(nargs>6) - R_RSP+=((nargs-6)*4); + R_RSP+=((nargs-6)*sizeof(void*)); emu->quitonlongjmp = oldquitonlongjmp; diff --git a/src/tools/callback.c b/src/tools/callback.c index 1f7250a6..8cdc117c 100755 --- a/src/tools/callback.c +++ b/src/tools/callback.c @@ -21,7 +21,7 @@ uint64_t RunFunction(box64context_t *context, uintptr_t fnc, int nargs, ...) x64emu_t *emu = thread_get_emu(); if(nargs>6) - R_ESP -= (nargs-6)*4; // need to push in reverse order + R_ESP -= (nargs-6)*sizeof(void*); // need to push in reverse order uint64_t *p = (uint64_t*)R_RSP; @@ -40,7 +40,7 @@ uint64_t RunFunction(box64context_t *context, uintptr_t fnc, int nargs, ...) DynaCall(emu, fnc); if(nargs>6) - R_ESP+=((nargs-6)*4); + R_ESP+=((nargs-6)*sizeof(void*)); uint64_t ret = R_RAX; @@ -51,7 +51,7 @@ EXPORTDYN uint64_t RunFunctionWithEmu(x64emu_t *emu, int QuitOnLongJump, uintptr_t fnc, int nargs, ...) { if(nargs>6) - R_ESP -= (nargs-6)*4; // need to push in reverse order + R_ESP -= (nargs-6)*sizeof(void*); // need to push in reverse order uint64_t *p = (uint64_t*)R_RSP; @@ -78,7 +78,7 @@ uint64_t RunFunctionWithEmu(x64emu_t *emu, int QuitOnLongJump, uintptr_t fnc, in DynaCall(emu, fnc); if(oldip==R_RIP && nargs>6) - R_ESP+=((nargs-6)*4); // restore stack only if EIP is the one expected (else, it means return value is not the one expected) + R_ESP+=((nargs-6)*sizeof(void*)); // restore stack only if EIP is the one expected (else, it means return value is not the one expected) emu->quit = old_quit; emu->quitonlongjmp = oldlong; -- cgit 1.4.1