diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/emu/x64emu_private.h | 2 | ||||
| -rw-r--r-- | src/wrapped32/generated/functions_list.txt | 3 | ||||
| -rw-r--r-- | src/wrapped32/generated/wrappedlibctypes32.h | 2 | ||||
| -rw-r--r-- | src/wrapped32/generated/wrapper32.c | 2 | ||||
| -rw-r--r-- | src/wrapped32/generated/wrapper32.h | 1 | ||||
| -rwxr-xr-x | src/wrapped32/wrappedlibc.c | 14 | ||||
| -rwxr-xr-x | src/wrapped32/wrappedlibc_private.h | 4 |
7 files changed, 21 insertions, 7 deletions
diff --git a/src/emu/x64emu_private.h b/src/emu/x64emu_private.h index 2f6730e5..ff4ad618 100644 --- a/src/emu/x64emu_private.h +++ b/src/emu/x64emu_private.h @@ -136,6 +136,8 @@ typedef struct x64emu_s { #ifdef BOX32 int libc_err; // copy of errno from libc unsigned short libctype[384]; // copy from __ctype_b because, again, is thread local + const unsigned short** ref_ctype; + const unsigned short* ctype; #endif } x64emu_t; diff --git a/src/wrapped32/generated/functions_list.txt b/src/wrapped32/generated/functions_list.txt index ecd106cc..ba60e75b 100644 --- a/src/wrapped32/generated/functions_list.txt +++ b/src/wrapped32/generated/functions_list.txt @@ -140,6 +140,7 @@ #() lFpBp_i -> lFpBi #() vFEipV -> vFEipV #() vFEppp -> vFEppp +#() iFEiip -> iFEiip #() iFEiiN -> iFEiiN #() iFEipp -> iFEipp #() iFELup -> iFELup @@ -218,12 +219,14 @@ wrappedlibc: - hFpp: - vFipV: - iFvpV: +- iFiip: - iFiiN: - iFipp: - iFppL: - iFppp: - iFppV: - iFpOu: +- lFipL: - vFpLLp: - vFpppp: - __libc_init diff --git a/src/wrapped32/generated/wrappedlibctypes32.h b/src/wrapped32/generated/wrappedlibctypes32.h index c6beb780..01a5c918 100644 --- a/src/wrapped32/generated/wrappedlibctypes32.h +++ b/src/wrapped32/generated/wrappedlibctypes32.h @@ -36,12 +36,14 @@ typedef void* (*pFpp_t)(void*, void*); typedef uintptr_t (*hFpp_t)(void*, void*); typedef void (*vFipV_t)(int32_t, void*, ...); typedef int32_t (*iFvpV_t)(void, void*, ...); +typedef int32_t (*iFiip_t)(int32_t, int32_t, void*); typedef int32_t (*iFiiN_t)(int32_t, int32_t, ...); typedef int32_t (*iFipp_t)(int32_t, void*, void*); typedef int32_t (*iFppL_t)(void*, void*, uintptr_t); typedef int32_t (*iFppp_t)(void*, void*, void*); typedef int32_t (*iFppV_t)(void*, void*, ...); typedef int32_t (*iFpOu_t)(void*, int32_t, uint32_t); +typedef intptr_t (*lFipL_t)(int32_t, void*, uintptr_t); typedef void (*vFpLLp_t)(void*, uintptr_t, uintptr_t, void*); typedef void (*vFpppp_t)(void*, void*, void*, void*); typedef int32_t (*iFiiII_t)(int32_t, int32_t, int64_t, int64_t); diff --git a/src/wrapped32/generated/wrapper32.c b/src/wrapped32/generated/wrapper32.c index 259c4729..bd64bfae 100644 --- a/src/wrapped32/generated/wrapper32.c +++ b/src/wrapped32/generated/wrapper32.c @@ -214,6 +214,7 @@ typedef int64_t (*IFpBp_i_t)(void*, struct_p_t*, int32_t); typedef intptr_t (*lFpBp_i_t)(void*, struct_p_t*, int32_t); typedef void (*vFEipV_t)(x64emu_t*, int32_t, void*, void*); typedef void (*vFEppp_t)(x64emu_t*, void*, void*, void*); +typedef int32_t (*iFEiip_t)(x64emu_t*, int32_t, int32_t, void*); typedef int32_t (*iFEiiN_t)(x64emu_t*, int32_t, int32_t, ...); typedef int32_t (*iFEipp_t)(x64emu_t*, int32_t, void*, void*); typedef int32_t (*iFELup_t)(x64emu_t*, uintptr_t, uint32_t, void*); @@ -400,6 +401,7 @@ void IFpBp_i_32(x64emu_t *emu, uintptr_t fcn) { IFpBp_i_t fn = (IFpBp_i_t)fcn; s void lFpBp_i_32(x64emu_t *emu, uintptr_t fcn) { lFpBp_i_t fn = (lFpBp_i_t)fcn; struct_p_t arg_8; R_EAX = to_long(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); } void vFEipV_32(x64emu_t *emu, uintptr_t fcn) { vFEipV_t fn = (vFEipV_t)fcn; fn(emu, from_ptri(int32_t, R_ESP + 4), from_ptriv(R_ESP + 8), from_ptrv(R_ESP + 12)); } void vFEppp_32(x64emu_t *emu, uintptr_t fcn) { vFEppp_t fn = (vFEppp_t)fcn; fn(emu, from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12)); } +void iFEiip_32(x64emu_t *emu, uintptr_t fcn) { iFEiip_t fn = (iFEiip_t)fcn; R_EAX = fn(emu, from_ptri(int32_t, R_ESP + 4), from_ptri(int32_t, R_ESP + 8), from_ptriv(R_ESP + 12)); } void iFEiiN_32(x64emu_t *emu, uintptr_t fcn) { iFEiiN_t fn = (iFEiiN_t)fcn; R_EAX = fn(emu, from_ptri(int32_t, R_ESP + 4), from_ptri(int32_t, R_ESP + 8), from_ptriv(R_ESP + 12)); } void iFEipp_32(x64emu_t *emu, uintptr_t fcn) { iFEipp_t fn = (iFEipp_t)fcn; R_EAX = fn(emu, from_ptri(int32_t, R_ESP + 4), from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12)); } void iFELup_32(x64emu_t *emu, uintptr_t fcn) { iFELup_t fn = (iFELup_t)fcn; R_EAX = fn(emu, to_ulong(from_ptri(ulong_t, R_ESP + 4)), from_ptri(uint32_t, R_ESP + 8), from_ptriv(R_ESP + 12)); } diff --git a/src/wrapped32/generated/wrapper32.h b/src/wrapped32/generated/wrapper32.h index ac92886d..2e754861 100644 --- a/src/wrapped32/generated/wrapper32.h +++ b/src/wrapped32/generated/wrapper32.h @@ -180,6 +180,7 @@ void IFpBp_i_32(x64emu_t *emu, uintptr_t fnc); void lFpBp_i_32(x64emu_t *emu, uintptr_t fnc); void vFEipV_32(x64emu_t *emu, uintptr_t fnc); void vFEppp_32(x64emu_t *emu, uintptr_t fnc); +void iFEiip_32(x64emu_t *emu, uintptr_t fnc); void iFEiiN_32(x64emu_t *emu, uintptr_t fnc); void iFEipp_32(x64emu_t *emu, uintptr_t fnc); void iFELup_32(x64emu_t *emu, uintptr_t fnc); diff --git a/src/wrapped32/wrappedlibc.c b/src/wrapped32/wrappedlibc.c index 5b2b2c6d..fed5a414 100755 --- a/src/wrapped32/wrappedlibc.c +++ b/src/wrapped32/wrappedlibc.c @@ -1178,16 +1178,16 @@ EXPORT int my32___fxstat(x64emu_t *emu, int vers, int fd, void* buf) r = FillStatFromStat64(vers, &st, buf); return r; } - +#endif EXPORT int my32___fxstat64(x64emu_t *emu, int vers, int fd, void* buf) { struct stat64 st; int r = fstat64(fd, &st); //int r = syscall(__NR_stat64, fd, &st); - UnalignStat64(&st, buf); + UnalignStat64_32(&st, buf); return r; } - +#if 0 EXPORT int my32_stat64(x64emu_t* emu, void* path, void* buf) { struct stat64 st; @@ -2309,8 +2309,12 @@ EXPORT int my32_alphasort64(x64emu_t* emu, ptr_t* d1_, ptr_t* d2_) EXPORT void* my32___ctype_b_loc(x64emu_t* emu) { const unsigned short** src =__ctype_b_loc(); - memcpy(emu->libctype, &((*src)[-128]), 384*sizeof(short)); - return &emu->libctype[128]; + if(src != emu->ref_ctype) { + memcpy(emu->libctype, &((*src)[-128]), 384*sizeof(short)); + emu->ref_ctype = src; + emu->ctype = emu->libctype+128; + } + return &emu->ctype; } EXPORT struct __processor_model diff --git a/src/wrapped32/wrappedlibc_private.h b/src/wrapped32/wrappedlibc_private.h index 45842e16..ad6ff146 100755 --- a/src/wrapped32/wrappedlibc_private.h +++ b/src/wrapped32/wrappedlibc_private.h @@ -436,7 +436,7 @@ GOW(fwrite, LFpLLh) //GO(__fwriting, iFp) // fwscanf //GOM(__fxstat, iFEiip) //%% -//GOM(__fxstat64, iFEiip) //%% need reaalign of struct stat64 +GOM(__fxstat64, iFEiip) //%% need reaalign of struct stat64 //GOM(__fxstatat, iFEiippi) //%% //GOM(__fxstatat64, iFEiippi) //%% struct stat64 again // __gai_sigqueue @@ -1335,7 +1335,7 @@ GOW(random, iFv) // rcmd // rcmd_af // __rcmd_errstr // type B -//GOM(read, lFipL) //%%,noE +GOM(read, lFipL) //%%,noE //GOW(__read, lFipL) // readahead // Weak //GO(__read_chk, lFipLL) |