about summary refs log tree commit diff stats
path: root/src/wrapped
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2023-05-08 15:20:52 +0200
committerptitSeb <sebastien.chev@gmail.com>2023-05-08 15:20:52 +0200
commit7db5b33284eb1611ec1ae15b030ef146f6b46c1c (patch)
tree66f5359a63d7dcd991d04c835f6c7c54ad85d00a /src/wrapped
parent6607ddb15daeec7f54504a907e5db5013d3da618 (diff)
downloadbox64-7db5b33284eb1611ec1ae15b030ef146f6b46c1c.tar.gz
box64-7db5b33284eb1611ec1ae15b030ef146f6b46c1c.zip
Some small changes to thread and fork and cloning x64emu_t struct
Diffstat (limited to 'src/wrapped')
-rwxr-xr-xsrc/wrapped/wrappedlibc.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/wrapped/wrappedlibc.c b/src/wrapped/wrappedlibc.c
index cb4ae59d..0c0c0238 100755
--- a/src/wrapped/wrappedlibc.c
+++ b/src/wrapped/wrappedlibc.c
@@ -482,6 +482,11 @@ int my_dl_iterate_phdr(x64emu_t *emu, void* F, void *data);
 
 pid_t EXPORT my_fork(x64emu_t* emu)
 {
+    #if 1
+    emu->quit = 1;
+    emu->fork = 3;  // use regular fork...
+    return 0;
+    #else
     // execute atforks prepare functions, in reverse order
     for (int i=my_context->atfork_sz-1; i>=0; --i)
         if(my_context->atforks[i].prepare)
@@ -507,6 +512,7 @@ pid_t EXPORT my_fork(x64emu_t* emu)
                 RunFunctionWithEmu(emu, 0, my_context->atforks[i].child, 0);
     }
     return v;
+    #endif
 }
 pid_t EXPORT my___fork(x64emu_t* emu) __attribute__((alias("my_fork")));
 pid_t EXPORT my_vfork(x64emu_t* emu)
@@ -3138,8 +3144,8 @@ EXPORT int my_clone(x64emu_t* emu, void* fn, void* stack, int flags, void* args,
     void* mystack = NULL;
     clone_arg_t* arg = (clone_arg_t*)box_calloc(1, sizeof(clone_arg_t));
     x64emu_t * newemu = NewX64Emu(emu->context, R_RIP, (uintptr_t)stack, 0, 0);
-    SetupX64Emu(newemu);
-    CloneEmu(newemu, emu);
+    SetupX64Emu(newemu, emu);
+    //CloneEmu(newemu, emu);
     if(my_context->stack_clone_used) {
         printf_log(LOG_DEBUG, " no free stack_clone ");
         mystack = box_malloc(1024*1024);  // stack for own process... memory leak, but no practical way to remove it