about summary refs log tree commit diff stats
path: root/src/emu
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2022-10-29 22:32:47 +0200
committerGitHub <noreply@github.com>2022-10-29 22:32:47 +0200
commit0e47d1269cc660d2b1451e76375b2d3545ce66f4 (patch)
tree27c958e5ef3cd147625112a82626624d51fd6fe5 /src/emu
parent7dc5359c2b10521696e7d251627eff029d53ee28 (diff)
downloadbox64-0e47d1269cc660d2b1451e76375b2d3545ce66f4.tar.gz
box64-0e47d1269cc660d2b1451e76375b2d3545ce66f4.zip
Malloc override (#437)
* Add some malloc override mecanism, but missing c++ function overriding
* Add c++ new/delete redirection too
* Added support for libtbbmalloc_proxy
Diffstat (limited to 'src/emu')
-rwxr-xr-xsrc/emu/x64int3.c5
-rwxr-xr-xsrc/emu/x64run_private.c1
2 files changed, 5 insertions, 1 deletions
diff --git a/src/emu/x64int3.c b/src/emu/x64int3.c
index dc2b02a2..0b3abba3 100755
--- a/src/emu/x64int3.c
+++ b/src/emu/x64int3.c
@@ -146,7 +146,10 @@ void x64Int3(x64emu_t* emu, uintptr_t* addr)
                     snprintf(buff, 255, "%04d|%p: Calling %s(%d, %p, %zu)", tid, *(void**)(R_RSP), s, R_EDI, (void*)R_RSI, R_RDX);
                     perr = 1;
                 } else if (!strcmp(s, "write")) {
-                    snprintf(buff, 255, "%04d|%p: Calling %s(%d, %p, %zu)", tid, *(void**)(R_RSP), s, R_EDI, (void*)R_RSI, R_RDX);
+                    if(R_EDI==2 || R_EDI==3)
+                        snprintf(buff, 255, "%04d|%p: Calling %s(%d, %p\"%s\", %zu)", tid, *(void**)(R_RSP), s, R_EDI, (void*)R_RSI, (char*)R_RSI, R_RDX);
+                    else
+                        snprintf(buff, 255, "%04d|%p: Calling %s(%d, %p, %zu)", tid, *(void**)(R_RSP), s, R_EDI, (void*)R_RSI, R_RDX);
                     perr = 1;
                 } else if (strstr(s, "access")==s) {
                     tmp = (char*)(R_RDI);
diff --git a/src/emu/x64run_private.c b/src/emu/x64run_private.c
index cc8ef149..c057b8a4 100755
--- a/src/emu/x64run_private.c
+++ b/src/emu/x64run_private.c
@@ -51,6 +51,7 @@ int32_t EXPORT my___libc_start_main(x64emu_t* emu, int *(main) (int, char * *, c
     } else {
         RunElfInit(my_context->elfs[0], emu);
     }
+    MarkElfInitDone(my_context->elfs[0]);
     printf_log(LOG_DEBUG, "Transfert to main(%d, %p, %p)=>%p from __libc_start_main\n", my_context->argc, my_context->argv, my_context->envv, main);
     // call main and finish
     Push64(emu, GetRBP(emu));   // set frame pointer