about summary refs log tree commit diff stats
path: root/src/tools/callback.c
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2021-09-19 19:00:19 +0200
committerptitSeb <sebastien.chev@gmail.com>2021-09-19 19:00:19 +0200
commit960ce86289fd35069ce417b0ed6e9556da5a1bb7 (patch)
treec2154c98667c08a23dfd26dffcc7fb2d9d7908d1 /src/tools/callback.c
parentb2bd3103d878628d7b2eeb68f469c00c9574f94a (diff)
downloadbox64-960ce86289fd35069ce417b0ed6e9556da5a1bb7.tar.gz
box64-960ce86289fd35069ce417b0ed6e9556da5a1bb7.zip
Fixed some nasty copypasta on EmuCall
Diffstat (limited to 'src/tools/callback.c')
-rwxr-xr-xsrc/tools/callback.c8
1 files changed, 4 insertions, 4 deletions
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;