diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2025-01-26 13:21:37 +0100 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2025-01-26 13:21:47 +0100 |
| commit | 81925643e82f1e4925f62cf575e23685e75a1d33 (patch) | |
| tree | 7e95153be5fad94058fd0657e4bf9b1639c0169e /src | |
| parent | 285c874e53dd69da97720218a8168bae08c6f7d6 (diff) | |
| download | box64-81925643e82f1e4925f62cf575e23685e75a1d33.tar.gz box64-81925643e82f1e4925f62cf575e23685e75a1d33.zip | |
[BOX32][WRAPPER] Added some more 32bits wrapped function, and improved wrapping of 32bits ld-linux.so
Diffstat (limited to 'src')
| -rw-r--r-- | src/librarian/library.c | 3 | ||||
| -rw-r--r-- | src/library_list_32.h | 1 | ||||
| -rw-r--r-- | src/library_list_static_32.h | 1 | ||||
| -rw-r--r-- | src/wrapped32/generated/converter32.c | 23 | ||||
| -rw-r--r-- | src/wrapped32/generated/converter32.h | 11 | ||||
| -rw-r--r-- | src/wrapped32/generated/functions_list.txt | 2 | ||||
| -rw-r--r-- | src/wrapped32/generated/wrapper32.c | 4 | ||||
| -rw-r--r-- | src/wrapped32/generated/wrapper32.h | 2 | ||||
| -rwxr-xr-x | src/wrapped32/wrappedldlinux.c | 1 | ||||
| -rwxr-xr-x | src/wrapped32/wrappedlibc_private.h | 4 |
10 files changed, 49 insertions, 3 deletions
diff --git a/src/librarian/library.c b/src/librarian/library.c index 6ad8d57b..670a8ef0 100644 --- a/src/librarian/library.c +++ b/src/librarian/library.c @@ -433,7 +433,8 @@ static const char* essential_libs[] = { "libxcb-image.so.0", "libxcb-keysyms.so.1", "libxcb-xtest.so.0", "libxcb-glx.so.0", "libxcb-dri2.so.0", "libxcb-dri3.so.0", "libXtst.so.6", "libXt.so.6", "libXcomposite.so.1", "libXdamage.so.1", "libXmu.so.6", "libxkbcommon.so.0", "libxkbcommon-x11.so.0", "libpulse-simple.so.0", "libpulse.so.0", "libvulkan.so.1", "libvulkan.so", - "ld-linux-x86-64.so.2", "crashhandler.so", "libtcmalloc_minimal.so.0", "libtcmalloc_minimal.so.4", "libanl.so.1" + "ld-linux-x86-64.so.2", "crashhandler.so", "libtcmalloc_minimal.so.0", "libtcmalloc_minimal.so.4", "libanl.so.1", + "ld-linux.so.2", "ld-linux.so.3" }; static const char* essential_libs_egl[] = { "libEGL.so", "libGLESv2.so" diff --git a/src/library_list_32.h b/src/library_list_32.h index 2af7342c..317e5aa0 100644 --- a/src/library_list_32.h +++ b/src/library_list_32.h @@ -16,6 +16,7 @@ GO("libdl.so.2", libdl) GO("libresolv.so.2", libresolv) GO("libresolv.so", libresolv) +GO("ld-linux.so.3", ldlinux) GO("ld-linux.so.2", ldlinux) GO("libGL.so", libgl) diff --git a/src/library_list_static_32.h b/src/library_list_static_32.h index 525b5bef..071be643 100644 --- a/src/library_list_static_32.h +++ b/src/library_list_static_32.h @@ -8,3 +8,4 @@ GO("libc.so.6", libc) GO("libm.so.6", libm) GO("libdl.so.2", libdl) GO("ld-linux.so.2", ldlinux) +GO("ld-linux.so.3", ldlinux) diff --git a/src/wrapped32/generated/converter32.c b/src/wrapped32/generated/converter32.c index 4064e7ac..54b5739f 100644 --- a/src/wrapped32/generated/converter32.c +++ b/src/wrapped32/generated/converter32.c @@ -935,3 +935,26 @@ void to_struct_iLiiiiLiiiiLi(ptr_t d, const struct_iLiiiiLiiiiLi_t *src) { *(ulong_t*)dest = to_ulong(src->L11); dest += 4; *(int*)dest = src->i12; dest += 4; } + +void from_struct_pppiiip(struct_pppiiip_t *dest, ptr_t s) { + uint8_t* src = (uint8_t*)from_ptrv(s); + dest->p0 = from_ptrv(*(ptr_t*)src); src += 4; + dest->p1 = from_ptrv(*(ptr_t*)src); src += 4; + dest->p2 = from_ptrv(*(ptr_t*)src); src += 4; + dest->i3 = *(int*)src; src += 4; + dest->i4 = *(int*)src; src += 4; + dest->i5 = *(int*)src; src += 4; + dest->p6 = from_ptrv(*(ptr_t*)src); src += 4; +} +void to_struct_pppiiip(ptr_t d, const struct_pppiiip_t *src) { + if (!src) return; + uint8_t* dest = (uint8_t*)from_ptrv(d); + *(ptr_t*)dest = to_ptrv(src->p0); dest += 4; + *(ptr_t*)dest = to_ptrv(src->p1); dest += 4; + *(ptr_t*)dest = to_ptrv(src->p2); dest += 4; + *(int*)dest = src->i3; dest += 4; + *(int*)dest = src->i4; dest += 4; + *(int*)dest = src->i5; dest += 4; + *(ptr_t*)dest = to_ptrv(src->p6); dest += 4; +} + diff --git a/src/wrapped32/generated/converter32.h b/src/wrapped32/generated/converter32.h index 3261416c..dcf171a7 100644 --- a/src/wrapped32/generated/converter32.h +++ b/src/wrapped32/generated/converter32.h @@ -472,5 +472,16 @@ typedef struct struct_iLiiiiLiiiiLi_s { } struct_iLiiiiLiiiiLi_t; void from_struct_iLiiiiLiiiiLi(struct_iLiiiiLiiiiLi_t* dest, ptr_t src); void to_struct_iLiiiiLiiiiLi(ptr_t dest, const struct_iLiiiiLiiiiLi_t* src); +typedef struct struct_pppiiip_s { + void* p0; + void* p1; + void* p2; + int i3; + int i4; + int i5; + void* p6; +} struct_pppiiip_t; +void from_struct_pppiiip(struct_pppiiip_t *dest, ptr_t src); +void to_struct_pppiiip(ptr_t dest, const struct_pppiiip_t *src); #endif // __CONVERTER_H_ diff --git a/src/wrapped32/generated/functions_list.txt b/src/wrapped32/generated/functions_list.txt index 3dab4f72..a1f6fadc 100644 --- a/src/wrapped32/generated/functions_list.txt +++ b/src/wrapped32/generated/functions_list.txt @@ -390,6 +390,7 @@ #() iErLL_BLL_ -> iEBB #() pErppppii_p -> pEBp #() vFbll_rllll_ -> vFBB +#() iEbpppiiip_p -> iEBp #() iFXbiiuuLip_ -> iFXB #() iFpruuipWCCp_ -> iFpB #() lEEriiiiiiiiilt_ -> lEEB @@ -1082,6 +1083,7 @@ #() iFXLbLWWWcc_i -> iFXLBi #() pESBppppii_pi -> pESBpi #() iFEprllll_rll_ -> iFEpBB +#() iEupuBpppiiip_ -> iEupuB #() iFXLuriiiiiLi_ -> iFXLuB #() uFnibpL_bLpCC_ -> uFniBB #() vFXLbLLLLLLLLLL_L -> vFXLBL diff --git a/src/wrapped32/generated/wrapper32.c b/src/wrapped32/generated/wrapper32.c index a65b5cc4..4cb72167 100644 --- a/src/wrapped32/generated/wrapper32.c +++ b/src/wrapped32/generated/wrapper32.c @@ -484,6 +484,7 @@ typedef int32_t (*iFXbiip__t)(void*, struct_iip_t*); typedef int32_t (*iErLL_BLL__t)(struct_LL_t*, struct_LL_t*); typedef void* (*pErppppii_p_t)(struct_ppppii_t*, void*); typedef void (*vFbll_rllll__t)(struct_ll_t*, struct_llll_t*); +typedef int32_t (*iEbpppiiip_p_t)(struct_pppiiip_t*, void*); typedef int32_t (*iFXbiiuuLip__t)(void*, struct_iiuuLip_t*); typedef int32_t (*iFpruuipWCCp__t)(void*, struct_uuipWCCp_t*); typedef intptr_t (*lEEriiiiiiiiilt__t)(x64emu_t*, struct_iiiiiiiiilt_t*); @@ -1176,6 +1177,7 @@ typedef int32_t (*iFXLpbLWWWcc__t)(void*, uintptr_t, void*, struct_LWWWcc_t*); typedef int32_t (*iFXLbLWWWcc_i_t)(void*, uintptr_t, struct_LWWWcc_t*, int32_t); typedef void* (*pESBppppii_pi_t)(void*, struct_ppppii_t*, void*, int32_t); typedef int32_t (*iFEprllll_rll__t)(x64emu_t*, void*, struct_llll_t*, struct_ll_t*); +typedef int32_t (*iEupuBpppiiip__t)(uint32_t, void*, uint32_t, struct_pppiiip_t*); typedef int32_t (*iFXLuriiiiiLi__t)(void*, uintptr_t, uint32_t, struct_iiiiiLi_t*); typedef uint32_t (*uFnibpL_bLpCC__t)(void*, int32_t, struct_pL_t*, struct_LpCC_t*); typedef void (*vFXLbLLLLLLLLLL_L_t)(void*, uintptr_t, struct_LLLLLLLLLL_t*, uintptr_t); @@ -2292,6 +2294,7 @@ void iFXbiip__32(x64emu_t *emu, uintptr_t fcn) { iFXbiip__t fn = (iFXbiip__t)fcn void iErLL_BLL__32(x64emu_t *emu, uintptr_t fcn) { iErLL_BLL__t fn = (iErLL_BLL__t)fcn; errno = emu->libc_err; struct_LL_t arg_4={0}; if (*(ptr_t*)(from_ptr((R_ESP + 4)))) from_struct_LL(&arg_4, *(ptr_t*)(from_ptr((R_ESP + 4)))); struct_LL_t arg_8={0}; R_EAX = fn(*(ptr_t*)(from_ptr((R_ESP + 4))) ? &arg_4 : NULL, *(ptr_t*)(from_ptr((R_ESP + 8))) ? &arg_8 : NULL); if (*(ptr_t*)(from_ptr((R_ESP + 8)))) to_struct_LL(*(ptr_t*)(from_ptr((R_ESP + 8))), &arg_8); emu->libc_err = errno; } void pErppppii_p_32(x64emu_t *emu, uintptr_t fcn) { pErppppii_p_t fn = (pErppppii_p_t)fcn; errno = emu->libc_err; struct_ppppii_t arg_4={0}; if (*(ptr_t*)(from_ptr((R_ESP + 4)))) from_struct_ppppii(&arg_4, *(ptr_t*)(from_ptr((R_ESP + 4)))); R_EAX = to_ptrv(fn(*(ptr_t*)(from_ptr((R_ESP + 4))) ? &arg_4 : NULL, from_ptriv(R_ESP + 8))); emu->libc_err = errno; } void vFbll_rllll__32(x64emu_t *emu, uintptr_t fcn) { vFbll_rllll__t fn = (vFbll_rllll__t)fcn; struct_ll_t arg_4={0}; if (*(ptr_t*)(from_ptr((R_ESP + 4)))) from_struct_ll(&arg_4, *(ptr_t*)(from_ptr((R_ESP + 4)))); struct_llll_t arg_8={0}; if (*(ptr_t*)(from_ptr((R_ESP + 8)))) from_struct_llll(&arg_8, *(ptr_t*)(from_ptr((R_ESP + 8)))); fn(*(ptr_t*)(from_ptr((R_ESP + 4))) ? &arg_4 : NULL, *(ptr_t*)(from_ptr((R_ESP + 8))) ? &arg_8 : NULL); if (*(ptr_t*)(from_ptr((R_ESP + 4)))) to_struct_ll(*(ptr_t*)(from_ptr((R_ESP + 4))), &arg_4); } +void iEbpppiiip_p_32(x64emu_t *emu, uintptr_t fcn) { iEbpppiiip_p_t fn = (iEbpppiiip_p_t)fcn; errno = emu->libc_err; struct_pppiiip_t arg_4={0}; if (*(ptr_t*)(from_ptr((R_ESP + 4)))) from_struct_pppiiip(&arg_4, *(ptr_t*)(from_ptr((R_ESP + 4)))); R_EAX = fn(*(ptr_t*)(from_ptr((R_ESP + 4))) ? &arg_4 : NULL, from_ptriv(R_ESP + 8)); if (*(ptr_t*)(from_ptr((R_ESP + 4)))) to_struct_pppiiip(*(ptr_t*)(from_ptr((R_ESP + 4))), &arg_4); emu->libc_err = errno; } void iFXbiiuuLip__32(x64emu_t *emu, uintptr_t fcn) { iFXbiiuuLip__t fn = (iFXbiiuuLip__t)fcn; struct_iiuuLip_t arg_8={0}; if (*(ptr_t*)(from_ptr((R_ESP + 8)))) from_struct_iiuuLip(&arg_8, *(ptr_t*)(from_ptr((R_ESP + 8)))); R_EAX = fn(getDisplay(from_ptriv(R_ESP + 4)), *(ptr_t*)(from_ptr((R_ESP + 8))) ? &arg_8 : NULL); if (*(ptr_t*)(from_ptr((R_ESP + 8)))) to_struct_iiuuLip(*(ptr_t*)(from_ptr((R_ESP + 8))), &arg_8); } void iFpruuipWCCp__32(x64emu_t *emu, uintptr_t fcn) { iFpruuipWCCp__t fn = (iFpruuipWCCp__t)fcn; struct_uuipWCCp_t arg_8={0}; if (*(ptr_t*)(from_ptr((R_ESP + 8)))) from_struct_uuipWCCp(&arg_8, *(ptr_t*)(from_ptr((R_ESP + 8)))); R_EAX = fn(from_ptriv(R_ESP + 4), *(ptr_t*)(from_ptr((R_ESP + 8))) ? &arg_8 : NULL); } void lEEriiiiiiiiilt__32(x64emu_t *emu, uintptr_t fcn) { lEEriiiiiiiiilt__t fn = (lEEriiiiiiiiilt__t)fcn; errno = emu->libc_err; struct_iiiiiiiiilt_t arg_4={0}; if (*(ptr_t*)(from_ptr((R_ESP + 4)))) from_struct_iiiiiiiiilt(&arg_4, *(ptr_t*)(from_ptr((R_ESP + 4)))); R_EAX = to_long(fn(emu, *(ptr_t*)(from_ptr((R_ESP + 4))) ? &arg_4 : NULL)); emu->libc_err = errno; } @@ -2984,6 +2987,7 @@ void iFXLpbLWWWcc__32(x64emu_t *emu, uintptr_t fcn) { iFXLpbLWWWcc__t fn = (iFXL void iFXLbLWWWcc_i_32(x64emu_t *emu, uintptr_t fcn) { iFXLbLWWWcc_i_t fn = (iFXLbLWWWcc_i_t)fcn; struct_LWWWcc_t arg_12={0}; if (*(ptr_t*)(from_ptr((R_ESP + 12)))) from_struct_LWWWcc(&arg_12, *(ptr_t*)(from_ptr((R_ESP + 12)))); R_EAX = fn(getDisplay(from_ptriv(R_ESP + 4)), from_ulong(from_ptri(ulong_t, R_ESP + 8)), *(ptr_t*)(from_ptr((R_ESP + 12))) ? &arg_12 : NULL, from_ptri(int32_t, R_ESP + 16)); if (*(ptr_t*)(from_ptr((R_ESP + 12)))) to_struct_LWWWcc(*(ptr_t*)(from_ptr((R_ESP + 12))), &arg_12); } void pESBppppii_pi_32(x64emu_t *emu, uintptr_t fcn) { pESBppppii_pi_t fn = (pESBppppii_pi_t)fcn; errno = emu->libc_err; struct_ppppii_t arg_8={0}; R_EAX = to_ptrv(fn(io_convert32(from_ptriv(R_ESP + 4)), *(ptr_t*)(from_ptr((R_ESP + 8))) ? &arg_8 : NULL, from_ptriv(R_ESP + 12), from_ptri(int32_t, R_ESP + 16))); if (*(ptr_t*)(from_ptr((R_ESP + 8)))) to_struct_ppppii(*(ptr_t*)(from_ptr((R_ESP + 8))), &arg_8); emu->libc_err = errno; } void iFEprllll_rll__32(x64emu_t *emu, uintptr_t fcn) { iFEprllll_rll__t fn = (iFEprllll_rll__t)fcn; struct_llll_t arg_8={0}; if (*(ptr_t*)(from_ptr((R_ESP + 8)))) from_struct_llll(&arg_8, *(ptr_t*)(from_ptr((R_ESP + 8)))); struct_ll_t arg_12={0}; if (*(ptr_t*)(from_ptr((R_ESP + 12)))) from_struct_ll(&arg_12, *(ptr_t*)(from_ptr((R_ESP + 12)))); R_EAX = fn(emu, from_ptriv(R_ESP + 4), *(ptr_t*)(from_ptr((R_ESP + 8))) ? &arg_8 : NULL, *(ptr_t*)(from_ptr((R_ESP + 12))) ? &arg_12 : NULL); } +void iEupuBpppiiip__32(x64emu_t *emu, uintptr_t fcn) { iEupuBpppiiip__t fn = (iEupuBpppiiip__t)fcn; errno = emu->libc_err; struct_pppiiip_t arg_16={0}; R_EAX = fn(from_ptri(uint32_t, R_ESP + 4), from_ptriv(R_ESP + 8), from_ptri(uint32_t, R_ESP + 12), *(ptr_t*)(from_ptr((R_ESP + 16))) ? &arg_16 : NULL); if (*(ptr_t*)(from_ptr((R_ESP + 16)))) to_struct_pppiiip(*(ptr_t*)(from_ptr((R_ESP + 16))), &arg_16); emu->libc_err = errno; } void iFXLuriiiiiLi__32(x64emu_t *emu, uintptr_t fcn) { iFXLuriiiiiLi__t fn = (iFXLuriiiiiLi__t)fcn; struct_iiiiiLi_t arg_16={0}; if (*(ptr_t*)(from_ptr((R_ESP + 16)))) from_struct_iiiiiLi(&arg_16, *(ptr_t*)(from_ptr((R_ESP + 16)))); R_EAX = fn(getDisplay(from_ptriv(R_ESP + 4)), from_ulong(from_ptri(ulong_t, R_ESP + 8)), from_ptri(uint32_t, R_ESP + 12), *(ptr_t*)(from_ptr((R_ESP + 16))) ? &arg_16 : NULL); } void uFnibpL_bLpCC__32(x64emu_t *emu, uintptr_t fcn) { uFnibpL_bLpCC__t fn = (uFnibpL_bLpCC__t)fcn; void *aligned_xcb = align_xcb_connection32(from_ptriv(R_ESP + 4)); struct_pL_t arg_12={0}; if (*(ptr_t*)(from_ptr((R_ESP + 12)))) from_struct_pL(&arg_12, *(ptr_t*)(from_ptr((R_ESP + 12)))); struct_LpCC_t arg_16={0}; if (*(ptr_t*)(from_ptr((R_ESP + 16)))) from_struct_LpCC(&arg_16, *(ptr_t*)(from_ptr((R_ESP + 16)))); R_EAX = (uint32_t)fn(aligned_xcb, from_ptri(int32_t, R_ESP + 8), *(ptr_t*)(from_ptr((R_ESP + 12))) ? &arg_12 : NULL, *(ptr_t*)(from_ptr((R_ESP + 16))) ? &arg_16 : NULL); unalign_xcb_connection32(aligned_xcb, from_ptriv(R_ESP + 4)); if (*(ptr_t*)(from_ptr((R_ESP + 12)))) to_struct_pL(*(ptr_t*)(from_ptr((R_ESP + 12))), &arg_12); if (*(ptr_t*)(from_ptr((R_ESP + 16)))) to_struct_LpCC(*(ptr_t*)(from_ptr((R_ESP + 16))), &arg_16); } void vFXLbLLLLLLLLLL_L_32(x64emu_t *emu, uintptr_t fcn) { vFXLbLLLLLLLLLL_L_t fn = (vFXLbLLLLLLLLLL_L_t)fcn; struct_LLLLLLLLLL_t arg_12={0}; if (*(ptr_t*)(from_ptr((R_ESP + 12)))) from_struct_LLLLLLLLLL(&arg_12, *(ptr_t*)(from_ptr((R_ESP + 12)))); fn(getDisplay(from_ptriv(R_ESP + 4)), from_ulong(from_ptri(ulong_t, R_ESP + 8)), *(ptr_t*)(from_ptr((R_ESP + 12))) ? &arg_12 : NULL, from_ulong(from_ptri(ulong_t, R_ESP + 16))); if (*(ptr_t*)(from_ptr((R_ESP + 12)))) to_struct_LLLLLLLLLL(*(ptr_t*)(from_ptr((R_ESP + 12))), &arg_12); } diff --git a/src/wrapped32/generated/wrapper32.h b/src/wrapped32/generated/wrapper32.h index 926241f3..950bc1e9 100644 --- a/src/wrapped32/generated/wrapper32.h +++ b/src/wrapped32/generated/wrapper32.h @@ -431,6 +431,7 @@ void iFXbiip__32(x64emu_t *emu, uintptr_t fnc); void iErLL_BLL__32(x64emu_t *emu, uintptr_t fnc); void pErppppii_p_32(x64emu_t *emu, uintptr_t fnc); void vFbll_rllll__32(x64emu_t *emu, uintptr_t fnc); +void iEbpppiiip_p_32(x64emu_t *emu, uintptr_t fnc); void iFXbiiuuLip__32(x64emu_t *emu, uintptr_t fnc); void iFpruuipWCCp__32(x64emu_t *emu, uintptr_t fnc); void lEEriiiiiiiiilt__32(x64emu_t *emu, uintptr_t fnc); @@ -1123,6 +1124,7 @@ void iFXLpbLWWWcc__32(x64emu_t *emu, uintptr_t fnc); void iFXLbLWWWcc_i_32(x64emu_t *emu, uintptr_t fnc); void pESBppppii_pi_32(x64emu_t *emu, uintptr_t fnc); void iFEprllll_rll__32(x64emu_t *emu, uintptr_t fnc); +void iEupuBpppiiip__32(x64emu_t *emu, uintptr_t fnc); void iFXLuriiiiiLi__32(x64emu_t *emu, uintptr_t fnc); void uFnibpL_bLpCC__32(x64emu_t *emu, uintptr_t fnc); void vFXLbLLLLLLLLLL_L_32(x64emu_t *emu, uintptr_t fnc); diff --git a/src/wrapped32/wrappedldlinux.c b/src/wrapped32/wrappedldlinux.c index b9773d99..b83e3559 100755 --- a/src/wrapped32/wrappedldlinux.c +++ b/src/wrapped32/wrappedldlinux.c @@ -42,6 +42,7 @@ static void stSetup32(box64context_t* context) // don't try to load the actual ld-linux (because name is variable), just use box64 itself, as it's linked to ld-linux static const char* ldlinuxName = "ld-linux.so.3"; #define LIBNAME ldlinux +#define ALTNAME "ld-linux.so.2" // fake (ignored) _r_data structure EXPORT void* my32__r_debug[5]; diff --git a/src/wrapped32/wrappedlibc_private.h b/src/wrapped32/wrappedlibc_private.h index 1974ccf9..55a5b50e 100755 --- a/src/wrapped32/wrappedlibc_private.h +++ b/src/wrapped32/wrappedlibc_private.h @@ -710,7 +710,7 @@ GO(inet_pton, iEipp) //GO(initgroups, iEpi) // init_module // initstate // Weak -//GOW(initstate_r, iEupup) +GOW(initstate_r, iEupuBpppiiip_) // inl // Weak GO(innetgr, iEpppp) GO(inotify_add_watch, iEipu) @@ -1360,7 +1360,7 @@ GOM(qsort, vEEpLLp) //%% GO(raise, iEi) GO(rand, iEv) GOW(random, lEv) -//GOW(random_r, iEpp) +GOW(random_r, iEbpppiiip_p) GO(rand_r, iEp) GOW(rawmemchr, pEpi) GO(__rawmemchr, pEpi) |