diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2021-04-13 17:43:10 +0200 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2021-04-13 17:43:10 +0200 |
| commit | 3adeabb06d9221b678f3b28726e776acb9332826 (patch) | |
| tree | 5e1089e9a30f159af798cca4751c21afa6132d0e /src | |
| parent | 459311187197964f44db932d9c42e0461b8cc895 (diff) | |
| download | box64-3adeabb06d9221b678f3b28726e776acb9332826.tar.gz box64-3adeabb06d9221b678f3b28726e776acb9332826.zip | |
Added some libc wrapped functions
Diffstat (limited to 'src')
| -rw-r--r-- | src/wrapped/generated/functions_list.txt | 3 | ||||
| -rw-r--r-- | src/wrapped/generated/wrapper.c | 9 | ||||
| -rw-r--r-- | src/wrapped/generated/wrapper.h | 3 | ||||
| -rwxr-xr-x | src/wrapped/wrappedlibc_private.h | 22 |
4 files changed, 26 insertions, 11 deletions
diff --git a/src/wrapped/generated/functions_list.txt b/src/wrapped/generated/functions_list.txt index c9bbb5e3..620ed10d 100644 --- a/src/wrapped/generated/functions_list.txt +++ b/src/wrapped/generated/functions_list.txt @@ -4,6 +4,7 @@ #() vFu #() vFf #() vFd +#() vFl #() vFp #() vFS #() cFv @@ -37,6 +38,7 @@ #() fFi #() fFf #() fFp +#() dFv #() dFi #() dFu #() dFd @@ -679,6 +681,7 @@ #() iFiLLLL #() iFipiii #() iFipuip +#() iFippLp #() iFipppi #() iFipppp #() iFuppLp diff --git a/src/wrapped/generated/wrapper.c b/src/wrapped/generated/wrapper.c index 75a12980..b6a0083a 100644 --- a/src/wrapped/generated/wrapper.c +++ b/src/wrapped/generated/wrapper.c @@ -38,6 +38,7 @@ typedef void (*vFi_t)(int64_t); typedef void (*vFu_t)(uint64_t); typedef void (*vFf_t)(float); typedef void (*vFd_t)(double); +typedef void (*vFl_t)(intptr_t); typedef void (*vFp_t)(void*); typedef void (*vFS_t)(void*); typedef int8_t (*cFv_t)(void); @@ -71,6 +72,7 @@ typedef uint64_t (*UFV_t)(void*); typedef float (*fFi_t)(int64_t); typedef float (*fFf_t)(float); typedef float (*fFp_t)(void*); +typedef double (*dFv_t)(void); typedef double (*dFi_t)(int64_t); typedef double (*dFu_t)(uint64_t); typedef double (*dFd_t)(double); @@ -713,6 +715,7 @@ typedef int64_t (*iFiiupp_t)(int64_t, int64_t, uint64_t, void*, void*); typedef int64_t (*iFiLLLL_t)(int64_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t); typedef int64_t (*iFipiii_t)(int64_t, void*, int64_t, int64_t, int64_t); typedef int64_t (*iFipuip_t)(int64_t, void*, uint64_t, int64_t, void*); +typedef int64_t (*iFippLp_t)(int64_t, void*, void*, uintptr_t, void*); typedef int64_t (*iFipppi_t)(int64_t, void*, void*, void*, int64_t); typedef int64_t (*iFipppp_t)(int64_t, void*, void*, void*, void*); typedef int64_t (*iFuppLp_t)(uint64_t, void*, void*, uintptr_t, void*); @@ -1238,6 +1241,7 @@ void vFi(x64emu_t *emu, uintptr_t fcn) { vFi_t fn = (vFi_t)fcn; fn((int64_t)R_RD void vFu(x64emu_t *emu, uintptr_t fcn) { vFu_t fn = (vFu_t)fcn; fn((uint64_t)R_RDI); } void vFf(x64emu_t *emu, uintptr_t fcn) { vFf_t fn = (vFf_t)fcn; fn(emu->xmm[0].f[0]); } void vFd(x64emu_t *emu, uintptr_t fcn) { vFd_t fn = (vFd_t)fcn; fn(emu->xmm[0].d[0]); } +void vFl(x64emu_t *emu, uintptr_t fcn) { vFl_t fn = (vFl_t)fcn; fn((intptr_t)R_RDI); } void vFp(x64emu_t *emu, uintptr_t fcn) { vFp_t fn = (vFp_t)fcn; fn((void*)R_RDI); } void vFS(x64emu_t *emu, uintptr_t fcn) { vFS_t fn = (vFS_t)fcn; fn(io_convert((void*)R_RDI)); } void cFv(x64emu_t *emu, uintptr_t fcn) { cFv_t fn = (cFv_t)fcn; R_RAX=fn(); } @@ -1271,6 +1275,7 @@ void UFV(x64emu_t *emu, uintptr_t fcn) { UFV_t fn = (UFV_t)fcn; R_RAX=fn((void*) void fFi(x64emu_t *emu, uintptr_t fcn) { fFi_t fn = (fFi_t)fcn; emu->xmm[0].f[0]=fn((int64_t)R_RDI); } void fFf(x64emu_t *emu, uintptr_t fcn) { fFf_t fn = (fFf_t)fcn; emu->xmm[0].f[0]=fn(emu->xmm[0].f[0]); } void fFp(x64emu_t *emu, uintptr_t fcn) { fFp_t fn = (fFp_t)fcn; emu->xmm[0].f[0]=fn((void*)R_RDI); } +void dFv(x64emu_t *emu, uintptr_t fcn) { dFv_t fn = (dFv_t)fcn; emu->xmm[0].d[0]=fn(); } void dFi(x64emu_t *emu, uintptr_t fcn) { dFi_t fn = (dFi_t)fcn; emu->xmm[0].d[0]=fn((int64_t)R_RDI); } void dFu(x64emu_t *emu, uintptr_t fcn) { dFu_t fn = (dFu_t)fcn; emu->xmm[0].d[0]=fn((uint64_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]); } @@ -1913,6 +1918,7 @@ void iFiiupp(x64emu_t *emu, uintptr_t fcn) { iFiiupp_t fn = (iFiiupp_t)fcn; R_RA void iFiLLLL(x64emu_t *emu, uintptr_t fcn) { iFiLLLL_t fn = (iFiLLLL_t)fcn; R_RAX=(int64_t)fn((int64_t)R_RDI, (uintptr_t)R_RSI, (uintptr_t)R_RDX, (uintptr_t)R_RCX, (uintptr_t)R_R8); } void iFipiii(x64emu_t *emu, uintptr_t fcn) { iFipiii_t fn = (iFipiii_t)fcn; R_RAX=(int64_t)fn((int64_t)R_RDI, (void*)R_RSI, (int64_t)R_RDX, (int64_t)R_RCX, (int64_t)R_R8); } void iFipuip(x64emu_t *emu, uintptr_t fcn) { iFipuip_t fn = (iFipuip_t)fcn; R_RAX=(int64_t)fn((int64_t)R_RDI, (void*)R_RSI, (uint64_t)R_RDX, (int64_t)R_RCX, (void*)R_R8); } +void iFippLp(x64emu_t *emu, uintptr_t fcn) { iFippLp_t fn = (iFippLp_t)fcn; R_RAX=(int64_t)fn((int64_t)R_RDI, (void*)R_RSI, (void*)R_RDX, (uintptr_t)R_RCX, (void*)R_R8); } void iFipppi(x64emu_t *emu, uintptr_t fcn) { iFipppi_t fn = (iFipppi_t)fcn; R_RAX=(int64_t)fn((int64_t)R_RDI, (void*)R_RSI, (void*)R_RDX, (void*)R_RCX, (int64_t)R_R8); } void iFipppp(x64emu_t *emu, uintptr_t fcn) { iFipppp_t fn = (iFipppp_t)fcn; R_RAX=(int64_t)fn((int64_t)R_RDI, (void*)R_RSI, (void*)R_RDX, (void*)R_RCX, (void*)R_R8); } void iFuppLp(x64emu_t *emu, uintptr_t fcn) { iFuppLp_t fn = (iFuppLp_t)fcn; R_RAX=(int64_t)fn((uint64_t)R_RDI, (void*)R_RSI, (void*)R_RDX, (uintptr_t)R_RCX, (void*)R_R8); } @@ -2449,6 +2455,7 @@ int isSimpleWrapper(wrapper_t fun) { if (fun == &vFu) return 1; if (fun == &vFf) return 1; if (fun == &vFd) return 1; + if (fun == &vFl) return 1; if (fun == &vFp) return 1; if (fun == &cFv) return 1; if (fun == &cFi) return 1; @@ -2478,6 +2485,7 @@ int isSimpleWrapper(wrapper_t fun) { if (fun == &fFi) return 1; if (fun == &fFf) return 1; if (fun == &fFp) return 1; + if (fun == &dFv) return 1; if (fun == &dFi) return 1; if (fun == &dFu) return 1; if (fun == &dFd) return 1; @@ -3021,6 +3029,7 @@ int isSimpleWrapper(wrapper_t fun) { if (fun == &iFiLLLL) return 1; if (fun == &iFipiii) return 1; if (fun == &iFipuip) return 1; + if (fun == &iFippLp) return 1; if (fun == &iFipppi) return 1; if (fun == &iFipppp) return 1; if (fun == &iFuppLp) return 1; diff --git a/src/wrapped/generated/wrapper.h b/src/wrapped/generated/wrapper.h index 7b7f1b7e..d17274b4 100644 --- a/src/wrapped/generated/wrapper.h +++ b/src/wrapped/generated/wrapper.h @@ -34,6 +34,7 @@ void vFi(x64emu_t *emu, uintptr_t fnc); void vFu(x64emu_t *emu, uintptr_t fnc); void vFf(x64emu_t *emu, uintptr_t fnc); void vFd(x64emu_t *emu, uintptr_t fnc); +void vFl(x64emu_t *emu, uintptr_t fnc); void vFp(x64emu_t *emu, uintptr_t fnc); void vFS(x64emu_t *emu, uintptr_t fnc); void cFv(x64emu_t *emu, uintptr_t fnc); @@ -67,6 +68,7 @@ void UFV(x64emu_t *emu, uintptr_t fnc); void fFi(x64emu_t *emu, uintptr_t fnc); void fFf(x64emu_t *emu, uintptr_t fnc); void fFp(x64emu_t *emu, uintptr_t fnc); +void dFv(x64emu_t *emu, uintptr_t fnc); void dFi(x64emu_t *emu, uintptr_t fnc); void dFu(x64emu_t *emu, uintptr_t fnc); void dFd(x64emu_t *emu, uintptr_t fnc); @@ -709,6 +711,7 @@ void iFiiupp(x64emu_t *emu, uintptr_t fnc); void iFiLLLL(x64emu_t *emu, uintptr_t fnc); void iFipiii(x64emu_t *emu, uintptr_t fnc); void iFipuip(x64emu_t *emu, uintptr_t fnc); +void iFippLp(x64emu_t *emu, uintptr_t fnc); void iFipppi(x64emu_t *emu, uintptr_t fnc); void iFipppp(x64emu_t *emu, uintptr_t fnc); void iFuppLp(x64emu_t *emu, uintptr_t fnc); diff --git a/src/wrapped/wrappedlibc_private.h b/src/wrapped/wrappedlibc_private.h index 78efca63..211aa89f 100755 --- a/src/wrapped/wrappedlibc_private.h +++ b/src/wrapped/wrappedlibc_private.h @@ -217,7 +217,7 @@ GOM(dl_iterate_phdr, iFEpp) //Weak //GOW(dngettext, //GO(dprintf, //GO(__dprintf_chk, -//GO(drand48, +GO(drand48, dFv) //GO(drand48_r, GOW(dup, iFi) GO(__dup2, iFii) @@ -261,7 +261,7 @@ GO(epoll_create1, iFO) GO(epoll_ctl, iFiiip) // need to check about alignment //GO(epoll_pwait, GO(epoll_wait, iFipii) -//GO(erand48, +GO(erand48, dFp) //GOW(erand48_r, //GO(err, //DATAB(errno, @@ -565,11 +565,11 @@ GO(getpid, uFv) //GOW(getppid, GOW(getpriority, iFii) GO(getprotobyname, pFp) -//GO(getprotobyname_r, +GO(getprotobyname_r, iFpppLp) GO(getprotobynumber, pFp) -//GO(getprotobynumber_r, +GO(getprotobynumber_r, iFippLp) GO(getprotoent, pFv) -//GO(getprotoent_r, +GO(getprotoent_r, iFppLp) //GOW(getpt, //GO(getpublickey, //GOW(getpw, @@ -999,7 +999,7 @@ GO(killpg, iFii) //GO(lchmod, //GOW(lchown, //GOW(lckpwdf, -//GO(lcong48, +GO(lcong48, vFp) //GOW(lcong48_r, //GOW(ldexp, //GOW(ldexpf, @@ -1083,7 +1083,7 @@ GOW(localtime_r, pFpp) GOM(_longjmp, vFEpi) //Weak GOM(longjmp, vFEpi) //weak GOM(__longjmp_chk, vFEpi) -//GO(lrand48, +GO(lrand48, lFv) //GO(lrand48_r, //GO(lremovexattr, GOM(lsearch, pFEpppLp) @@ -1182,7 +1182,7 @@ GOM(mmap64, pFEpLiiiI) //weak //GO(mprobe, //GO(__mprotect, GOM(mprotect, iFEpLi) //weak -//GO(mrand48, +GO(mrand48, lFv) //GO(mrand48_r, GOM(mremap, pFEpLLiN) //weal //GO(msgctl, @@ -1217,7 +1217,7 @@ GO(nl_langinfo, pFu) GO(__nl_langinfo_l, pFup) GOW(nl_langinfo_l, pFup) //DATAB(_nl_msg_cat_cntr, -//GO(nrand48, +GO(nrand48, lFp) //GOW(nrand48_r, //GO(__nss_configure_lookup, //GO(__nss_database_lookup, @@ -1579,7 +1579,7 @@ GO(__sched_yield, iFv) GOW(sched_yield, iFv) GO2(__secure_getenv, pFp, getenv) // not always present GOW(secure_getenv, pFp) -//GO(seed48, +GO(seed48, pFp) //GOW(seed48_r, GO(seekdir, vFpi) GO(__select, iFipppp) @@ -1721,7 +1721,7 @@ GOM(sprintf, iFEppV) GOM(__sprintf_chk, iFEpilpV) //GOW(sprofil, GOW(srand, vFu) -//GO(srand48, +GO(srand48, vFl) //GOW(srand48_r, GOW(srandom, vFu) //GOW(srandom_r, |