diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2021-05-19 08:45:37 +0200 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2021-05-19 08:45:37 +0200 |
| commit | 4d347f9ff04e11175bc0c25a693782be6ea5e29e (patch) | |
| tree | d1e74ee97ff6f81a93d63a17c4542dc07b725884 /src | |
| parent | 252258d138b0160eee040d5834a0b02d88e0d48d (diff) | |
| download | box64-4d347f9ff04e11175bc0c25a693782be6ea5e29e.tar.gz box64-4d347f9ff04e11175bc0c25a693782be6ea5e29e.zip | |
Added a few wrapped function to libc and pthreads
Diffstat (limited to 'src')
| -rwxr-xr-x | src/libtools/threads.c | 40 | ||||
| -rw-r--r-- | src/wrapped/generated/functions_list.txt | 3 | ||||
| -rw-r--r-- | src/wrapped/generated/wrappedlibctypes.h | 4 | ||||
| -rw-r--r-- | src/wrapped/generated/wrappedlibpthreadtypes.h | 2 | ||||
| -rw-r--r-- | src/wrapped/generated/wrappedsdl2types.h | 2 | ||||
| -rw-r--r-- | src/wrapped/generated/wrapper.c | 7 | ||||
| -rw-r--r-- | src/wrapped/generated/wrapper.h | 3 | ||||
| -rwxr-xr-x | src/wrapped/wrappedlibc_private.h | 4 | ||||
| -rwxr-xr-x | src/wrapped/wrappedlibpthread_private.h | 4 |
9 files changed, 40 insertions, 29 deletions
diff --git a/src/libtools/threads.c b/src/libtools/threads.c index b2ab3b5d..054451ff 100755 --- a/src/libtools/threads.c +++ b/src/libtools/threads.c @@ -681,27 +681,27 @@ EXPORT void my__pthread_cleanup_pop(x64emu_t* emu, void* buffer, int exec) _pthread_cleanup_pop(buffer, exec); } -//EXPORT int my_pthread_getaffinity_np(x64emu_t* emu, pthread_t thread, int cpusetsize, void* cpuset) -//{ -// (void)emu; -// int ret = pthread_getaffinity_np(thread, cpusetsize, cpuset); -// if(ret<0) { -// printf_log(LOG_INFO, "Warning, pthread_getaffinity_np(%p, %d, %p) errored, with errno=%d\n", (void*)thread, cpusetsize, cpuset, errno); -// } -// -// return ret; -//} +EXPORT int my_pthread_getaffinity_np(x64emu_t* emu, pthread_t thread, size_t cpusetsize, void* cpuset) +{ + (void)emu; + int ret = pthread_getaffinity_np(thread, cpusetsize, cpuset); + if(ret<0) { + printf_log(LOG_INFO, "Warning, pthread_getaffinity_np(%p, %zd, %p) errored, with errno=%d\n", (void*)thread, cpusetsize, cpuset, errno); + } -//EXPORT int my_pthread_setaffinity_np(x64emu_t* emu, pthread_t thread, int cpusetsize, void* cpuset) -//{ -// (void)emu; -// int ret = pthread_setaffinity_np(thread, cpusetsize, cpuset); -// if(ret<0) { -// printf_log(LOG_INFO, "Warning, pthread_setaffinity_np(%p, %d, %p) errored, with errno=%d\n", (void*)thread, cpusetsize, cpuset, errno); -// } -// -// return ret; -//} + return ret; +} + +EXPORT int my_pthread_setaffinity_np(x64emu_t* emu, pthread_t thread, size_t cpusetsize, void* cpuset) +{ + (void)emu; + int ret = pthread_setaffinity_np(thread, cpusetsize, cpuset); + if(ret<0) { + printf_log(LOG_INFO, "Warning, pthread_setaffinity_np(%p, %zd, %p) errored, with errno=%d\n", (void*)thread, cpusetsize, cpuset, errno); + } + + return ret; +} //EXPORT int my_pthread_attr_setaffinity_np(x64emu_t* emu, void* attr, uint32_t cpusetsize, void* cpuset) //{ diff --git a/src/wrapped/generated/functions_list.txt b/src/wrapped/generated/functions_list.txt index f4b372aa..888129cf 100644 --- a/src/wrapped/generated/functions_list.txt +++ b/src/wrapped/generated/functions_list.txt @@ -456,6 +456,7 @@ #() iFEpii #() iFEpip #() iFEpLi +#() iFEpLp #() iFEppi #() iFEppL #() iFEppp @@ -879,6 +880,7 @@ #() iFpiuuup #() iFpiuupp #() iFpippip +#() iFpipppL #() iFpipppp #() iFpupuui #() iFppiiuu @@ -1208,7 +1210,6 @@ #() pFiiiippppppppppppppp #() pFpippppppppppppppppp #() pFipppppppppppppppppppppp -#!defined(NOALIGN) iFEpLp #!defined(NOALIGN) iFEppu #!defined(NOALIGN) iFEiiip #!defined(NOALIGN) iFEipii diff --git a/src/wrapped/generated/wrappedlibctypes.h b/src/wrapped/generated/wrappedlibctypes.h index 4921641d..4ca1ad4c 100644 --- a/src/wrapped/generated/wrappedlibctypes.h +++ b/src/wrapped/generated/wrappedlibctypes.h @@ -66,7 +66,6 @@ typedef int64_t (*iFpippppp_t)(void*, int64_t, void*, void*, void*, void*, void* GO(__stack_chk_fail, vFv_t) \ GO(_ITM_deregisterTMCloneTable, vFp_t) \ GO(__cxa_finalize, vFp_t) \ - GO(__sigsetjmp, iFp_t) \ GO(_setjmp, iFp_t) \ GO(getcontext, iFp_t) \ GO(setjmp, iFp_t) \ @@ -76,7 +75,9 @@ typedef int64_t (*iFpippppp_t)(void*, int64_t, void*, void*, void*, void*, void* GO(_longjmp, vFpi_t) \ GO(longjmp, vFpi_t) \ GO(_ITM_registerTMCloneTable, vFpu_t) \ + GO(__sigsetjmp, iFpi_t) \ GO(backtrace, iFpi_t) \ + GO(siglongjmp, iFpi_t) \ GO(munmap, iFpL_t) \ GO(__vprintf_chk, iFpp_t) \ GO(dl_iterate_phdr, iFpp_t) \ @@ -125,6 +126,7 @@ typedef int64_t (*iFpippppp_t)(void*, int64_t, void*, void*, void*, void*, void* GO(__isoc99_sscanf, iFppV_t) \ GO(fprintf, iFppV_t) \ GO(fscanf, iFppV_t) \ + GO(fwprintf, iFppV_t) \ GO(sprintf, iFppV_t) \ GO(sscanf, iFppV_t) \ GO(swscanf, iFppV_t) \ diff --git a/src/wrapped/generated/wrappedlibpthreadtypes.h b/src/wrapped/generated/wrappedlibpthreadtypes.h index 107e43eb..24c70469 100644 --- a/src/wrapped/generated/wrappedlibpthreadtypes.h +++ b/src/wrapped/generated/wrappedlibpthreadtypes.h @@ -79,6 +79,8 @@ typedef int64_t (*iFpppp_t)(void*, void*, void*, void*); GO(_pthread_cleanup_push, vFppp_t) \ GO(_pthread_cleanup_push_defer, vFppp_t) \ GO(pthread_attr_setaffinity_np, iFpLp_t) \ + GO(pthread_getaffinity_np, iFpLp_t) \ + GO(pthread_setaffinity_np, iFpLp_t) \ GO(pthread_barrier_init, iFppu_t) \ GO(pthread_attr_setstack, iFppL_t) \ GO(__pthread_atfork, iFppp_t) \ diff --git a/src/wrapped/generated/wrappedsdl2types.h b/src/wrapped/generated/wrappedsdl2types.h index d59b86a1..249e094f 100644 --- a/src/wrapped/generated/wrappedsdl2types.h +++ b/src/wrapped/generated/wrappedsdl2types.h @@ -33,6 +33,7 @@ typedef void* (*pFpp_t)(void*, void*); typedef void (*vFipV_t)(int64_t, void*, void*); typedef int64_t (*iFupp_t)(uint64_t, void*, void*); typedef int64_t (*iFppi_t)(void*, void*, int64_t); +typedef int64_t (*iFppV_t)(void*, void*, void*); typedef int64_t (*IFpIi_t)(void*, int64_t, int64_t); typedef void* (*pFupp_t)(uint64_t, void*, void*); typedef void* (*pFppi_t)(void*, void*, int64_t); @@ -99,6 +100,7 @@ typedef void* (*pFpippp_t)(void*, int64_t, void*, void*, void*); GO(SDL_LogWarn, vFipV_t) \ GO(SDL_TLSSet, iFupp_t) \ GO(SDL_SaveBMP_RW, iFppi_t) \ + GO(SDL_sscanf, iFppV_t) \ GO(SDL_RWseek, IFpIi_t) \ GO(SDL_AddTimer, pFupp_t) \ GO(SDL_LoadFile_RW, pFppi_t) \ diff --git a/src/wrapped/generated/wrapper.c b/src/wrapped/generated/wrapper.c index ab9a9b64..2f3a93d2 100644 --- a/src/wrapped/generated/wrapper.c +++ b/src/wrapped/generated/wrapper.c @@ -490,6 +490,7 @@ typedef int64_t (*iFEupp_t)(x64emu_t*, uint64_t, void*, void*); typedef int64_t (*iFEpii_t)(x64emu_t*, void*, int64_t, int64_t); typedef int64_t (*iFEpip_t)(x64emu_t*, void*, int64_t, void*); typedef int64_t (*iFEpLi_t)(x64emu_t*, void*, uintptr_t, int64_t); +typedef int64_t (*iFEpLp_t)(x64emu_t*, void*, uintptr_t, void*); typedef int64_t (*iFEppi_t)(x64emu_t*, void*, void*, int64_t); typedef int64_t (*iFEppL_t)(x64emu_t*, void*, void*, uintptr_t); typedef int64_t (*iFEppp_t)(x64emu_t*, void*, void*, void*); @@ -913,6 +914,7 @@ typedef int64_t (*iFpiippp_t)(void*, int64_t, int64_t, void*, void*, void*); typedef int64_t (*iFpiuuup_t)(void*, int64_t, uint64_t, uint64_t, uint64_t, void*); typedef int64_t (*iFpiuupp_t)(void*, int64_t, uint64_t, uint64_t, void*, void*); typedef int64_t (*iFpippip_t)(void*, int64_t, void*, void*, int64_t, void*); +typedef int64_t (*iFpipppL_t)(void*, int64_t, void*, void*, void*, uintptr_t); typedef int64_t (*iFpipppp_t)(void*, int64_t, void*, void*, void*, void*); typedef int64_t (*iFpupuui_t)(void*, uint64_t, void*, uint64_t, uint64_t, int64_t); typedef int64_t (*iFppiiuu_t)(void*, void*, int64_t, int64_t, uint64_t, uint64_t); @@ -1244,7 +1246,6 @@ typedef void* (*pFpippppppppppppppppp_t)(void*, int64_t, void*, void*, void*, vo typedef void* (*pFipppppppppppppppppppppp_t)(int64_t, void*, void*, void*, void*, void*, void*, void*, void*, void*, void*, void*, void*, void*, void*, void*, void*, void*, void*, void*, void*, void*, void*); #if !defined(NOALIGN) -typedef int64_t (*iFEpLp_t)(x64emu_t*, void*, uintptr_t, void*); typedef int64_t (*iFEppu_t)(x64emu_t*, void*, void*, uint64_t); typedef int64_t (*iFEiiip_t)(x64emu_t*, int64_t, int64_t, int64_t, void*); typedef int64_t (*iFEipii_t)(x64emu_t*, int64_t, void*, int64_t, int64_t); @@ -1720,6 +1721,7 @@ void iFEupp(x64emu_t *emu, uintptr_t fcn) { iFEupp_t fn = (iFEupp_t)fcn; R_RAX=( void iFEpii(x64emu_t *emu, uintptr_t fcn) { iFEpii_t fn = (iFEpii_t)fcn; R_RAX=(int64_t)fn(emu, (void*)R_RDI, (int64_t)R_RSI, (int64_t)R_RDX); } void iFEpip(x64emu_t *emu, uintptr_t fcn) { iFEpip_t fn = (iFEpip_t)fcn; R_RAX=(int64_t)fn(emu, (void*)R_RDI, (int64_t)R_RSI, (void*)R_RDX); } void iFEpLi(x64emu_t *emu, uintptr_t fcn) { iFEpLi_t fn = (iFEpLi_t)fcn; R_RAX=(int64_t)fn(emu, (void*)R_RDI, (uintptr_t)R_RSI, (int64_t)R_RDX); } +void iFEpLp(x64emu_t *emu, uintptr_t fcn) { iFEpLp_t fn = (iFEpLp_t)fcn; R_RAX=(int64_t)fn(emu, (void*)R_RDI, (uintptr_t)R_RSI, (void*)R_RDX); } void iFEppi(x64emu_t *emu, uintptr_t fcn) { iFEppi_t fn = (iFEppi_t)fcn; R_RAX=(int64_t)fn(emu, (void*)R_RDI, (void*)R_RSI, (int64_t)R_RDX); } void iFEppL(x64emu_t *emu, uintptr_t fcn) { iFEppL_t fn = (iFEppL_t)fcn; R_RAX=(int64_t)fn(emu, (void*)R_RDI, (void*)R_RSI, (uintptr_t)R_RDX); } void iFEppp(x64emu_t *emu, uintptr_t fcn) { iFEppp_t fn = (iFEppp_t)fcn; R_RAX=(int64_t)fn(emu, (void*)R_RDI, (void*)R_RSI, (void*)R_RDX); } @@ -2143,6 +2145,7 @@ void iFpiippp(x64emu_t *emu, uintptr_t fcn) { iFpiippp_t fn = (iFpiippp_t)fcn; R void iFpiuuup(x64emu_t *emu, uintptr_t fcn) { iFpiuuup_t fn = (iFpiuuup_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (int64_t)R_RSI, (uint64_t)R_RDX, (uint64_t)R_RCX, (uint64_t)R_R8, (void*)R_R9); } void iFpiuupp(x64emu_t *emu, uintptr_t fcn) { iFpiuupp_t fn = (iFpiuupp_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (int64_t)R_RSI, (uint64_t)R_RDX, (uint64_t)R_RCX, (void*)R_R8, (void*)R_R9); } void iFpippip(x64emu_t *emu, uintptr_t fcn) { iFpippip_t fn = (iFpippip_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (int64_t)R_RSI, (void*)R_RDX, (void*)R_RCX, (int64_t)R_R8, (void*)R_R9); } +void iFpipppL(x64emu_t *emu, uintptr_t fcn) { iFpipppL_t fn = (iFpipppL_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (int64_t)R_RSI, (void*)R_RDX, (void*)R_RCX, (void*)R_R8, (uintptr_t)R_R9); } void iFpipppp(x64emu_t *emu, uintptr_t fcn) { iFpipppp_t fn = (iFpipppp_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (int64_t)R_RSI, (void*)R_RDX, (void*)R_RCX, (void*)R_R8, (void*)R_R9); } void iFpupuui(x64emu_t *emu, uintptr_t fcn) { iFpupuui_t fn = (iFpupuui_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (uint64_t)R_RSI, (void*)R_RDX, (uint64_t)R_RCX, (uint64_t)R_R8, (int64_t)R_R9); } void iFppiiuu(x64emu_t *emu, uintptr_t fcn) { iFppiiuu_t fn = (iFppiiuu_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (void*)R_RSI, (int64_t)R_RDX, (int64_t)R_RCX, (uint64_t)R_R8, (uint64_t)R_R9); } @@ -2474,7 +2477,6 @@ void pFpippppppppppppppppp(x64emu_t *emu, uintptr_t fcn) { pFpippppppppppppppppp void pFipppppppppppppppppppppp(x64emu_t *emu, uintptr_t fcn) { pFipppppppppppppppppppppp_t fn = (pFipppppppppppppppppppppp_t)fcn; R_RAX=(uintptr_t)fn((int64_t)R_RDI, (void*)R_RSI, (void*)R_RDX, (void*)R_RCX, (void*)R_R8, (void*)R_R9, *(void**)(R_RSP + 8), *(void**)(R_RSP + 16), *(void**)(R_RSP + 24), *(void**)(R_RSP + 32), *(void**)(R_RSP + 40), *(void**)(R_RSP + 48), *(void**)(R_RSP + 56), *(void**)(R_RSP + 64), *(void**)(R_RSP + 72), *(void**)(R_RSP + 80), *(void**)(R_RSP + 88), *(void**)(R_RSP + 96), *(void**)(R_RSP + 104), *(void**)(R_RSP + 112), *(void**)(R_RSP + 120), *(void**)(R_RSP + 128), *(void**)(R_RSP + 136)); } #if !defined(NOALIGN) -void iFEpLp(x64emu_t *emu, uintptr_t fcn) { iFEpLp_t fn = (iFEpLp_t)fcn; R_RAX=(int64_t)fn(emu, (void*)R_RDI, (uintptr_t)R_RSI, (void*)R_RDX); } void iFEppu(x64emu_t *emu, uintptr_t fcn) { iFEppu_t fn = (iFEppu_t)fcn; R_RAX=(int64_t)fn(emu, (void*)R_RDI, (void*)R_RSI, (uint64_t)R_RDX); } void iFEiiip(x64emu_t *emu, uintptr_t fcn) { iFEiiip_t fn = (iFEiiip_t)fcn; R_RAX=(int64_t)fn(emu, (int64_t)R_RDI, (int64_t)R_RSI, (int64_t)R_RDX, (void*)R_RCX); } void iFEipii(x64emu_t *emu, uintptr_t fcn) { iFEipii_t fn = (iFEipii_t)fcn; R_RAX=(int64_t)fn(emu, (int64_t)R_RDI, (void*)R_RSI, (int64_t)R_RDX, (int64_t)R_RCX); } @@ -3252,6 +3254,7 @@ int isSimpleWrapper(wrapper_t fun) { if (fun == &iFpiuuup) return 1; if (fun == &iFpiuupp) return 1; if (fun == &iFpippip) return 1; + if (fun == &iFpipppL) return 1; if (fun == &iFpipppp) return 1; if (fun == &iFpupuui) return 1; if (fun == &iFppiiuu) return 1; diff --git a/src/wrapped/generated/wrapper.h b/src/wrapped/generated/wrapper.h index cdf0aa05..a64be1dd 100644 --- a/src/wrapped/generated/wrapper.h +++ b/src/wrapped/generated/wrapper.h @@ -486,6 +486,7 @@ void iFEupp(x64emu_t *emu, uintptr_t fnc); void iFEpii(x64emu_t *emu, uintptr_t fnc); void iFEpip(x64emu_t *emu, uintptr_t fnc); void iFEpLi(x64emu_t *emu, uintptr_t fnc); +void iFEpLp(x64emu_t *emu, uintptr_t fnc); void iFEppi(x64emu_t *emu, uintptr_t fnc); void iFEppL(x64emu_t *emu, uintptr_t fnc); void iFEppp(x64emu_t *emu, uintptr_t fnc); @@ -909,6 +910,7 @@ void iFpiippp(x64emu_t *emu, uintptr_t fnc); void iFpiuuup(x64emu_t *emu, uintptr_t fnc); void iFpiuupp(x64emu_t *emu, uintptr_t fnc); void iFpippip(x64emu_t *emu, uintptr_t fnc); +void iFpipppL(x64emu_t *emu, uintptr_t fnc); void iFpipppp(x64emu_t *emu, uintptr_t fnc); void iFpupuui(x64emu_t *emu, uintptr_t fnc); void iFppiiuu(x64emu_t *emu, uintptr_t fnc); @@ -1240,7 +1242,6 @@ void pFpippppppppppppppppp(x64emu_t *emu, uintptr_t fnc); void pFipppppppppppppppppppppp(x64emu_t *emu, uintptr_t fnc); #if !defined(NOALIGN) -void iFEpLp(x64emu_t *emu, uintptr_t fnc); void iFEppu(x64emu_t *emu, uintptr_t fnc); void iFEiiip(x64emu_t *emu, uintptr_t fnc); void iFEipii(x64emu_t *emu, uintptr_t fnc); diff --git a/src/wrapped/wrappedlibc_private.h b/src/wrapped/wrappedlibc_private.h index 2c8fc470..fc115393 100755 --- a/src/wrapped/wrappedlibc_private.h +++ b/src/wrapped/wrappedlibc_private.h @@ -1924,8 +1924,8 @@ GO(syncfs, iFi) GOM(syscall, LFEv) GO(__sysconf, lFi) GOW(sysconf, lFi) -//GO(__sysctl, -//GOW(sysctl, +GO(__sysctl, iFpipppL) +GOW(sysctl, iFpipppL) DATA(_sys_errlist, sizeof(void*)) DATA(sys_errlist, sizeof(void*)) GOW(sysinfo, iFp) diff --git a/src/wrapped/wrappedlibpthread_private.h b/src/wrapped/wrappedlibpthread_private.h index 578230f2..2b1405ff 100755 --- a/src/wrapped/wrappedlibpthread_private.h +++ b/src/wrapped/wrappedlibpthread_private.h @@ -116,7 +116,7 @@ GO(pthread_detach, iFL) GO(pthread_equal, iFLL) //GOM(pthread_exit, vFEp) GO(pthread_exit, vFp) -//GOM(pthread_getaffinity_np, iFEpup) +GOM(pthread_getaffinity_np, iFEpLp) GO(pthread_getattr_np, iFLp) //GO(pthread_getconcurrency, iFv) //GO(pthread_getcpuclockid, iFup) @@ -226,7 +226,7 @@ GO(pthread_rwlock_unlock, iFp) GO(__pthread_rwlock_wrlock, iFp) GO(pthread_rwlock_wrlock, iFp) GO(pthread_self, LFv) -//GOM(pthread_setaffinity_np, iFELup) +GOM(pthread_setaffinity_np, iFEpLp) GO(pthread_setcancelstate, iFip) GO(pthread_setcanceltype, iFip) GO(pthread_setconcurrency, iFi) |