about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2025-10-12 14:52:49 +0200
committerptitSeb <sebastien.chev@gmail.com>2025-10-12 14:52:49 +0200
commit7b66c024f058eddd7055856f1c963d5c84f38cb6 (patch)
tree84290d970796649f419095cd7052ce1d1619e5ea
parentaf437fa354f387fb563ded1a8db7c5051148b5cd (diff)
downloadbox64-7b66c024f058eddd7055856f1c963d5c84f38cb6.tar.gz
box64-7b66c024f058eddd7055856f1c963d5c84f38cb6.zip
[DYNACACHE] Allow Dynacache to be serialized when _exit is used
-rw-r--r--src/wrapped/generated/functions_list.txt1
-rw-r--r--src/wrapped/generated/wrappedlibctypes.h1
-rw-r--r--src/wrapped/wrappedlibc.c14
-rw-r--r--src/wrapped/wrappedlibc_private.h2
4 files changed, 16 insertions, 2 deletions
diff --git a/src/wrapped/generated/functions_list.txt b/src/wrapped/generated/functions_list.txt
index 11fe4f39..200d3d7a 100644
--- a/src/wrapped/generated/functions_list.txt
+++ b/src/wrapped/generated/functions_list.txt
@@ -4875,6 +4875,7 @@ wrappedlibc:
   - __cxa_pure_virtual
   - __stack_chk_fail
 - vFi:
+  - _exit
   - exit
 - vFp:
   - _ITM_deregisterTMCloneTable
diff --git a/src/wrapped/generated/wrappedlibctypes.h b/src/wrapped/generated/wrappedlibctypes.h
index f22b2ee7..7f3ad690 100644
--- a/src/wrapped/generated/wrappedlibctypes.h
+++ b/src/wrapped/generated/wrappedlibctypes.h
@@ -118,6 +118,7 @@ typedef int32_t (*iFppipppp_t)(void*, void*, int32_t, void*, void*, void*, void*
 	GO(_Jv_RegisterClasses, vFv_t) \
 	GO(__cxa_pure_virtual, vFv_t) \
 	GO(__stack_chk_fail, vFv_t) \
+	GO(_exit, vFi_t) \
 	GO(exit, vFi_t) \
 	GO(_ITM_deregisterTMCloneTable, vFp_t) \
 	GO(_ZGTtdlPv, vFp_t) \
diff --git a/src/wrapped/wrappedlibc.c b/src/wrapped/wrappedlibc.c
index 280f5f7b..c3d9da2a 100644
--- a/src/wrapped/wrappedlibc.c
+++ b/src/wrapped/wrappedlibc.c
@@ -3877,7 +3877,19 @@ EXPORT void my_exit(x64emu_t* emu, int code)
     exit(code);
 }
 
-EXPORT void my__exit(x64emu_t* emu, int code) __attribute__((alias("my_exit")));
+EXPORT void my__exit(x64emu_t* emu, int code)
+{
+    if(emu->flags.quitonexit || emu->quit) {
+        _exit(code);
+    }
+    printf_log(LOG_INFO, "Fast _exit called\n");
+    emu->quit = 1;
+    box64_exit_code = code;
+    SerializeAllMapping();   // just to be safe
+    // then call all the fini
+    
+    _exit(code);
+}
 
 EXPORT int my_prctl(x64emu_t* emu, int option, unsigned long arg2, unsigned long arg3, unsigned long arg4, unsigned long arg5)
 {
diff --git a/src/wrapped/wrappedlibc_private.h b/src/wrapped/wrappedlibc_private.h
index d318f558..83a89f09 100644
--- a/src/wrapped/wrappedlibc_private.h
+++ b/src/wrapped/wrappedlibc_private.h
@@ -352,7 +352,7 @@ GOM(execv, iFEpp)
 GOM(execve, iFEppp)
 GOM(execvp, iFEpp)
 GOWM(execvpe, iFEppp)
-GO(_exit, vFi)
+GOM(_exit, vFEi)
 GOM(exit, vFEi)
 GOW(_Exit, vFi)
 GO(explicit_bzero, vFpL)