diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2024-11-30 14:50:48 +0100 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2024-11-30 14:50:48 +0100 |
| commit | cb30db320e51a8fa805429f17fc6c965ca1c2b00 (patch) | |
| tree | aa08524313c6575ae2d2704807360c95b76ea0ef /src | |
| parent | e1ae914a1db729730c89e8e69351f2dba8bad168 (diff) | |
| download | box64-cb30db320e51a8fa805429f17fc6c965ca1c2b00.tar.gz box64-cb30db320e51a8fa805429f17fc6c965ca1c2b00.zip | |
[BOX32][WRAPPER] Added some more libc wrapped functions
Diffstat (limited to 'src')
| -rw-r--r-- | src/wrapped32/generated/functions_list.txt | 35 | ||||
| -rw-r--r-- | src/wrapped32/generated/wrappedlibctypes32.h | 21 | ||||
| -rw-r--r-- | src/wrapped32/generated/wrapper32.c | 23 | ||||
| -rw-r--r-- | src/wrapped32/generated/wrapper32.h | 16 | ||||
| -rwxr-xr-x | src/wrapped32/wrappedlibc.c | 82 | ||||
| -rwxr-xr-x | src/wrapped32/wrappedlibc_private.h | 20 |
6 files changed, 131 insertions, 66 deletions
diff --git a/src/wrapped32/generated/functions_list.txt b/src/wrapped32/generated/functions_list.txt index bf7b8a41..334bc9d2 100644 --- a/src/wrapped32/generated/functions_list.txt +++ b/src/wrapped32/generated/functions_list.txt @@ -967,6 +967,7 @@ #() uFppibp_ -> uFppiB #() UEpBp_ii -> UEpBii #() lEiibl_L -> lEiiBL +#() LEpBp_ii -> LEpBii #() LEpbp_Lp -> LEpBLp #() iEEpprLL_ -> iEEppB #() iEpurLL_p -> iEpuBp @@ -1093,6 +1094,7 @@ #() vFXLppi -> vFXLppi #() vFXpiiL -> vFXpiiL #() iEEiiip -> iEEiiip +#() iEEiipV -> iEEiipV #() iEEipii -> iEEipii #() iEEippL -> iEEippL #() iEEpipp -> iEEpipp @@ -1106,6 +1108,8 @@ #() iEEpppi -> iEEpppi #() iEEpppp -> iEEpppp #() iFEpppp -> iFEpppp +#() iEESipp -> iEESipp +#() iEESipV -> iEESipV #() iFEXipp -> iFEXipp #() iFEXLip -> iFEXLip #() iFEXLlp -> iFEXLlp @@ -1269,7 +1273,9 @@ #() vFXLiipi -> vFXLiipi #() vFXLpppi -> vFXLpppi #() iEEiippi -> iEEiippi +#() iEEipiup -> iEEipiup #() iEEuppLp -> iEEuppLp +#() iEEpiipV -> iEEpiipV #() iFEpiuuu -> iFEpiuuu #() iEEpiLpp -> iEEpiLpp #() iEEpipOi -> iEEpipOi @@ -1390,6 +1396,7 @@ #() vFXLppipi -> vFXLppipi #() vFXpiipii -> vFXpiipii #() vFXppiiii -> vFXppiiii +#() iEEpLiipp -> iEEpLiipp #() iEEpLiipV -> iEEpLiipV #() iEEpLiLpV -> iEEpLiLpV #() iFEpppipp -> iFEpppipp @@ -1623,16 +1630,7 @@ #!defined(HAVE_LD80BITS) KFKp -> KFKp #!defined(HAVE_LD80BITS) KEKp -> KEKp #!defined(HAVE_LD80BITS) KEpBp_a -> KEpBa -#() iEEvpp -> iEEpp -#() iEEvpV -> iEEpV #() UEsvvs -> UEss -#() pEEppv -> pEEpp -#() LEpBp_iv -> LEpBp_i -#() iEEivpV -> iEEipV -#() iEESvpp -> iEESpp -#() iEESvpV -> iEESpV -#() iEEpvvpV -> iEEppV -#() iEEpLvvpp -> iEEpLpp wrappedcrashhandler: wrappedexpat: - vFpp: @@ -1830,11 +1828,10 @@ wrappedlibc: - vEpup: - _ITM_addUserCommitAction - vEppu: -- iEvpp: -- iEvpV: - iEiip: - iEiiN: - iEipp: +- iEipV: - iEpii: - posix_spawn_file_actions_adddup2 - iEpLi: @@ -1860,7 +1857,7 @@ wrappedlibc: - pEpii: - pEpII: - pEpLL: -- pEppv: +- pEppi: - __realpath_chk - KEpBp_a: - __strtold_l @@ -1875,8 +1872,8 @@ wrappedlibc: - __syslog_chk - vEpLLp: - vEppiV: -- iEivpV: - iEiiip: +- iEiipV: - iEipii: - iEippi: - utimensat @@ -1888,18 +1885,20 @@ wrappedlibc: - iEpLpV: - iEpppp: - getaddrinfo -- iESvpp: -- iESvpV: +- iESipp: +- iESipV: - uEippu: - regerror -- LEpBp_iv: +- LEpBp_ii: - iEiippi: +- iEipiup: + - statx - iEipppp: - getopt_long - iEuppLp: - getgrgid_r - getpwuid_r -- iEpvvpV: +- iEpiipV: - iEpiLpp: - iEpipOi: - posix_spawn_file_actions_addopen @@ -1910,7 +1909,7 @@ wrappedlibc: - getpwnam_r - pEpLLiN: - pEppLLp: -- iEpLvvpp: +- iEpLiipp: - iEpLiipV: - iEpLiLpV: - iFpppupp: diff --git a/src/wrapped32/generated/wrappedlibctypes32.h b/src/wrapped32/generated/wrappedlibctypes32.h index 92d8e15f..97cbd7bb 100644 --- a/src/wrapped32/generated/wrappedlibctypes32.h +++ b/src/wrapped32/generated/wrappedlibctypes32.h @@ -64,11 +64,10 @@ typedef void (*vEipV_t)(int32_t, void*, ...); typedef void (*vEpuu_t)(void*, uint32_t, uint32_t); typedef void (*vEpup_t)(void*, uint32_t, void*); typedef void (*vEppu_t)(void*, void*, uint32_t); -typedef int32_t (*iEvpp_t)(void, void*, void*); -typedef int32_t (*iEvpV_t)(void, void*, ...); typedef int32_t (*iEiip_t)(int32_t, int32_t, void*); typedef int32_t (*iEiiN_t)(int32_t, int32_t, ...); typedef int32_t (*iEipp_t)(int32_t, void*, void*); +typedef int32_t (*iEipV_t)(int32_t, void*, ...); typedef int32_t (*iEpii_t)(void*, int32_t, int32_t); typedef int32_t (*iEpLi_t)(void*, uintptr_t, int32_t); typedef int32_t (*iEppi_t)(void*, void*, int32_t); @@ -83,7 +82,7 @@ typedef intptr_t (*lEppL_t)(void*, void*, uintptr_t); typedef void* (*pEpii_t)(void*, int32_t, int32_t); typedef void* (*pEpII_t)(void*, int64_t, int64_t); typedef void* (*pEpLL_t)(void*, uintptr_t, uintptr_t); -typedef void* (*pEppv_t)(void*, void*, void); +typedef void* (*pEppi_t)(void*, void*, int32_t); typedef double (*KEpBp_a_t)(void*, struct_p_t*, void*); typedef intptr_t (*lEpBp_i_t)(void*, struct_p_t*, int32_t); typedef uintptr_t (*LEpBp_i_t)(void*, struct_p_t*, int32_t); @@ -91,8 +90,8 @@ typedef void (*vEiipp_t)(int32_t, int32_t, void*, void*); typedef void (*vEiipV_t)(int32_t, int32_t, void*, ...); typedef void (*vEpLLp_t)(void*, uintptr_t, uintptr_t, void*); typedef void (*vEppiV_t)(void*, void*, int32_t, ...); -typedef int32_t (*iEivpV_t)(int32_t, void, void*, ...); typedef int32_t (*iEiiip_t)(int32_t, int32_t, int32_t, void*); +typedef int32_t (*iEiipV_t)(int32_t, int32_t, void*, ...); typedef int32_t (*iEipii_t)(int32_t, void*, int32_t, int32_t); typedef int32_t (*iEippi_t)(int32_t, void*, void*, int32_t); typedef int32_t (*iEippL_t)(int32_t, void*, void*, uintptr_t); @@ -101,21 +100,22 @@ typedef int32_t (*iEpipV_t)(void*, int32_t, void*, ...); typedef int32_t (*iEpLpp_t)(void*, uintptr_t, void*, void*); typedef int32_t (*iEpLpV_t)(void*, uintptr_t, void*, ...); typedef int32_t (*iEpppp_t)(void*, void*, void*, void*); -typedef int32_t (*iESvpp_t)(void*, void, void*, void*); -typedef int32_t (*iESvpV_t)(void*, void, void*, ...); +typedef int32_t (*iESipp_t)(void*, int32_t, void*, void*); +typedef int32_t (*iESipV_t)(void*, int32_t, void*, ...); typedef uint32_t (*uEippu_t)(int32_t, void*, void*, uint32_t); -typedef uintptr_t (*LEpBp_iv_t)(void*, struct_p_t*, int32_t, void); +typedef uintptr_t (*LEpBp_ii_t)(void*, struct_p_t*, int32_t, int32_t); typedef int32_t (*iEiippi_t)(int32_t, int32_t, void*, void*, int32_t); +typedef int32_t (*iEipiup_t)(int32_t, void*, int32_t, uint32_t, void*); typedef int32_t (*iEipppp_t)(int32_t, void*, void*, void*, void*); typedef int32_t (*iEuppLp_t)(uint32_t, void*, void*, uintptr_t, void*); -typedef int32_t (*iEpvvpV_t)(void*, void, void, void*, ...); +typedef int32_t (*iEpiipV_t)(void*, int32_t, int32_t, void*, ...); typedef int32_t (*iEpiLpp_t)(void*, int32_t, uintptr_t, void*, void*); typedef int32_t (*iEpipOi_t)(void*, int32_t, void*, int32_t, int32_t); typedef int32_t (*iEppupi_t)(void*, void*, uint32_t, void*, int32_t); typedef int32_t (*iEpppLp_t)(void*, void*, void*, uintptr_t, void*); typedef void* (*pEpLLiN_t)(void*, uintptr_t, uintptr_t, int32_t, ...); typedef void* (*pEppLLp_t)(void*, void*, uintptr_t, uintptr_t, void*); -typedef int32_t (*iEpLvvpp_t)(void*, uintptr_t, void, void, void*, void*); +typedef int32_t (*iEpLiipp_t)(void*, uintptr_t, int32_t, int32_t, void*, void*); typedef int32_t (*iEpLiipV_t)(void*, uintptr_t, int32_t, int32_t, void*, ...); typedef int32_t (*iEpLiLpV_t)(void*, uintptr_t, int32_t, uintptr_t, void*, ...); typedef int32_t (*iFpppupp_t)(void*, void*, void*, uint32_t, void*, void*); @@ -194,7 +194,7 @@ typedef int32_t (*iEpLiLppp_t)(void*, uintptr_t, int32_t, uintptr_t, void*, void GO(recvmsg, lEipi_t) \ GO(sendmsg, lEipi_t) \ GO(writev, lEipi_t) \ - GO(__realpath_chk, pEppv_t) \ + GO(__realpath_chk, pEppi_t) \ GO(__strtold_l, KEpBp_a_t) \ GO(strtold_l, KEpBp_a_t) \ GO(wcstol, lEpBp_i_t) \ @@ -205,6 +205,7 @@ typedef int32_t (*iEpLiLppp_t)(void*, uintptr_t, int32_t, uintptr_t, void*, void GO(readlinkat, iEippL_t) \ GO(getaddrinfo, iEpppp_t) \ GO(regerror, uEippu_t) \ + GO(statx, iEipiup_t) \ GO(getopt_long, iEipppp_t) \ GO(getgrgid_r, iEuppLp_t) \ GO(getpwuid_r, iEuppLp_t) \ diff --git a/src/wrapped32/generated/wrapper32.c b/src/wrapped32/generated/wrapper32.c index 1d69df01..71201273 100644 --- a/src/wrapped32/generated/wrapper32.c +++ b/src/wrapped32/generated/wrapper32.c @@ -1058,6 +1058,7 @@ typedef int64_t (*IEpBp_ii_t)(void*, struct_p_t*, int32_t, int32_t); typedef uint32_t (*uFppibp__t)(void*, void*, int32_t, struct_p_t*); typedef uint64_t (*UEpBp_ii_t)(void*, struct_p_t*, int32_t, int32_t); typedef intptr_t (*lEiibl_L_t)(int32_t, int32_t, struct_l_t*, uintptr_t); +typedef uintptr_t (*LEpBp_ii_t)(void*, struct_p_t*, int32_t, int32_t); typedef uintptr_t (*LEpbp_Lp_t)(void*, struct_p_t*, uintptr_t, void*); typedef int32_t (*iEEpprLL__t)(x64emu_t*, void*, void*, struct_LL_t*); typedef int32_t (*iEpurLL_p_t)(void*, uint32_t, struct_LL_t*, void*); @@ -1184,6 +1185,7 @@ typedef void (*vFXLiiL_t)(void*, uintptr_t, int32_t, int32_t, uintptr_t); typedef void (*vFXLppi_t)(void*, uintptr_t, void*, void*, int32_t); typedef void (*vFXpiiL_t)(void*, void*, int32_t, int32_t, uintptr_t); typedef int32_t (*iEEiiip_t)(x64emu_t*, int32_t, int32_t, int32_t, void*); +typedef int32_t (*iEEiipV_t)(x64emu_t*, int32_t, int32_t, void*, void*); typedef int32_t (*iEEipii_t)(x64emu_t*, int32_t, void*, int32_t, int32_t); typedef int32_t (*iEEippL_t)(x64emu_t*, int32_t, void*, void*, uintptr_t); typedef int32_t (*iEEpipp_t)(x64emu_t*, void*, int32_t, void*, void*); @@ -1197,6 +1199,8 @@ typedef int32_t (*iFEpplp_t)(x64emu_t*, void*, void*, intptr_t, void*); typedef int32_t (*iEEpppi_t)(x64emu_t*, void*, void*, void*, int32_t); typedef int32_t (*iEEpppp_t)(x64emu_t*, void*, void*, void*, void*); typedef int32_t (*iFEpppp_t)(x64emu_t*, void*, void*, void*, void*); +typedef int32_t (*iEESipp_t)(x64emu_t*, void*, int32_t, void*, void*); +typedef int32_t (*iEESipV_t)(x64emu_t*, void*, int32_t, void*, void*); typedef int32_t (*iFEXipp_t)(x64emu_t*, void*, int32_t, void*, void*); typedef int32_t (*iFEXLip_t)(x64emu_t*, void*, uintptr_t, int32_t, void*); typedef int32_t (*iFEXLlp_t)(x64emu_t*, void*, uintptr_t, intptr_t, void*); @@ -1360,7 +1364,9 @@ typedef void (*vFXLiiiL_t)(void*, uintptr_t, int32_t, int32_t, int32_t, uintptr_ typedef void (*vFXLiipi_t)(void*, uintptr_t, int32_t, int32_t, void*, int32_t); typedef void (*vFXLpppi_t)(void*, uintptr_t, void*, void*, void*, int32_t); typedef int32_t (*iEEiippi_t)(x64emu_t*, int32_t, int32_t, void*, void*, int32_t); +typedef int32_t (*iEEipiup_t)(x64emu_t*, int32_t, void*, int32_t, uint32_t, void*); typedef int32_t (*iEEuppLp_t)(x64emu_t*, uint32_t, void*, void*, uintptr_t, void*); +typedef int32_t (*iEEpiipV_t)(x64emu_t*, void*, int32_t, int32_t, void*, void*); typedef int32_t (*iFEpiuuu_t)(x64emu_t*, void*, int32_t, uint32_t, uint32_t, uint32_t); typedef int32_t (*iEEpiLpp_t)(x64emu_t*, void*, int32_t, uintptr_t, void*, void*); typedef int32_t (*iEEpipOi_t)(x64emu_t*, void*, int32_t, void*, int32_t, int32_t); @@ -1481,6 +1487,7 @@ typedef void (*vFXLLuuuu_t)(void*, uintptr_t, uintptr_t, uint32_t, uint32_t, uin typedef void (*vFXLppipi_t)(void*, uintptr_t, void*, void*, int32_t, void*, int32_t); typedef void (*vFXpiipii_t)(void*, void*, int32_t, int32_t, void*, int32_t, int32_t); typedef void (*vFXppiiii_t)(void*, void*, void*, int32_t, int32_t, int32_t, int32_t); +typedef int32_t (*iEEpLiipp_t)(x64emu_t*, void*, uintptr_t, int32_t, int32_t, void*, void*); typedef int32_t (*iEEpLiipV_t)(x64emu_t*, void*, uintptr_t, int32_t, int32_t, void*, void*); typedef int32_t (*iEEpLiLpV_t)(x64emu_t*, void*, uintptr_t, int32_t, uintptr_t, void*, void*); typedef int32_t (*iFEpppipp_t)(x64emu_t*, void*, void*, void*, int32_t, void*, void*); @@ -2690,6 +2697,7 @@ void IEpBp_ii_32(x64emu_t *emu, uintptr_t fcn) { IEpBp_ii_t fn = (IEpBp_ii_t)fcn void uFppibp__32(x64emu_t *emu, uintptr_t fcn) { uFppibp__t fn = (uFppibp__t)fcn; struct_p_t arg_16={0}; if (*(ptr_t*)(from_ptr((R_ESP + 16)))) from_struct_p(&arg_16, *(ptr_t*)(from_ptr((R_ESP + 16)))); R_EAX = (uint32_t)fn(from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ptri(int32_t, R_ESP + 12), *(ptr_t*)(from_ptr((R_ESP + 16))) ? &arg_16 : NULL); if (*(ptr_t*)(from_ptr((R_ESP + 16)))) to_struct_p(*(ptr_t*)(from_ptr((R_ESP + 16))), &arg_16); } void UEpBp_ii_32(x64emu_t *emu, uintptr_t fcn) { UEpBp_ii_t fn = (UEpBp_ii_t)fcn; errno = emu->libc_err; struct_p_t arg_8={0}; ui64_t r; r.u = (uint64_t)fn(from_ptriv(R_ESP + 4), *(ptr_t*)(from_ptr((R_ESP + 8))) ? &arg_8 : NULL, from_ptri(int32_t, R_ESP + 12), from_ptri(int32_t, R_ESP + 16)); R_EAX = r.d[0]; R_EDX = r.d[1]; if (*(ptr_t*)(from_ptr((R_ESP + 8)))) to_struct_p(*(ptr_t*)(from_ptr((R_ESP + 8))), &arg_8); emu->libc_err = errno; } void lEiibl_L_32(x64emu_t *emu, uintptr_t fcn) { lEiibl_L_t fn = (lEiibl_L_t)fcn; errno = emu->libc_err; struct_l_t arg_12={0}; if (*(ptr_t*)(from_ptr((R_ESP + 12)))) from_struct_l(&arg_12, *(ptr_t*)(from_ptr((R_ESP + 12)))); R_EAX = to_long(fn(from_ptri(int32_t, R_ESP + 4), from_ptri(int32_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_l(*(ptr_t*)(from_ptr((R_ESP + 12))), &arg_12); emu->libc_err = errno; } +void LEpBp_ii_32(x64emu_t *emu, uintptr_t fcn) { LEpBp_ii_t fn = (LEpBp_ii_t)fcn; errno = emu->libc_err; struct_p_t arg_8={0}; R_EAX = to_ulong(fn(from_ptriv(R_ESP + 4), *(ptr_t*)(from_ptr((R_ESP + 8))) ? &arg_8 : NULL, from_ptri(int32_t, R_ESP + 12), from_ptri(int32_t, R_ESP + 16))); if (*(ptr_t*)(from_ptr((R_ESP + 8)))) to_struct_p(*(ptr_t*)(from_ptr((R_ESP + 8))), &arg_8); emu->libc_err = errno; } void LEpbp_Lp_32(x64emu_t *emu, uintptr_t fcn) { LEpbp_Lp_t fn = (LEpbp_Lp_t)fcn; errno = emu->libc_err; struct_p_t arg_8={0}; if (*(ptr_t*)(from_ptr((R_ESP + 8)))) from_struct_p(&arg_8, *(ptr_t*)(from_ptr((R_ESP + 8)))); R_EAX = to_ulong(fn(from_ptriv(R_ESP + 4), *(ptr_t*)(from_ptr((R_ESP + 8))) ? &arg_8 : NULL, from_ulong(from_ptri(ulong_t, R_ESP + 12)), from_ptriv(R_ESP + 16))); if (*(ptr_t*)(from_ptr((R_ESP + 8)))) to_struct_p(*(ptr_t*)(from_ptr((R_ESP + 8))), &arg_8); emu->libc_err = errno; } void iEEpprLL__32(x64emu_t *emu, uintptr_t fcn) { iEEpprLL__t fn = (iEEpprLL__t)fcn; errno = emu->libc_err; 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), from_ptriv(R_ESP + 8), *(ptr_t*)(from_ptr((R_ESP + 12))) ? &arg_12 : NULL); emu->libc_err = errno; } void iEpurLL_p_32(x64emu_t *emu, uintptr_t fcn) { iEpurLL_p_t fn = (iEpurLL_p_t)fcn; errno = emu->libc_err; 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(from_ptriv(R_ESP + 4), from_ptri(uint32_t, R_ESP + 8), *(ptr_t*)(from_ptr((R_ESP + 12))) ? &arg_12 : NULL, from_ptriv(R_ESP + 16)); emu->libc_err = errno; } @@ -2816,6 +2824,7 @@ void vFXLiiL_32(x64emu_t *emu, uintptr_t fcn) { vFXLiiL_t fn = (vFXLiiL_t)fcn; f void vFXLppi_32(x64emu_t *emu, uintptr_t fcn) { vFXLppi_t fn = (vFXLppi_t)fcn; fn(getDisplay(from_ptriv(R_ESP + 4)), from_ulong(from_ptri(ulong_t, R_ESP + 8)), from_ptriv(R_ESP + 12), from_ptriv(R_ESP + 16), from_ptri(int32_t, R_ESP + 20)); } void vFXpiiL_32(x64emu_t *emu, uintptr_t fcn) { vFXpiiL_t fn = (vFXpiiL_t)fcn; fn(getDisplay(from_ptriv(R_ESP + 4)), from_ptriv(R_ESP + 8), from_ptri(int32_t, R_ESP + 12), from_ptri(int32_t, R_ESP + 16), from_ulong(from_ptri(ulong_t, R_ESP + 20))); } void iEEiiip_32(x64emu_t *emu, uintptr_t fcn) { iEEiiip_t fn = (iEEiiip_t)fcn; errno = emu->libc_err; R_EAX = fn(emu, from_ptri(int32_t, R_ESP + 4), from_ptri(int32_t, R_ESP + 8), from_ptri(int32_t, R_ESP + 12), from_ptriv(R_ESP + 16)); emu->libc_err = errno; } +void iEEiipV_32(x64emu_t *emu, uintptr_t fcn) { iEEiipV_t fn = (iEEiipV_t)fcn; errno = emu->libc_err; R_EAX = fn(emu, from_ptri(int32_t, R_ESP + 4), from_ptri(int32_t, R_ESP + 8), from_ptriv(R_ESP + 12), from_ptrv(R_ESP + 16)); emu->libc_err = errno; } void iEEipii_32(x64emu_t *emu, uintptr_t fcn) { iEEipii_t fn = (iEEipii_t)fcn; errno = emu->libc_err; R_EAX = fn(emu, from_ptri(int32_t, R_ESP + 4), from_ptriv(R_ESP + 8), from_ptri(int32_t, R_ESP + 12), from_ptri(int32_t, R_ESP + 16)); emu->libc_err = errno; } void iEEippL_32(x64emu_t *emu, uintptr_t fcn) { iEEippL_t fn = (iEEippL_t)fcn; errno = emu->libc_err; R_EAX = fn(emu, from_ptri(int32_t, R_ESP + 4), from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12), from_ulong(from_ptri(ulong_t, R_ESP + 16))); emu->libc_err = errno; } void iEEpipp_32(x64emu_t *emu, uintptr_t fcn) { iEEpipp_t fn = (iEEpipp_t)fcn; errno = emu->libc_err; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ptri(int32_t, R_ESP + 8), from_ptriv(R_ESP + 12), from_ptriv(R_ESP + 16)); emu->libc_err = errno; } @@ -2829,6 +2838,8 @@ void iFEpplp_32(x64emu_t *emu, uintptr_t fcn) { iFEpplp_t fn = (iFEpplp_t)fcn; R void iEEpppi_32(x64emu_t *emu, uintptr_t fcn) { iEEpppi_t fn = (iEEpppi_t)fcn; errno = emu->libc_err; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12), from_ptri(int32_t, R_ESP + 16)); emu->libc_err = errno; } void iEEpppp_32(x64emu_t *emu, uintptr_t fcn) { iEEpppp_t fn = (iEEpppp_t)fcn; errno = emu->libc_err; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12), from_ptriv(R_ESP + 16)); emu->libc_err = errno; } void iFEpppp_32(x64emu_t *emu, uintptr_t fcn) { iFEpppp_t fn = (iFEpppp_t)fcn; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12), from_ptriv(R_ESP + 16)); } +void iEESipp_32(x64emu_t *emu, uintptr_t fcn) { iEESipp_t fn = (iEESipp_t)fcn; errno = emu->libc_err; R_EAX = fn(emu, io_convert32(from_ptriv(R_ESP + 4)), from_ptri(int32_t, R_ESP + 8), from_ptriv(R_ESP + 12), from_ptriv(R_ESP + 16)); emu->libc_err = errno; } +void iEESipV_32(x64emu_t *emu, uintptr_t fcn) { iEESipV_t fn = (iEESipV_t)fcn; errno = emu->libc_err; R_EAX = fn(emu, io_convert32(from_ptriv(R_ESP + 4)), from_ptri(int32_t, R_ESP + 8), from_ptriv(R_ESP + 12), from_ptrv(R_ESP + 16)); emu->libc_err = errno; } void iFEXipp_32(x64emu_t *emu, uintptr_t fcn) { iFEXipp_t fn = (iFEXipp_t)fcn; R_EAX = fn(emu, getDisplay(from_ptriv(R_ESP + 4)), from_ptri(int32_t, R_ESP + 8), from_ptriv(R_ESP + 12), from_ptriv(R_ESP + 16)); } void iFEXLip_32(x64emu_t *emu, uintptr_t fcn) { iFEXLip_t fn = (iFEXLip_t)fcn; R_EAX = fn(emu, getDisplay(from_ptriv(R_ESP + 4)), from_ulong(from_ptri(ulong_t, R_ESP + 8)), from_ptri(int32_t, R_ESP + 12), from_ptriv(R_ESP + 16)); } void iFEXLlp_32(x64emu_t *emu, uintptr_t fcn) { iFEXLlp_t fn = (iFEXLlp_t)fcn; R_EAX = fn(emu, getDisplay(from_ptriv(R_ESP + 4)), from_ulong(from_ptri(ulong_t, R_ESP + 8)), from_long(from_ptri(long_t, R_ESP + 12)), from_ptriv(R_ESP + 16)); } @@ -2992,7 +3003,9 @@ void vFXLiiiL_32(x64emu_t *emu, uintptr_t fcn) { vFXLiiiL_t fn = (vFXLiiiL_t)fcn void vFXLiipi_32(x64emu_t *emu, uintptr_t fcn) { vFXLiipi_t fn = (vFXLiipi_t)fcn; fn(getDisplay(from_ptriv(R_ESP + 4)), from_ulong(from_ptri(ulong_t, R_ESP + 8)), from_ptri(int32_t, R_ESP + 12), from_ptri(int32_t, R_ESP + 16), from_ptriv(R_ESP + 20), from_ptri(int32_t, R_ESP + 24)); } void vFXLpppi_32(x64emu_t *emu, uintptr_t fcn) { vFXLpppi_t fn = (vFXLpppi_t)fcn; fn(getDisplay(from_ptriv(R_ESP + 4)), from_ulong(from_ptri(ulong_t, R_ESP + 8)), from_ptriv(R_ESP + 12), from_ptriv(R_ESP + 16), from_ptriv(R_ESP + 20), from_ptri(int32_t, R_ESP + 24)); } void iEEiippi_32(x64emu_t *emu, uintptr_t fcn) { iEEiippi_t fn = (iEEiippi_t)fcn; errno = emu->libc_err; R_EAX = fn(emu, from_ptri(int32_t, R_ESP + 4), from_ptri(int32_t, R_ESP + 8), from_ptriv(R_ESP + 12), from_ptriv(R_ESP + 16), from_ptri(int32_t, R_ESP + 20)); emu->libc_err = errno; } +void iEEipiup_32(x64emu_t *emu, uintptr_t fcn) { iEEipiup_t fn = (iEEipiup_t)fcn; errno = emu->libc_err; R_EAX = fn(emu, from_ptri(int32_t, R_ESP + 4), from_ptriv(R_ESP + 8), from_ptri(int32_t, R_ESP + 12), from_ptri(uint32_t, R_ESP + 16), from_ptriv(R_ESP + 20)); emu->libc_err = errno; } void iEEuppLp_32(x64emu_t *emu, uintptr_t fcn) { iEEuppLp_t fn = (iEEuppLp_t)fcn; errno = emu->libc_err; R_EAX = fn(emu, from_ptri(uint32_t, R_ESP + 4), from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12), from_ulong(from_ptri(ulong_t, R_ESP + 16)), from_ptriv(R_ESP + 20)); emu->libc_err = errno; } +void iEEpiipV_32(x64emu_t *emu, uintptr_t fcn) { iEEpiipV_t fn = (iEEpiipV_t)fcn; errno = emu->libc_err; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ptri(int32_t, R_ESP + 8), from_ptri(int32_t, R_ESP + 12), from_ptriv(R_ESP + 16), from_ptrv(R_ESP + 20)); emu->libc_err = errno; } void iFEpiuuu_32(x64emu_t *emu, uintptr_t fcn) { iFEpiuuu_t fn = (iFEpiuuu_t)fcn; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ptri(int32_t, R_ESP + 8), from_ptri(uint32_t, R_ESP + 12), from_ptri(uint32_t, R_ESP + 16), from_ptri(uint32_t, R_ESP + 20)); } void iEEpiLpp_32(x64emu_t *emu, uintptr_t fcn) { iEEpiLpp_t fn = (iEEpiLpp_t)fcn; errno = emu->libc_err; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ptri(int32_t, R_ESP + 8), from_ulong(from_ptri(ulong_t, R_ESP + 12)), from_ptriv(R_ESP + 16), from_ptriv(R_ESP + 20)); emu->libc_err = errno; } void iEEpipOi_32(x64emu_t *emu, uintptr_t fcn) { iEEpipOi_t fn = (iEEpipOi_t)fcn; errno = emu->libc_err; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ptri(int32_t, R_ESP + 8), from_ptriv(R_ESP + 12), of_convert32(from_ptri(int32_t, R_ESP + 16)), from_ptri(int32_t, R_ESP + 20)); emu->libc_err = errno; } @@ -3113,6 +3126,7 @@ void vFXLLuuuu_32(x64emu_t *emu, uintptr_t fcn) { vFXLLuuuu_t fn = (vFXLLuuuu_t) void vFXLppipi_32(x64emu_t *emu, uintptr_t fcn) { vFXLppipi_t fn = (vFXLppipi_t)fcn; fn(getDisplay(from_ptriv(R_ESP + 4)), from_ulong(from_ptri(ulong_t, R_ESP + 8)), from_ptriv(R_ESP + 12), from_ptriv(R_ESP + 16), from_ptri(int32_t, R_ESP + 20), from_ptriv(R_ESP + 24), from_ptri(int32_t, R_ESP + 28)); } void vFXpiipii_32(x64emu_t *emu, uintptr_t fcn) { vFXpiipii_t fn = (vFXpiipii_t)fcn; fn(getDisplay(from_ptriv(R_ESP + 4)), from_ptriv(R_ESP + 8), from_ptri(int32_t, R_ESP + 12), from_ptri(int32_t, R_ESP + 16), from_ptriv(R_ESP + 20), from_ptri(int32_t, R_ESP + 24), from_ptri(int32_t, R_ESP + 28)); } void vFXppiiii_32(x64emu_t *emu, uintptr_t fcn) { vFXppiiii_t fn = (vFXppiiii_t)fcn; fn(getDisplay(from_ptriv(R_ESP + 4)), from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12), from_ptri(int32_t, R_ESP + 16), from_ptri(int32_t, R_ESP + 20), from_ptri(int32_t, R_ESP + 24), from_ptri(int32_t, R_ESP + 28)); } +void iEEpLiipp_32(x64emu_t *emu, uintptr_t fcn) { iEEpLiipp_t fn = (iEEpLiipp_t)fcn; errno = emu->libc_err; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ulong(from_ptri(ulong_t, R_ESP + 8)), from_ptri(int32_t, R_ESP + 12), from_ptri(int32_t, R_ESP + 16), from_ptriv(R_ESP + 20), from_ptriv(R_ESP + 24)); emu->libc_err = errno; } void iEEpLiipV_32(x64emu_t *emu, uintptr_t fcn) { iEEpLiipV_t fn = (iEEpLiipV_t)fcn; errno = emu->libc_err; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ulong(from_ptri(ulong_t, R_ESP + 8)), from_ptri(int32_t, R_ESP + 12), from_ptri(int32_t, R_ESP + 16), from_ptriv(R_ESP + 20), from_ptrv(R_ESP + 24)); emu->libc_err = errno; } void iEEpLiLpV_32(x64emu_t *emu, uintptr_t fcn) { iEEpLiLpV_t fn = (iEEpLiLpV_t)fcn; errno = emu->libc_err; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ulong(from_ptri(ulong_t, R_ESP + 8)), from_ptri(int32_t, R_ESP + 12), from_ulong(from_ptri(ulong_t, R_ESP + 16)), from_ptriv(R_ESP + 20), from_ptrv(R_ESP + 24)); emu->libc_err = errno; } void iFEpppipp_32(x64emu_t *emu, uintptr_t fcn) { iFEpppipp_t fn = (iFEpppipp_t)fcn; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12), from_ptri(int32_t, R_ESP + 16), from_ptriv(R_ESP + 20), from_ptriv(R_ESP + 24)); } @@ -3353,16 +3367,7 @@ void KEKp_32(x64emu_t *emu, uintptr_t fcn) { KEKp_t fn = (KEKp_t)fcn; errno = em void KEpBp_a_32(x64emu_t *emu, uintptr_t fcn) { KEpBp_a_t fn = (KEpBp_a_t)fcn; errno = emu->libc_err; struct_p_t arg_8={0}; double db = fn(from_ptriv(R_ESP + 4), *(ptr_t*)(from_ptr((R_ESP + 8))) ? &arg_8 : NULL, from_locale(from_ptri(ptr_t, R_ESP + 12))); fpu_do_push(emu); ST0val = db; if (*(ptr_t*)(from_ptr((R_ESP + 8)))) to_struct_p(*(ptr_t*)(from_ptr((R_ESP + 8))), &arg_8); emu->libc_err = errno; } #endif -void iEEvpp_32(x64emu_t *emu, uintptr_t fcn) { iEEpp_t fn = (iEEpp_t)fcn; errno = emu->libc_err; R_EAX = fn(emu, from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12)); emu->libc_err = errno; } -void iEEvpV_32(x64emu_t *emu, uintptr_t fcn) { iEEpV_t fn = (iEEpV_t)fcn; errno = emu->libc_err; R_EAX = fn(emu, from_ptriv(R_ESP + 8), from_ptrv(R_ESP + 12)); emu->libc_err = errno; } void UEsvvs_32(x64emu_t *emu, uintptr_t fcn) { UEss_t fn = (UEss_t)fcn; errno = emu->libc_err; ui64_t r; r.u = (uint64_t)fn(from_ptrv(R_ESP + 4), from_ptrv(R_ESP + 12)); R_EAX = r.d[0]; R_EDX = r.d[1]; emu->libc_err = errno; } -void pEEppv_32(x64emu_t *emu, uintptr_t fcn) { pEEpp_t fn = (pEEpp_t)fcn; errno = emu->libc_err; R_EAX = to_ptrv(fn(emu, from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8))); emu->libc_err = errno; } -void LEpBp_iv_32(x64emu_t *emu, uintptr_t fcn) { LEpBp_i_t fn = (LEpBp_i_t)fcn; errno = emu->libc_err; struct_p_t arg_8={0}; R_EAX = to_ulong(fn(from_ptriv(R_ESP + 4), *(ptr_t*)(from_ptr((R_ESP + 8))) ? &arg_8 : NULL, from_ptri(int32_t, R_ESP + 12))); if (*(ptr_t*)(from_ptr((R_ESP + 8)))) to_struct_p(*(ptr_t*)(from_ptr((R_ESP + 8))), &arg_8); emu->libc_err = errno; } -void iEEivpV_32(x64emu_t *emu, uintptr_t fcn) { iEEipV_t fn = (iEEipV_t)fcn; errno = emu->libc_err; R_EAX = fn(emu, from_ptri(int32_t, R_ESP + 4), from_ptriv(R_ESP + 12), from_ptrv(R_ESP + 16)); emu->libc_err = errno; } -void iEESvpp_32(x64emu_t *emu, uintptr_t fcn) { iEESpp_t fn = (iEESpp_t)fcn; errno = emu->libc_err; R_EAX = fn(emu, io_convert32(from_ptriv(R_ESP + 4)), from_ptriv(R_ESP + 12), from_ptriv(R_ESP + 16)); emu->libc_err = errno; } -void iEESvpV_32(x64emu_t *emu, uintptr_t fcn) { iEESpV_t fn = (iEESpV_t)fcn; errno = emu->libc_err; R_EAX = fn(emu, io_convert32(from_ptriv(R_ESP + 4)), from_ptriv(R_ESP + 12), from_ptrv(R_ESP + 16)); emu->libc_err = errno; } -void iEEpvvpV_32(x64emu_t *emu, uintptr_t fcn) { iEEppV_t fn = (iEEppV_t)fcn; errno = emu->libc_err; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 16), from_ptrv(R_ESP + 20)); emu->libc_err = errno; } -void iEEpLvvpp_32(x64emu_t *emu, uintptr_t fcn) { iEEpLpp_t fn = (iEEpLpp_t)fcn; errno = emu->libc_err; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ulong(from_ptri(ulong_t, R_ESP + 8)), from_ptriv(R_ESP + 20), from_ptriv(R_ESP + 24)); emu->libc_err = errno; } int isRetX87Wrapper32(wrapper_t fun) { if (fun == &fFi_32) return 1; diff --git a/src/wrapped32/generated/wrapper32.h b/src/wrapped32/generated/wrapper32.h index 31e1521e..650d4791 100644 --- a/src/wrapped32/generated/wrapper32.h +++ b/src/wrapped32/generated/wrapper32.h @@ -1008,6 +1008,7 @@ void IEpBp_ii_32(x64emu_t *emu, uintptr_t fnc); void uFppibp__32(x64emu_t *emu, uintptr_t fnc); void UEpBp_ii_32(x64emu_t *emu, uintptr_t fnc); void lEiibl_L_32(x64emu_t *emu, uintptr_t fnc); +void LEpBp_ii_32(x64emu_t *emu, uintptr_t fnc); void LEpbp_Lp_32(x64emu_t *emu, uintptr_t fnc); void iEEpprLL__32(x64emu_t *emu, uintptr_t fnc); void iEpurLL_p_32(x64emu_t *emu, uintptr_t fnc); @@ -1134,6 +1135,7 @@ void vFXLiiL_32(x64emu_t *emu, uintptr_t fnc); void vFXLppi_32(x64emu_t *emu, uintptr_t fnc); void vFXpiiL_32(x64emu_t *emu, uintptr_t fnc); void iEEiiip_32(x64emu_t *emu, uintptr_t fnc); +void iEEiipV_32(x64emu_t *emu, uintptr_t fnc); void iEEipii_32(x64emu_t *emu, uintptr_t fnc); void iEEippL_32(x64emu_t *emu, uintptr_t fnc); void iEEpipp_32(x64emu_t *emu, uintptr_t fnc); @@ -1147,6 +1149,8 @@ void iFEpplp_32(x64emu_t *emu, uintptr_t fnc); void iEEpppi_32(x64emu_t *emu, uintptr_t fnc); void iEEpppp_32(x64emu_t *emu, uintptr_t fnc); void iFEpppp_32(x64emu_t *emu, uintptr_t fnc); +void iEESipp_32(x64emu_t *emu, uintptr_t fnc); +void iEESipV_32(x64emu_t *emu, uintptr_t fnc); void iFEXipp_32(x64emu_t *emu, uintptr_t fnc); void iFEXLip_32(x64emu_t *emu, uintptr_t fnc); void iFEXLlp_32(x64emu_t *emu, uintptr_t fnc); @@ -1310,7 +1314,9 @@ void vFXLiiiL_32(x64emu_t *emu, uintptr_t fnc); void vFXLiipi_32(x64emu_t *emu, uintptr_t fnc); void vFXLpppi_32(x64emu_t *emu, uintptr_t fnc); void iEEiippi_32(x64emu_t *emu, uintptr_t fnc); +void iEEipiup_32(x64emu_t *emu, uintptr_t fnc); void iEEuppLp_32(x64emu_t *emu, uintptr_t fnc); +void iEEpiipV_32(x64emu_t *emu, uintptr_t fnc); void iFEpiuuu_32(x64emu_t *emu, uintptr_t fnc); void iEEpiLpp_32(x64emu_t *emu, uintptr_t fnc); void iEEpipOi_32(x64emu_t *emu, uintptr_t fnc); @@ -1431,6 +1437,7 @@ void vFXLLuuuu_32(x64emu_t *emu, uintptr_t fnc); void vFXLppipi_32(x64emu_t *emu, uintptr_t fnc); void vFXpiipii_32(x64emu_t *emu, uintptr_t fnc); void vFXppiiii_32(x64emu_t *emu, uintptr_t fnc); +void iEEpLiipp_32(x64emu_t *emu, uintptr_t fnc); void iEEpLiipV_32(x64emu_t *emu, uintptr_t fnc); void iEEpLiLpV_32(x64emu_t *emu, uintptr_t fnc); void iFEpppipp_32(x64emu_t *emu, uintptr_t fnc); @@ -1671,14 +1678,5 @@ void KEKp_32(x64emu_t *emu, uintptr_t fnc); void KEpBp_a_32(x64emu_t *emu, uintptr_t fnc); #endif -void iEEvpp_32(x64emu_t *emu, uintptr_t fnc); -void iEEvpV_32(x64emu_t *emu, uintptr_t fnc); void UEsvvs_32(x64emu_t *emu, uintptr_t fnc); -void pEEppv_32(x64emu_t *emu, uintptr_t fnc); -void LEpBp_iv_32(x64emu_t *emu, uintptr_t fnc); -void iEEivpV_32(x64emu_t *emu, uintptr_t fnc); -void iEESvpp_32(x64emu_t *emu, uintptr_t fnc); -void iEESvpV_32(x64emu_t *emu, uintptr_t fnc); -void iEEpvvpV_32(x64emu_t *emu, uintptr_t fnc); -void iEEpLvvpp_32(x64emu_t *emu, uintptr_t fnc); #endif // __WRAPPER32_H_ diff --git a/src/wrapped32/wrappedlibc.c b/src/wrapped32/wrappedlibc.c index 7c3691f9..e696004a 100755 --- a/src/wrapped32/wrappedlibc.c +++ b/src/wrapped32/wrappedlibc.c @@ -125,8 +125,6 @@ static const char* libcName = #endif ; -static library_t* my_lib = NULL; - extern int fix_64bit_inodes; typedef int32_t (*iFiiV_t)(int32_t, int32_t, ...); #if 0 @@ -159,7 +157,11 @@ typedef void* (*pFu_t)(uint32_t); #endif -//#include "wrappercallback.h" +#define ADDED_FUNCTIONS() \ + +#include "generated/wrappedlibctypes32.h" + +#include "wrappercallback32.h" // utility functions #define SUPER() \ @@ -721,14 +723,22 @@ EXPORT int my32_printf(x64emu_t *emu, void* fmt, void* b) { PREPARE_VALIST_32; return vprintf((const char*)fmt, VARARGS_32); } -EXPORT int my32___printf_chk(x64emu_t *emu, void* fmt, void* b) __attribute__((alias("my32_printf"))); +EXPORT int my32___printf_chk(x64emu_t *emu, int a, void* fmt, void* b) { + myStackAlign32((const char*)fmt, b, emu->scratch); + PREPARE_VALIST_32; + return vprintf((const char*)fmt, VARARGS_32); +} EXPORT int my32_vprintf(x64emu_t *emu, void* fmt, void* b) { myStackAlign32((const char*)fmt, b, emu->scratch); PREPARE_VALIST_32; return vprintf(fmt, VARARGS_32); } -EXPORT int my32___vprintf_chk(x64emu_t *emu, void* fmt, void* b) __attribute__((alias("my32_vprintf"))); +EXPORT int my32___vprintf_chk(x64emu_t *emu, int a, void* fmt, void* b) { + myStackAlign32((const char*)fmt, b, emu->scratch); + PREPARE_VALIST_32; + return vprintf(fmt, VARARGS_32); +} EXPORT int my32_vfprintf(x64emu_t *emu, void* F, void* fmt, void* b) { // need to align on arm @@ -736,8 +746,13 @@ EXPORT int my32_vfprintf(x64emu_t *emu, void* F, void* fmt, void* b) { PREPARE_VALIST_32; return vfprintf(F, fmt, VARARGS_32); } -EXPORT int my32___vfprintf_chk(x64emu_t *emu, void* F, void* fmt, void* b) __attribute__((alias("my32_vfprintf"))); EXPORT int my32__IO_vfprintf(x64emu_t *emu, void* F, void* fmt, void* b) __attribute__((alias("my32_vfprintf"))); +EXPORT int my32___vfprintf_chk(x64emu_t *emu, void* F, int a1, void* fmt, void* b) { + // need to align on arm + myStackAlign32((const char*)fmt, b, emu->scratch); + PREPARE_VALIST_32; + return vfprintf(F, fmt, VARARGS_32); +} EXPORT int my32_dprintf(x64emu_t *emu, int fd, void* fmt, void* V) { // need to align on arm @@ -745,15 +760,25 @@ EXPORT int my32_dprintf(x64emu_t *emu, int fd, void* fmt, void* V) { PREPARE_VALIST_32; return vdprintf(fd, fmt, VARARGS_32); } -EXPORT int my32___dprintf_chk(x64emu_t *emu, int fd, void* fmt, void* V) __attribute__((alias("my32_dprintf"))); +EXPORT int my32___dprintf_chk(x64emu_t *emu, int fd, int a, void* fmt, void* V) { + // need to align on arm + myStackAlign32((const char*)fmt, V, emu->scratch); + PREPARE_VALIST_32; + return vdprintf(fd, fmt, VARARGS_32); +} -EXPORT int my32_fprintf(x64emu_t *emu, void* F, void* fmt, void* V) { +EXPORT int my32_fprintf(x64emu_t *emu, void* F, void* fmt, void* V) { + // need to align on arm + myStackAlign32((const char*)fmt, V, emu->scratch); + PREPARE_VALIST_32; + return vfprintf(F, fmt, VARARGS_32); +} +EXPORT int my32___fprintf_chk(x64emu_t *emu, void* F, int a, void* fmt, void* V) { // need to align on arm myStackAlign32((const char*)fmt, V, emu->scratch); PREPARE_VALIST_32; return vfprintf(F, fmt, VARARGS_32); } -EXPORT int my32___fprintf_chk(x64emu_t *emu, void* F, void* fmt, void* V) __attribute__((alias("my32_fprintf"))); extern int box64_stdout_no_w; EXPORT int my32_wprintf(x64emu_t *emu, void* fmt, void* V) { // need to align on arm @@ -844,7 +869,12 @@ EXPORT int my32_sprintf(x64emu_t* emu, void* buff, void * fmt, void * b) { PREPARE_VALIST_32; return vsprintf(buff, fmt, VARARGS_32); } -EXPORT int my32___sprintf_chk(x64emu_t* emu, void* buff, void * fmt, void * b) __attribute__((alias("my32_sprintf"))); +EXPORT int my32___sprintf_chk(x64emu_t* emu, void* buff, int a1, int a2, void * fmt, void * b) { + // need to align on arm + myStackAlign32((const char*)fmt, b, emu->scratch); + PREPARE_VALIST_32; + return vsprintf(buff, fmt, VARARGS_32); +} EXPORT int my32_asprintf(x64emu_t* emu, ptr_t* buff, void * fmt, void * b) { // need to align on arm @@ -906,7 +936,13 @@ EXPORT int my32_vsnprintf(x64emu_t* emu, void* buff, size_t s, void * fmt, void return r; } EXPORT int my32___vsnprintf(x64emu_t* emu, void* buff, size_t s, void * fmt, void * b) __attribute__((alias("my32_vsnprintf"))); -EXPORT int my32___vsnprintf_chk(x64emu_t* emu, void* buff, size_t s, void * fmt, void * b) __attribute__((alias("my32_vsnprintf"))); +EXPORT int my32___vsnprintf_chk(x64emu_t* emu, void* buff, size_t s, int a1, int a2, void * fmt, void * b) { + // need to align on arm + myStackAlign32((const char*)fmt, (uint32_t*)b, emu->scratch); + PREPARE_VALIST_32; + int r = vsnprintf(buff, s, fmt, VARARGS_32); + return r; +} EXPORT int my32_vasprintf(x64emu_t* emu, ptr_t* strp, void* fmt, void* b) { // need to align on arm @@ -1138,6 +1174,28 @@ EXPORT int my32___fxstat64(x64emu_t *emu, int vers, int fd, void* buf) UnalignStat64_32(&st, buf); return r; } + +EXPORT int my32_statx(x64emu_t* emu, int dirfd, void* path, int flags, uint32_t mask, void* buf) +{ + // no need to convert the structure? + int ret = -1; + if(my->statx) + ret = my->statx(dirfd, path, flags, mask, buf); + else + #ifdef __NR_statx + { + ret = syscall(__NR_statx, dirfd, path, flags, mask, buf); + if(ret<0) { + errno = -ret; + ret = -1; + } + } + #else + errno = ENOSYS; + #endif + return ret; +} + EXPORT int my32_stat64(x64emu_t* emu, void* path, void* buf) { struct stat64 st; @@ -3163,6 +3221,8 @@ EXPORT void* my32___errno_location(x64emu_t* emu) return &emu->libc_err; } +#undef HAS_MY + #define PRE_INIT\ if(1) \ my_lib = lib->w.lib = dlopen(NULL, RTLD_LAZY | RTLD_GLOBAL);\ diff --git a/src/wrapped32/wrappedlibc_private.h b/src/wrapped32/wrappedlibc_private.h index f14a2e44..a74f57c4 100755 --- a/src/wrapped32/wrappedlibc_private.h +++ b/src/wrapped32/wrappedlibc_private.h @@ -221,7 +221,7 @@ GOW2(dl_iterate_phdr, iEEpp, my_dl_iterate_phdr) //%% // _dl_vsym //GOW(dngettext, pEpppu) //GOM(dprintf, iEEipV) -GOM(__dprintf_chk, iEEivpV) //%% +GOM(__dprintf_chk, iEEiipV) //%% GO(drand48, dEv) // drand48_r GOW(dup, iEi) @@ -376,7 +376,7 @@ GOM(__fork, iEEv) //%% GOW(fpathconf, lEii) //GO(__fpending, uEp) GOM(fprintf, iEESpV) //%% -GOM(__fprintf_chk, iEESvpV) //%% +GOM(__fprintf_chk, iEESipV) //%% // __fpu_control // type B //GO(__fpurge, vEp) GOW(fputc, iEiS) @@ -599,6 +599,7 @@ GOW(getsockopt, iEiiipp) // getspnam_r // getsubopt GOW(gettext, pEp) +GOW(gettid, iEv) GOW(gettimeofday, iEBll_p) //GO(__gettimeofday, iEpp) // getttyent @@ -1289,7 +1290,7 @@ GOW(pread64, lEipLI) //GOM(preadv64, lEEipiI) //%% not always present // __pread_chk GOM(printf, iEEpV) //%% -GOM(__printf_chk, iEEvpV) //%% +GOM(__printf_chk, iEEipV) //%% //GO(__printf_fp, iEppp) // does this needs aligment? // printf_size // printf_size_info @@ -1370,7 +1371,7 @@ GOM(readv, lEEipi) GO(realloc, pEpL) //DATAV(__realloc_hook, 4) GOM(realpath, pEEpp) //%% -GO2(__realpath_chk, pEEppv, my32_realpath) +GO2(__realpath_chk, pEEppi, my32_realpath) // reboot // re_comp // Weak // re_compile_fastmap // Weak @@ -1597,7 +1598,7 @@ GOW(socket, iEiii) GOW(socketpair, iEiiip) //GO(splice, iEipipuu) GOM(sprintf, iEEppV) //%% -GOM(__sprintf_chk, iEEpvvpV) //%% +GOM(__sprintf_chk, iEEpiipV) //%% // sprofil // Weak GOW(srand, vEu) GO(srand48, vEl) @@ -1615,6 +1616,7 @@ GOWM(statfs, iEpp) //%%,noE GOWM(statfs64, iEpp) //%%,noE GOM(statvfs, iEEpp) GOWM(statvfs64, iEEpp) +GOM(statx, iEEipiup) DATAM(stderr, 4) DATAM(stdin, 4) DATAM(stdout, 4) @@ -1724,7 +1726,7 @@ GO(__strtoll_internal, IEpBp_ii) //GOW(strtoll_l, IEppip) //GOW(strtoq, IEppi) // is that ok? GOM(strtoul, LEpBp_i) //%%,noE -GO2(__strtoul_internal, LEpBp_iv, my32_strtoul) //%%,noE +GO2(__strtoul_internal, LEpBp_ii, my32_strtoul) //%%,noE GO(strtoull, UEpBp_i) //GO(__strtoul_l, uEppip) //GOW(strtoul_l, LEppip) @@ -1899,7 +1901,7 @@ GOM(__vasprintf_chk, iEEpipp) //%% GOWM(vfork, iEEv) //%% // __vfork GOM(vfprintf, iEESpp) //%% -GOM(__vfprintf_chk, iEESvpp) //%% +GOM(__vfprintf_chk, iEESipp) //%% //GOWM(vfscanf, iEEppp) //%% // __vfscanf //GOWM(vfwprintf, iEEppp) //%% @@ -1909,11 +1911,11 @@ GOM(__vfprintf_chk, iEESvpp) //%% // vlimit // vmsplice GOM(vprintf, iEEpp) //%% -GOM(__vprintf_chk, iEEvpp) //%% +GOM(__vprintf_chk, iEEipp) //%% // vscanf // Weak GOWM(vsnprintf, iEEpLpp) //%% GOWM(__vsnprintf, iEEpLpp) //%% -GOM(__vsnprintf_chk, iEEpLvvpp) //%% +GOM(__vsnprintf_chk, iEEpLiipp) //%% GOWM(vsprintf, iEEppp) //%% GOM(__vsprintf_chk, iEEpiLpp) //%% //GOM(vsscanf, iEEppp) //%% |