diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2024-09-30 14:00:33 +0200 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2024-09-30 14:00:33 +0200 |
| commit | f7c93b68d8fc62987b0c73e97cae5cc6ee31b269 (patch) | |
| tree | e4566c417f51f7a1bc2b4f9565b401b0a28b50fd /src/elfs | |
| parent | f7e769f8c44d4fb69597f0d3acf8782cfcd8dc17 (diff) | |
| download | box64-f7c93b68d8fc62987b0c73e97cae5cc6ee31b269.tar.gz box64-f7c93b68d8fc62987b0c73e97cae5cc6ee31b269.zip | |
[BOX32] Fixed main Elf init not always called
Diffstat (limited to 'src/elfs')
| -rw-r--r-- | src/elfs/elfloader.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/elfs/elfloader.c b/src/elfs/elfloader.c index 10bb7b02..6c782c52 100644 --- a/src/elfs/elfloader.c +++ b/src/elfs/elfloader.c @@ -1169,8 +1169,12 @@ void RunElfInit(elfheader_t* h, x64emu_t *emu) RunElfInit(lib_elf, emu); } printf_dump(LOG_DEBUG, "Calling Init for %s @%p\n", ElfName(h), (void*)p); - if(h->initentry) - RunFunctionWithEmu(emu, 0, p, 3, my_context->argc, my_context->argv, my_context->envv); + if(h->initentry) { + if(box64_is32bits) + RunFunctionWithEmu(emu, 0, p, 3, my_context->argc, my_context->argv32, my_context->envv32); + else + RunFunctionWithEmu(emu, 0, p, 3, my_context->argc, my_context->argv, my_context->envv); + } printf_dump(LOG_DEBUG, "Done Init for %s\n", ElfName(h)); // and check init array now #ifdef BOX32 @@ -1179,7 +1183,7 @@ void RunElfInit(elfheader_t* h, x64emu_t *emu) for (size_t i=0; i<h->initarray_sz; ++i) { if(addr[i]) { printf_dump(LOG_DEBUG, "Calling Init[%zu] for %s @%p\n", i, ElfName(h), from_ptrv(addr[i])); - RunFunctionWithEmu(emu, 0, (uintptr_t)addr[i], 3, my_context->argc, my_context->argv, my_context->envv); + RunFunctionWithEmu(emu, 0, (uintptr_t)addr[i], 3, my_context->argc, my_context->argv32, my_context->envv32); } } } else |