diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2024-12-13 16:54:54 +0100 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2024-12-13 16:54:54 +0100 |
| commit | 1c5ccefdefd31e62e08de22dbf6f06b07fd8d424 (patch) | |
| tree | 66975042cd88f82513c6bdd3918dc0f4011c8bfc | |
| parent | 64bfd06be4449751d54650bf2f6cc66550df0b6b (diff) | |
| download | box64-1c5ccefdefd31e62e08de22dbf6f06b07fd8d424.tar.gz box64-1c5ccefdefd31e62e08de22dbf6f06b07fd8d424.zip | |
[BOX32][WRAPPER] Added a few more libc 32bits wrapped functions
| -rw-r--r-- | src/wrapped32/generated/functions_list.txt | 5 | ||||
| -rw-r--r-- | src/wrapped32/generated/wrappedlibctypes32.h | 2 | ||||
| -rw-r--r-- | src/wrapped32/generated/wrapper32.c | 6 | ||||
| -rw-r--r-- | src/wrapped32/generated/wrapper32.h | 3 | ||||
| -rwxr-xr-x | src/wrapped32/wrappedlibc_private.h | 12 |
5 files changed, 22 insertions, 6 deletions
diff --git a/src/wrapped32/generated/functions_list.txt b/src/wrapped32/generated/functions_list.txt index f282171e..d447edc5 100644 --- a/src/wrapped32/generated/functions_list.txt +++ b/src/wrapped32/generated/functions_list.txt @@ -36,6 +36,7 @@ #() iEd -> iEd #() iEl -> iEl #() iEL -> iEL +#() iFL -> iFL #() iEp -> iEp #() iFp -> iFp #() iEh -> iEh @@ -568,6 +569,7 @@ #() iFXpp -> iFXpp #() IEiIi -> IEiIi #() IFpIi -> IFpIi +#() IEppi -> IEppi #() CFipp -> CFipp #() CFuUu -> CFuUu #() CFuff -> CFuff @@ -589,6 +591,7 @@ #() uEppL -> uEppL #() uFppp -> uFppp #() uFXuu -> uFXuu +#() UEppi -> UEppi #() fFuii -> fFuii #() fEfff -> fEfff #() fEffp -> fEffp @@ -1945,6 +1948,8 @@ wrappedlibc: - gethostbyname - pES: - getmntent +- tEp: + - __secure_getenv - iEbp_: - getifaddrs - pErl_: diff --git a/src/wrapped32/generated/wrappedlibctypes32.h b/src/wrapped32/generated/wrappedlibctypes32.h index 25ad6055..10566663 100644 --- a/src/wrapped32/generated/wrappedlibctypes32.h +++ b/src/wrapped32/generated/wrappedlibctypes32.h @@ -35,6 +35,7 @@ typedef void* (*pFL_t)(uintptr_t); typedef void* (*pEp_t)(void*); typedef void* (*pFp_t)(void*); typedef void* (*pES_t)(void*); +typedef char* (*tEp_t)(void*); typedef int32_t (*iEbp__t)(struct_p_t*); typedef void* (*pErl__t)(struct_l_t*); typedef void* (*pEriiiiiiiiilt__t)(struct_iiiiiiiiilt_t*); @@ -167,6 +168,7 @@ typedef int32_t (*iFpuippupp_t)(void*, uint32_t, int32_t, void*, void*, uint32_t GO(localtime, pEp_t) \ GO(gethostbyname, pFp_t) \ GO(getmntent, pES_t) \ + GO(__secure_getenv, tEp_t) \ GO(getifaddrs, iEbp__t) \ GO(ctime, pErl__t) \ GO(asctime, pEriiiiiiiiilt__t) \ diff --git a/src/wrapped32/generated/wrapper32.c b/src/wrapped32/generated/wrapper32.c index 570efc8f..6bb10ef7 100644 --- a/src/wrapped32/generated/wrapper32.c +++ b/src/wrapped32/generated/wrapper32.c @@ -127,6 +127,7 @@ typedef int32_t (*iEf_t)(float); typedef int32_t (*iEd_t)(double); typedef int32_t (*iEl_t)(intptr_t); typedef int32_t (*iEL_t)(uintptr_t); +typedef int32_t (*iFL_t)(uintptr_t); typedef int32_t (*iEp_t)(void*); typedef int32_t (*iFp_t)(void*); typedef int32_t (*iEh_t)(uintptr_t); @@ -659,6 +660,7 @@ typedef int32_t (*iFXpL_t)(void*, void*, uintptr_t); typedef int32_t (*iFXpp_t)(void*, void*, void*); typedef int64_t (*IEiIi_t)(int32_t, int64_t, int32_t); typedef int64_t (*IFpIi_t)(void*, int64_t, int32_t); +typedef int64_t (*IEppi_t)(void*, void*, int32_t); typedef uint8_t (*CFipp_t)(int32_t, void*, void*); typedef uint8_t (*CFuUu_t)(uint32_t, uint64_t, uint32_t); typedef uint8_t (*CFuff_t)(uint32_t, float, float); @@ -680,6 +682,7 @@ typedef uint32_t (*uFppu_t)(void*, void*, uint32_t); typedef uint32_t (*uEppL_t)(void*, void*, uintptr_t); typedef uint32_t (*uFppp_t)(void*, void*, void*); typedef uint32_t (*uFXuu_t)(void*, uint32_t, uint32_t); +typedef uint64_t (*UEppi_t)(void*, void*, int32_t); typedef float (*fFuii_t)(uint32_t, int32_t, int32_t); typedef float (*fEfff_t)(float, float, float); typedef float (*fEffp_t)(float, float, void*); @@ -1892,6 +1895,7 @@ void iEf_32(x64emu_t *emu, uintptr_t fcn) { iEf_t fn = (iEf_t)fcn; errno = emu-> void iEd_32(x64emu_t *emu, uintptr_t fcn) { iEd_t fn = (iEd_t)fcn; errno = emu->libc_err; R_EAX = fn(from_ptri(double, R_ESP + 4)); emu->libc_err = errno; } void iEl_32(x64emu_t *emu, uintptr_t fcn) { iEl_t fn = (iEl_t)fcn; errno = emu->libc_err; R_EAX = fn(from_long(from_ptri(long_t, R_ESP + 4))); emu->libc_err = errno; } void iEL_32(x64emu_t *emu, uintptr_t fcn) { iEL_t fn = (iEL_t)fcn; errno = emu->libc_err; R_EAX = fn(from_ulong(from_ptri(ulong_t, R_ESP + 4))); emu->libc_err = errno; } +void iFL_32(x64emu_t *emu, uintptr_t fcn) { iFL_t fn = (iFL_t)fcn; R_EAX = fn(from_ulong(from_ptri(ulong_t, R_ESP + 4))); } void iEp_32(x64emu_t *emu, uintptr_t fcn) { iEp_t fn = (iEp_t)fcn; errno = emu->libc_err; R_EAX = fn(from_ptriv(R_ESP + 4)); emu->libc_err = errno; } void iFp_32(x64emu_t *emu, uintptr_t fcn) { iFp_t fn = (iFp_t)fcn; R_EAX = fn(from_ptriv(R_ESP + 4)); } void iEh_32(x64emu_t *emu, uintptr_t fcn) { iEh_t fn = (iEh_t)fcn; errno = emu->libc_err; R_EAX = fn(from_hash(from_ptri(ptr_t, R_ESP + 4))); emu->libc_err = errno; } @@ -2424,6 +2428,7 @@ void iFXpL_32(x64emu_t *emu, uintptr_t fcn) { iFXpL_t fn = (iFXpL_t)fcn; R_EAX = void iFXpp_32(x64emu_t *emu, uintptr_t fcn) { iFXpp_t fn = (iFXpp_t)fcn; R_EAX = fn(getDisplay(from_ptriv(R_ESP + 4)), from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12)); } void IEiIi_32(x64emu_t *emu, uintptr_t fcn) { IEiIi_t fn = (IEiIi_t)fcn; errno = emu->libc_err; ui64_t r; r.i = fn(from_ptri(int32_t, R_ESP + 4), from_ptri(int64_t, R_ESP + 8), from_ptri(int32_t, R_ESP + 16)); R_EAX = r.d[0]; R_EDX = r.d[1]; emu->libc_err = errno; } void IFpIi_32(x64emu_t *emu, uintptr_t fcn) { IFpIi_t fn = (IFpIi_t)fcn; ui64_t r; r.i = fn(from_ptriv(R_ESP + 4), from_ptri(int64_t, R_ESP + 8), from_ptri(int32_t, R_ESP + 16)); R_EAX = r.d[0]; R_EDX = r.d[1]; } +void IEppi_32(x64emu_t *emu, uintptr_t fcn) { IEppi_t fn = (IEppi_t)fcn; errno = emu->libc_err; ui64_t r; r.i = fn(from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ptri(int32_t, R_ESP + 12)); R_EAX = r.d[0]; R_EDX = r.d[1]; emu->libc_err = errno; } void CFipp_32(x64emu_t *emu, uintptr_t fcn) { CFipp_t fn = (CFipp_t)fcn; R_EAX = (unsigned char)fn(from_ptri(int32_t, R_ESP + 4), from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12)); } void CFuUu_32(x64emu_t *emu, uintptr_t fcn) { CFuUu_t fn = (CFuUu_t)fcn; R_EAX = (unsigned char)fn(from_ptri(uint32_t, R_ESP + 4), from_ptri(uint64_t, R_ESP + 8), from_ptri(uint32_t, R_ESP + 16)); } void CFuff_32(x64emu_t *emu, uintptr_t fcn) { CFuff_t fn = (CFuff_t)fcn; R_EAX = (unsigned char)fn(from_ptri(uint32_t, R_ESP + 4), from_ptri(float, R_ESP + 8), from_ptri(float, R_ESP + 12)); } @@ -2445,6 +2450,7 @@ void uFppu_32(x64emu_t *emu, uintptr_t fcn) { uFppu_t fn = (uFppu_t)fcn; R_EAX = void uEppL_32(x64emu_t *emu, uintptr_t fcn) { uEppL_t fn = (uEppL_t)fcn; errno = emu->libc_err; R_EAX = (uint32_t)fn(from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ulong(from_ptri(ulong_t, R_ESP + 12))); emu->libc_err = errno; } void uFppp_32(x64emu_t *emu, uintptr_t fcn) { uFppp_t fn = (uFppp_t)fcn; R_EAX = (uint32_t)fn(from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12)); } void uFXuu_32(x64emu_t *emu, uintptr_t fcn) { uFXuu_t fn = (uFXuu_t)fcn; R_EAX = (uint32_t)fn(getDisplay(from_ptriv(R_ESP + 4)), from_ptri(uint32_t, R_ESP + 8), from_ptri(uint32_t, R_ESP + 12)); } +void UEppi_32(x64emu_t *emu, uintptr_t fcn) { UEppi_t fn = (UEppi_t)fcn; errno = emu->libc_err; ui64_t r; r.u = (uint64_t)fn(from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ptri(int32_t, R_ESP + 12)); R_EAX = r.d[0]; R_EDX = r.d[1]; emu->libc_err = errno; } void fFuii_32(x64emu_t *emu, uintptr_t fcn) { fFuii_t fn = (fFuii_t)fcn; float fl = fn(from_ptri(uint32_t, R_ESP + 4), from_ptri(int32_t, R_ESP + 8), from_ptri(int32_t, R_ESP + 12)); fpu_do_push(emu); ST0val = fl; } void fEfff_32(x64emu_t *emu, uintptr_t fcn) { fEfff_t fn = (fEfff_t)fcn; errno = emu->libc_err; float fl = fn(from_ptri(float, R_ESP + 4), from_ptri(float, R_ESP + 8), from_ptri(float, R_ESP + 12)); fpu_do_push(emu); ST0val = fl; emu->libc_err = errno; } void fEffp_32(x64emu_t *emu, uintptr_t fcn) { fEffp_t fn = (fEffp_t)fcn; errno = emu->libc_err; float fl = fn(from_ptri(float, R_ESP + 4), from_ptri(float, R_ESP + 8), from_ptriv(R_ESP + 12)); fpu_do_push(emu); ST0val = fl; emu->libc_err = errno; } diff --git a/src/wrapped32/generated/wrapper32.h b/src/wrapped32/generated/wrapper32.h index c83602e1..f9a2d1cc 100644 --- a/src/wrapped32/generated/wrapper32.h +++ b/src/wrapped32/generated/wrapper32.h @@ -77,6 +77,7 @@ void iEf_32(x64emu_t *emu, uintptr_t fnc); void iEd_32(x64emu_t *emu, uintptr_t fnc); void iEl_32(x64emu_t *emu, uintptr_t fnc); void iEL_32(x64emu_t *emu, uintptr_t fnc); +void iFL_32(x64emu_t *emu, uintptr_t fnc); void iEp_32(x64emu_t *emu, uintptr_t fnc); void iFp_32(x64emu_t *emu, uintptr_t fnc); void iEh_32(x64emu_t *emu, uintptr_t fnc); @@ -609,6 +610,7 @@ void iFXpL_32(x64emu_t *emu, uintptr_t fnc); void iFXpp_32(x64emu_t *emu, uintptr_t fnc); void IEiIi_32(x64emu_t *emu, uintptr_t fnc); void IFpIi_32(x64emu_t *emu, uintptr_t fnc); +void IEppi_32(x64emu_t *emu, uintptr_t fnc); void CFipp_32(x64emu_t *emu, uintptr_t fnc); void CFuUu_32(x64emu_t *emu, uintptr_t fnc); void CFuff_32(x64emu_t *emu, uintptr_t fnc); @@ -630,6 +632,7 @@ void uFppu_32(x64emu_t *emu, uintptr_t fnc); void uEppL_32(x64emu_t *emu, uintptr_t fnc); void uFppp_32(x64emu_t *emu, uintptr_t fnc); void uFXuu_32(x64emu_t *emu, uintptr_t fnc); +void UEppi_32(x64emu_t *emu, uintptr_t fnc); void fFuii_32(x64emu_t *emu, uintptr_t fnc); void fEfff_32(x64emu_t *emu, uintptr_t fnc); void fEffp_32(x64emu_t *emu, uintptr_t fnc); diff --git a/src/wrapped32/wrappedlibc_private.h b/src/wrapped32/wrappedlibc_private.h index b7c539e4..bd5b9c84 100755 --- a/src/wrapped32/wrappedlibc_private.h +++ b/src/wrapped32/wrappedlibc_private.h @@ -507,7 +507,7 @@ GOM(gethostbyname, pFEp) GOM(gethostbyname_r, iFEpppupp) //GO(gethostent, pFv) //GO(gethostent_r, iFppupp) -// gethostid +GO(gethostid, LFv) GOW(gethostname, iEpL) // __gethostname_chk GOM(getifaddrs, iEEbp_) @@ -1239,7 +1239,7 @@ GOW(pathconf, lEpi) GOW(pause, iEv) GO(pclose, iES) GO(perror, vEp) -// personality // Weak +GOW(personality, iFL) GOW(pipe, iEp) // __pipe GOW(pipe2, iEpO) // assuming this works the same as pipe, so pointer for array of 2 int @@ -1256,7 +1256,7 @@ GO(posix_fadvise, iEilli) GO(posix_fadvise64, iEiIIi) GO(posix_fallocate, iEill) GO(posix_fallocate64, iEiII) -// posix_madvise +GO(posix_madvise, iEpLi) GOW(posix_memalign, iEBp_LL) // posix_openpt // Weak GOM(posix_spawn, iEEpppppp) @@ -1464,7 +1464,7 @@ GO(__sched_setscheduler, iEiip) GOW(sched_setscheduler, iEiip) GO(__sched_yield, iEv) GOW(sched_yield, iEv) -GO(__secure_getenv, tEp) +GO2(__secure_getenv, tEp, secure_getenv) GO(secure_getenv, tEp) // seed48 // seed48_r // Weak @@ -1724,7 +1724,7 @@ GO(strtoll, IEpBp_i) GO(__strtoll_internal, IEpBp_ii) GO(__strtoll_l, IEpBp_ia) GOW(strtoll_l, IEpBp_ia) -//GOW(strtoq, IEppi) // is that ok? +GOW(strtoq, IEppi) // is that ok? GOM(strtoul, LEpBp_i) //%%,noE GO2(__strtoul_internal, LEpBp_ii, my32_strtoul) //%%,noE GO(strtoull, UEpBp_i) @@ -1734,7 +1734,7 @@ GO(__strtoull_internal, UEpBp_ii) GO(__strtoull_l, UEpBp_ia) GOW(strtoull_l, UEpBp_ia) //GO(strtoumax, UEppi) -//GOW(strtouq, UEppi) // ok? +GOW(strtouq, UEppi) // ok? GOW(strverscmp, iEpp) // __strverscmp GO(strxfrm, uEppL) |