about summary refs log tree commit diff stats
path: root/src/emu
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2024-09-30 14:00:33 +0200
committerptitSeb <sebastien.chev@gmail.com>2024-09-30 14:00:33 +0200
commitf7c93b68d8fc62987b0c73e97cae5cc6ee31b269 (patch)
treee4566c417f51f7a1bc2b4f9565b401b0a28b50fd /src/emu
parentf7e769f8c44d4fb69597f0d3acf8782cfcd8dc17 (diff)
downloadbox64-f7c93b68d8fc62987b0c73e97cae5cc6ee31b269.tar.gz
box64-f7c93b68d8fc62987b0c73e97cae5cc6ee31b269.zip
[BOX32] Fixed main Elf init not always called
Diffstat (limited to 'src/emu')
-rw-r--r--src/emu/x64run_private.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/emu/x64run_private.c b/src/emu/x64run_private.c
index deba1a05..5cb8141f 100644
--- a/src/emu/x64run_private.c
+++ b/src/emu/x64run_private.c
@@ -146,6 +146,14 @@ int32_t EXPORT my32___libc_start_main(x64emu_t* emu, int *(main) (int, char * *,
         if(emu->error)  // any error, don't bother with more
             return 0;
         emu->quit = 0;
+    } else {
+        if(my_context->elfs[0]) {
+            printf_dump(LOG_DEBUG, "Calling init from main elf\n");
+            RunElfInit(my_context->elfs[0], emu);
+        }
+    }
+    if(my_context->elfs[0]) {
+        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