diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2025-02-21 15:42:21 +0100 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2025-02-21 15:42:21 +0100 |
| commit | 91b282235b44ae32ec46738fba2d151ace99fb5b (patch) | |
| tree | b3f6191131e28b038506d398b927f55a764e965d | |
| parent | 63c3e4fcf5351fbab35efaa1bcce92e74e970313 (diff) | |
| download | box64-91b282235b44ae32ec46738fba2d151ace99fb5b.tar.gz box64-91b282235b44ae32ec46738fba2d151ace99fb5b.zip | |
[BOX32][ANDROID][TERMUX] revert previous commit and added a new test for shmat wrapped function (still for #2227)
| -rw-r--r-- | src/wrapped32/generated/functions_list.txt | 3 | ||||
| -rw-r--r-- | src/wrapped32/generated/wrapper32.c | 18 | ||||
| -rw-r--r-- | src/wrapped32/generated/wrapper32.h | 9 | ||||
| -rwxr-xr-x | src/wrapped32/wrappedlibc.c | 2 | ||||
| -rwxr-xr-x | src/wrapped32/wrappedlibc_private.h | 7 |
5 files changed, 6 insertions, 33 deletions
diff --git a/src/wrapped32/generated/functions_list.txt b/src/wrapped32/generated/functions_list.txt index 2e8e6981..bda7fd26 100644 --- a/src/wrapped32/generated/functions_list.txt +++ b/src/wrapped32/generated/functions_list.txt @@ -1065,6 +1065,7 @@ #() LFXCii -> LFXCii #() LFXLuu -> LFXLuu #() LFXpLp -> LFXpLp +#() pEEipi -> pEEipi #() pFEupi -> pFEupi #() pFEupp -> pFEupp #() pEEpii -> pEEpii @@ -2011,8 +2012,6 @@ #() vFuuuuiiiiuuiiiiiii -> vFuuuuiiiiuuiiiiiii #() vFXpuiiiiipuiiiiiiii -> vFXpuiiiiipuiiiiiiii #() uFippuuuuiiiiuuiiiiiiiipp -> uFippuuuuiiiiuuiiiiiiiipp -#defined(ANDROID) pEipi -> pEipi -#!defined(ANDROID) pEEipi -> pEEipi #defined(HAVE_LD80BITS) DED -> DED #defined(HAVE_LD80BITS) DFDi -> DFDi #defined(HAVE_LD80BITS) DEDD -> DEDD diff --git a/src/wrapped32/generated/wrapper32.c b/src/wrapped32/generated/wrapper32.c index d7b49293..70a8c017 100644 --- a/src/wrapped32/generated/wrapper32.c +++ b/src/wrapped32/generated/wrapper32.c @@ -1159,6 +1159,7 @@ typedef uintptr_t (*LEppLa_t)(void*, void*, uintptr_t, void*); typedef uintptr_t (*LFXCii_t)(void*, uint8_t, int32_t, int32_t); typedef uintptr_t (*LFXLuu_t)(void*, uintptr_t, uint32_t, uint32_t); typedef uintptr_t (*LFXpLp_t)(void*, void*, uintptr_t, void*); +typedef void* (*pEEipi_t)(x64emu_t*, int32_t, void*, int32_t); typedef void* (*pFEupi_t)(x64emu_t*, uint32_t, void*, int32_t); typedef void* (*pFEupp_t)(x64emu_t*, uint32_t, void*, void*); typedef void* (*pEEpii_t)(x64emu_t*, void*, int32_t, int32_t); @@ -2106,14 +2107,6 @@ typedef void (*vFuuuuiiiiuuiiiiiii_t)(uint32_t, uint32_t, uint32_t, uint32_t, in typedef void (*vFXpuiiiiipuiiiiiiii_t)(void*, void*, uint32_t, int32_t, int32_t, int32_t, int32_t, int32_t, void*, uint32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t); typedef uint32_t (*uFippuuuuiiiiuuiiiiiiiipp_t)(int32_t, void*, void*, uint32_t, uint32_t, uint32_t, uint32_t, int32_t, int32_t, int32_t, int32_t, uint32_t, uint32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, void*, void*); -#if defined(ANDROID) -typedef void* (*pEipi_t)(int32_t, void*, int32_t); -#endif - -#if !defined(ANDROID) -typedef void* (*pEEipi_t)(x64emu_t*, int32_t, void*, int32_t); -#endif - #if defined(HAVE_LD80BITS) typedef long double (*DED_t)(long double); typedef long double (*DFDi_t)(long double, int32_t); @@ -3199,6 +3192,7 @@ void LEppLa_32(x64emu_t *emu, uintptr_t fcn) { LEppLa_t fn = (LEppLa_t)fcn; errn void LFXCii_32(x64emu_t *emu, uintptr_t fcn) { LFXCii_t fn = (LFXCii_t)fcn; R_EAX = to_ulong(fn(getDisplay(from_ptriv(R_ESP + 4)), from_ptri(uint8_t, R_ESP + 8), from_ptri(int32_t, R_ESP + 12), from_ptri(int32_t, R_ESP + 16))); } void LFXLuu_32(x64emu_t *emu, uintptr_t fcn) { LFXLuu_t fn = (LFXLuu_t)fcn; R_EAX = to_ulong(fn(getDisplay(from_ptriv(R_ESP + 4)), from_ulong(from_ptri(ulong_t, R_ESP + 8)), from_ptri(uint32_t, R_ESP + 12), from_ptri(uint32_t, R_ESP + 16))); } void LFXpLp_32(x64emu_t *emu, uintptr_t fcn) { LFXpLp_t fn = (LFXpLp_t)fcn; R_EAX = to_ulong(fn(getDisplay(from_ptriv(R_ESP + 4)), from_ptriv(R_ESP + 8), from_ulong(from_ptri(ulong_t, R_ESP + 12)), from_ptriv(R_ESP + 16))); } +void pEEipi_32(x64emu_t *emu, uintptr_t fcn) { pEEipi_t fn = (pEEipi_t)fcn; errno = emu->libc_err; R_EAX = to_ptrv(fn(emu, from_ptri(int32_t, R_ESP + 4), from_ptriv(R_ESP + 8), from_ptri(int32_t, R_ESP + 12))); emu->libc_err = errno; } void pFEupi_32(x64emu_t *emu, uintptr_t fcn) { pFEupi_t fn = (pFEupi_t)fcn; R_EAX = to_ptrv(fn(emu, from_ptri(uint32_t, R_ESP + 4), from_ptriv(R_ESP + 8), from_ptri(int32_t, R_ESP + 12))); } void pFEupp_32(x64emu_t *emu, uintptr_t fcn) { pFEupp_t fn = (pFEupp_t)fcn; R_EAX = to_ptrv(fn(emu, from_ptri(uint32_t, R_ESP + 4), from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12))); } void pEEpii_32(x64emu_t *emu, uintptr_t fcn) { pEEpii_t fn = (pEEpii_t)fcn; errno = emu->libc_err; R_EAX = to_ptrv(fn(emu, from_ptriv(R_ESP + 4), from_ptri(int32_t, R_ESP + 8), from_ptri(int32_t, R_ESP + 12))); emu->libc_err = errno; } @@ -4146,14 +4140,6 @@ void vFuuuuiiiiuuiiiiiii_32(x64emu_t *emu, uintptr_t fcn) { vFuuuuiiiiuuiiiiiii_ void vFXpuiiiiipuiiiiiiii_32(x64emu_t *emu, uintptr_t fcn) { vFXpuiiiiipuiiiiiiii_t fn = (vFXpuiiiiipuiiiiiiii_t)fcn; fn(getDisplay(from_ptriv(R_ESP + 4)), from_ptriv(R_ESP + 8), from_ptri(uint32_t, 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), from_ptri(int32_t, R_ESP + 32), from_ptriv(R_ESP + 36), from_ptri(uint32_t, R_ESP + 40), from_ptri(int32_t, R_ESP + 44), from_ptri(int32_t, R_ESP + 48), from_ptri(int32_t, R_ESP + 52), from_ptri(int32_t, R_ESP + 56), from_ptri(int32_t, R_ESP + 60), from_ptri(int32_t, R_ESP + 64), from_ptri(int32_t, R_ESP + 68), from_ptri(int32_t, R_ESP + 72)); } void uFippuuuuiiiiuuiiiiiiiipp_32(x64emu_t *emu, uintptr_t fcn) { uFippuuuuiiiiuuiiiiiiiipp_t fn = (uFippuuuuiiiiuuiiiiiiiipp_t)fcn; R_EAX = (uint32_t)fn(from_ptri(int32_t, R_ESP + 4), from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12), from_ptri(uint32_t, R_ESP + 16), from_ptri(uint32_t, R_ESP + 20), from_ptri(uint32_t, R_ESP + 24), from_ptri(uint32_t, R_ESP + 28), from_ptri(int32_t, R_ESP + 32), from_ptri(int32_t, R_ESP + 36), from_ptri(int32_t, R_ESP + 40), from_ptri(int32_t, R_ESP + 44), from_ptri(uint32_t, R_ESP + 48), from_ptri(uint32_t, R_ESP + 52), from_ptri(int32_t, R_ESP + 56), from_ptri(int32_t, R_ESP + 60), from_ptri(int32_t, R_ESP + 64), from_ptri(int32_t, R_ESP + 68), from_ptri(int32_t, R_ESP + 72), from_ptri(int32_t, R_ESP + 76), from_ptri(int32_t, R_ESP + 80), from_ptri(int32_t, R_ESP + 84), from_ptriv(R_ESP + 88), from_ptriv(R_ESP + 92)); } -#if defined(ANDROID) -void pEipi_32(x64emu_t *emu, uintptr_t fcn) { pEipi_t fn = (pEipi_t)fcn; errno = emu->libc_err; R_EAX = to_ptrv(fn(from_ptri(int32_t, R_ESP + 4), from_ptriv(R_ESP + 8), from_ptri(int32_t, R_ESP + 12))); emu->libc_err = errno; } -#endif - -#if !defined(ANDROID) -void pEEipi_32(x64emu_t *emu, uintptr_t fcn) { pEEipi_t fn = (pEEipi_t)fcn; errno = emu->libc_err; R_EAX = to_ptrv(fn(emu, from_ptri(int32_t, R_ESP + 4), from_ptriv(R_ESP + 8), from_ptri(int32_t, R_ESP + 12))); emu->libc_err = errno; } -#endif - #if defined(HAVE_LD80BITS) void DED_32(x64emu_t *emu, uintptr_t fcn) { DED_t fn = (DED_t)fcn; errno = emu->libc_err; long double ld = fn(LD2localLD(from_ptrv(R_ESP + 4))); fpu_do_push(emu); ST0val = ld; emu->libc_err = errno; } void DFDi_32(x64emu_t *emu, uintptr_t fcn) { DFDi_t fn = (DFDi_t)fcn; long double ld = fn(LD2localLD(from_ptrv(R_ESP + 4)), from_ptri(int32_t, R_ESP + 16)); fpu_do_push(emu); ST0val = ld; } diff --git a/src/wrapped32/generated/wrapper32.h b/src/wrapped32/generated/wrapper32.h index 36f8bc48..09c2bce9 100644 --- a/src/wrapped32/generated/wrapper32.h +++ b/src/wrapped32/generated/wrapper32.h @@ -1106,6 +1106,7 @@ void LEppLa_32(x64emu_t *emu, uintptr_t fnc); void LFXCii_32(x64emu_t *emu, uintptr_t fnc); void LFXLuu_32(x64emu_t *emu, uintptr_t fnc); void LFXpLp_32(x64emu_t *emu, uintptr_t fnc); +void pEEipi_32(x64emu_t *emu, uintptr_t fnc); void pFEupi_32(x64emu_t *emu, uintptr_t fnc); void pFEupp_32(x64emu_t *emu, uintptr_t fnc); void pEEpii_32(x64emu_t *emu, uintptr_t fnc); @@ -2053,14 +2054,6 @@ void vFuuuuiiiiuuiiiiiii_32(x64emu_t *emu, uintptr_t fnc); void vFXpuiiiiipuiiiiiiii_32(x64emu_t *emu, uintptr_t fnc); void uFippuuuuiiiiuuiiiiiiiipp_32(x64emu_t *emu, uintptr_t fnc); -#if defined(ANDROID) -void pEipi_32(x64emu_t *emu, uintptr_t fnc); -#endif - -#if !defined(ANDROID) -void pEEipi_32(x64emu_t *emu, uintptr_t fnc); -#endif - #if defined(HAVE_LD80BITS) void DED_32(x64emu_t *emu, uintptr_t fnc); void DFDi_32(x64emu_t *emu, uintptr_t fnc); diff --git a/src/wrapped32/wrappedlibc.c b/src/wrapped32/wrappedlibc.c index e1fedcf8..a18f8780 100755 --- a/src/wrapped32/wrappedlibc.c +++ b/src/wrapped32/wrappedlibc.c @@ -3212,7 +3212,7 @@ EXPORT void* my32_shmat(x64emu_t*emu, int shmid, void* shmaddr, int flags) if(shmctl(shmid, IPC_STAT, &ds)>=0) sz = ds.shm_segsz; } - if(!shmaddr) { + if(!shmaddr && sz) { shmaddr = find31bitBlockNearHint(shmaddr, sz, 0); } void* ret = shmat(shmid, shmaddr, flags); diff --git a/src/wrapped32/wrappedlibc_private.h b/src/wrapped32/wrappedlibc_private.h index 642aa281..55a5b50e 100755 --- a/src/wrapped32/wrappedlibc_private.h +++ b/src/wrapped32/wrappedlibc_private.h @@ -1554,14 +1554,9 @@ GOW(setvbuf, iESpiL) GO(setxattr, iEpppLi) // sgetspent // sgetspent_r // Weak -#ifdef ANDROID -GOW(shmat, pEipi) -GOW(shmdt, iEp) -#else GOWM(shmat, pEEipi) -GOWM(shmdt, iEEp) -#endif GOW(shmctl, iEiip) +GOWM(shmdt, iEEp) GOW(shmget, iEiLi) GOW(shutdown, iEii) GOWM(sigaction, iEEipp) //%% |