diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2021-03-09 17:21:53 +0100 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2021-03-09 17:21:53 +0100 |
| commit | 949bbb40ebc9fa89badf709d459d1a54764183ac (patch) | |
| tree | 41123cee8cfc5f23434dd4648c1d8b09491c8474 /src | |
| parent | 5ce5951f5db4377b1c745ed71e69376e875ce93a (diff) | |
| download | box64-949bbb40ebc9fa89badf709d459d1a54764183ac.tar.gz box64-949bbb40ebc9fa89badf709d459d1a54764183ac.zip | |
A large batch of wrapped libc functions
Diffstat (limited to 'src')
| -rw-r--r-- | src/wrapped/generated/functions_list.txt | 6 | ||||
| -rw-r--r-- | src/wrapped/generated/wrapper.c | 11 | ||||
| -rw-r--r-- | src/wrapped/generated/wrapper.h | 6 | ||||
| -rwxr-xr-x | src/wrapped/wrappedlibc.c | 68 | ||||
| -rwxr-xr-x | src/wrapped/wrappedlibc_private.h | 198 |
5 files changed, 174 insertions, 115 deletions
diff --git a/src/wrapped/generated/functions_list.txt b/src/wrapped/generated/functions_list.txt index 5a046bc0..41d1170b 100644 --- a/src/wrapped/generated/functions_list.txt +++ b/src/wrapped/generated/functions_list.txt @@ -34,6 +34,7 @@ #() dFi #() dFd #() dFp +#() lFE #() lFi #() lFp #() LFv @@ -199,6 +200,7 @@ #() iFpiu #() iFpiL #() iFpip +#() iFpIi #() iFpui #() iFpuu #() iFpuU @@ -206,6 +208,7 @@ #() iFpup #() iFpfu #() iFpff +#() iFpli #() iFplp #() iFpLp #() iFppi @@ -266,6 +269,7 @@ #() pFpuL #() pFpup #() pFpUp +#() pFpLL #() pFppi #() pFppu #() pFppL @@ -326,6 +330,7 @@ #() vFpppu #() vFpppp #() cFpiii +#() iFEiiN #() iFEipp #() iFEupp #() iFEpip @@ -859,6 +864,7 @@ #!defined(HAVE_LD80BITS) KFKK #!defined(HAVE_LD80BITS) KFKp #() iFEv -> iFE +#() lFEv -> lFE #() pFEv -> pFE #() pFppv -> pFpp #() iFEvpp -> iFEpp diff --git a/src/wrapped/generated/wrapper.c b/src/wrapped/generated/wrapper.c index 67778c9b..3c9fe484 100644 --- a/src/wrapped/generated/wrapper.c +++ b/src/wrapped/generated/wrapper.c @@ -67,6 +67,7 @@ typedef float (*fFp_t)(void*); typedef double (*dFi_t)(int32_t); typedef double (*dFd_t)(double); typedef double (*dFp_t)(void*); +typedef intptr_t (*lFE_t)(x64emu_t*); typedef intptr_t (*lFi_t)(int32_t); typedef intptr_t (*lFp_t)(void*); typedef uintptr_t (*LFv_t)(void); @@ -232,6 +233,7 @@ typedef int32_t (*iFpii_t)(void*, int32_t, int32_t); typedef int32_t (*iFpiu_t)(void*, int32_t, uint32_t); typedef int32_t (*iFpiL_t)(void*, int32_t, uintptr_t); typedef int32_t (*iFpip_t)(void*, int32_t, void*); +typedef int32_t (*iFpIi_t)(void*, int64_t, int32_t); typedef int32_t (*iFpui_t)(void*, uint32_t, int32_t); typedef int32_t (*iFpuu_t)(void*, uint32_t, uint32_t); typedef int32_t (*iFpuU_t)(void*, uint32_t, uint64_t); @@ -239,6 +241,7 @@ typedef int32_t (*iFpuL_t)(void*, uint32_t, uintptr_t); typedef int32_t (*iFpup_t)(void*, uint32_t, void*); typedef int32_t (*iFpfu_t)(void*, float, uint32_t); typedef int32_t (*iFpff_t)(void*, float, float); +typedef int32_t (*iFpli_t)(void*, intptr_t, int32_t); typedef int32_t (*iFplp_t)(void*, intptr_t, void*); typedef int32_t (*iFpLp_t)(void*, uintptr_t, void*); typedef int32_t (*iFppi_t)(void*, void*, int32_t); @@ -299,6 +302,7 @@ typedef void* (*pFpuu_t)(void*, uint32_t, uint32_t); typedef void* (*pFpuL_t)(void*, uint32_t, uintptr_t); typedef void* (*pFpup_t)(void*, uint32_t, void*); typedef void* (*pFpUp_t)(void*, uint64_t, void*); +typedef void* (*pFpLL_t)(void*, uintptr_t, uintptr_t); typedef void* (*pFppi_t)(void*, void*, int32_t); typedef void* (*pFppu_t)(void*, void*, uint32_t); typedef void* (*pFppL_t)(void*, void*, uintptr_t); @@ -359,6 +363,7 @@ typedef void (*vFpppi_t)(void*, void*, void*, int32_t); typedef void (*vFpppu_t)(void*, void*, void*, uint32_t); typedef void (*vFpppp_t)(void*, void*, void*, void*); typedef int8_t (*cFpiii_t)(void*, int32_t, int32_t, int32_t); +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 (*iFEupp_t)(x64emu_t*, uint32_t, void*, void*); typedef int32_t (*iFEpip_t)(x64emu_t*, void*, int32_t, void*); @@ -934,6 +939,7 @@ void fFp(x64emu_t *emu, uintptr_t fcn) { fFp_t fn = (fFp_t)fcn; emu->xmm[0].f[0] void dFi(x64emu_t *emu, uintptr_t fcn) { dFi_t fn = (dFi_t)fcn; emu->xmm[0].d[0]=fn((int32_t)R_RDI); } void dFd(x64emu_t *emu, uintptr_t fcn) { dFd_t fn = (dFd_t)fcn; emu->xmm[0].d[0]=fn(emu->xmm[0].d[0]); } void dFp(x64emu_t *emu, uintptr_t fcn) { dFp_t fn = (dFp_t)fcn; emu->xmm[0].d[0]=fn((void*)R_RDI); } +void lFE(x64emu_t *emu, uintptr_t fcn) { lFE_t fn = (lFE_t)fcn; R_RAX=(intptr_t)fn(emu); } void lFi(x64emu_t *emu, uintptr_t fcn) { lFi_t fn = (lFi_t)fcn; R_RAX=(intptr_t)fn((int32_t)R_RDI); } void lFp(x64emu_t *emu, uintptr_t fcn) { lFp_t fn = (lFp_t)fcn; R_RAX=(intptr_t)fn((void*)R_RDI); } void LFv(x64emu_t *emu, uintptr_t fcn) { LFv_t fn = (LFv_t)fcn; R_RAX=(uintptr_t)fn(); } @@ -1099,6 +1105,7 @@ void iFpii(x64emu_t *emu, uintptr_t fcn) { iFpii_t fn = (iFpii_t)fcn; R_RAX=fn(( void iFpiu(x64emu_t *emu, uintptr_t fcn) { iFpiu_t fn = (iFpiu_t)fcn; R_RAX=fn((void*)R_RDI, (int32_t)R_RSI, (uint32_t)R_RDX); } void iFpiL(x64emu_t *emu, uintptr_t fcn) { iFpiL_t fn = (iFpiL_t)fcn; R_RAX=fn((void*)R_RDI, (int32_t)R_RSI, (uintptr_t)R_RDX); } void iFpip(x64emu_t *emu, uintptr_t fcn) { iFpip_t fn = (iFpip_t)fcn; R_RAX=fn((void*)R_RDI, (int32_t)R_RSI, (void*)R_RDX); } +void iFpIi(x64emu_t *emu, uintptr_t fcn) { iFpIi_t fn = (iFpIi_t)fcn; R_RAX=fn((void*)R_RDI, (int64_t)R_RSI, (int32_t)R_RDX); } void iFpui(x64emu_t *emu, uintptr_t fcn) { iFpui_t fn = (iFpui_t)fcn; R_RAX=fn((void*)R_RDI, (uint32_t)R_RSI, (int32_t)R_RDX); } void iFpuu(x64emu_t *emu, uintptr_t fcn) { iFpuu_t fn = (iFpuu_t)fcn; R_RAX=fn((void*)R_RDI, (uint32_t)R_RSI, (uint32_t)R_RDX); } void iFpuU(x64emu_t *emu, uintptr_t fcn) { iFpuU_t fn = (iFpuU_t)fcn; R_RAX=fn((void*)R_RDI, (uint32_t)R_RSI, (uint64_t)R_RDX); } @@ -1106,6 +1113,7 @@ void iFpuL(x64emu_t *emu, uintptr_t fcn) { iFpuL_t fn = (iFpuL_t)fcn; R_RAX=fn(( void iFpup(x64emu_t *emu, uintptr_t fcn) { iFpup_t fn = (iFpup_t)fcn; R_RAX=fn((void*)R_RDI, (uint32_t)R_RSI, (void*)R_RDX); } void iFpfu(x64emu_t *emu, uintptr_t fcn) { iFpfu_t fn = (iFpfu_t)fcn; R_RAX=fn((void*)R_RDI, emu->xmm[0].f[0], (uint32_t)R_RSI); } void iFpff(x64emu_t *emu, uintptr_t fcn) { iFpff_t fn = (iFpff_t)fcn; R_RAX=fn((void*)R_RDI, emu->xmm[0].f[0], emu->xmm[1].f[0]); } +void iFpli(x64emu_t *emu, uintptr_t fcn) { iFpli_t fn = (iFpli_t)fcn; R_RAX=fn((void*)R_RDI, (intptr_t)R_RSI, (int32_t)R_RDX); } void iFplp(x64emu_t *emu, uintptr_t fcn) { iFplp_t fn = (iFplp_t)fcn; R_RAX=fn((void*)R_RDI, (intptr_t)R_RSI, (void*)R_RDX); } void iFpLp(x64emu_t *emu, uintptr_t fcn) { iFpLp_t fn = (iFpLp_t)fcn; R_RAX=fn((void*)R_RDI, (uintptr_t)R_RSI, (void*)R_RDX); } void iFppi(x64emu_t *emu, uintptr_t fcn) { iFppi_t fn = (iFppi_t)fcn; R_RAX=fn((void*)R_RDI, (void*)R_RSI, (int32_t)R_RDX); } @@ -1166,6 +1174,7 @@ void pFpuu(x64emu_t *emu, uintptr_t fcn) { pFpuu_t fn = (pFpuu_t)fcn; R_RAX=(uin void pFpuL(x64emu_t *emu, uintptr_t fcn) { pFpuL_t fn = (pFpuL_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (uint32_t)R_RSI, (uintptr_t)R_RDX); } void pFpup(x64emu_t *emu, uintptr_t fcn) { pFpup_t fn = (pFpup_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (uint32_t)R_RSI, (void*)R_RDX); } void pFpUp(x64emu_t *emu, uintptr_t fcn) { pFpUp_t fn = (pFpUp_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (uint64_t)R_RSI, (void*)R_RDX); } +void pFpLL(x64emu_t *emu, uintptr_t fcn) { pFpLL_t fn = (pFpLL_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (uintptr_t)R_RSI, (uintptr_t)R_RDX); } void pFppi(x64emu_t *emu, uintptr_t fcn) { pFppi_t fn = (pFppi_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (void*)R_RSI, (int32_t)R_RDX); } void pFppu(x64emu_t *emu, uintptr_t fcn) { pFppu_t fn = (pFppu_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (void*)R_RSI, (uint32_t)R_RDX); } void pFppL(x64emu_t *emu, uintptr_t fcn) { pFppL_t fn = (pFppL_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (void*)R_RSI, (uintptr_t)R_RDX); } @@ -1226,6 +1235,7 @@ void vFpppi(x64emu_t *emu, uintptr_t fcn) { vFpppi_t fn = (vFpppi_t)fcn; fn((voi void vFpppu(x64emu_t *emu, uintptr_t fcn) { vFpppu_t fn = (vFpppu_t)fcn; fn((void*)R_RDI, (void*)R_RSI, (void*)R_RDX, (uint32_t)R_RCX); } void vFpppp(x64emu_t *emu, uintptr_t fcn) { vFpppp_t fn = (vFpppp_t)fcn; fn((void*)R_RDI, (void*)R_RSI, (void*)R_RDX, (void*)R_RCX); } void cFpiii(x64emu_t *emu, uintptr_t fcn) { cFpiii_t fn = (cFpiii_t)fcn; R_RAX=fn((void*)R_RDI, (int32_t)R_RSI, (int32_t)R_RDX, (int32_t)R_RCX); } +void iFEiiN(x64emu_t *emu, uintptr_t fcn) { iFEiiN_t fn = (iFEiiN_t)fcn; R_RAX=fn(emu, (int32_t)R_RDI, (int32_t)R_RSI, (void*)R_RDX); } void iFEipp(x64emu_t *emu, uintptr_t fcn) { iFEipp_t fn = (iFEipp_t)fcn; R_RAX=fn(emu, (int32_t)R_RDI, (void*)R_RSI, (void*)R_RDX); } void iFEupp(x64emu_t *emu, uintptr_t fcn) { iFEupp_t fn = (iFEupp_t)fcn; R_RAX=fn(emu, (uint32_t)R_RDI, (void*)R_RSI, (void*)R_RDX); } void iFEpip(x64emu_t *emu, uintptr_t fcn) { iFEpip_t fn = (iFEpip_t)fcn; R_RAX=fn(emu, (void*)R_RDI, (int32_t)R_RSI, (void*)R_RDX); } @@ -1766,6 +1776,7 @@ void KFKp(x64emu_t *emu, uintptr_t fcn) { KFKp_t fn = (KFKp_t)fcn; double db=fn( #endif void iFEv(x64emu_t *emu, uintptr_t fcn) { iFE_t fn = (iFE_t)fcn; R_RAX=fn(emu); } +void lFEv(x64emu_t *emu, uintptr_t fcn) { lFE_t fn = (lFE_t)fcn; R_RAX=(intptr_t)fn(emu); } void pFEv(x64emu_t *emu, uintptr_t fcn) { pFE_t fn = (pFE_t)fcn; R_RAX=(uintptr_t)fn(emu); } void pFppv(x64emu_t *emu, uintptr_t fcn) { pFpp_t fn = (pFpp_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (void*)R_RSI); } void iFEvpp(x64emu_t *emu, uintptr_t fcn) { iFEpp_t fn = (iFEpp_t)fcn; R_RAX=fn(emu, (void*)R_RSI, (void*)R_RDX); } diff --git a/src/wrapped/generated/wrapper.h b/src/wrapped/generated/wrapper.h index 88a7982e..5bc6db80 100644 --- a/src/wrapped/generated/wrapper.h +++ b/src/wrapped/generated/wrapper.h @@ -64,6 +64,7 @@ void fFp(x64emu_t *emu, uintptr_t fnc); void dFi(x64emu_t *emu, uintptr_t fnc); void dFd(x64emu_t *emu, uintptr_t fnc); void dFp(x64emu_t *emu, uintptr_t fnc); +void lFE(x64emu_t *emu, uintptr_t fnc); void lFi(x64emu_t *emu, uintptr_t fnc); void lFp(x64emu_t *emu, uintptr_t fnc); void LFv(x64emu_t *emu, uintptr_t fnc); @@ -229,6 +230,7 @@ void iFpii(x64emu_t *emu, uintptr_t fnc); void iFpiu(x64emu_t *emu, uintptr_t fnc); void iFpiL(x64emu_t *emu, uintptr_t fnc); void iFpip(x64emu_t *emu, uintptr_t fnc); +void iFpIi(x64emu_t *emu, uintptr_t fnc); void iFpui(x64emu_t *emu, uintptr_t fnc); void iFpuu(x64emu_t *emu, uintptr_t fnc); void iFpuU(x64emu_t *emu, uintptr_t fnc); @@ -236,6 +238,7 @@ void iFpuL(x64emu_t *emu, uintptr_t fnc); void iFpup(x64emu_t *emu, uintptr_t fnc); void iFpfu(x64emu_t *emu, uintptr_t fnc); void iFpff(x64emu_t *emu, uintptr_t fnc); +void iFpli(x64emu_t *emu, uintptr_t fnc); void iFplp(x64emu_t *emu, uintptr_t fnc); void iFpLp(x64emu_t *emu, uintptr_t fnc); void iFppi(x64emu_t *emu, uintptr_t fnc); @@ -296,6 +299,7 @@ void pFpuu(x64emu_t *emu, uintptr_t fnc); void pFpuL(x64emu_t *emu, uintptr_t fnc); void pFpup(x64emu_t *emu, uintptr_t fnc); void pFpUp(x64emu_t *emu, uintptr_t fnc); +void pFpLL(x64emu_t *emu, uintptr_t fnc); void pFppi(x64emu_t *emu, uintptr_t fnc); void pFppu(x64emu_t *emu, uintptr_t fnc); void pFppL(x64emu_t *emu, uintptr_t fnc); @@ -356,6 +360,7 @@ void vFpppi(x64emu_t *emu, uintptr_t fnc); void vFpppu(x64emu_t *emu, uintptr_t fnc); void vFpppp(x64emu_t *emu, uintptr_t fnc); void cFpiii(x64emu_t *emu, uintptr_t fnc); +void iFEiiN(x64emu_t *emu, uintptr_t fnc); void iFEipp(x64emu_t *emu, uintptr_t fnc); void iFEupp(x64emu_t *emu, uintptr_t fnc); void iFEpip(x64emu_t *emu, uintptr_t fnc); @@ -896,6 +901,7 @@ void KFKp(x64emu_t *emu, uintptr_t fnc); #endif void iFEv(x64emu_t *emu, uintptr_t fnc); +void lFEv(x64emu_t *emu, uintptr_t fnc); void pFEv(x64emu_t *emu, uintptr_t fnc); void pFppv(x64emu_t *emu, uintptr_t fnc); void iFEvpp(x64emu_t *emu, uintptr_t fnc); diff --git a/src/wrapped/wrappedlibc.c b/src/wrapped/wrappedlibc.c index 81e20343..50e354e9 100755 --- a/src/wrapped/wrappedlibc.c +++ b/src/wrapped/wrappedlibc.c @@ -108,6 +108,15 @@ void freeLIBCMy(void* lib) { // empty for now } + +static int regs_abi[] = {_DI, _SI, _DX, _CX, _R8, _R9}; +void* getVargN(x64emu_t *emu, int n) +{ + if(n<6) + return (void*)emu->regs[regs_abi[n]].q[0]; + return ((void**)R_RSP)[1+n-6]; +} + #if 0 // utility functions #define SUPER() \ @@ -1647,14 +1656,14 @@ EXPORT int32_t my_nftw64(x64emu_t* emu, void* pathname, void* B, int32_t nopenfd { return nftw64(pathname, findnftw64Fct(B), nopenfd, flags); } - +#endif EXPORT int32_t my_execv(x64emu_t* emu, const char* path, char* const argv[]) { int self = isProcSelf(path, "exe"); - int x86 = FileIsX86ELF(path); + int x86 = FileIsX64ELF(path); printf_log(LOG_DEBUG, "execv(\"%s\", %p) is x86=%d\n", path, argv, x86); #if 1 - if ((x86 || self) && argv) { + if (x86 || self) { int skip_first = 0; if(strlen(path)>=strlen("wine-preloader") && strcmp(path+strlen(path)-strlen("wine-preloader"), "wine-preloader")==0) skip_first++; @@ -1671,18 +1680,16 @@ EXPORT int32_t my_execv(x64emu_t* emu, const char* path, char* const argv[]) return ret; } #endif - if(self && !argv) - return execv(emu->context->box64path, argv); return execv(path, argv); } EXPORT int32_t my_execve(x64emu_t* emu, const char* path, char* const argv[], char* const envp[]) { int self = isProcSelf(path, "exe"); - int x86 = FileIsX86ELF(path); + int x86 = FileIsX64ELF(path); printf_log(LOG_DEBUG, "execv(\"%s\", %p) is x86=%d\n", path, argv, x86); #if 1 - if ((x86 || self) && argv) { + if (x86 || self) { int skip_first = 0; if(strlen(path)>=strlen("wine-preloader") && strcmp(path+strlen(path)-strlen("wine-preloader"), "wine-preloader")==0) skip_first++; @@ -1699,8 +1706,6 @@ EXPORT int32_t my_execve(x64emu_t* emu, const char* path, char* const argv[], ch return ret; } #endif - if(self && !argv) - return execve(emu->context->box64path, argv, envp); return execve(path, argv, envp); } @@ -1709,12 +1714,14 @@ EXPORT int32_t my_execvp(x64emu_t* emu, const char* path, char* const argv[]) { // need to use BOX86_PATH / PATH here... char* fullpath = ResolveFile(path, &my_context->box64_path); + if(!fullpath) + fullpath = strdup(path); // use fullpath... int self = isProcSelf(fullpath, "exe"); - int x86 = FileIsX86ELF(fullpath); + int x86 = FileIsX64ELF(fullpath); printf_log(LOG_DEBUG, "execvp(\"%s\", %p), IsX86=%d / fullpath=\"%s\"\n", path, argv, x86, fullpath); free(fullpath); - if ((x86 || self) && argv) { + if (x86 || self) { // count argv... int i=0; while(argv[i]) ++i; @@ -1728,12 +1735,37 @@ EXPORT int32_t my_execvp(x64emu_t* emu, const char* path, char* const argv[]) free(newargv); return ret; } - if(self && !argv) - return execvp(emu->context->box64path, argv); // fullpath is gone, so the search will only be on PATH, not on BOX86_PATH (is that an issue?) return execvp(path, argv); } +EXPORT int32_t my_execlp(x64emu_t* emu, const char* path) +{ + // need to use BOX86_PATH / PATH here... + char* fullpath = ResolveFile(path, &my_context->box64_path); + if(!fullpath) + fullpath = strdup(path); + // use fullpath... + int self = isProcSelf(fullpath, "exe"); + int x86 = FileIsX64ELF(fullpath); + printf_log(LOG_DEBUG, "execvp(\"%s\", ...), IsX86=%d / fullpath=\"%s\"\n", path, x86, fullpath); + free(fullpath); + // count argv... + int i=0; + while(getVargN(emu, i+1)) ++i; + char** newargv = (char**)calloc(i+((x86 || self)?2:1), sizeof(char*)); + int j=0; + if ((x86 || self)) + newargv[j++] = emu->context->box64path; + for (int k=0; k<i; ++k) + newargv[j++] = getVargN(emu, k+1); + if(self) newargv[1] = emu->context->fullpath; + printf_log(LOG_DEBUG, " => execlp(\"%s\", %p [\"%s\", \"%s\"...:%d])\n", newargv[0], newargv, newargv[1], i?newargv[2]:"", i); + int ret = execvp(newargv[0], newargv); + free(newargv); + return ret; +} +#if 0 // execvp should use PATH to search for the program first EXPORT int32_t my_posix_spawnp(x64emu_t* emu, pid_t* pid, const char* path, const posix_spawn_file_actions_t *actions, const posix_spawnattr_t* attrp, char* const argv[], char* const envp[]) @@ -1742,7 +1774,7 @@ EXPORT int32_t my_posix_spawnp(x64emu_t* emu, pid_t* pid, const char* path, char* fullpath = ResolveFile(path, &my_context->box64_path); // use fullpath... int self = isProcSelf(fullpath, "exe"); - int x86 = FileIsX86ELF(fullpath); + int x86 = FileIsX64ELF(fullpath); printf_log(LOG_DEBUG, "posix_spawnp(%p, \"%s\", %p, %p, %p, %p), IsX86=%d / fullpath=\"%s\"\n", pid, path, actions, attrp, argv, envp, x86, fullpath); free(fullpath); if ((x86 || self)) { @@ -1851,7 +1883,7 @@ EXPORT int32_t my___poll_chk(void* a, uint32_t b, int c, int l) { return poll(a, b, c); // no check... } - +#endif EXPORT int32_t my_fcntl64(x64emu_t* emu, int32_t a, int32_t b, uint32_t d1, uint32_t d2, uint32_t d3, uint32_t d4, uint32_t d5, uint32_t d6) { // Implemented starting glibc 2.14+ @@ -1860,6 +1892,7 @@ EXPORT int32_t my_fcntl64(x64emu_t* emu, int32_t a, int32_t b, uint32_t d1, uint iFiiV_t f = dlsym(lib->priv.w.lib, "fcntl64"); if(b==F_SETFL) d1 = of_convert(d1); + #if 0 if(b==F_GETLK64 || b==F_SETLK64 || b==F_SETLKW64) { my_flock64_t fl; @@ -1868,6 +1901,7 @@ EXPORT int32_t my_fcntl64(x64emu_t* emu, int32_t a, int32_t b, uint32_t d1, uint UnalignFlock64((void*)d1, &fl); return ret; } + #endif //TODO: check if better to use the syscall or regular fcntl? //return syscall(__NR_fcntl64, a, b, d1); // should be enough int ret = f?f(a, b, d1):fcntl(a, b, d1); @@ -1891,6 +1925,7 @@ EXPORT int32_t my_fcntl(x64emu_t* emu, int32_t a, int32_t b, uint32_t d1, uint32 } if(b==F_SETFL) d1 = of_convert(d1); + #if 0 if(b==F_GETLK64 || b==F_SETLK64 || b==F_SETLKW64) { my_flock64_t fl; @@ -1899,6 +1934,7 @@ EXPORT int32_t my_fcntl(x64emu_t* emu, int32_t a, int32_t b, uint32_t d1, uint32 UnalignFlock64((void*)d1, &fl); return ret; } + #endif int ret = fcntl(a, b, d1); if(b==F_GETFL && ret!=-1) ret = of_unconvert(ret); @@ -1906,7 +1942,7 @@ EXPORT int32_t my_fcntl(x64emu_t* emu, int32_t a, int32_t b, uint32_t d1, uint32 return ret; } EXPORT int32_t my___fcntl(x64emu_t* emu, int32_t a, int32_t b, uint32_t d1, uint32_t d2, uint32_t d3, uint32_t d4, uint32_t d5, uint32_t d6) __attribute__((alias("my_fcntl"))); - +#if 0 EXPORT int32_t my_preadv64(x64emu_t* emu, int32_t fd, void* v, int32_t c, int64_t o) { library_t* lib = my_lib; diff --git a/src/wrapped/wrappedlibc_private.h b/src/wrapped/wrappedlibc_private.h index 9b05237e..f315e0a8 100755 --- a/src/wrapped/wrappedlibc_private.h +++ b/src/wrapped/wrappedlibc_private.h @@ -279,10 +279,10 @@ GO(__errno_location, pFv) //GO(eventfd_write, //GO(execl, //GO(execle, -//GO(execlp, +GOM(execlp, iFEpV) //GO(execv, //GOW(execve, -//GO(execvp, +GOM(execvp, iFEp) //GOW(execvpe, GO(_exit, vFi) GO(exit, vFi) @@ -302,11 +302,11 @@ GOW(_Exit, vFi) //GO(fchmodat, //GOW(fchown, //GO(fchownat, -//GO(fclose, -//GOW(fcloseall, -//GOW(__fcntl, -//GOW(fcntl, -//GOW(fcntl64, +GO(fclose, iFp) +GOW(fcloseall, iFv) +GOM(__fcntl, iFEiiN) //Weak +GOM(fcntl, iFEiiN) //Weak +GOM(fcntl64, iFEiiN) //Weak //GO(fcvt, //GOW(fcvt_r, //GO(fdatasync, @@ -350,12 +350,12 @@ GO(fflush_unlocked, iFp) //GO(fgetws_unlocked, //GO(__fgetws_unlocked_chk, //GO(fgetxattr, -//GOW(fileno, -//GOW(fileno_unlocked, -//GO(__finite, -//GOW(finite, -//GO(__finitef, -//GOW(finitef, +GOW(fileno, iFp) +GOW(fileno_unlocked, iFp) +GO(__finite, iFd) +GOW(finite, iFd) +GO(__finitef, iFf) +GOW(finitef, iFf) //GO(__finitel, //GOW(finitel, //GO(__flbf, @@ -371,7 +371,7 @@ GOM(fopen, pFEpp) GOM(fopen64, pFEpp) // Weak //GO(fopencookie, //GO(__fork, -GOM(fork, iFEv) // Weak +GOM(fork, lFEv) // Weak //GO(__fortify_fail, //GOW(fpathconf, //GO(__fpending, @@ -405,23 +405,23 @@ GO(free, vFp) //GOW(frexpf, //GOW(frexpl, //GO(fscanf, -//GO(fseek, -//GOW(fseeko, -//GO(__fseeko64, -//GOW(fseeko64, -//GO(__fsetlocking, -//GO(fsetpos, -//GO(fsetpos64, +GO(fseek, iFpli) +GOW(fseeko, iFpli) +GO(__fseeko64, iFpIi) +GOW(fseeko64, iFpIi) +GO(__fsetlocking, iFpi) +GO(fsetpos, iFpp) +GO(fsetpos64, iFpp) //GO(fsetxattr, //GOW(fstatfs, //GOW(fstatfs64, //GOW(fstatvfs, //GOW(fstatvfs64, //GO(fsync, -//GOW(ftell, -//GOW(ftello, -//GO(__ftello64, -//GOW(ftello64, +GOW(ftell, lFp) +GOW(ftello, lFp) +GO(__ftello64, IFp) +GOW(ftello64, IFp) //GO(ftime, //GO(ftok, //GOW(ftruncate, @@ -470,15 +470,15 @@ GO(__fxstatat64, iFiippi) //GO(__getauxval, //GOW(getauxval, //GOW(get_avphys_pages, -//GOW(getc, -//GO(getchar, -//GO(getchar_unlocked, +GOW(getc, iFp) +GO(getchar, iFv) +GO(getchar_unlocked, iFv) GOM(getcontext, iFEp) //Weak -//GOW(getc_unlocked, -//GO(get_current_dir_name, -//GOW(getcwd, -//GO(__getcwd_chk, -//GO(getdate, +GOW(getc_unlocked, iFp) +GO(get_current_dir_name, pFv) +GOW(getcwd, pFpL) +GO(__getcwd_chk, pFpLL) +GO(getdate, pFp) //DATAB(getdate_err, //GOW(getdate_r, //GOW(__getdelim, @@ -545,8 +545,8 @@ GOW(geteuid, pFv) //GO(getopt, //GO(getopt_long, //GO(getopt_long_only, -//GO(__getpagesize, -//GOW(getpagesize, +GO(__getpagesize, iFv) +GOW(getpagesize, iFv) //GO(getpass, //GOW(getpeername, //GO(__getpgid, @@ -863,44 +863,44 @@ GOW(getrlimit64, iFip) //GO(_IO_wsetb, //GO(iruserok, //GO(iruserok_af, -//GO(isalnum, +GO(isalnum, iFi) //GO(__isalnum_l, //GOW(isalnum_l, -//GO(isalpha, +GO(isalpha, iFi) //GO(__isalpha_l, -//GOW(isalpha_l, -//GO(isascii, +GOW(isalpha_l, iFip) +GO(isascii, iFi) //GOW(__isascii_l, //GO(isastream, -//GOW(isatty, -//GO(isblank, +GOW(isatty, iFi) +GO(isblank, iFi) //GO(__isblank_l, //GOW(isblank_l, -//GO(iscntrl, +GO(iscntrl, iFi) //GO(__iscntrl_l, //GOW(iscntrl_l, //GO(__isctype, //GOW(isctype, -//GO(isdigit, +GO(isdigit, iFi) //GO(__isdigit_l, //GOW(isdigit_l, //GO(isfdtype, -//GO(isgraph, +GO(isgraph, iFi) //GO(__isgraph_l, //GOW(isgraph_l, -//GO(__isinf, -//GOW(isinf, -//GO(__isinff, -//GOW(isinff, +GO(__isinf, iFd) +GOW(isinf, iFd) +GO(__isinff, iFf) +GOW(isinff, iFf) //GO(__isinfl, //GOW(isinfl, -//GO(islower, +GO(islower, iFi) //GO(__islower_l, //GOW(islower_l, -//GO(__isnan, -//GOW(isnan, -//GO(__isnanf, -//GOW(isnanf, +GO(__isnan, iFd) +GOW(isnan, iFd) +GO(__isnanf, iFf) +GOW(isnanf, iFf) //GO(__isnanl, //GOW(isnanl, //GO(__isoc99_fscanf, @@ -915,63 +915,63 @@ GOW(getrlimit64, iFip) //GO(__isoc99_vswscanf, //GO(__isoc99_vwscanf, //GO(__isoc99_wscanf, -//GO(isprint, +GO(isprint, iFi) //GO(__isprint_l, //GOW(isprint_l, -//GO(ispunct, +GO(ispunct, iFi) //GO(__ispunct_l, //GOW(ispunct_l, -//GO(isspace, +GO(isspace, iFi) //GO(__isspace_l, //GOW(isspace_l, -//GO(isupper, +GO(isupper, iFi) //GO(__isupper_l, //GOW(isupper_l, -//GOW(iswalnum, +GOW(iswalnum, iFi) //GO(__iswalnum_l, -//GOW(iswalnum_l, -//GOW(iswalpha, +GOW(iswalnum_l, iFip) +GOW(iswalpha, iFi) //GO(__iswalpha_l, -//GOW(iswalpha_l, -//GOW(iswblank, +GOW(iswalpha_l, iFip) +GOW(iswblank, iFi) //GO(__iswblank_l, -//GOW(iswblank_l, -//GOW(iswcntrl, +GOW(iswblank_l, iFip) +GOW(iswcntrl, iFi) //GO(__iswcntrl_l, -//GOW(iswcntrl_l, +GOW(iswcntrl_l, iFip) //GO(__iswctype, //GOW(iswctype, //GO(__iswctype_l, //GOW(iswctype_l, -//GOW(iswdigit, +GOW(iswdigit, iFi) //GO(__iswdigit_l, -//GOW(iswdigit_l, -//GOW(iswgraph, +GOW(iswdigit_l, iFip) +GOW(iswgraph, iFi) //GO(__iswgraph_l, -//GOW(iswgraph_l, -//GOW(iswlower, +GOW(iswgraph_l, iFip) +GOW(iswlower, iFi) //GO(__iswlower_l, -//GOW(iswlower_l, -//GOW(iswprint, +GOW(iswlower_l, iFip) +GOW(iswprint, iFi) //GO(__iswprint_l, -//GOW(iswprint_l, -//GOW(iswpunct, +GOW(iswprint_l, iFip) +GOW(iswpunct, iFi) //GO(__iswpunct_l, -//GOW(iswpunct_l, -//GOW(iswspace, +GOW(iswpunct_l, iFip) +GOW(iswspace, iFi) //GO(__iswspace_l, -//GOW(iswspace_l, -//GOW(iswupper, +GOW(iswspace_l, iFip) +GOW(iswupper, iFi) //GO(__iswupper_l, -//GOW(iswupper_l, -//GOW(iswxdigit, +GOW(iswupper_l, iFip) +GOW(iswxdigit, iFi) //GO(__iswxdigit_l, -//GOW(iswxdigit_l, -//GO(isxdigit, +GOW(iswxdigit_l, iFip) +GO(isxdigit, iFi) //GO(__isxdigit_l, -//GOW(isxdigit_l, +GOW(isxdigit_l, iFip) //GO(__ivaliduser, -//GO(jrand48, +GO(jrand48, iFp) //GOW(jrand48_r, //GO(key_decryptsession, //GO(key_decryptsession_pk, @@ -1442,10 +1442,10 @@ GO(pwritev64, lFipiI) //GO(quick_exit, //GO(quotactl, //GO(raise, -//GO(rand, +GO(rand, iFv) //GOW(random, //GOW(random_r, -//GO(rand_r, +GO(rand_r, iFp) //GOI(__rawmemchr, //GOI(rawmemchr, //GO(rcmd, @@ -1599,7 +1599,7 @@ GO2(__realpath_chk, pFppv, my_realpath) //GOW(setcontext, //GO(setdomainname, //GO(setegid, -//GOW(setenv, +GOW(setenv, iFppi) //GO(_seterr_reply, //GO(seteuid, //GO(setfsent, @@ -1717,7 +1717,7 @@ GOW(sleep, uFu) //GO(sprintf, //GO(__sprintf_chk, //GOW(sprofil, -//GOW(srand, +GOW(srand, vFu) //GO(srand48, //GOW(srand48_r, //GOW(srandom, @@ -1968,14 +1968,14 @@ GO(tmpnam, pFp) GO(tmpnam_r, pFp) GO(toascii, iFi) //GOW(__toascii_l, -//GO(_tolower, -//GO(tolower, +GO(_tolower, iFi) +GO(tolower, iFi) //GO(__tolower_l, -//GOW(tolower_l, +GOW(tolower_l, iFip) //GO(_toupper, -//GO(toupper, +GO(toupper, iFi) //GO(__toupper_l, -//GOW(toupper_l, +GOW(toupper_l, iFip) //GO(__towctrans, //GOW(towctrans, //GO(__towctrans_l, @@ -2013,7 +2013,7 @@ GOW(tzset, vFv) //GOW(unlink, //GO(unlinkat, //GO(unlockpt, -//GOW(unsetenv, +GOW(unsetenv, iFp) //GO(unshare, //GOW(updwtmp, //GO(updwtmpx, @@ -2197,10 +2197,10 @@ GO(__wctype_l, LFpp) //GO(__woverflow, //GO(wprintf, //GO(__wprintf_chk, -//GOW(__write, -//GOW(write, +GOW(__write, lFipL) +GOW(write, lFipL) //GO(__write_nocancel, -//GOW(writev, +GOW(writev, lFipi) //GO(wscanf, //GO(__wuflow, //GO(__wunderflow, @@ -2282,8 +2282,8 @@ GO(__wctype_l, LFpp) //GO(__xpg_strerror_r, //GO(xprt_register, //GO(xprt_unregister, -//GO(__xstat, -//GO(__xstat64, +GO(__xstat, iFipp) +GO(__xstat64, iFipp) GOM(_Jv_RegisterClasses, vFv) // dummy |