diff options
| author | alexvorxx <72611580+alexvorxx@users.noreply.github.com> | 2025-02-26 19:47:42 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-26 17:47:42 +0100 |
| commit | 4120dc10bdf79bc4787ff14549ea02da3b7feb21 (patch) | |
| tree | 6fed38313b4e2bfe4355b15af898ff2f0b7903f6 /src/wrapped32 | |
| parent | 48f51bd5fef5b9b6ea5ad086cfd44a07c5441d8a (diff) | |
| download | box64-4120dc10bdf79bc4787ff14549ea02da3b7feb21.tar.gz box64-4120dc10bdf79bc4787ff14549ea02da3b7feb21.zip | |
Fixed Box32 for Winlator Glibc (#2404)
* 1 * 2 * 3 * 4 * Fix * 5 * 6 * 7 * 8 * revert 8 * 9
Diffstat (limited to 'src/wrapped32')
| -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 | 4 | ||||
| -rwxr-xr-x | src/wrapped32/wrappedlibc_private.h | 7 |
5 files changed, 36 insertions, 5 deletions
diff --git a/src/wrapped32/generated/functions_list.txt b/src/wrapped32/generated/functions_list.txt index bda7fd26..85629280 100644 --- a/src/wrapped32/generated/functions_list.txt +++ b/src/wrapped32/generated/functions_list.txt @@ -1065,7 +1065,6 @@ #() LFXCii -> LFXCii #() LFXLuu -> LFXLuu #() LFXpLp -> LFXpLp -#() pEEipi -> pEEipi #() pFEupi -> pFEupi #() pFEupp -> pFEupp #() pEEpii -> pEEpii @@ -2012,6 +2011,8 @@ #() vFuuuuiiiiuuiiiiiii -> vFuuuuiiiiuuiiiiiii #() vFXpuiiiiipuiiiiiiii -> vFXpuiiiiipuiiiiiiii #() uFippuuuuiiiiuuiiiiiiiipp -> uFippuuuuiiiiuuiiiiiiiipp +#defined(WINLATOR_GLIBC) pEipi -> pEipi +#!defined(WINLATOR_GLIBC) 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 70a8c017..d089d76b 100644 --- a/src/wrapped32/generated/wrapper32.c +++ b/src/wrapped32/generated/wrapper32.c @@ -1159,7 +1159,6 @@ 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); @@ -2107,6 +2106,14 @@ 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*); +#ifdef WINLATOR_GLIBC +typedef void* (*pEipi_t)(int32_t, void*, int32_t); +#endif + +#ifndef WINLATOR_GLIBC +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); @@ -3192,7 +3199,6 @@ 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; } @@ -4140,6 +4146,14 @@ 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)); } +#ifdef WINLATOR_GLIBC +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 + +#ifndef WINLATOR_GLIBC +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 09c2bce9..82d01f9c 100644 --- a/src/wrapped32/generated/wrapper32.h +++ b/src/wrapped32/generated/wrapper32.h @@ -1106,7 +1106,6 @@ 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); @@ -2054,6 +2053,14 @@ 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); +#ifdef WINLATOR_GLIBC +void pEipi_32(x64emu_t *emu, uintptr_t fnc); +#endif + +#ifndef WINLATOR_GLIBC +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 a18f8780..a1b0d67d 100755 --- a/src/wrapped32/wrappedlibc.c +++ b/src/wrapped32/wrappedlibc.c @@ -40,8 +40,10 @@ #include <sys/sysinfo.h> #include <sys/time.h> #include <regex.h> +#ifndef WINLATOR_GLIBC #include <sys/ipc.h> #include <sys/shm.h> +#endif #include <sys/wait.h> #include "wrappedlibs.h" @@ -3203,6 +3205,7 @@ EXPORT void my32_regfree(x64emu_t* emu, void* p) regfree(&p_l); } +#ifndef WINLATOR_GLIBC EXPORT void* my32_shmat(x64emu_t*emu, int shmid, void* shmaddr, int flags) { size_t sz = 0; @@ -3227,6 +3230,7 @@ EXPORT int my32_shmdt(x64emu_t* emu, void* addr) { return shmdt(addr); } +#endif #if 0 #ifndef __NR_memfd_create diff --git a/src/wrapped32/wrappedlibc_private.h b/src/wrapped32/wrappedlibc_private.h index 55a5b50e..a6756e51 100755 --- a/src/wrapped32/wrappedlibc_private.h +++ b/src/wrapped32/wrappedlibc_private.h @@ -1554,9 +1554,14 @@ GOW(setvbuf, iESpiL) GO(setxattr, iEpppLi) // sgetspent // sgetspent_r // Weak +#ifdef WINLATOR_GLIBC +GOW(shmat, pEipi) +GOW(shmdt, iEp) +#else GOWM(shmat, pEEipi) -GOW(shmctl, iEiip) GOWM(shmdt, iEEp) +#endif +GOW(shmctl, iEiip) GOW(shmget, iEiLi) GOW(shutdown, iEii) GOWM(sigaction, iEEipp) //%% |