From 6b6e6c874bee2b8baa00da9f4aea335ef7d2f022 Mon Sep 17 00:00:00 2001 From: Benjamin Levy Date: Mon, 12 Apr 2021 06:44:28 -0400 Subject: [PATCH] Initial Android support attempt --- CMakeLists.txt | 32 ++++-- rebuild_wrappers.py | 2 + src/elfs/elfloader.c | 7 +- src/elfs/elfparser.c | 115 +++++++++++--------- src/emu/x86emu.c | 4 +- src/emu/x86run_private.c | 20 ++++ src/include/myalign.h | 3 + src/library_list.h | 50 ++++++--- src/libtools/signals.c | 2 +- src/libtools/threads.c | 13 ++- src/main.c | 3 + src/wrapped/generated/functions_list.txt | 12 --- src/wrapped/generated/wrapper.c | 24 ----- src/wrapped/generated/wrapper.h | 12 --- src/wrapped/wrappedfreetype.c | 8 +- src/wrapped/wrappedgnutls.c | 8 +- src/wrapped/wrappedlber.c | 8 +- src/wrapped/wrappedlcms2.c | 8 +- src/wrapped/wrappedldapr.c | 16 ++- src/wrapped/wrappedlibc.c | 127 +++++++++++++++++++++-- src/wrapped/wrappedlibc_private.h | 12 +++ src/wrapped/wrappedlibcups.c | 8 +- src/wrapped/wrappedlibdl.c | 10 +- src/wrapped/wrappedlibm.c | 8 +- src/wrapped/wrappedlibtiff.c | 8 +- src/wrapped/wrappedmpg123.c | 8 +- src/wrapped/wrappedpng16.c | 8 +- src/wrapped/wrappedxml2.c | 8 +- src/wrapped/wrappedxslt.c | 8 +- 29 files changed, 405 insertions(+), 147 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6f405c92e1..7a8bf36a6f 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,6 +10,7 @@ option(RK3399 "Set to ON if targeting an Rockchip RK3399 based device" ${RK3399} option(GAMESHELL "Set to ON if targeting a GameShell device" ${GAMESHELL}) option(ODROID "Set to ON if targeting an ODroid device" ${ODROID}) option(POWER9 "Set to ON if targeting a POWER9 processor" ${POWER9}) +option(ANDROID "Set to ON if targeting an Android device" ${ANDROID}) option(USE_CCACHE "Set to ON to use ccache if present in the system" ${USE_CCACHE}) option(HAVE_TRACE "Set to ON to have Trace ability (needs ZydisInfo library)" ${HAVE_TRACE}) option(NOLOADADDR "Set to ON to avoid fixing the load address of Box86" ${NO_LOADAADR}) @@ -20,6 +21,9 @@ if(PANDORA OR PYRA OR RPI2 OR RPI3 OR RPI4 OR GAMESHELL OR ODROID OR RK3399 OR R set(NOALIGN OFF CACHE BOOL "") set(ARM_DYNAREC ON CACHE BOOL "") endif() +if(ANDROID) + set(NOLOADADDR ON CACHE BOOL "") +endif() option(LD80BITS "Set to ON if host device have 80bits long double (i.e. i386)" ${LD80BITS}) option(NOALIGN "Set to ON if host device doesn't need re-align (i.e. i386)" ${NOALIGN}) option(ARM_DYNAREC "Set to ON to use ARM Dynamic Recompilation" ${ARM_DYNAREC}) @@ -228,7 +232,6 @@ set(ELFLOADER_SRC "${BOX86_ROOT}/src/libtools/myalign.c" "${BOX86_ROOT}/src/libtools/myalign64.c" "${BOX86_ROOT}/src/libtools/myfts.c" - "${BOX86_ROOT}/src/libtools/obstack.c" "${BOX86_ROOT}/src/libtools/sdl1rwops.c" "${BOX86_ROOT}/src/libtools/sdl2rwops.c" "${BOX86_ROOT}/src/libtools/signals.c" @@ -237,6 +240,9 @@ set(ELFLOADER_SRC "${BOX86_ROOT}/src/dynarec/dynarec.c" "${BOX86_ROOT}/src/wrapped/generated/wrapper.c" ) +if(NOT ANDROID) + set(ELFLOADER_SRC "${BOX86_ROOT}/src/libtools/obstack.c") +endif() set(WRAPPEDS "${BOX86_ROOT}/src/wrapped/wrappedlibc.c" @@ -296,9 +302,6 @@ set(WRAPPEDS "${BOX86_ROOT}/src/wrapped/wrappedopenal.c" "${BOX86_ROOT}/src/wrapped/wrappedalure.c" "${BOX86_ROOT}/src/wrapped/wrappedalut.c" - "${BOX86_ROOT}/src/wrapped/wrappedlibjpeg.c" - "${BOX86_ROOT}/src/wrapped/wrappedlibjpeg62.c" - "${BOX86_ROOT}/src/wrapped/wrappedturbojpeg.c" "${BOX86_ROOT}/src/wrapped/wrappedcurl.c" "${BOX86_ROOT}/src/wrapped/wrappedudev0.c" "${BOX86_ROOT}/src/wrapped/wrappedudev1.c" @@ -368,6 +371,13 @@ set(WRAPPEDS "${BOX86_ROOT}/src/wrapped/wrappedldlinux.c" "${BOX86_ROOT}/src/wrapped/wrappedcrashhandler.c" ) +if(NOT ANDROID) + set(WRAPPEDS + "${BOX86_ROOT}/src/wrapped/wrappedlibjpeg.c" + "${BOX86_ROOT}/src/wrapped/wrappedlibjpeg62.c" + "${BOX86_ROOT}/src/wrapped/wrappedturbojpeg.c" + ) +endif() # If BOX86_ROOT contains a ".c", the build breaks... string(REPLACE ".c" "_private.h" MODROOT ${BOX86_ROOT}) @@ -385,7 +395,7 @@ add_custom_command( OUTPUT "${BOX86_ROOT}/src/wrapped/generated/functions_list.txt" COMMAND "${PYTHON_EXECUTABLE}" "${BOX86_ROOT}/rebuild_wrappers.py" "${BOX86_ROOT}" - "PANDORA" "HAVE_LD80BITS" "NOALIGN" "HAVE_TRACE" "POWERPCLE" "--" + "PANDORA" "HAVE_LD80BITS" "NOALIGN" "HAVE_TRACE" "POWERPCLE" "ANDROID" "--" ${WRAPPEDS_HEAD} MAIN_DEPENDENCY "${BOX86_ROOT}/rebuild_wrappers.py" DEPENDS ${WRAPPEDS} ${WRAPPEDS_HEAD} @@ -494,7 +504,11 @@ else() add_library(${BOX86} OBJECT ${ELFLOADER_SRC} ${WRAPPEDS} "${BOX86_ROOT}/src/git_head.h") endif() if(ARM_DYNAREC) - target_link_libraries(${BOX86} dynarec m dl rt pthread) + if(ANDROID) + target_link_libraries(${BOX86} dynarec m dl) + else() + target_link_libraries(${BOX86} dynarec m dl rt pthread) + endif() endif() if(${CMAKE_VERSION} VERSION_LESS "3.13") set_target_properties(${BOX86} PROPERTIES LINK_FLAGS -rdynamic) @@ -512,7 +526,11 @@ else(BOX86LIB) add_executable(${BOX86} ${ELFLOADER_SRC} ${WRAPPEDS} "${BOX86_ROOT}/src/git_head.h") add_dependencies(${BOX86} WRAPPERS) add_dependencies(${BOX86} PRINTER) -target_link_libraries(${BOX86} m dl rt pthread) +if(ANDROID) + target_link_libraries(${BOX86} m dl) +else() + target_link_libraries(${BOX86} m dl rt pthread) +endif() if(ARM_DYNAREC) target_link_libraries(${BOX86} dynarec) endif() diff --git a/rebuild_wrappers.py b/rebuild_wrappers.py index 00e964a331..71ec19c2e3 100755 --- a/rebuild_wrappers.py +++ b/rebuild_wrappers.py @@ -58,6 +58,8 @@ def main(root, defines, files, ver): continue #if !(defined(GO) && defined(GOM)...) elif preproc_cmd.startswith("error"): continue #error meh! + elif preproc_cmd.startswith("include"): + continue #inherit other library elif preproc_cmd.startswith("endif"): if dependants != []: dependants.pop() diff --git a/src/elfs/elfloader.c b/src/elfs/elfloader.c index 2700db7e4c..52ed123b6a 100755 --- a/src/elfs/elfloader.c +++ b/src/elfs/elfloader.c @@ -10,6 +10,7 @@ #include #include #include +#include #include "box86version.h" #include "elfloader.h" @@ -945,6 +946,10 @@ void RunElfFini(elfheader_t* h, x86emu_t *emu) if(!h || h->fini_done) return; h->fini_done = 1; +#ifdef ANDROID + // TODO: Fix .fini_array on Android + printf_log(LOG_DEBUG, "Android does not support Fini for %s\n", ElfName(h)); +#else // first check fini array Elf32_Addr *addr = (Elf32_Addr*)(h->finiarray + h->delta); for (int i=0; ifiniarray_sz; ++i) { @@ -958,7 +963,7 @@ void RunElfFini(elfheader_t* h, x86emu_t *emu) RunFunctionWithEmu(emu, 0, p, 0); } h->init_done = 0; // can be re-inited again... - return; +#endif } uintptr_t GetElfInit(elfheader_t* h) diff --git a/src/elfs/elfparser.c b/src/elfs/elfparser.c index bd8c141354..ecf40dcdb5 100755 --- a/src/elfs/elfparser.c +++ b/src/elfs/elfparser.c @@ -189,30 +189,71 @@ elfheader_t* ParseElfHeader(FILE* f, const char* name, int exec) // also grab the DT_STRTAB string table { for (int i=0; inumDynamic; ++i) { - if(h->Dynamic[i].d_tag == DT_REL) - h->rel = h->Dynamic[i].d_un.d_ptr; - else if(h->Dynamic[i].d_tag == DT_RELSZ) - h->relsz = h->Dynamic[i].d_un.d_val; - else if(h->Dynamic[i].d_tag == DT_RELENT) - h->relent = h->Dynamic[i].d_un.d_val; - else if(h->Dynamic[i].d_tag == DT_RELA) - h->rela = h->Dynamic[i].d_un.d_ptr; - else if(h->Dynamic[i].d_tag == DT_RELASZ) - h->relasz = h->Dynamic[i].d_un.d_val; - else if(h->Dynamic[i].d_tag == DT_RELAENT) - h->relaent = h->Dynamic[i].d_un.d_val; - else if(h->Dynamic[i].d_tag == DT_PLTGOT) - h->pltgot = h->Dynamic[i].d_un.d_val; - else if(h->Dynamic[i].d_tag == DT_PLTREL) - h->pltrel = h->Dynamic[i].d_un.d_val; - else if(h->Dynamic[i].d_tag == DT_PLTRELSZ) - h->pltsz = h->Dynamic[i].d_un.d_val; - else if(h->Dynamic[i].d_tag == DT_JMPREL) - h->jmprel = h->Dynamic[i].d_un.d_val; - else if(h->Dynamic[i].d_tag == DT_STRTAB) - h->DynStrTab = (char*)(h->Dynamic[i].d_un.d_ptr); - else if(h->Dynamic[i].d_tag == DT_STRSZ) - h->szDynStrTab = h->Dynamic[i].d_un.d_val; + Elf32_Dyn d = h->Dynamic[i]; + Elf32_Word val = d.d_un.d_val; + Elf32_Addr ptr = d.d_un.d_ptr; + switch (d.d_tag) { + case DT_REL: + h->rel = ptr; + break; + case DT_RELSZ: + h->relsz = val; + break; + case DT_RELENT: + h->relent = val; + break; + case DT_RELA: + h->rela = ptr; + break; + case DT_RELASZ: + h->relasz = val; + break; + case DT_RELAENT: + h->relaent = val; + break; + case DT_PLTGOT: + h->pltgot = val; + break; + case DT_PLTREL: + h->pltrel = val; + break; + case DT_PLTRELSZ: + h->pltsz = val; + break; + case DT_JMPREL: + h->jmprel = val; + break; + case DT_STRTAB: + h->DynStrTab = (char *)(ptr); + break; + case DT_STRSZ: + h->szDynStrTab = val; + break; + case DT_INIT: // Entry point + h->initentry = ptr; + printf_log(LOG_DEBUG, "The DT_INIT is at address %p\n", (void*)h->initentry); + break; + case DT_INIT_ARRAY: + h->initarray = ptr; + printf_log(LOG_DEBUG, "The DT_INIT_ARRAY is at address %p\n", (void*)h->initarray); + break; + case DT_INIT_ARRAYSZ: + h->initarray_sz = val / sizeof(Elf32_Addr); + printf_log(LOG_DEBUG, "The DT_INIT_ARRAYSZ is %d\n", h->initarray_sz); + break; + case DT_FINI: // Exit hook + h->finientry = ptr; + printf_log(LOG_DEBUG, "The DT_FINI is at address %p\n", (void*)h->finientry); + break; + case DT_FINI_ARRAY: + h->finiarray = ptr; + printf_log(LOG_DEBUG, "The DT_FINI_ARRAY is at address %p\n", (void*)h->finiarray); + break; + case DT_FINI_ARRAYSZ: + h->finiarray_sz = val / sizeof(Elf32_Addr); + printf_log(LOG_DEBUG, "The DT_FINI_ARRAYSZ is %d\n", h->finiarray_sz); + break; + } } if(h->rel) { if(h->relent != sizeof(Elf32_Rel)) { @@ -270,32 +311,6 @@ elfheader_t* ParseElfHeader(FILE* f, const char* name, int exec) h->plt_end = h->plt + h->SHEntries[ii].sh_size; printf_log(LOG_DEBUG, "The PLT Table is at address %p..%p\n", (void*)h->plt, (void*)h->plt_end); } - // look for .init entry point - ii = FindSection(h->SHEntries, h->numSHEntries, h->SHStrTab, ".init"); - if(ii) { - h->initentry = h->SHEntries[ii].sh_addr; - printf_log(LOG_DEBUG, "The .init is at address %p\n", (void*)h->initentry); - } - // and .init_array - ii = FindSection(h->SHEntries, h->numSHEntries, h->SHStrTab, ".init_array"); - if(ii) { - h->initarray_sz = h->SHEntries[ii].sh_size / sizeof(Elf32_Addr); - h->initarray = (uintptr_t)(h->SHEntries[ii].sh_addr); - printf_log(LOG_DEBUG, "The .init_array is at address %p, and have %d elements\n", (void*)h->initarray, h->initarray_sz); - } - // look for .fini entry point - ii = FindSection(h->SHEntries, h->numSHEntries, h->SHStrTab, ".fini"); - if(ii) { - h->finientry = h->SHEntries[ii].sh_addr; - printf_log(LOG_DEBUG, "The .fini is at address %p\n", (void*)h->finientry); - } - // and .fini_array - ii = FindSection(h->SHEntries, h->numSHEntries, h->SHStrTab, ".fini_array"); - if(ii) { - h->finiarray_sz = h->SHEntries[ii].sh_size / sizeof(Elf32_Addr); - h->finiarray = (uintptr_t)(h->SHEntries[ii].sh_addr); - printf_log(LOG_DEBUG, "The .fini_array is at address %p, and have %d elements\n", (void*)h->finiarray, h->finiarray_sz); - } // grab .text for main code ii = FindSection(h->SHEntries, h->numSHEntries, h->SHStrTab, ".text"); if(ii) { diff --git a/src/emu/x86emu.c b/src/emu/x86emu.c index dfd024ca9c..e0acf7bfc0 100755 --- a/src/emu/x86emu.c +++ b/src/emu/x86emu.c @@ -347,6 +347,8 @@ const char* DumpCPURegs(x86emu_t* emu, uintptr_t ip) } sprintf(tmp, "EIP=%08x ", ip); strcat(buff, tmp); + sprintf(tmp, "[EBP-0x10]=%08x ", *(uint32_t *)(emu->regs[_BP].dword[0]-0x10)); + strcat(buff, tmp); return buff; } @@ -477,4 +479,4 @@ void ResetSegmentsCache(x86emu_t *emu) if(!emu) return; memset(emu->segs_serial, 0, sizeof(emu->segs_serial)); -} \ No newline at end of file +} diff --git a/src/emu/x86run_private.c b/src/emu/x86run_private.c index b30cc6267e..4c2135fe5f 100755 --- a/src/emu/x86run_private.c +++ b/src/emu/x86run_private.c @@ -27,6 +27,25 @@ #define PARITY(x) (((emu->x86emu_parity_tab[(x) / 32] >> ((x) % 32)) & 1) == 0) #define XOR2(x) (((x) ^ ((x)>>1)) & 0x1) +#ifdef ANDROID +void EXPORT my___libc_init(x86emu_t* emu, void* raw_args __unused, void (*onexit)(void) __unused, int (*main)(int, char**, char**), void const * const structors __unused) +{ + //TODO: register fini + // let's cheat and set all args... + Push(emu, (uint32_t)my_context->envv); + Push(emu, (uint32_t)my_context->argv); + Push(emu, (uint32_t)my_context->argc); + + printf_log(LOG_DEBUG, "Transfert to main(%d, %p, %p)=>%p from __libc_init\n", my_context->argc, my_context->argv, my_context->envv, main); + // call main and finish + PushExit(emu); + R_EIP=(uint32_t)main; + + DynaRun(emu); + + emu->quit = 1; // finished! +} +#else int32_t EXPORT my___libc_start_main(x86emu_t* emu, int *(main) (int, char * *, char * *), int argc, char * * ubp_av, void (*init) (void), void (*fini) (void), void (*rtld_fini) (void), void (* stack_end)) { //TODO: register rtld_fini @@ -54,6 +73,7 @@ int32_t EXPORT my___libc_start_main(x86emu_t* emu, int *(main) (int, char * *, c emu->quit = 1; // finished! return 0; } +#endif const char* GetNativeName(void* p) { diff --git a/src/include/myalign.h b/src/include/myalign.h index d06a92465b..75a8b27704 100755 --- a/src/include/myalign.h +++ b/src/include/myalign.h @@ -44,8 +44,11 @@ void AlignSmpegInfo(void* dest, void* source); // x86 -> Arm // stat64 is packed on i386, not on arm (and possibly other structures) #undef st_atime +#undef st_atime_nsec #undef st_mtime +#undef st_mtime_nsec #undef st_ctime +#undef st_ctime_nsec struct i386_stat64 { uint64_t st_dev; uint8_t __pad0[4]; diff --git a/src/library_list.h b/src/library_list.h index 8155e86e81..ccf9ffda68 100755 --- a/src/library_list.h +++ b/src/library_list.h @@ -2,7 +2,6 @@ #error Nope #endif -GO("libc.so.6", libc) GO("libpthread.so.0", libpthread) GO("librt.so.1", librt) GO("libGL.so.1", libgl) @@ -10,8 +9,6 @@ GO("libGL.so", libgl) GO("libGLU.so.1", libglu) GO("libX11.so.6", libx11) GO("libasound.so.2", libasound) -GO("libdl.so.2", libdl) -GO("libm.so.6", libm) GO("libSDL2-2.0.so.0", sdl2) GO("libSDL2-2.0.so.1", sdl2) GO("libSDL2.so", sdl2) @@ -30,7 +27,6 @@ GO("libvorbisfile.so.3", vorbisfile) GO("libvorbis.so.0", libvorbis) GO("libogg.so.0", libogg) GO("libpng12.so.0", png12) -GO("libpng16.so.16", png16) GO("libXxf86vm.so.1", libxxf86vm) GO("libXinerama.so.1", xinerama) GO("libXrandr.so.2", libxrandr) @@ -67,9 +63,6 @@ GO("libopenal.so", openal) GO("openal.so", openal) GO("libalut.so.0", alut) GO("libalure.so.1", alure) -GO("libjpeg.so.8", libjpeg) -GO("libjpeg.so.62", libjpeg62) -GO("libturbojpeg.so.0", turbojpeg) GO("libcurl.so.4", curl) GO("libcurl-gnutls.so.4", curl) GO("libudev.so.0", udev0) @@ -113,7 +106,6 @@ GO("libnm.so.0", libnm) GO("libnm-glib.so.4", libnm) GO("libnm-util.so.2", libnm) GO("libfontconfig.so.1", fontconfig) -GO("libfreetype.so.6", freetype) GO("libbz2.so.1", bz2) GO("libSM.so.6", libsm) GO("libICE.so.6", libice) @@ -125,22 +117,48 @@ GO("libtinfo.so.5", libtinfo) GO("libncurses.so.6", libncurses6) GO("libtinfo.so.6", libtinfo6) GO("libtcmalloc_minimal.so.4", tcmallocminimal) -GO("libmpg123.so.0", mpg123) -GO("libgnutls.so.30", gnutls) -GO("libcups.so.2", libcups) GO("d3dadapter9.so.1", d3dadapter9) GO("libvulkan.so.1", vulkan) GO("libvulkan.so", vulkan) GO("libwayland-client.so.0", waylandclient) -GO("libxml2.so.2", xml2) -GO("libxslt.so.1", xslt) -GO("libldap_r-2.4.so.2", ldapr) -GO("liblber-2.4.so.2", lber) GO("libnsl.so.1", nsl) -GO("liblcms2.so.2", lcms2) GO("libkrb5.so.3", krb5) GO("libgssapi_krb5.so.2", gssapikrb5) + +#ifdef ANDROID +GO("libc.so", libc) +GO("libm.so", libm) +GO("libdl.so", libdl) +GO("libcups.so", libcups) +GO("liblber-2.4.so", lber) +GO("libldap_r-2.4.so", ldapr) +GO("libpng16.so", png16) +GO("libxslt.so", xslt) +GO("libfreetype.so", freetype) +GO("libgnutls.so", gnutls) +GO("liblcms2.so", lcms2) +GO("libmpg123.so", mpg123) +GO("libtiff.so", libtiff) +GO("libxml2.so", xml2) +#else +GO("libc.so.6", libc) +GO("libm.so.6", libm) +GO("libdl.so.2", libdl) +GO("libjpeg.so.8", libjpeg) +GO("libjpeg.so.62", libjpeg62) +GO("libturbojpeg.so.0", turbojpeg) +GO("libcups.so.2", libcups) +GO("liblber-2.4.so.2", lber) +GO("libldap_r-2.4.so.2", ldapr) +GO("libpng16.so.16", png16) +GO("libxslt.so.1", xslt) +GO("libfreetype.so.6", freetype) +GO("libgnutls.so.30", gnutls) +GO("liblcms2.so.2", lcms2) +GO("libmpg123.so.0", mpg123) GO("libtiff.so.5", libtiff) +GO("libxml2.so.2", xml2) +#endif GO("ld-linux.so.2", ldlinux) diff --git a/src/libtools/signals.c b/src/libtools/signals.c index af5e7c0dd6..5558565abe 100755 --- a/src/libtools/signals.c +++ b/src/libtools/signals.c @@ -199,7 +199,7 @@ typedef struct i386_ucontext_s i386_mcontext_t uc_mcontext; i386_sigset_t uc_sigmask; /* Allow for uc_sigmask growth. Glibc uses a 1024-bit sigset_t. */ - int __unused[32 - (sizeof (sigset_t) / sizeof (int))]; + int unused[32 - (sizeof (sigset_t) / sizeof (int))]; //struct i386_xstate_cntxt uc_xstate; struct i386_xstate xstate; } i386_ucontext_t; diff --git a/src/libtools/threads.c b/src/libtools/threads.c index 0837dbb7d9..657d349dd9 100755 --- a/src/libtools/threads.c +++ b/src/libtools/threads.c @@ -51,7 +51,7 @@ typedef struct jump_buff_i386_s { typedef struct __jmp_buf_tag_s { jump_buff_i386_t __jmpbuf; int __mask_was_saved; - __sigset_t __saved_mask; + sigset_t __saved_mask; } __jmp_buf_tag_t; typedef struct x86_unwind_buff_s { @@ -65,7 +65,9 @@ typedef struct x86_unwind_buff_s { typedef void(*vFv_t)(); KHASH_MAP_INIT_INT(threadstack, threadstack_t*) +#ifndef ANDROID KHASH_MAP_INIT_INT(cancelthread, __pthread_unwind_buf_t*) +#endif void CleanStackSize(box86context_t* context) { @@ -132,6 +134,8 @@ static void FreeCancelThread(box86context_t* context) if(!context) return; } + +#ifndef ANDROID static __pthread_unwind_buf_t* AddCancelThread(x86_unwind_buff_t* buff) { __pthread_unwind_buf_t* r = (__pthread_unwind_buf_t*)calloc(1, sizeof(__pthread_unwind_buf_t)); @@ -150,6 +154,7 @@ static void DelCancelThread(x86_unwind_buff_t* buff) free(r); buff->__pad[3] = NULL; } +#endif typedef struct emuthread_s { uintptr_t fnc; @@ -336,6 +341,7 @@ void* my_prepare_thread(x86emu_t *emu, void* f, void* arg, int ssize, void** pet void my_longjmp(x86emu_t* emu, /*struct __jmp_buf_tag __env[1]*/void *p, int32_t __val); +#ifndef ANDROID #define CANCEL_MAX 8 static __thread x86emu_t* cancel_emu[CANCEL_MAX] = {0}; static __thread x86_unwind_buff_t* cancel_buff[CANCEL_MAX] = {0}; @@ -390,6 +396,7 @@ EXPORT void my___pthread_unwind_next(x86emu_t* emu, void* p) // just in case it does return emu->quit = 1; } +#endif KHASH_MAP_INIT_INT(once, int) @@ -609,6 +616,7 @@ EXPORT int my_pthread_attr_setscope(x86emu_t* emu, void* attr, int scope) // but PTHREAD_SCOPE_PROCESS doesn't seem supported on ARM linux, and PTHREAD_SCOPE_SYSTEM is default } +#ifndef ANDROID EXPORT void my__pthread_cleanup_push_defer(x86emu_t* emu, void* buffer, void* routine, void* arg) { _pthread_cleanup_push_defer(buffer, findcleanup_routineFct(routine), arg); @@ -677,6 +685,7 @@ EXPORT int my_pthread_attr_setaffinity_np(x86emu_t* emu, void* attr, uint32_t cp return ret; } +#endif EXPORT int my_pthread_kill(x86emu_t* emu, void* thread, int sig) { @@ -778,7 +787,7 @@ emu_jmpbuf_t* GetJmpBuf() emu_jmpbuf_t *ejb = (emu_jmpbuf_t*)pthread_getspecific(jmpbuf_key); if(!ejb) { ejb = (emu_jmpbuf_t*)calloc(1, sizeof(emu_jmpbuf_t)); - ejb->jmpbuf = calloc(1, sizeof(struct __jmp_buf_tag)); + ejb->jmpbuf = calloc(1, sizeof(jmp_buf)); pthread_setspecific(jmpbuf_key, ejb); } return ejb; diff --git a/src/main.c b/src/main.c index 13fa9063eb..0971b6ae21 100755 --- a/src/main.c +++ b/src/main.c @@ -803,7 +803,10 @@ static void free_contextargv() free(my_context->argv[i]); } +#ifndef ANDROID const char **environ __attribute__((weak)) = NULL; +#endif + int main(int argc, const char **argv, const char **env) { init_auxval(argc, argv, environ?environ:env); diff --git a/src/wrapped/generated/functions_list.txt b/src/wrapped/generated/functions_list.txt index 64a9e9b80c..f62bdf35c8 100644 --- a/src/wrapped/generated/functions_list.txt +++ b/src/wrapped/generated/functions_list.txt @@ -442,7 +442,6 @@ #() lFppi #() lFppL #() lFSpl -#() LFiii #() LFpii #() LFpip #() LFpLi @@ -510,8 +509,6 @@ #() pFSpp #() vFEiip #() vFEipV -#() vFEpii -#() vFEpiL #() vFEpip #() vFEpuu #() vFEpup @@ -567,7 +564,6 @@ #() vFpiUu #() vFpifi #() vFpipi -#() vFpipu #() vFpipp #() vFpipG #() vFpCiW @@ -737,7 +733,6 @@ #() uFEipp #() uFEupp #() uFEpup -#() uFEppu #() uFEppp #() uFifff #() uFippu @@ -831,7 +826,6 @@ #() pFpppV #() pFSppi #() vFEippp -#() vFEpipu #() vFEpuup #() vFEpupp #() vFEpLLp @@ -1013,7 +1007,6 @@ #() iFpplpp #() iFppLwp #() iFppLip -#() iFppLpi #() iFppLpL #() iFppLpp #() iFpppii @@ -1096,7 +1089,6 @@ #() pFppiup #() pFppipi #() pFppipp -#() pFppuui #() pFppuuu #() pFppuup #() pFpppii @@ -1161,7 +1153,6 @@ #() vFpiiipp #() vFpiiuuu #() vFpiippp -#() vFpipiiu #() vFpipipV #() vFpipppi #() vFpipppp @@ -1272,7 +1263,6 @@ #() iFpplppi #() iFppLupp #() iFppLpLp -#() iFppLppp #() iFpppiuu #() iFpppipp #() iFpppuii @@ -1319,7 +1309,6 @@ #() pFdddddd #() pFpiiiiu #() pFpiiCCC -#() pFpiiuuu #() pFpippip #() pFpuuuuu #() pFplpppp @@ -1722,7 +1711,6 @@ #() iFiiiiiiiiip #() iFpuipuppppp #() iFpuupiuiipp -#() iFppipiippii #() iFppuuiiiiii #() iFppuuiiuupi #() iFpppLLipppp diff --git a/src/wrapped/generated/wrapper.c b/src/wrapped/generated/wrapper.c index 6156beecc5..4146993f4f 100644 --- a/src/wrapped/generated/wrapper.c +++ b/src/wrapped/generated/wrapper.c @@ -513,7 +513,6 @@ typedef intptr_t (*lFpLp_t)(void*, uintptr_t, void*); typedef intptr_t (*lFppi_t)(void*, void*, int32_t); typedef intptr_t (*lFppL_t)(void*, void*, uintptr_t); typedef intptr_t (*lFSpl_t)(void*, void*, intptr_t); -typedef uintptr_t (*LFiii_t)(int32_t, int32_t, int32_t); typedef uintptr_t (*LFpii_t)(void*, int32_t, int32_t); typedef uintptr_t (*LFpip_t)(void*, int32_t, void*); typedef uintptr_t (*LFpLi_t)(void*, uintptr_t, int32_t); @@ -581,8 +580,6 @@ typedef void* (*pFSpl_t)(void*, void*, intptr_t); typedef void* (*pFSpp_t)(void*, void*, void*); typedef void (*vFEiip_t)(x86emu_t*, int32_t, int32_t, void*); typedef void (*vFEipV_t)(x86emu_t*, int32_t, void*, void*); -typedef void (*vFEpii_t)(x86emu_t*, void*, int32_t, int32_t); -typedef void (*vFEpiL_t)(x86emu_t*, void*, int32_t, uintptr_t); typedef void (*vFEpip_t)(x86emu_t*, void*, int32_t, void*); typedef void (*vFEpuu_t)(x86emu_t*, void*, uint32_t, uint32_t); typedef void (*vFEpup_t)(x86emu_t*, void*, uint32_t, void*); @@ -638,7 +635,6 @@ typedef void (*vFpiup_t)(void*, int32_t, uint32_t, void*); typedef void (*vFpiUu_t)(void*, int32_t, uint64_t, uint32_t); typedef void (*vFpifi_t)(void*, int32_t, float, int32_t); typedef void (*vFpipi_t)(void*, int32_t, void*, int32_t); -typedef void (*vFpipu_t)(void*, int32_t, void*, uint32_t); typedef void (*vFpipp_t)(void*, int32_t, void*, void*); typedef void (*vFpipG_t)(void*, int32_t, void*, void*); typedef void (*vFpCiW_t)(void*, uint8_t, int32_t, uint16_t); @@ -808,7 +804,6 @@ typedef int64_t (*IFSIii_t)(void*, int64_t, int32_t, int32_t); typedef uint32_t (*uFEipp_t)(x86emu_t*, int32_t, void*, void*); typedef uint32_t (*uFEupp_t)(x86emu_t*, uint32_t, void*, void*); typedef uint32_t (*uFEpup_t)(x86emu_t*, void*, uint32_t, void*); -typedef uint32_t (*uFEppu_t)(x86emu_t*, void*, void*, uint32_t); typedef uint32_t (*uFEppp_t)(x86emu_t*, void*, void*, void*); typedef uint32_t (*uFifff_t)(int32_t, float, float, float); typedef uint32_t (*uFippu_t)(int32_t, void*, void*, uint32_t); @@ -902,7 +897,6 @@ typedef void* (*pFpppp_t)(void*, void*, void*, void*); typedef void* (*pFpppV_t)(void*, void*, void*, void*); typedef void* (*pFSppi_t)(void*, void*, void*, int32_t); typedef void (*vFEippp_t)(x86emu_t*, int32_t, void*, void*, void*); -typedef void (*vFEpipu_t)(x86emu_t*, void*, int32_t, void*, uint32_t); typedef void (*vFEpuup_t)(x86emu_t*, void*, uint32_t, uint32_t, void*); typedef void (*vFEpupp_t)(x86emu_t*, void*, uint32_t, void*, void*); typedef void (*vFEpLLp_t)(x86emu_t*, void*, uintptr_t, uintptr_t, void*); @@ -1084,7 +1078,6 @@ typedef int32_t (*iFppllp_t)(void*, void*, intptr_t, intptr_t, void*); typedef int32_t (*iFpplpp_t)(void*, void*, intptr_t, void*, void*); typedef int32_t (*iFppLwp_t)(void*, void*, uintptr_t, int16_t, void*); typedef int32_t (*iFppLip_t)(void*, void*, uintptr_t, int32_t, void*); -typedef int32_t (*iFppLpi_t)(void*, void*, uintptr_t, void*, int32_t); typedef int32_t (*iFppLpL_t)(void*, void*, uintptr_t, void*, uintptr_t); typedef int32_t (*iFppLpp_t)(void*, void*, uintptr_t, void*, void*); typedef int32_t (*iFpppii_t)(void*, void*, void*, int32_t, int32_t); @@ -1167,7 +1160,6 @@ typedef void* (*pFppiip_t)(void*, void*, int32_t, int32_t, void*); typedef void* (*pFppiup_t)(void*, void*, int32_t, uint32_t, void*); typedef void* (*pFppipi_t)(void*, void*, int32_t, void*, int32_t); typedef void* (*pFppipp_t)(void*, void*, int32_t, void*, void*); -typedef void* (*pFppuui_t)(void*, void*, uint32_t, uint32_t, int32_t); typedef void* (*pFppuuu_t)(void*, void*, uint32_t, uint32_t, uint32_t); typedef void* (*pFppuup_t)(void*, void*, uint32_t, uint32_t, void*); typedef void* (*pFpppii_t)(void*, void*, void*, int32_t, int32_t); @@ -1232,7 +1224,6 @@ typedef void (*vFpiiiii_t)(void*, int32_t, int32_t, int32_t, int32_t, int32_t); typedef void (*vFpiiipp_t)(void*, int32_t, int32_t, int32_t, void*, void*); typedef void (*vFpiiuuu_t)(void*, int32_t, int32_t, uint32_t, uint32_t, uint32_t); typedef void (*vFpiippp_t)(void*, int32_t, int32_t, void*, void*, void*); -typedef void (*vFpipiiu_t)(void*, int32_t, void*, int32_t, int32_t, uint32_t); typedef void (*vFpipipV_t)(void*, int32_t, void*, int32_t, void*, void*); typedef void (*vFpipppi_t)(void*, int32_t, void*, void*, void*, int32_t); typedef void (*vFpipppp_t)(void*, int32_t, void*, void*, void*, void*); @@ -1343,7 +1334,6 @@ typedef int32_t (*iFppdidd_t)(void*, void*, double, int32_t, double, double); typedef int32_t (*iFpplppi_t)(void*, void*, intptr_t, void*, void*, int32_t); typedef int32_t (*iFppLupp_t)(void*, void*, uintptr_t, uint32_t, void*, void*); typedef int32_t (*iFppLpLp_t)(void*, void*, uintptr_t, void*, uintptr_t, void*); -typedef int32_t (*iFppLppp_t)(void*, void*, uintptr_t, void*, void*, void*); typedef int32_t (*iFpppiuu_t)(void*, void*, void*, int32_t, uint32_t, uint32_t); typedef int32_t (*iFpppipp_t)(void*, void*, void*, int32_t, void*, void*); typedef int32_t (*iFpppuii_t)(void*, void*, void*, uint32_t, int32_t, int32_t); @@ -1390,7 +1380,6 @@ typedef void* (*pFiCiiCi_t)(int32_t, uint8_t, int32_t, int32_t, uint8_t, int32_t typedef void* (*pFdddddd_t)(double, double, double, double, double, double); typedef void* (*pFpiiiiu_t)(void*, int32_t, int32_t, int32_t, int32_t, uint32_t); typedef void* (*pFpiiCCC_t)(void*, int32_t, int32_t, uint8_t, uint8_t, uint8_t); -typedef void* (*pFpiiuuu_t)(void*, int32_t, int32_t, uint32_t, uint32_t, uint32_t); typedef void* (*pFpippip_t)(void*, int32_t, void*, void*, int32_t, void*); typedef void* (*pFpuuuuu_t)(void*, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t); typedef void* (*pFplpppp_t)(void*, intptr_t, void*, void*, void*, void*); @@ -1793,7 +1782,6 @@ typedef int32_t (*iFEppppppipp_t)(x86emu_t*, void*, void*, void*, void*, void*, typedef int32_t (*iFiiiiiiiiip_t)(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, void*); typedef int32_t (*iFpuipuppppp_t)(void*, uint32_t, int32_t, void*, uint32_t, void*, void*, void*, void*, void*); typedef int32_t (*iFpuupiuiipp_t)(void*, uint32_t, uint32_t, void*, int32_t, uint32_t, int32_t, int32_t, void*, void*); -typedef int32_t (*iFppipiippii_t)(void*, void*, int32_t, void*, int32_t, int32_t, void*, void*, int32_t, int32_t); typedef int32_t (*iFppuuiiiiii_t)(void*, void*, uint32_t, uint32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t); typedef int32_t (*iFppuuiiuupi_t)(void*, void*, uint32_t, uint32_t, int32_t, int32_t, uint32_t, uint32_t, void*, int32_t); typedef int32_t (*iFpppLLipppp_t)(void*, void*, void*, uintptr_t, uintptr_t, int32_t, void*, void*, void*, void*); @@ -2429,7 +2417,6 @@ void lFpLp(x86emu_t *emu, uintptr_t fcn) { lFpLp_t fn = (lFpLp_t)fcn; R_EAX=(int void lFppi(x86emu_t *emu, uintptr_t fcn) { lFppi_t fn = (lFppi_t)fcn; R_EAX=(intptr_t)fn(*(void**)(R_ESP + 4), *(void**)(R_ESP + 8), *(int32_t*)(R_ESP + 12)); } void lFppL(x86emu_t *emu, uintptr_t fcn) { lFppL_t fn = (lFppL_t)fcn; R_EAX=(intptr_t)fn(*(void**)(R_ESP + 4), *(void**)(R_ESP + 8), *(uintptr_t*)(R_ESP + 12)); } void lFSpl(x86emu_t *emu, uintptr_t fcn) { lFSpl_t fn = (lFSpl_t)fcn; R_EAX=(intptr_t)fn(io_convert(*(void**)(R_ESP + 4)), *(void**)(R_ESP + 8), *(intptr_t*)(R_ESP + 12)); } -void LFiii(x86emu_t *emu, uintptr_t fcn) { LFiii_t fn = (LFiii_t)fcn; R_EAX=(uintptr_t)fn(*(int32_t*)(R_ESP + 4), *(int32_t*)(R_ESP + 8), *(int32_t*)(R_ESP + 12)); } void LFpii(x86emu_t *emu, uintptr_t fcn) { LFpii_t fn = (LFpii_t)fcn; R_EAX=(uintptr_t)fn(*(void**)(R_ESP + 4), *(int32_t*)(R_ESP + 8), *(int32_t*)(R_ESP + 12)); } void LFpip(x86emu_t *emu, uintptr_t fcn) { LFpip_t fn = (LFpip_t)fcn; R_EAX=(uintptr_t)fn(*(void**)(R_ESP + 4), *(int32_t*)(R_ESP + 8), *(void**)(R_ESP + 12)); } void LFpLi(x86emu_t *emu, uintptr_t fcn) { LFpLi_t fn = (LFpLi_t)fcn; R_EAX=(uintptr_t)fn(*(void**)(R_ESP + 4), *(uintptr_t*)(R_ESP + 8), *(int32_t*)(R_ESP + 12)); } @@ -2497,8 +2484,6 @@ void pFSpl(x86emu_t *emu, uintptr_t fcn) { pFSpl_t fn = (pFSpl_t)fcn; R_EAX=(uin void pFSpp(x86emu_t *emu, uintptr_t fcn) { pFSpp_t fn = (pFSpp_t)fcn; R_EAX=(uintptr_t)fn(io_convert(*(void**)(R_ESP + 4)), *(void**)(R_ESP + 8), *(void**)(R_ESP + 12)); } void vFEiip(x86emu_t *emu, uintptr_t fcn) { vFEiip_t fn = (vFEiip_t)fcn; fn(emu, *(int32_t*)(R_ESP + 4), *(int32_t*)(R_ESP + 8), *(void**)(R_ESP + 12)); } void vFEipV(x86emu_t *emu, uintptr_t fcn) { vFEipV_t fn = (vFEipV_t)fcn; fn(emu, *(int32_t*)(R_ESP + 4), *(void**)(R_ESP + 8), (void*)(R_ESP + 12)); } -void vFEpii(x86emu_t *emu, uintptr_t fcn) { vFEpii_t fn = (vFEpii_t)fcn; fn(emu, *(void**)(R_ESP + 4), *(int32_t*)(R_ESP + 8), *(int32_t*)(R_ESP + 12)); } -void vFEpiL(x86emu_t *emu, uintptr_t fcn) { vFEpiL_t fn = (vFEpiL_t)fcn; fn(emu, *(void**)(R_ESP + 4), *(int32_t*)(R_ESP + 8), *(uintptr_t*)(R_ESP + 12)); } void vFEpip(x86emu_t *emu, uintptr_t fcn) { vFEpip_t fn = (vFEpip_t)fcn; fn(emu, *(void**)(R_ESP + 4), *(int32_t*)(R_ESP + 8), *(void**)(R_ESP + 12)); } void vFEpuu(x86emu_t *emu, uintptr_t fcn) { vFEpuu_t fn = (vFEpuu_t)fcn; fn(emu, *(void**)(R_ESP + 4), *(uint32_t*)(R_ESP + 8), *(uint32_t*)(R_ESP + 12)); } void vFEpup(x86emu_t *emu, uintptr_t fcn) { vFEpup_t fn = (vFEpup_t)fcn; fn(emu, *(void**)(R_ESP + 4), *(uint32_t*)(R_ESP + 8), *(void**)(R_ESP + 12)); } @@ -2554,7 +2539,6 @@ void vFpiup(x86emu_t *emu, uintptr_t fcn) { vFpiup_t fn = (vFpiup_t)fcn; fn(*(vo void vFpiUu(x86emu_t *emu, uintptr_t fcn) { vFpiUu_t fn = (vFpiUu_t)fcn; fn(*(void**)(R_ESP + 4), *(int32_t*)(R_ESP + 8), *(uint64_t*)(R_ESP + 12), *(uint32_t*)(R_ESP + 20)); } void vFpifi(x86emu_t *emu, uintptr_t fcn) { vFpifi_t fn = (vFpifi_t)fcn; fn(*(void**)(R_ESP + 4), *(int32_t*)(R_ESP + 8), *(float*)(R_ESP + 12), *(int32_t*)(R_ESP + 16)); } void vFpipi(x86emu_t *emu, uintptr_t fcn) { vFpipi_t fn = (vFpipi_t)fcn; fn(*(void**)(R_ESP + 4), *(int32_t*)(R_ESP + 8), *(void**)(R_ESP + 12), *(int32_t*)(R_ESP + 16)); } -void vFpipu(x86emu_t *emu, uintptr_t fcn) { vFpipu_t fn = (vFpipu_t)fcn; fn(*(void**)(R_ESP + 4), *(int32_t*)(R_ESP + 8), *(void**)(R_ESP + 12), *(uint32_t*)(R_ESP + 16)); } void vFpipp(x86emu_t *emu, uintptr_t fcn) { vFpipp_t fn = (vFpipp_t)fcn; fn(*(void**)(R_ESP + 4), *(int32_t*)(R_ESP + 8), *(void**)(R_ESP + 12), *(void**)(R_ESP + 16)); } void vFpipG(x86emu_t *emu, uintptr_t fcn) { vFpipG_t fn = (vFpipG_t)fcn; my_GValue_t arg16; alignGValue(&arg16, *(void**)(R_ESP + 16)); fn(*(void**)(R_ESP + 4), *(int32_t*)(R_ESP + 8), *(void**)(R_ESP + 12), &arg16); unalignGValue(*(void**)(R_ESP + 16), &arg16); } void vFpCiW(x86emu_t *emu, uintptr_t fcn) { vFpCiW_t fn = (vFpCiW_t)fcn; fn(*(void**)(R_ESP + 4), *(uint8_t*)(R_ESP + 8), *(int32_t*)(R_ESP + 12), *(uint16_t*)(R_ESP + 16)); } @@ -2724,7 +2708,6 @@ void IFSIii(x86emu_t *emu, uintptr_t fcn) { IFSIii_t fn = (IFSIii_t)fcn; ui64_t void uFEipp(x86emu_t *emu, uintptr_t fcn) { uFEipp_t fn = (uFEipp_t)fcn; R_EAX=(uint32_t)fn(emu, *(int32_t*)(R_ESP + 4), *(void**)(R_ESP + 8), *(void**)(R_ESP + 12)); } void uFEupp(x86emu_t *emu, uintptr_t fcn) { uFEupp_t fn = (uFEupp_t)fcn; R_EAX=(uint32_t)fn(emu, *(uint32_t*)(R_ESP + 4), *(void**)(R_ESP + 8), *(void**)(R_ESP + 12)); } void uFEpup(x86emu_t *emu, uintptr_t fcn) { uFEpup_t fn = (uFEpup_t)fcn; R_EAX=(uint32_t)fn(emu, *(void**)(R_ESP + 4), *(uint32_t*)(R_ESP + 8), *(void**)(R_ESP + 12)); } -void uFEppu(x86emu_t *emu, uintptr_t fcn) { uFEppu_t fn = (uFEppu_t)fcn; R_EAX=(uint32_t)fn(emu, *(void**)(R_ESP + 4), *(void**)(R_ESP + 8), *(uint32_t*)(R_ESP + 12)); } void uFEppp(x86emu_t *emu, uintptr_t fcn) { uFEppp_t fn = (uFEppp_t)fcn; R_EAX=(uint32_t)fn(emu, *(void**)(R_ESP + 4), *(void**)(R_ESP + 8), *(void**)(R_ESP + 12)); } void uFifff(x86emu_t *emu, uintptr_t fcn) { uFifff_t fn = (uFifff_t)fcn; R_EAX=(uint32_t)fn(*(int32_t*)(R_ESP + 4), *(float*)(R_ESP + 8), *(float*)(R_ESP + 12), *(float*)(R_ESP + 16)); } void uFippu(x86emu_t *emu, uintptr_t fcn) { uFippu_t fn = (uFippu_t)fcn; R_EAX=(uint32_t)fn(*(int32_t*)(R_ESP + 4), *(void**)(R_ESP + 8), *(void**)(R_ESP + 12), *(uint32_t*)(R_ESP + 16)); } @@ -2818,7 +2801,6 @@ void pFpppp(x86emu_t *emu, uintptr_t fcn) { pFpppp_t fn = (pFpppp_t)fcn; R_EAX=( void pFpppV(x86emu_t *emu, uintptr_t fcn) { pFpppV_t fn = (pFpppV_t)fcn; R_EAX=(uintptr_t)fn(*(void**)(R_ESP + 4), *(void**)(R_ESP + 8), *(void**)(R_ESP + 12), (void*)(R_ESP + 16)); } void pFSppi(x86emu_t *emu, uintptr_t fcn) { pFSppi_t fn = (pFSppi_t)fcn; R_EAX=(uintptr_t)fn(io_convert(*(void**)(R_ESP + 4)), *(void**)(R_ESP + 8), *(void**)(R_ESP + 12), *(int32_t*)(R_ESP + 16)); } void vFEippp(x86emu_t *emu, uintptr_t fcn) { vFEippp_t fn = (vFEippp_t)fcn; fn(emu, *(int32_t*)(R_ESP + 4), *(void**)(R_ESP + 8), *(void**)(R_ESP + 12), *(void**)(R_ESP + 16)); } -void vFEpipu(x86emu_t *emu, uintptr_t fcn) { vFEpipu_t fn = (vFEpipu_t)fcn; fn(emu, *(void**)(R_ESP + 4), *(int32_t*)(R_ESP + 8), *(void**)(R_ESP + 12), *(uint32_t*)(R_ESP + 16)); } void vFEpuup(x86emu_t *emu, uintptr_t fcn) { vFEpuup_t fn = (vFEpuup_t)fcn; fn(emu, *(void**)(R_ESP + 4), *(uint32_t*)(R_ESP + 8), *(uint32_t*)(R_ESP + 12), *(void**)(R_ESP + 16)); } void vFEpupp(x86emu_t *emu, uintptr_t fcn) { vFEpupp_t fn = (vFEpupp_t)fcn; fn(emu, *(void**)(R_ESP + 4), *(uint32_t*)(R_ESP + 8), *(void**)(R_ESP + 12), *(void**)(R_ESP + 16)); } void vFEpLLp(x86emu_t *emu, uintptr_t fcn) { vFEpLLp_t fn = (vFEpLLp_t)fcn; fn(emu, *(void**)(R_ESP + 4), *(uintptr_t*)(R_ESP + 8), *(uintptr_t*)(R_ESP + 12), *(void**)(R_ESP + 16)); } @@ -3000,7 +2982,6 @@ void iFppllp(x86emu_t *emu, uintptr_t fcn) { iFppllp_t fn = (iFppllp_t)fcn; R_EA void iFpplpp(x86emu_t *emu, uintptr_t fcn) { iFpplpp_t fn = (iFpplpp_t)fcn; R_EAX=fn(*(void**)(R_ESP + 4), *(void**)(R_ESP + 8), *(intptr_t*)(R_ESP + 12), *(void**)(R_ESP + 16), *(void**)(R_ESP + 20)); } void iFppLwp(x86emu_t *emu, uintptr_t fcn) { iFppLwp_t fn = (iFppLwp_t)fcn; R_EAX=fn(*(void**)(R_ESP + 4), *(void**)(R_ESP + 8), *(uintptr_t*)(R_ESP + 12), *(int16_t*)(R_ESP + 16), *(void**)(R_ESP + 20)); } void iFppLip(x86emu_t *emu, uintptr_t fcn) { iFppLip_t fn = (iFppLip_t)fcn; R_EAX=fn(*(void**)(R_ESP + 4), *(void**)(R_ESP + 8), *(uintptr_t*)(R_ESP + 12), *(int32_t*)(R_ESP + 16), *(void**)(R_ESP + 20)); } -void iFppLpi(x86emu_t *emu, uintptr_t fcn) { iFppLpi_t fn = (iFppLpi_t)fcn; R_EAX=fn(*(void**)(R_ESP + 4), *(void**)(R_ESP + 8), *(uintptr_t*)(R_ESP + 12), *(void**)(R_ESP + 16), *(int32_t*)(R_ESP + 20)); } void iFppLpL(x86emu_t *emu, uintptr_t fcn) { iFppLpL_t fn = (iFppLpL_t)fcn; R_EAX=fn(*(void**)(R_ESP + 4), *(void**)(R_ESP + 8), *(uintptr_t*)(R_ESP + 12), *(void**)(R_ESP + 16), *(uintptr_t*)(R_ESP + 20)); } void iFppLpp(x86emu_t *emu, uintptr_t fcn) { iFppLpp_t fn = (iFppLpp_t)fcn; R_EAX=fn(*(void**)(R_ESP + 4), *(void**)(R_ESP + 8), *(uintptr_t*)(R_ESP + 12), *(void**)(R_ESP + 16), *(void**)(R_ESP + 20)); } void iFpppii(x86emu_t *emu, uintptr_t fcn) { iFpppii_t fn = (iFpppii_t)fcn; R_EAX=fn(*(void**)(R_ESP + 4), *(void**)(R_ESP + 8), *(void**)(R_ESP + 12), *(int32_t*)(R_ESP + 16), *(int32_t*)(R_ESP + 20)); } @@ -3083,7 +3064,6 @@ void pFppiip(x86emu_t *emu, uintptr_t fcn) { pFppiip_t fn = (pFppiip_t)fcn; R_EA void pFppiup(x86emu_t *emu, uintptr_t fcn) { pFppiup_t fn = (pFppiup_t)fcn; R_EAX=(uintptr_t)fn(*(void**)(R_ESP + 4), *(void**)(R_ESP + 8), *(int32_t*)(R_ESP + 12), *(uint32_t*)(R_ESP + 16), *(void**)(R_ESP + 20)); } void pFppipi(x86emu_t *emu, uintptr_t fcn) { pFppipi_t fn = (pFppipi_t)fcn; R_EAX=(uintptr_t)fn(*(void**)(R_ESP + 4), *(void**)(R_ESP + 8), *(int32_t*)(R_ESP + 12), *(void**)(R_ESP + 16), *(int32_t*)(R_ESP + 20)); } void pFppipp(x86emu_t *emu, uintptr_t fcn) { pFppipp_t fn = (pFppipp_t)fcn; R_EAX=(uintptr_t)fn(*(void**)(R_ESP + 4), *(void**)(R_ESP + 8), *(int32_t*)(R_ESP + 12), *(void**)(R_ESP + 16), *(void**)(R_ESP + 20)); } -void pFppuui(x86emu_t *emu, uintptr_t fcn) { pFppuui_t fn = (pFppuui_t)fcn; R_EAX=(uintptr_t)fn(*(void**)(R_ESP + 4), *(void**)(R_ESP + 8), *(uint32_t*)(R_ESP + 12), *(uint32_t*)(R_ESP + 16), *(int32_t*)(R_ESP + 20)); } void pFppuuu(x86emu_t *emu, uintptr_t fcn) { pFppuuu_t fn = (pFppuuu_t)fcn; R_EAX=(uintptr_t)fn(*(void**)(R_ESP + 4), *(void**)(R_ESP + 8), *(uint32_t*)(R_ESP + 12), *(uint32_t*)(R_ESP + 16), *(uint32_t*)(R_ESP + 20)); } void pFppuup(x86emu_t *emu, uintptr_t fcn) { pFppuup_t fn = (pFppuup_t)fcn; R_EAX=(uintptr_t)fn(*(void**)(R_ESP + 4), *(void**)(R_ESP + 8), *(uint32_t*)(R_ESP + 12), *(uint32_t*)(R_ESP + 16), *(void**)(R_ESP + 20)); } void pFpppii(x86emu_t *emu, uintptr_t fcn) { pFpppii_t fn = (pFpppii_t)fcn; R_EAX=(uintptr_t)fn(*(void**)(R_ESP + 4), *(void**)(R_ESP + 8), *(void**)(R_ESP + 12), *(int32_t*)(R_ESP + 16), *(int32_t*)(R_ESP + 20)); } @@ -3148,7 +3128,6 @@ void vFpiiiii(x86emu_t *emu, uintptr_t fcn) { vFpiiiii_t fn = (vFpiiiii_t)fcn; f void vFpiiipp(x86emu_t *emu, uintptr_t fcn) { vFpiiipp_t fn = (vFpiiipp_t)fcn; fn(*(void**)(R_ESP + 4), *(int32_t*)(R_ESP + 8), *(int32_t*)(R_ESP + 12), *(int32_t*)(R_ESP + 16), *(void**)(R_ESP + 20), *(void**)(R_ESP + 24)); } void vFpiiuuu(x86emu_t *emu, uintptr_t fcn) { vFpiiuuu_t fn = (vFpiiuuu_t)fcn; fn(*(void**)(R_ESP + 4), *(int32_t*)(R_ESP + 8), *(int32_t*)(R_ESP + 12), *(uint32_t*)(R_ESP + 16), *(uint32_t*)(R_ESP + 20), *(uint32_t*)(R_ESP + 24)); } void vFpiippp(x86emu_t *emu, uintptr_t fcn) { vFpiippp_t fn = (vFpiippp_t)fcn; fn(*(void**)(R_ESP + 4), *(int32_t*)(R_ESP + 8), *(int32_t*)(R_ESP + 12), *(void**)(R_ESP + 16), *(void**)(R_ESP + 20), *(void**)(R_ESP + 24)); } -void vFpipiiu(x86emu_t *emu, uintptr_t fcn) { vFpipiiu_t fn = (vFpipiiu_t)fcn; fn(*(void**)(R_ESP + 4), *(int32_t*)(R_ESP + 8), *(void**)(R_ESP + 12), *(int32_t*)(R_ESP + 16), *(int32_t*)(R_ESP + 20), *(uint32_t*)(R_ESP + 24)); } void vFpipipV(x86emu_t *emu, uintptr_t fcn) { vFpipipV_t fn = (vFpipipV_t)fcn; fn(*(void**)(R_ESP + 4), *(int32_t*)(R_ESP + 8), *(void**)(R_ESP + 12), *(int32_t*)(R_ESP + 16), *(void**)(R_ESP + 20), (void*)(R_ESP + 24)); } void vFpipppi(x86emu_t *emu, uintptr_t fcn) { vFpipppi_t fn = (vFpipppi_t)fcn; fn(*(void**)(R_ESP + 4), *(int32_t*)(R_ESP + 8), *(void**)(R_ESP + 12), *(void**)(R_ESP + 16), *(void**)(R_ESP + 20), *(int32_t*)(R_ESP + 24)); } void vFpipppp(x86emu_t *emu, uintptr_t fcn) { vFpipppp_t fn = (vFpipppp_t)fcn; fn(*(void**)(R_ESP + 4), *(int32_t*)(R_ESP + 8), *(void**)(R_ESP + 12), *(void**)(R_ESP + 16), *(void**)(R_ESP + 20), *(void**)(R_ESP + 24)); } @@ -3259,7 +3238,6 @@ void iFppdidd(x86emu_t *emu, uintptr_t fcn) { iFppdidd_t fn = (iFppdidd_t)fcn; R void iFpplppi(x86emu_t *emu, uintptr_t fcn) { iFpplppi_t fn = (iFpplppi_t)fcn; R_EAX=fn(*(void**)(R_ESP + 4), *(void**)(R_ESP + 8), *(intptr_t*)(R_ESP + 12), *(void**)(R_ESP + 16), *(void**)(R_ESP + 20), *(int32_t*)(R_ESP + 24)); } void iFppLupp(x86emu_t *emu, uintptr_t fcn) { iFppLupp_t fn = (iFppLupp_t)fcn; R_EAX=fn(*(void**)(R_ESP + 4), *(void**)(R_ESP + 8), *(uintptr_t*)(R_ESP + 12), *(uint32_t*)(R_ESP + 16), *(void**)(R_ESP + 20), *(void**)(R_ESP + 24)); } void iFppLpLp(x86emu_t *emu, uintptr_t fcn) { iFppLpLp_t fn = (iFppLpLp_t)fcn; R_EAX=fn(*(void**)(R_ESP + 4), *(void**)(R_ESP + 8), *(uintptr_t*)(R_ESP + 12), *(void**)(R_ESP + 16), *(uintptr_t*)(R_ESP + 20), *(void**)(R_ESP + 24)); } -void iFppLppp(x86emu_t *emu, uintptr_t fcn) { iFppLppp_t fn = (iFppLppp_t)fcn; R_EAX=fn(*(void**)(R_ESP + 4), *(void**)(R_ESP + 8), *(uintptr_t*)(R_ESP + 12), *(void**)(R_ESP + 16), *(void**)(R_ESP + 20), *(void**)(R_ESP + 24)); } void iFpppiuu(x86emu_t *emu, uintptr_t fcn) { iFpppiuu_t fn = (iFpppiuu_t)fcn; R_EAX=fn(*(void**)(R_ESP + 4), *(void**)(R_ESP + 8), *(void**)(R_ESP + 12), *(int32_t*)(R_ESP + 16), *(uint32_t*)(R_ESP + 20), *(uint32_t*)(R_ESP + 24)); } void iFpppipp(x86emu_t *emu, uintptr_t fcn) { iFpppipp_t fn = (iFpppipp_t)fcn; R_EAX=fn(*(void**)(R_ESP + 4), *(void**)(R_ESP + 8), *(void**)(R_ESP + 12), *(int32_t*)(R_ESP + 16), *(void**)(R_ESP + 20), *(void**)(R_ESP + 24)); } void iFpppuii(x86emu_t *emu, uintptr_t fcn) { iFpppuii_t fn = (iFpppuii_t)fcn; R_EAX=fn(*(void**)(R_ESP + 4), *(void**)(R_ESP + 8), *(void**)(R_ESP + 12), *(uint32_t*)(R_ESP + 16), *(int32_t*)(R_ESP + 20), *(int32_t*)(R_ESP + 24)); } @@ -3306,7 +3284,6 @@ void pFiCiiCi(x86emu_t *emu, uintptr_t fcn) { pFiCiiCi_t fn = (pFiCiiCi_t)fcn; R void pFdddddd(x86emu_t *emu, uintptr_t fcn) { pFdddddd_t fn = (pFdddddd_t)fcn; R_EAX=(uintptr_t)fn(*(double*)(R_ESP + 4), *(double*)(R_ESP + 12), *(double*)(R_ESP + 20), *(double*)(R_ESP + 28), *(double*)(R_ESP + 36), *(double*)(R_ESP + 44)); } void pFpiiiiu(x86emu_t *emu, uintptr_t fcn) { pFpiiiiu_t fn = (pFpiiiiu_t)fcn; R_EAX=(uintptr_t)fn(*(void**)(R_ESP + 4), *(int32_t*)(R_ESP + 8), *(int32_t*)(R_ESP + 12), *(int32_t*)(R_ESP + 16), *(int32_t*)(R_ESP + 20), *(uint32_t*)(R_ESP + 24)); } void pFpiiCCC(x86emu_t *emu, uintptr_t fcn) { pFpiiCCC_t fn = (pFpiiCCC_t)fcn; R_EAX=(uintptr_t)fn(*(void**)(R_ESP + 4), *(int32_t*)(R_ESP + 8), *(int32_t*)(R_ESP + 12), *(uint8_t*)(R_ESP + 16), *(uint8_t*)(R_ESP + 20), *(uint8_t*)(R_ESP + 24)); } -void pFpiiuuu(x86emu_t *emu, uintptr_t fcn) { pFpiiuuu_t fn = (pFpiiuuu_t)fcn; R_EAX=(uintptr_t)fn(*(void**)(R_ESP + 4), *(int32_t*)(R_ESP + 8), *(int32_t*)(R_ESP + 12), *(uint32_t*)(R_ESP + 16), *(uint32_t*)(R_ESP + 20), *(uint32_t*)(R_ESP + 24)); } void pFpippip(x86emu_t *emu, uintptr_t fcn) { pFpippip_t fn = (pFpippip_t)fcn; R_EAX=(uintptr_t)fn(*(void**)(R_ESP + 4), *(int32_t*)(R_ESP + 8), *(void**)(R_ESP + 12), *(void**)(R_ESP + 16), *(int32_t*)(R_ESP + 20), *(void**)(R_ESP + 24)); } void pFpuuuuu(x86emu_t *emu, uintptr_t fcn) { pFpuuuuu_t fn = (pFpuuuuu_t)fcn; R_EAX=(uintptr_t)fn(*(void**)(R_ESP + 4), *(uint32_t*)(R_ESP + 8), *(uint32_t*)(R_ESP + 12), *(uint32_t*)(R_ESP + 16), *(uint32_t*)(R_ESP + 20), *(uint32_t*)(R_ESP + 24)); } void pFplpppp(x86emu_t *emu, uintptr_t fcn) { pFplpppp_t fn = (pFplpppp_t)fcn; R_EAX=(uintptr_t)fn(*(void**)(R_ESP + 4), *(intptr_t*)(R_ESP + 8), *(void**)(R_ESP + 12), *(void**)(R_ESP + 16), *(void**)(R_ESP + 20), *(void**)(R_ESP + 24)); } @@ -3709,7 +3686,6 @@ void iFEppppppipp(x86emu_t *emu, uintptr_t fcn) { iFEppppppipp_t fn = (iFEpppppp void iFiiiiiiiiip(x86emu_t *emu, uintptr_t fcn) { iFiiiiiiiiip_t fn = (iFiiiiiiiiip_t)fcn; R_EAX=fn(*(int32_t*)(R_ESP + 4), *(int32_t*)(R_ESP + 8), *(int32_t*)(R_ESP + 12), *(int32_t*)(R_ESP + 16), *(int32_t*)(R_ESP + 20), *(int32_t*)(R_ESP + 24), *(int32_t*)(R_ESP + 28), *(int32_t*)(R_ESP + 32), *(int32_t*)(R_ESP + 36), *(void**)(R_ESP + 40)); } void iFpuipuppppp(x86emu_t *emu, uintptr_t fcn) { iFpuipuppppp_t fn = (iFpuipuppppp_t)fcn; R_EAX=fn(*(void**)(R_ESP + 4), *(uint32_t*)(R_ESP + 8), *(int32_t*)(R_ESP + 12), *(void**)(R_ESP + 16), *(uint32_t*)(R_ESP + 20), *(void**)(R_ESP + 24), *(void**)(R_ESP + 28), *(void**)(R_ESP + 32), *(void**)(R_ESP + 36), *(void**)(R_ESP + 40)); } void iFpuupiuiipp(x86emu_t *emu, uintptr_t fcn) { iFpuupiuiipp_t fn = (iFpuupiuiipp_t)fcn; R_EAX=fn(*(void**)(R_ESP + 4), *(uint32_t*)(R_ESP + 8), *(uint32_t*)(R_ESP + 12), *(void**)(R_ESP + 16), *(int32_t*)(R_ESP + 20), *(uint32_t*)(R_ESP + 24), *(int32_t*)(R_ESP + 28), *(int32_t*)(R_ESP + 32), *(void**)(R_ESP + 36), *(void**)(R_ESP + 40)); } -void iFppipiippii(x86emu_t *emu, uintptr_t fcn) { iFppipiippii_t fn = (iFppipiippii_t)fcn; R_EAX=fn(*(void**)(R_ESP + 4), *(void**)(R_ESP + 8), *(int32_t*)(R_ESP + 12), *(void**)(R_ESP + 16), *(int32_t*)(R_ESP + 20), *(int32_t*)(R_ESP + 24), *(void**)(R_ESP + 28), *(void**)(R_ESP + 32), *(int32_t*)(R_ESP + 36), *(int32_t*)(R_ESP + 40)); } void iFppuuiiiiii(x86emu_t *emu, uintptr_t fcn) { iFppuuiiiiii_t fn = (iFppuuiiiiii_t)fcn; R_EAX=fn(*(void**)(R_ESP + 4), *(void**)(R_ESP + 8), *(uint32_t*)(R_ESP + 12), *(uint32_t*)(R_ESP + 16), *(int32_t*)(R_ESP + 20), *(int32_t*)(R_ESP + 24), *(int32_t*)(R_ESP + 28), *(int32_t*)(R_ESP + 32), *(int32_t*)(R_ESP + 36), *(int32_t*)(R_ESP + 40)); } void iFppuuiiuupi(x86emu_t *emu, uintptr_t fcn) { iFppuuiiuupi_t fn = (iFppuuiiuupi_t)fcn; R_EAX=fn(*(void**)(R_ESP + 4), *(void**)(R_ESP + 8), *(uint32_t*)(R_ESP + 12), *(uint32_t*)(R_ESP + 16), *(int32_t*)(R_ESP + 20), *(int32_t*)(R_ESP + 24), *(uint32_t*)(R_ESP + 28), *(uint32_t*)(R_ESP + 32), *(void**)(R_ESP + 36), *(int32_t*)(R_ESP + 40)); } void iFpppLLipppp(x86emu_t *emu, uintptr_t fcn) { iFpppLLipppp_t fn = (iFpppLLipppp_t)fcn; R_EAX=fn(*(void**)(R_ESP + 4), *(void**)(R_ESP + 8), *(void**)(R_ESP + 12), *(uintptr_t*)(R_ESP + 16), *(uintptr_t*)(R_ESP + 20), *(int32_t*)(R_ESP + 24), *(void**)(R_ESP + 28), *(void**)(R_ESP + 32), *(void**)(R_ESP + 36), *(void**)(R_ESP + 40)); } diff --git a/src/wrapped/generated/wrapper.h b/src/wrapped/generated/wrapper.h index b2d93b1f43..138afd2767 100644 --- a/src/wrapped/generated/wrapper.h +++ b/src/wrapped/generated/wrapper.h @@ -474,7 +474,6 @@ void lFpLp(x86emu_t *emu, uintptr_t fnc); void lFppi(x86emu_t *emu, uintptr_t fnc); void lFppL(x86emu_t *emu, uintptr_t fnc); void lFSpl(x86emu_t *emu, uintptr_t fnc); -void LFiii(x86emu_t *emu, uintptr_t fnc); void LFpii(x86emu_t *emu, uintptr_t fnc); void LFpip(x86emu_t *emu, uintptr_t fnc); void LFpLi(x86emu_t *emu, uintptr_t fnc); @@ -542,8 +541,6 @@ void pFSpl(x86emu_t *emu, uintptr_t fnc); void pFSpp(x86emu_t *emu, uintptr_t fnc); void vFEiip(x86emu_t *emu, uintptr_t fnc); void vFEipV(x86emu_t *emu, uintptr_t fnc); -void vFEpii(x86emu_t *emu, uintptr_t fnc); -void vFEpiL(x86emu_t *emu, uintptr_t fnc); void vFEpip(x86emu_t *emu, uintptr_t fnc); void vFEpuu(x86emu_t *emu, uintptr_t fnc); void vFEpup(x86emu_t *emu, uintptr_t fnc); @@ -599,7 +596,6 @@ void vFpiup(x86emu_t *emu, uintptr_t fnc); void vFpiUu(x86emu_t *emu, uintptr_t fnc); void vFpifi(x86emu_t *emu, uintptr_t fnc); void vFpipi(x86emu_t *emu, uintptr_t fnc); -void vFpipu(x86emu_t *emu, uintptr_t fnc); void vFpipp(x86emu_t *emu, uintptr_t fnc); void vFpipG(x86emu_t *emu, uintptr_t fnc); void vFpCiW(x86emu_t *emu, uintptr_t fnc); @@ -769,7 +765,6 @@ void IFSIii(x86emu_t *emu, uintptr_t fnc); void uFEipp(x86emu_t *emu, uintptr_t fnc); void uFEupp(x86emu_t *emu, uintptr_t fnc); void uFEpup(x86emu_t *emu, uintptr_t fnc); -void uFEppu(x86emu_t *emu, uintptr_t fnc); void uFEppp(x86emu_t *emu, uintptr_t fnc); void uFifff(x86emu_t *emu, uintptr_t fnc); void uFippu(x86emu_t *emu, uintptr_t fnc); @@ -863,7 +858,6 @@ void pFpppp(x86emu_t *emu, uintptr_t fnc); void pFpppV(x86emu_t *emu, uintptr_t fnc); void pFSppi(x86emu_t *emu, uintptr_t fnc); void vFEippp(x86emu_t *emu, uintptr_t fnc); -void vFEpipu(x86emu_t *emu, uintptr_t fnc); void vFEpuup(x86emu_t *emu, uintptr_t fnc); void vFEpupp(x86emu_t *emu, uintptr_t fnc); void vFEpLLp(x86emu_t *emu, uintptr_t fnc); @@ -1045,7 +1039,6 @@ void iFppllp(x86emu_t *emu, uintptr_t fnc); void iFpplpp(x86emu_t *emu, uintptr_t fnc); void iFppLwp(x86emu_t *emu, uintptr_t fnc); void iFppLip(x86emu_t *emu, uintptr_t fnc); -void iFppLpi(x86emu_t *emu, uintptr_t fnc); void iFppLpL(x86emu_t *emu, uintptr_t fnc); void iFppLpp(x86emu_t *emu, uintptr_t fnc); void iFpppii(x86emu_t *emu, uintptr_t fnc); @@ -1128,7 +1121,6 @@ void pFppiip(x86emu_t *emu, uintptr_t fnc); void pFppiup(x86emu_t *emu, uintptr_t fnc); void pFppipi(x86emu_t *emu, uintptr_t fnc); void pFppipp(x86emu_t *emu, uintptr_t fnc); -void pFppuui(x86emu_t *emu, uintptr_t fnc); void pFppuuu(x86emu_t *emu, uintptr_t fnc); void pFppuup(x86emu_t *emu, uintptr_t fnc); void pFpppii(x86emu_t *emu, uintptr_t fnc); @@ -1193,7 +1185,6 @@ void vFpiiiii(x86emu_t *emu, uintptr_t fnc); void vFpiiipp(x86emu_t *emu, uintptr_t fnc); void vFpiiuuu(x86emu_t *emu, uintptr_t fnc); void vFpiippp(x86emu_t *emu, uintptr_t fnc); -void vFpipiiu(x86emu_t *emu, uintptr_t fnc); void vFpipipV(x86emu_t *emu, uintptr_t fnc); void vFpipppi(x86emu_t *emu, uintptr_t fnc); void vFpipppp(x86emu_t *emu, uintptr_t fnc); @@ -1304,7 +1295,6 @@ void iFppdidd(x86emu_t *emu, uintptr_t fnc); void iFpplppi(x86emu_t *emu, uintptr_t fnc); void iFppLupp(x86emu_t *emu, uintptr_t fnc); void iFppLpLp(x86emu_t *emu, uintptr_t fnc); -void iFppLppp(x86emu_t *emu, uintptr_t fnc); void iFpppiuu(x86emu_t *emu, uintptr_t fnc); void iFpppipp(x86emu_t *emu, uintptr_t fnc); void iFpppuii(x86emu_t *emu, uintptr_t fnc); @@ -1351,7 +1341,6 @@ void pFiCiiCi(x86emu_t *emu, uintptr_t fnc); void pFdddddd(x86emu_t *emu, uintptr_t fnc); void pFpiiiiu(x86emu_t *emu, uintptr_t fnc); void pFpiiCCC(x86emu_t *emu, uintptr_t fnc); -void pFpiiuuu(x86emu_t *emu, uintptr_t fnc); void pFpippip(x86emu_t *emu, uintptr_t fnc); void pFpuuuuu(x86emu_t *emu, uintptr_t fnc); void pFplpppp(x86emu_t *emu, uintptr_t fnc); @@ -1754,7 +1743,6 @@ void iFEppppppipp(x86emu_t *emu, uintptr_t fnc); void iFiiiiiiiiip(x86emu_t *emu, uintptr_t fnc); void iFpuipuppppp(x86emu_t *emu, uintptr_t fnc); void iFpuupiuiipp(x86emu_t *emu, uintptr_t fnc); -void iFppipiippii(x86emu_t *emu, uintptr_t fnc); void iFppuuiiiiii(x86emu_t *emu, uintptr_t fnc); void iFppuuiiuupi(x86emu_t *emu, uintptr_t fnc); void iFpppLLipppp(x86emu_t *emu, uintptr_t fnc); diff --git a/src/wrapped/wrappedfreetype.c b/src/wrapped/wrappedfreetype.c index c31387ddda..64c4005b5a 100755 --- a/src/wrapped/wrappedfreetype.c +++ b/src/wrapped/wrappedfreetype.c @@ -18,7 +18,13 @@ #include "emu/x86emu_private.h" #include "myalign.h" -const char* freetypeName = "libfreetype.so.6"; +const char* freetypeName = +#ifdef ANDROID + "libfreetype.so" +#else + "libfreetype.so.6" +#endif + ; #define LIBNAME freetype typedef union FT_StreamDesc_s diff --git a/src/wrapped/wrappedgnutls.c b/src/wrapped/wrappedgnutls.c index 2ef245c47d..e679737933 100755 --- a/src/wrapped/wrappedgnutls.c +++ b/src/wrapped/wrappedgnutls.c @@ -18,7 +18,13 @@ #include "emu/x86emu_private.h" #include "callback.h" -const char* gnutlsName = "libgnutls.so.30"; +const char* gnutlsName = +#if ANDROID + "libgnutls.so" +#else + "libgnutls.so.30" +#endif + ; #define LIBNAME gnutls static library_t *my_lib = NULL; diff --git a/src/wrapped/wrappedlber.c b/src/wrapped/wrappedlber.c index efe0ca934c..feb03dd954 100755 --- a/src/wrapped/wrappedlber.c +++ b/src/wrapped/wrappedlber.c @@ -11,7 +11,13 @@ #include "librarian/library_private.h" #include "x86emu.h" -const char* lberName = "liblber-2.4.so.2"; +const char* lberName = +#ifdef ANDROID + "liblber-2.4.so" +#else + "liblber-2.4.so.2" +#endif + ; #define LIBNAME lber #include "wrappedlib_init.h" diff --git a/src/wrapped/wrappedlcms2.c b/src/wrapped/wrappedlcms2.c index a942a418c3..ce95ab1d2b 100755 --- a/src/wrapped/wrappedlcms2.c +++ b/src/wrapped/wrappedlcms2.c @@ -16,7 +16,13 @@ #include "librarian.h" #include "callback.h" -const char* lcms2Name = "liblcms2.so.2"; +const char* lcms2Name = +#ifdef ANDROID + "liblcms2.so" +#else + "liblcms2.so.2" +#endif + ; #define LIBNAME lcms2 static library_t* my_lib = NULL; diff --git a/src/wrapped/wrappedldapr.c b/src/wrapped/wrappedldapr.c index ff07653fed..71f9e68671 100755 --- a/src/wrapped/wrappedldapr.c +++ b/src/wrapped/wrappedldapr.c @@ -16,7 +16,13 @@ #include "librarian.h" #include "callback.h" -const char* ldaprName = "libldap_r-2.4.so.2"; +const char* ldaprName = +#ifdef ANDROID + "libldap_r-2.4.so" +#else + "libldap_r-2.4.so.2" +#endif + ; #define LIBNAME ldapr static library_t *my_lib = NULL; @@ -85,11 +91,17 @@ EXPORT int my_ldap_sasl_interactive_bind_s(x86emu_t* emu, void* ld, void* dn, vo return my->ldap_sasl_interactive_bind_s(ld, dn, mechs, sctrls, cctrls, flags, find_LDAP_SASL_INTERACT_PROC_Fct(f), defaults); } +#ifdef ANDROID +#define NEEDED_LIB "liblber-2.4.so" +#else +#define NEEDED_LIB "liblber-2.4.so.2" +#endif + #define CUSTOM_INIT \ lib->priv.w.p2 = getLdaprMy(lib); \ lib->priv.w.needed = 1; \ lib->priv.w.neededlibs = (char**)calloc(lib->priv.w.needed, sizeof(char*)); \ - lib->priv.w.neededlibs[0] = strdup("liblber-2.4.so.2"); \ + lib->priv.w.neededlibs[0] = strdup(NEEDED_LIB); \ my_lib = lib; #define CUSTOM_FINI \ diff --git a/src/wrapped/wrappedlibc.c b/src/wrapped/wrappedlibc.c index 6af8f751a1..480b849475 100755 --- a/src/wrapped/wrappedlibc.c +++ b/src/wrapped/wrappedlibc.c @@ -125,7 +125,14 @@ #undef glob #define LIBNAME libc -const char* libcName = "libc.so.6"; + +const char* libcName = +#ifdef ANDROID + "libc.so" +#else + "libc.so.6" +#endif + ; static library_t* my_lib = NULL; @@ -1107,6 +1114,32 @@ static int FillStatFromStat64(int vers, const struct stat64 *st64, void *st32) return 0; } +#ifdef ANDROID +EXPORT int my_stat(char* path, void* buf) +{ + struct stat64 st; + int r = stat64(path, &st); + UnalignStat64(&st, buf); + return r; +} + +EXPORT int my_fstat(int fd, void* buf) +{ + struct stat64 st; + int r = fstat64(fd, &st); + UnalignStat64(&st, buf); + return r; +} + +EXPORT int my_lstat(char* path, void* buf) +{ + struct stat64 st; + int r = lstat64(path, &st); + UnalignStat64(&st, buf); + return r; +} +#endif + EXPORT int my___fxstat(x86emu_t *emu, int vers, int fd, void* buf) { if (vers == 1) @@ -1247,6 +1280,51 @@ EXPORT int my_statfs64(const char* path, void* buf) } +#ifdef ANDROID +typedef int (*__compar_d_fn_t)(const void*, const void*, void*); + +static size_t qsort_r_partition(void* base, size_t size, __compar_d_fn_t compar, void* arg, size_t lo, size_t hi) +{ + void* tmp = malloc(size); + void* pivot = ((char*)base) + lo * size; + size_t i = lo; + for (size_t j = lo; j <= hi; j++) + { + void* base_i = ((char*)base) + i * size; + void* base_j = ((char*)base) + j * size; + if (compar(base_j, pivot, arg) < 0) + { + memcpy(tmp, base_i, size); + memcpy(base_i, base_j, size); + memcpy(base_j, tmp, size); + i++; + } + } + void* base_i = ((char *)base) + i * size; + void* base_hi = ((char *)base) + hi * size; + memcpy(tmp, base_i, size); + memcpy(base_i, base_hi, size); + memcpy(base_hi, tmp, size); + free(tmp); + return i; +} + +static void qsort_r_helper(void* base, size_t size, __compar_d_fn_t compar, void* arg, ssize_t lo, ssize_t hi) +{ + if (lo < hi) + { + size_t p = qsort_r_partition(base, size, compar, arg, lo, hi); + qsort_r_helper(base, size, compar, arg, lo, p - 1); + qsort_r_helper(base, size, compar, arg, p + 1, hi); + } +} + +static void qsort_r(void* base, size_t nmemb, size_t size, __compar_d_fn_t compar, void* arg) +{ + return qsort_r_helper(base, size, compar, arg, 0, nmemb - 1); +} +#endif + typedef struct compare_r_s { x86emu_t* emu; uintptr_t f; @@ -1511,6 +1589,15 @@ static void CreateCPUTopologyCoreID(int fd, int cpu) } +#ifdef ANDROID +static int shm_open(const char *name, int oflag, mode_t mode) { + return -1; +} +static int shm_unlink(const char *name) { + return -1; +} +#endif + #define TMP_CPUINFO "box86_tmpcpuinfo" #define TMP_CPUTOPO "box86_tmpcputopo%d" #endif @@ -1828,10 +1915,12 @@ EXPORT int32_t my_glob(x86emu_t *emu, void* pat, int32_t flags, void* errfnc, vo return f(pat, flags, findgloberrFct(errfnc), pglob); } +#ifndef ANDROID EXPORT int32_t my_glob64(x86emu_t *emu, void* pat, int32_t flags, void* errfnc, void* pglob) { return glob64(pat, flags, findgloberrFct(errfnc), pglob); } +#endif EXPORT int my_scandir64(x86emu_t *emu, void* dir, void* namelist, void* sel, void* comp) { @@ -1974,6 +2063,7 @@ EXPORT int32_t my___cxa_thread_atexit_impl(x86emu_t* emu, void* dtor, void* obj, return 0; } +#ifndef ANDROID extern void __chk_fail(); EXPORT unsigned long int my___fdelt_chk (unsigned long int d) { @@ -1982,6 +2072,7 @@ EXPORT unsigned long int my___fdelt_chk (unsigned long int d) return d / __NFDBITS; } +#endif EXPORT int32_t my_getrandom(x86emu_t* emu, void* buf, uint32_t buflen, uint32_t flags) { @@ -2187,6 +2278,11 @@ void InitCpuModel() | (1<cookie = cookie; return fopencookie(cb, mode, io_funcs); } +#endif EXPORT long my_prlimit64(void* pid, uint32_t res, void* new_rlim, void* old_rlim) { @@ -2503,8 +2602,13 @@ EXPORT void* my___libc_dlsym(x86emu_t* emu, void* handle, void* name) return my_dlsym(emu, handle, name); } +#if ANDROID +void obstackSetup() { +} +#else // all obstack function defined in obstack.c file void obstackSetup(); +#endif EXPORT int my_nanosleep(const struct timespec *req, struct timespec *rem) { @@ -2601,6 +2705,7 @@ EXPORT void my_mcount(void* frompc, void* selfpc) return; } +#ifndef ANDROID union semun { int val; /* Value for SETVAL */ struct semid_ds *buf; /* Buffer for IPC_STAT, IPC_SET */ @@ -2608,6 +2713,7 @@ union semun { struct seminfo *__buf; /* Buffer for IPC_INFO (Linux-specific) */ }; +#endif EXPORT int my_semctl(x86emu_t* emu, int semid, int semnum, int cmd, union semun b) { @@ -2630,6 +2736,17 @@ EXPORT char* my_program_invocation_short_name = NULL; lib->priv.w.lib = dlopen(NULL, RTLD_LAZY | RTLD_GLOBAL); \ else +#ifdef ANDROID +#define NUM_NEEDED_LIBS 0 +#define NEEDED_LIBS +#else +#define NUM_NEEDED_LIBS 3 +#define NEEDED_LIBS \ + lib->priv.w.neededlibs[0] = strdup("ld-linux.so.2"); \ + lib->priv.w.neededlibs[1] = strdup("libpthread.so.0"); \ + lib->priv.w.neededlibs[2] = strdup("librt.so.1"); +#endif + #define CUSTOM_INIT \ box86->libclib = lib; \ my_lib = lib; \ @@ -2642,11 +2759,9 @@ EXPORT char* my_program_invocation_short_name = NULL; my___progname = my_program_invocation_short_name = \ strrchr(box86->argv[0], '/'); \ lib->priv.w.p2 = getLIBCMy(lib); \ - lib->priv.w.needed = 3; \ + lib->priv.w.needed = NUM_NEEDED_LIBS; \ lib->priv.w.neededlibs = (char**)calloc(lib->priv.w.needed, sizeof(char*)); \ - lib->priv.w.neededlibs[0] = strdup("ld-linux.so.2"); \ - lib->priv.w.neededlibs[1] = strdup("libpthread.so.0"); \ - lib->priv.w.neededlibs[2] = strdup("librt.so.1"); + NEEDED_LIBS #define CUSTOM_FINI \ freeLIBCMy(lib->priv.w.p2); \ diff --git a/src/wrapped/wrappedlibc_private.h b/src/wrapped/wrappedlibc_private.h index 961bf501c8..d4bdc10e79 100755 --- a/src/wrapped/wrappedlibc_private.h +++ b/src/wrapped/wrappedlibc_private.h @@ -2195,3 +2195,15 @@ GOM(__register_frame_info, vFpp) // faked function GOM(__deregister_frame_info, pFp) GO(name_to_handle_at, iFipppi) // only glibc 2.14+, so may not be present... + +#ifdef ANDROID +GOM(__libc_init, vFEpppp) +GOM(stat, iFpp) +GOM(lstat, iFpp) +GOM(fstat, iFip) +GO(__errno, pFv) +GO(setprogname, vFp) +GO(getprogname, pFv) +#include "wrappedlibpthread_private.h" +#include "wrappedlibrt_private.h" +#endif diff --git a/src/wrapped/wrappedlibcups.c b/src/wrapped/wrappedlibcups.c index aba6d30a19..f1cdf0aebb 100755 --- a/src/wrapped/wrappedlibcups.c +++ b/src/wrapped/wrappedlibcups.c @@ -18,7 +18,13 @@ #include "emu/x86emu_private.h" #include "myalign.h" -const char* libcupsName = "libcups.so.2"; +const char* libcupsName = +#ifdef ANDROID + "libcups.so" +#else + "libcups.so.2" +#endif + ; #define LIBNAME libcups #if 0 diff --git a/src/wrapped/wrappedlibdl.c b/src/wrapped/wrappedlibdl.c index 66428223a4..b8726dfe85 100755 --- a/src/wrapped/wrappedlibdl.c +++ b/src/wrapped/wrappedlibdl.c @@ -46,7 +46,13 @@ void* my_dlvsym(x86emu_t* emu, void *handle, void *symbol, void *version) EXPORT int my_dlinfo(x86emu_t* emu, void* handle, int request, void* info) EXPORT; #define LIBNAME libdl -const char* libdlName = "libdl.so.2"; +const char* libdlName = +#ifdef ANDROID + "libdl.so" +#else + "libdl.so.2" +#endif + ; // define all standard library functions #include "wrappedlib_init.h" @@ -412,4 +418,4 @@ int my_dlinfo(x86emu_t* emu, void* handle, int request, void* info) snprintf(dl->last_error, 129, "unsupported call to dlinfo request:%d\n", request); } return -1; -} \ No newline at end of file +} diff --git a/src/wrapped/wrappedlibm.c b/src/wrapped/wrappedlibm.c index e663e641c7..e0f4e3f442 100755 --- a/src/wrapped/wrappedlibm.c +++ b/src/wrapped/wrappedlibm.c @@ -14,7 +14,13 @@ #include "x86emu.h" #include "debug.h" -const char* libmName = "libm.so.6"; +const char* libmName = +#ifdef ANDROID + "libm.so" +#else + "libm.so.6" +#endif + ; #define LIBNAME libm static library_t* my_lib = NULL; diff --git a/src/wrapped/wrappedlibtiff.c b/src/wrapped/wrappedlibtiff.c index 1229cbd1e7..cc6c3b43a1 100755 --- a/src/wrapped/wrappedlibtiff.c +++ b/src/wrapped/wrappedlibtiff.c @@ -18,7 +18,13 @@ #include "emu/x86emu_private.h" #include "myalign.h" -const char* libtiffName = "libtiff.so.5"; +const char* libtiffName = +#ifdef ANDROID + "libtiff.so" +#else + "libtiff.so.5" +#endif + ; #define LIBNAME libtiff static library_t* my_lib = NULL; diff --git a/src/wrapped/wrappedmpg123.c b/src/wrapped/wrappedmpg123.c index 7b17cd801b..b0ae843d16 100755 --- a/src/wrapped/wrappedmpg123.c +++ b/src/wrapped/wrappedmpg123.c @@ -17,7 +17,13 @@ #include "box86context.h" #include "emu/x86emu_private.h" -const char* mpg123Name = "libmpg123.so.0"; +const char* mpg123Name = +#ifdef ANDROID + "libmpg123.so" +#else + "libmpg123.so.0" +#endif + ; #define LIBNAME mpg123 typedef int (*iFpppp_t) (void*, void*, void*, void*); diff --git a/src/wrapped/wrappedpng16.c b/src/wrapped/wrappedpng16.c index f58b0733cd..84e0b5f6c0 100755 --- a/src/wrapped/wrappedpng16.c +++ b/src/wrapped/wrappedpng16.c @@ -17,7 +17,13 @@ #include "box86context.h" #include "emu/x86emu_private.h" -const char* png16Name = "libpng16.so.16"; +const char* png16Name = +#ifdef ANDROID + "libpng16.so" +#else + "libpng16.so.16" +#endif + ; #define LIBNAME png16 typedef void (*vFpp_t)(void*, void*); diff --git a/src/wrapped/wrappedxml2.c b/src/wrapped/wrappedxml2.c index 5fcb7ed963..a25fb9a6a3 100755 --- a/src/wrapped/wrappedxml2.c +++ b/src/wrapped/wrappedxml2.c @@ -16,7 +16,13 @@ #include "librarian.h" #include "callback.h" -const char* xml2Name = "libxml2.so.2"; +const char* xml2Name = +#ifdef ANDROID + "libxml2.so" +#else + "libxml2.so.2" +#endif + ; #define LIBNAME xml2 static library_t *my_lib = NULL; diff --git a/src/wrapped/wrappedxslt.c b/src/wrapped/wrappedxslt.c index e65e309038..9e3274fa99 100755 --- a/src/wrapped/wrappedxslt.c +++ b/src/wrapped/wrappedxslt.c @@ -16,7 +16,13 @@ #include "librarian.h" #include "callback.h" -const char* xsltName = "libxslt.so.1"; +const char *xsltName = +#ifdef ANDROID + "libxslt.so" +#else + "libxslt.so.1" +#endif + ; #define LIBNAME xslt static library_t *my_lib = NULL;