diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2021-06-15 17:15:01 +0200 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2021-06-15 17:15:01 +0200 |
| commit | 8e694eac57952921d815e732d970d681c638fcb8 (patch) | |
| tree | 26ff623be73fcc7d0034336c7de082be5588abcd /src | |
| parent | 8622f9fdc3883ef79517ef459c60af1d60c517ff (diff) | |
| download | box64-8e694eac57952921d815e732d970d681c638fcb8.tar.gz box64-8e694eac57952921d815e732d970d681c638fcb8.zip | |
Some more wrapped functions to libc, and both libudev
Diffstat (limited to 'src')
| -rw-r--r-- | src/wrapped/generated/functions_list.txt | 19 | ||||
| -rw-r--r-- | src/wrapped/generated/wrappedtcmallocminimaltypes.h | 23 | ||||
| -rw-r--r-- | src/wrapped/generated/wrappedudev0types.h | 19 | ||||
| -rw-r--r-- | src/wrapped/generated/wrappedudev1types.h | 19 | ||||
| -rw-r--r-- | src/wrapped/generated/wrapper.c | 14 | ||||
| -rw-r--r-- | src/wrapped/generated/wrapper.h | 6 | ||||
| -rwxr-xr-x | src/wrapped/wrappedlibc_private.h | 12 | ||||
| -rwxr-xr-x | src/wrapped/wrappedudev0.c | 83 | ||||
| -rwxr-xr-x | src/wrapped/wrappedudev0_private.h | 3 | ||||
| -rwxr-xr-x | src/wrapped/wrappedudev1.c | 82 | ||||
| -rwxr-xr-x | src/wrapped/wrappedudev1_private.h | 3 |
11 files changed, 273 insertions, 10 deletions
diff --git a/src/wrapped/generated/functions_list.txt b/src/wrapped/generated/functions_list.txt index 43538c6e..a260c626 100644 --- a/src/wrapped/generated/functions_list.txt +++ b/src/wrapped/generated/functions_list.txt @@ -166,6 +166,7 @@ #() lFpi #() lFpp #() LFii +#() LFLi #() LFLp #() LFpi #() LFpL @@ -268,6 +269,7 @@ #() iFipu #() iFipL #() iFipp +#() iFipO #() iFuuu #() iFuup #() iFuff @@ -494,7 +496,6 @@ #() iFilli #() iFiLwp #() iFipii -#() iFipiO #() iFipui #() iFipup #() iFipLp @@ -502,6 +503,7 @@ #() iFippu #() iFippL #() iFippp +#() iFipON #() iFuipp #() iFuuff #() iFuppi @@ -813,6 +815,7 @@ #() pFpuiii #() pFpuiip #() pFpuWWW +#() pFpuuip #() pFpuuWW #() pFpuuup #() pFpdddd @@ -1074,6 +1077,7 @@ #() iFpppppip #() iFppppppp #() uFuippppp +#() pFEpLiiii #() pFEpLiiiI #() pFEppppip #() pFifffppp @@ -2147,6 +2151,19 @@ wrappedsmpeg2: - SMPEG_setdisplay - pFppii: - SMPEG_new_rwops +wrappedtcmallocminimal: +- iFpL: + - munmap +- pFpLiiii: + - mmap +- pFpLiiiI: + - mmap64 +wrappedudev0: +- vFpp: + - udev_set_log_fn +wrappedudev1: +- vFpp: + - udev_set_log_fn wrappedutil: - iFpppp: - forkpty diff --git a/src/wrapped/generated/wrappedtcmallocminimaltypes.h b/src/wrapped/generated/wrappedtcmallocminimaltypes.h new file mode 100644 index 00000000..ee95bcd7 --- /dev/null +++ b/src/wrapped/generated/wrappedtcmallocminimaltypes.h @@ -0,0 +1,23 @@ +/******************************************************************* + * File automatically generated by rebuild_wrappers.py (v2.0.1.14) * + *******************************************************************/ +#ifndef __wrappedtcmallocminimalTYPES_H_ +#define __wrappedtcmallocminimalTYPES_H_ + +#ifndef LIBNAME +#error You should only #include this file inside a wrapped*.c file +#endif +#ifndef ADDED_FUNCTIONS +#define ADDED_FUNCTIONS() +#endif + +typedef int64_t (*iFpL_t)(void*, uintptr_t); +typedef void* (*pFpLiiii_t)(void*, uintptr_t, int64_t, int64_t, int64_t, int64_t); +typedef void* (*pFpLiiiI_t)(void*, uintptr_t, int64_t, int64_t, int64_t, int64_t); + +#define SUPER() ADDED_FUNCTIONS() \ + GO(munmap, iFpL_t) \ + GO(mmap, pFpLiiii_t) \ + GO(mmap64, pFpLiiiI_t) + +#endif // __wrappedtcmallocminimalTYPES_H_ diff --git a/src/wrapped/generated/wrappedudev0types.h b/src/wrapped/generated/wrappedudev0types.h new file mode 100644 index 00000000..3a02323d --- /dev/null +++ b/src/wrapped/generated/wrappedudev0types.h @@ -0,0 +1,19 @@ +/******************************************************************* + * File automatically generated by rebuild_wrappers.py (v2.0.1.14) * + *******************************************************************/ +#ifndef __wrappedudev0TYPES_H_ +#define __wrappedudev0TYPES_H_ + +#ifndef LIBNAME +#error You should only #include this file inside a wrapped*.c file +#endif +#ifndef ADDED_FUNCTIONS +#define ADDED_FUNCTIONS() +#endif + +typedef void (*vFpp_t)(void*, void*); + +#define SUPER() ADDED_FUNCTIONS() \ + GO(udev_set_log_fn, vFpp_t) + +#endif // __wrappedudev0TYPES_H_ diff --git a/src/wrapped/generated/wrappedudev1types.h b/src/wrapped/generated/wrappedudev1types.h new file mode 100644 index 00000000..72a014f3 --- /dev/null +++ b/src/wrapped/generated/wrappedudev1types.h @@ -0,0 +1,19 @@ +/******************************************************************* + * File automatically generated by rebuild_wrappers.py (v2.0.1.14) * + *******************************************************************/ +#ifndef __wrappedudev1TYPES_H_ +#define __wrappedudev1TYPES_H_ + +#ifndef LIBNAME +#error You should only #include this file inside a wrapped*.c file +#endif +#ifndef ADDED_FUNCTIONS +#define ADDED_FUNCTIONS() +#endif + +typedef void (*vFpp_t)(void*, void*); + +#define SUPER() ADDED_FUNCTIONS() \ + GO(udev_set_log_fn, vFpp_t) + +#endif // __wrappedudev1TYPES_H_ diff --git a/src/wrapped/generated/wrapper.c b/src/wrapped/generated/wrapper.c index 4df2b8ad..a9b6785a 100644 --- a/src/wrapped/generated/wrapper.c +++ b/src/wrapped/generated/wrapper.c @@ -200,6 +200,7 @@ typedef intptr_t (*lFll_t)(intptr_t, intptr_t); typedef intptr_t (*lFpi_t)(void*, int64_t); typedef intptr_t (*lFpp_t)(void*, void*); typedef uintptr_t (*LFii_t)(int64_t, int64_t); +typedef uintptr_t (*LFLi_t)(uintptr_t, int64_t); typedef uintptr_t (*LFLp_t)(uintptr_t, void*); typedef uintptr_t (*LFpi_t)(void*, int64_t); typedef uintptr_t (*LFpL_t)(void*, uintptr_t); @@ -302,6 +303,7 @@ typedef int64_t (*iFipi_t)(int64_t, void*, int64_t); typedef int64_t (*iFipu_t)(int64_t, void*, uint64_t); typedef int64_t (*iFipL_t)(int64_t, void*, uintptr_t); typedef int64_t (*iFipp_t)(int64_t, void*, void*); +typedef int64_t (*iFipO_t)(int64_t, void*, int32_t); typedef int64_t (*iFuuu_t)(uint64_t, uint64_t, uint64_t); typedef int64_t (*iFuup_t)(uint64_t, uint64_t, void*); typedef int64_t (*iFuff_t)(uint64_t, float, float); @@ -528,7 +530,6 @@ typedef int64_t (*iFiuii_t)(int64_t, uint64_t, int64_t, int64_t); typedef int64_t (*iFilli_t)(int64_t, intptr_t, intptr_t, int64_t); typedef int64_t (*iFiLwp_t)(int64_t, uintptr_t, int16_t, void*); typedef int64_t (*iFipii_t)(int64_t, void*, int64_t, int64_t); -typedef int64_t (*iFipiO_t)(int64_t, void*, int64_t, int32_t); typedef int64_t (*iFipui_t)(int64_t, void*, uint64_t, int64_t); typedef int64_t (*iFipup_t)(int64_t, void*, uint64_t, void*); typedef int64_t (*iFipLp_t)(int64_t, void*, uintptr_t, void*); @@ -536,6 +537,7 @@ typedef int64_t (*iFippi_t)(int64_t, void*, void*, int64_t); typedef int64_t (*iFippu_t)(int64_t, void*, void*, uint64_t); typedef int64_t (*iFippL_t)(int64_t, void*, void*, uintptr_t); typedef int64_t (*iFippp_t)(int64_t, void*, void*, void*); +typedef int64_t (*iFipON_t)(int64_t, void*, int32_t, ...); typedef int64_t (*iFuipp_t)(uint64_t, int64_t, void*, void*); typedef int64_t (*iFuuff_t)(uint64_t, uint64_t, float, float); typedef int64_t (*iFuppi_t)(uint64_t, void*, void*, int64_t); @@ -847,6 +849,7 @@ typedef void* (*pFpCppp_t)(void*, uint8_t, void*, void*, void*); typedef void* (*pFpuiii_t)(void*, uint64_t, int64_t, int64_t, int64_t); typedef void* (*pFpuiip_t)(void*, uint64_t, int64_t, int64_t, void*); typedef void* (*pFpuWWW_t)(void*, uint64_t, uint16_t, uint16_t, uint16_t); +typedef void* (*pFpuuip_t)(void*, uint64_t, uint64_t, int64_t, void*); typedef void* (*pFpuuWW_t)(void*, uint64_t, uint64_t, uint16_t, uint16_t); typedef void* (*pFpuuup_t)(void*, uint64_t, uint64_t, uint64_t, void*); typedef void* (*pFpdddd_t)(void*, double, double, double, double); @@ -1108,6 +1111,7 @@ typedef int64_t (*iFppppdpi_t)(void*, void*, void*, void*, double, void*, int64_ typedef int64_t (*iFpppppip_t)(void*, void*, void*, void*, void*, int64_t, void*); typedef int64_t (*iFppppppp_t)(void*, void*, void*, void*, void*, void*, void*); typedef uint64_t (*uFuippppp_t)(uint64_t, int64_t, void*, void*, void*, void*, void*); +typedef void* (*pFEpLiiii_t)(x64emu_t*, void*, uintptr_t, int64_t, int64_t, int64_t, int64_t); typedef void* (*pFEpLiiiI_t)(x64emu_t*, void*, uintptr_t, int64_t, int64_t, int64_t, int64_t); typedef void* (*pFEppppip_t)(x64emu_t*, void*, void*, void*, void*, int64_t, void*); typedef void* (*pFifffppp_t)(int64_t, float, float, float, void*, void*, void*); @@ -1493,6 +1497,7 @@ void lFll(x64emu_t *emu, uintptr_t fcn) { lFll_t fn = (lFll_t)fcn; R_RAX=(intptr void lFpi(x64emu_t *emu, uintptr_t fcn) { lFpi_t fn = (lFpi_t)fcn; R_RAX=(intptr_t)fn((void*)R_RDI, (int64_t)R_RSI); } void lFpp(x64emu_t *emu, uintptr_t fcn) { lFpp_t fn = (lFpp_t)fcn; R_RAX=(intptr_t)fn((void*)R_RDI, (void*)R_RSI); } void LFii(x64emu_t *emu, uintptr_t fcn) { LFii_t fn = (LFii_t)fcn; R_RAX=(uintptr_t)fn((int64_t)R_RDI, (int64_t)R_RSI); } +void LFLi(x64emu_t *emu, uintptr_t fcn) { LFLi_t fn = (LFLi_t)fcn; R_RAX=(uintptr_t)fn((uintptr_t)R_RDI, (int64_t)R_RSI); } void LFLp(x64emu_t *emu, uintptr_t fcn) { LFLp_t fn = (LFLp_t)fcn; R_RAX=(uintptr_t)fn((uintptr_t)R_RDI, (void*)R_RSI); } void LFpi(x64emu_t *emu, uintptr_t fcn) { LFpi_t fn = (LFpi_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (int64_t)R_RSI); } void LFpL(x64emu_t *emu, uintptr_t fcn) { LFpL_t fn = (LFpL_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (uintptr_t)R_RSI); } @@ -1595,6 +1600,7 @@ void iFipi(x64emu_t *emu, uintptr_t fcn) { iFipi_t fn = (iFipi_t)fcn; R_RAX=(int void iFipu(x64emu_t *emu, uintptr_t fcn) { iFipu_t fn = (iFipu_t)fcn; R_RAX=(int64_t)fn((int64_t)R_RDI, (void*)R_RSI, (uint64_t)R_RDX); } void iFipL(x64emu_t *emu, uintptr_t fcn) { iFipL_t fn = (iFipL_t)fcn; R_RAX=(int64_t)fn((int64_t)R_RDI, (void*)R_RSI, (uintptr_t)R_RDX); } void iFipp(x64emu_t *emu, uintptr_t fcn) { iFipp_t fn = (iFipp_t)fcn; R_RAX=(int64_t)fn((int64_t)R_RDI, (void*)R_RSI, (void*)R_RDX); } +void iFipO(x64emu_t *emu, uintptr_t fcn) { iFipO_t fn = (iFipO_t)fcn; R_RAX=(int64_t)fn((int64_t)R_RDI, (void*)R_RSI, of_convert((int32_t)R_RDX)); } void iFuuu(x64emu_t *emu, uintptr_t fcn) { iFuuu_t fn = (iFuuu_t)fcn; R_RAX=(int64_t)fn((uint64_t)R_RDI, (uint64_t)R_RSI, (uint64_t)R_RDX); } void iFuup(x64emu_t *emu, uintptr_t fcn) { iFuup_t fn = (iFuup_t)fcn; R_RAX=(int64_t)fn((uint64_t)R_RDI, (uint64_t)R_RSI, (void*)R_RDX); } void iFuff(x64emu_t *emu, uintptr_t fcn) { iFuff_t fn = (iFuff_t)fcn; R_RAX=(int64_t)fn((uint64_t)R_RDI, emu->xmm[0].f[0], emu->xmm[1].f[0]); } @@ -1821,7 +1827,6 @@ void iFiuii(x64emu_t *emu, uintptr_t fcn) { iFiuii_t fn = (iFiuii_t)fcn; R_RAX=( void iFilli(x64emu_t *emu, uintptr_t fcn) { iFilli_t fn = (iFilli_t)fcn; R_RAX=(int64_t)fn((int64_t)R_RDI, (intptr_t)R_RSI, (intptr_t)R_RDX, (int64_t)R_RCX); } void iFiLwp(x64emu_t *emu, uintptr_t fcn) { iFiLwp_t fn = (iFiLwp_t)fcn; R_RAX=(int64_t)fn((int64_t)R_RDI, (uintptr_t)R_RSI, (int16_t)R_RDX, (void*)R_RCX); } void iFipii(x64emu_t *emu, uintptr_t fcn) { iFipii_t fn = (iFipii_t)fcn; R_RAX=(int64_t)fn((int64_t)R_RDI, (void*)R_RSI, (int64_t)R_RDX, (int64_t)R_RCX); } -void iFipiO(x64emu_t *emu, uintptr_t fcn) { iFipiO_t fn = (iFipiO_t)fcn; R_RAX=(int64_t)fn((int64_t)R_RDI, (void*)R_RSI, (int64_t)R_RDX, of_convert((int32_t)R_RCX)); } void iFipui(x64emu_t *emu, uintptr_t fcn) { iFipui_t fn = (iFipui_t)fcn; R_RAX=(int64_t)fn((int64_t)R_RDI, (void*)R_RSI, (uint64_t)R_RDX, (int64_t)R_RCX); } void iFipup(x64emu_t *emu, uintptr_t fcn) { iFipup_t fn = (iFipup_t)fcn; R_RAX=(int64_t)fn((int64_t)R_RDI, (void*)R_RSI, (uint64_t)R_RDX, (void*)R_RCX); } void iFipLp(x64emu_t *emu, uintptr_t fcn) { iFipLp_t fn = (iFipLp_t)fcn; R_RAX=(int64_t)fn((int64_t)R_RDI, (void*)R_RSI, (uintptr_t)R_RDX, (void*)R_RCX); } @@ -1829,6 +1834,7 @@ void iFippi(x64emu_t *emu, uintptr_t fcn) { iFippi_t fn = (iFippi_t)fcn; R_RAX=( void iFippu(x64emu_t *emu, uintptr_t fcn) { iFippu_t fn = (iFippu_t)fcn; R_RAX=(int64_t)fn((int64_t)R_RDI, (void*)R_RSI, (void*)R_RDX, (uint64_t)R_RCX); } void iFippL(x64emu_t *emu, uintptr_t fcn) { iFippL_t fn = (iFippL_t)fcn; R_RAX=(int64_t)fn((int64_t)R_RDI, (void*)R_RSI, (void*)R_RDX, (uintptr_t)R_RCX); } void iFippp(x64emu_t *emu, uintptr_t fcn) { iFippp_t fn = (iFippp_t)fcn; R_RAX=(int64_t)fn((int64_t)R_RDI, (void*)R_RSI, (void*)R_RDX, (void*)R_RCX); } +void iFipON(x64emu_t *emu, uintptr_t fcn) { iFipON_t fn = (iFipON_t)fcn; R_RAX=(int64_t)fn((int64_t)R_RDI, (void*)R_RSI, of_convert((int32_t)R_RDX), (void*)R_RCX); } void iFuipp(x64emu_t *emu, uintptr_t fcn) { iFuipp_t fn = (iFuipp_t)fcn; R_RAX=(int64_t)fn((uint64_t)R_RDI, (int64_t)R_RSI, (void*)R_RDX, (void*)R_RCX); } void iFuuff(x64emu_t *emu, uintptr_t fcn) { iFuuff_t fn = (iFuuff_t)fcn; R_RAX=(int64_t)fn((uint64_t)R_RDI, (uint64_t)R_RSI, emu->xmm[0].f[0], emu->xmm[1].f[0]); } void iFuppi(x64emu_t *emu, uintptr_t fcn) { iFuppi_t fn = (iFuppi_t)fcn; R_RAX=(int64_t)fn((uint64_t)R_RDI, (void*)R_RSI, (void*)R_RDX, (int64_t)R_RCX); } @@ -2140,6 +2146,7 @@ void pFpCppp(x64emu_t *emu, uintptr_t fcn) { pFpCppp_t fn = (pFpCppp_t)fcn; R_RA void pFpuiii(x64emu_t *emu, uintptr_t fcn) { pFpuiii_t fn = (pFpuiii_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (uint64_t)R_RSI, (int64_t)R_RDX, (int64_t)R_RCX, (int64_t)R_R8); } void pFpuiip(x64emu_t *emu, uintptr_t fcn) { pFpuiip_t fn = (pFpuiip_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (uint64_t)R_RSI, (int64_t)R_RDX, (int64_t)R_RCX, (void*)R_R8); } void pFpuWWW(x64emu_t *emu, uintptr_t fcn) { pFpuWWW_t fn = (pFpuWWW_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (uint64_t)R_RSI, (uint16_t)R_RDX, (uint16_t)R_RCX, (uint16_t)R_R8); } +void pFpuuip(x64emu_t *emu, uintptr_t fcn) { pFpuuip_t fn = (pFpuuip_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (uint64_t)R_RSI, (uint64_t)R_RDX, (int64_t)R_RCX, (void*)R_R8); } void pFpuuWW(x64emu_t *emu, uintptr_t fcn) { pFpuuWW_t fn = (pFpuuWW_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (uint64_t)R_RSI, (uint64_t)R_RDX, (uint16_t)R_RCX, (uint16_t)R_R8); } void pFpuuup(x64emu_t *emu, uintptr_t fcn) { pFpuuup_t fn = (pFpuuup_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (uint64_t)R_RSI, (uint64_t)R_RDX, (uint64_t)R_RCX, (void*)R_R8); } void pFpdddd(x64emu_t *emu, uintptr_t fcn) { pFpdddd_t fn = (pFpdddd_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, emu->xmm[0].d[0], emu->xmm[1].d[0], emu->xmm[2].d[0], emu->xmm[3].d[0]); } @@ -2401,6 +2408,7 @@ void iFppppdpi(x64emu_t *emu, uintptr_t fcn) { iFppppdpi_t fn = (iFppppdpi_t)fcn void iFpppppip(x64emu_t *emu, uintptr_t fcn) { iFpppppip_t fn = (iFpppppip_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (void*)R_RSI, (void*)R_RDX, (void*)R_RCX, (void*)R_R8, (int64_t)R_R9, *(void**)(R_RSP + 8)); } void iFppppppp(x64emu_t *emu, uintptr_t fcn) { iFppppppp_t fn = (iFppppppp_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (void*)R_RSI, (void*)R_RDX, (void*)R_RCX, (void*)R_R8, (void*)R_R9, *(void**)(R_RSP + 8)); } void uFuippppp(x64emu_t *emu, uintptr_t fcn) { uFuippppp_t fn = (uFuippppp_t)fcn; R_RAX=(uint64_t)fn((uint64_t)R_RDI, (int64_t)R_RSI, (void*)R_RDX, (void*)R_RCX, (void*)R_R8, (void*)R_R9, *(void**)(R_RSP + 8)); } +void pFEpLiiii(x64emu_t *emu, uintptr_t fcn) { pFEpLiiii_t fn = (pFEpLiiii_t)fcn; R_RAX=(uintptr_t)fn(emu, (void*)R_RDI, (uintptr_t)R_RSI, (int64_t)R_RDX, (int64_t)R_RCX, (int64_t)R_R8, (int64_t)R_R9); } void pFEpLiiiI(x64emu_t *emu, uintptr_t fcn) { pFEpLiiiI_t fn = (pFEpLiiiI_t)fcn; R_RAX=(uintptr_t)fn(emu, (void*)R_RDI, (uintptr_t)R_RSI, (int64_t)R_RDX, (int64_t)R_RCX, (int64_t)R_R8, (int64_t)R_R9); } void pFEppppip(x64emu_t *emu, uintptr_t fcn) { pFEppppip_t fn = (pFEppppip_t)fcn; R_RAX=(uintptr_t)fn(emu, (void*)R_RDI, (void*)R_RSI, (void*)R_RDX, (void*)R_RCX, (int64_t)R_R8, (void*)R_R9); } void pFifffppp(x64emu_t *emu, uintptr_t fcn) { pFifffppp_t fn = (pFifffppp_t)fcn; R_RAX=(uintptr_t)fn((int64_t)R_RDI, emu->xmm[0].f[0], emu->xmm[1].f[0], emu->xmm[2].f[0], (void*)R_RSI, (void*)R_RDX, (void*)R_RCX); } @@ -2776,6 +2784,7 @@ int isSimpleWrapper(wrapper_t fun) { if (fun == &lFpi) return 1; if (fun == &lFpp) return 1; if (fun == &LFii) return 1; + if (fun == &LFLi) return 1; if (fun == &LFLp) return 1; if (fun == &LFpi) return 1; if (fun == &LFpL) return 1; @@ -3323,6 +3332,7 @@ int isSimpleWrapper(wrapper_t fun) { if (fun == &pFpuiii) return 1; if (fun == &pFpuiip) return 1; if (fun == &pFpuWWW) return 1; + if (fun == &pFpuuip) return 1; if (fun == &pFpuuWW) return 1; if (fun == &pFpuuup) return 1; if (fun == &pFpdddd) return 1; diff --git a/src/wrapped/generated/wrapper.h b/src/wrapped/generated/wrapper.h index b784d479..e8248e0e 100644 --- a/src/wrapped/generated/wrapper.h +++ b/src/wrapped/generated/wrapper.h @@ -196,6 +196,7 @@ void lFll(x64emu_t *emu, uintptr_t fnc); void lFpi(x64emu_t *emu, uintptr_t fnc); void lFpp(x64emu_t *emu, uintptr_t fnc); void LFii(x64emu_t *emu, uintptr_t fnc); +void LFLi(x64emu_t *emu, uintptr_t fnc); void LFLp(x64emu_t *emu, uintptr_t fnc); void LFpi(x64emu_t *emu, uintptr_t fnc); void LFpL(x64emu_t *emu, uintptr_t fnc); @@ -298,6 +299,7 @@ void iFipi(x64emu_t *emu, uintptr_t fnc); void iFipu(x64emu_t *emu, uintptr_t fnc); void iFipL(x64emu_t *emu, uintptr_t fnc); void iFipp(x64emu_t *emu, uintptr_t fnc); +void iFipO(x64emu_t *emu, uintptr_t fnc); void iFuuu(x64emu_t *emu, uintptr_t fnc); void iFuup(x64emu_t *emu, uintptr_t fnc); void iFuff(x64emu_t *emu, uintptr_t fnc); @@ -524,7 +526,6 @@ void iFiuii(x64emu_t *emu, uintptr_t fnc); void iFilli(x64emu_t *emu, uintptr_t fnc); void iFiLwp(x64emu_t *emu, uintptr_t fnc); void iFipii(x64emu_t *emu, uintptr_t fnc); -void iFipiO(x64emu_t *emu, uintptr_t fnc); void iFipui(x64emu_t *emu, uintptr_t fnc); void iFipup(x64emu_t *emu, uintptr_t fnc); void iFipLp(x64emu_t *emu, uintptr_t fnc); @@ -532,6 +533,7 @@ void iFippi(x64emu_t *emu, uintptr_t fnc); void iFippu(x64emu_t *emu, uintptr_t fnc); void iFippL(x64emu_t *emu, uintptr_t fnc); void iFippp(x64emu_t *emu, uintptr_t fnc); +void iFipON(x64emu_t *emu, uintptr_t fnc); void iFuipp(x64emu_t *emu, uintptr_t fnc); void iFuuff(x64emu_t *emu, uintptr_t fnc); void iFuppi(x64emu_t *emu, uintptr_t fnc); @@ -843,6 +845,7 @@ void pFpCppp(x64emu_t *emu, uintptr_t fnc); void pFpuiii(x64emu_t *emu, uintptr_t fnc); void pFpuiip(x64emu_t *emu, uintptr_t fnc); void pFpuWWW(x64emu_t *emu, uintptr_t fnc); +void pFpuuip(x64emu_t *emu, uintptr_t fnc); void pFpuuWW(x64emu_t *emu, uintptr_t fnc); void pFpuuup(x64emu_t *emu, uintptr_t fnc); void pFpdddd(x64emu_t *emu, uintptr_t fnc); @@ -1104,6 +1107,7 @@ void iFppppdpi(x64emu_t *emu, uintptr_t fnc); void iFpppppip(x64emu_t *emu, uintptr_t fnc); void iFppppppp(x64emu_t *emu, uintptr_t fnc); void uFuippppp(x64emu_t *emu, uintptr_t fnc); +void pFEpLiiii(x64emu_t *emu, uintptr_t fnc); void pFEpLiiiI(x64emu_t *emu, uintptr_t fnc); void pFEppppip(x64emu_t *emu, uintptr_t fnc); void pFifffppp(x64emu_t *emu, uintptr_t fnc); diff --git a/src/wrapped/wrappedlibc_private.h b/src/wrapped/wrappedlibc_private.h index ccd38944..c44e5005 100755 --- a/src/wrapped/wrappedlibc_private.h +++ b/src/wrapped/wrappedlibc_private.h @@ -1053,7 +1053,7 @@ GO(__libc_memalign, pFLL) //GO(__libc_msgsnd, //GO(__libc_pread, //GO(__libc_pthread_init, -//GO(__libc_pvalloc, +GO(__libc_pvalloc, pFL) //GO(__libc_pwrite, //GO(__libc_readline_unlocked, GO(__libc_realloc, pFpL) @@ -1068,7 +1068,7 @@ GO(__libc_realloc, pFpL) GOM(__libc_start_main, iFEpippppp) //GO(__libc_system, //GO(__libc_thread_freeres, -//GO(__libc_valloc, +GO(__libc_valloc, pFL) //GO(__libc_vfork, //GOW(link, //GO(linkat, @@ -1111,7 +1111,7 @@ GOM(malloc, pFL) // need to wrap to clear allocated memory? //GOW(malloc_stats, GOW(malloc_trim, iFL) GOW(malloc_usable_size, LFp) -//GOW(mallopt, +GOW(mallopt, iFii) //DATAB(mallwatch, GO(mblen, iFpL) GO(__mbrlen, LFpLp) @@ -1273,10 +1273,10 @@ GO(__open_2, iFpO) GOM(open64, iFEpOu) //Weak //GO(__open64_2, //GO(__open64_nocancel, -GOW(openat, iFipiO) +GOW(openat, iFipON) //GO(__openat_2, -GOW(openat64, iFipiO) -//GO(__openat64_2, +GOW(openat64, iFipON) +GO(__openat64_2, iFipO) //GO(open_by_handle_at, //GO(__open_catalog, GOW(opendir, pFp) diff --git a/src/wrapped/wrappedudev0.c b/src/wrapped/wrappedudev0.c index 284ea202..c6ca5857 100755 --- a/src/wrapped/wrappedudev0.c +++ b/src/wrapped/wrappedudev0.c @@ -3,6 +3,7 @@ #include <string.h> #define _GNU_SOURCE /* See feature_test_macros(7) */ #include <dlfcn.h> +#include <stdarg.h> #include "wrappedlibs.h" @@ -10,11 +11,93 @@ #include "bridge.h" #include "librarian/library_private.h" #include "x64emu.h" +#include "debug.h" +#include "myalign.h" +#include "callback.h" const char* udev0Name = "libudev.so.0"; #define LIBNAME udev0 // fallback to 1 version... Not sure if really correct (probably not) #define ALTNAME "libudev.so.1" +static library_t* my_lib = NULL; + +typedef void (*vFpp_t)(void*, void*); + +#define SUPER() \ +GO(udev_set_log_fn, vFpp_t) \ + +typedef struct udev0_my_s { + // functions + #define GO(A, W) W A; + SUPER() + #undef GO +} udev0_my_t; + +static void* getUdev0My(library_t* lib) +{ + udev0_my_t* my = (udev0_my_t*)calloc(1, sizeof(udev0_my_t)); + #define GO(A, W) my->A = (W)dlsym(lib->priv.w.lib, #A); + SUPER() + #undef GO + return my; +} + +static void freeUdev0My(void* lib) +{ + (void)lib; + //udev0_my_t *my = (udev0_my_t *)lib; +} +#undef SUPER + +#define SUPER() \ +GO(0) \ +GO(1) \ +GO(2) \ +GO(3) \ +GO(4) + +// log_fn ... +#define GO(A) \ +static uintptr_t my_log_fn_fct_##A = 0; \ +static void my_log_fn_##A(void* udev, int p, void *f, int l, void* fn, void* fmt, x64_va_list_t args) \ +{ \ + CONVERT_VALIST(args) \ + RunFunction(my_context, my_log_fn_fct_##A, 7, udev, p, f, l, fn, fmt, VARARGS); \ +} +SUPER() +#undef GO +static void* find_log_fn_Fct(void* fct) +{ + if(!fct) return fct; + if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct); + #define GO(A) if(my_log_fn_fct_##A == (uintptr_t)fct) return my_log_fn_##A; + SUPER() + #undef GO + #define GO(A) if(my_log_fn_fct_##A == 0) {my_log_fn_fct_##A = (uintptr_t)fct; return my_log_fn_##A; } + SUPER() + #undef GO + printf_log(LOG_NONE, "Warning, no more slot for udev1 log_fn callback\n"); + return NULL; +} +#undef SUPER + +EXPORT void my0_udev_set_log_fn(x64emu_t* emu, void* udev, void* f) +{ + udev0_my_t* my = (udev0_my_t*)my_lib->priv.w.p2; + + my->udev_set_log_fn(udev, find_log_fn_Fct(f)); +} + +#define CUSTOM_INIT \ + lib->priv.w.p2 = getUdev0My(lib); \ + lib->altmy = strdup("my0_"); \ + my_lib = lib; + +#define CUSTOM_FINI \ + freeUdev0My(lib->priv.w.p2);\ + free(lib->priv.w.p2); \ + my_lib = NULL; + #include "wrappedlib_init.h" diff --git a/src/wrapped/wrappedudev0_private.h b/src/wrapped/wrappedudev0_private.h index 2026fb7a..57c999e5 100755 --- a/src/wrapped/wrappedudev0_private.h +++ b/src/wrapped/wrappedudev0_private.h @@ -80,3 +80,6 @@ GO(udev_queue_get_seqnum_is_finished, iFpU) GO(udev_queue_get_seqnum_sequence_is_finished, iFpUU) GO(udev_queue_get_queued_list_entry, pFp) GO(udev_queue_get_failed_list_entry, pFp) +GOM(udev_set_log_fn, vFEpp) +GO(udev_get_log_priority, iFp) +GO(udev_set_log_priority, vFpi) \ No newline at end of file diff --git a/src/wrapped/wrappedudev1.c b/src/wrapped/wrappedudev1.c index d485214d..5939ef2c 100755 --- a/src/wrapped/wrappedudev1.c +++ b/src/wrapped/wrappedudev1.c @@ -3,6 +3,7 @@ #include <string.h> #define _GNU_SOURCE /* See feature_test_macros(7) */ #include <dlfcn.h> +#include <stdarg.h> #include "wrappedlibs.h" @@ -10,11 +11,92 @@ #include "bridge.h" #include "librarian/library_private.h" #include "x64emu.h" +#include "debug.h" +#include "myalign.h" +#include "callback.h" const char* udev1Name = "libudev.so.1"; #define LIBNAME udev1 // fallback to 0 version... Not sure if really correct (probably not) #define ALTNAME "libudev.so.0" +static library_t* my_lib = NULL; + +typedef void (*vFpp_t)(void*, void*); + +#define SUPER() \ +GO(udev_set_log_fn, vFpp_t) \ + +typedef struct udev1_my_s { + // functions + #define GO(A, W) W A; + SUPER() + #undef GO +} udev1_my_t; + +static void* getUdev1My(library_t* lib) +{ + udev1_my_t* my = (udev1_my_t*)calloc(1, sizeof(udev1_my_t)); + #define GO(A, W) my->A = (W)dlsym(lib->priv.w.lib, #A); + SUPER() + #undef GO + return my; +} + +static void freeUdev1My(void* lib) +{ + (void)lib; + //udev1_my_t *my = (udev1_my_t *)lib; +} +#undef SUPER + +#define SUPER() \ +GO(0) \ +GO(1) \ +GO(2) \ +GO(3) \ +GO(4) + +// log_fn ... +#define GO(A) \ +static uintptr_t my_log_fn_fct_##A = 0; \ +static void my_log_fn_##A(void* udev, int p, void *f, int l, void* fn, void* fmt, x64_va_list_t args) \ +{ \ + CONVERT_VALIST(args) \ + RunFunction(my_context, my_log_fn_fct_##A, 7, udev, p, f, l, fn, fmt, VARARGS); \ +} +SUPER() +#undef GO +static void* find_log_fn_Fct(void* fct) +{ + if(!fct) return fct; + if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct); + #define GO(A) if(my_log_fn_fct_##A == (uintptr_t)fct) return my_log_fn_##A; + SUPER() + #undef GO + #define GO(A) if(my_log_fn_fct_##A == 0) {my_log_fn_fct_##A = (uintptr_t)fct; return my_log_fn_##A; } + SUPER() + #undef GO + printf_log(LOG_NONE, "Warning, no more slot for udev1 log_fn callback\n"); + return NULL; +} +#undef SUPER + +EXPORT void my_udev_set_log_fn(x64emu_t* emu, void* udev, void* f) +{ + udev1_my_t* my = (udev1_my_t*)my_lib->priv.w.p2; + + my->udev_set_log_fn(udev, find_log_fn_Fct(f)); +} + +#define CUSTOM_INIT \ + lib->priv.w.p2 = getUdev1My(lib); \ + my_lib = lib; + +#define CUSTOM_FINI \ + freeUdev1My(lib->priv.w.p2);\ + free(lib->priv.w.p2); \ + my_lib = NULL; + #include "wrappedlib_init.h" diff --git a/src/wrapped/wrappedudev1_private.h b/src/wrapped/wrappedudev1_private.h index f7644e36..d16f424e 100755 --- a/src/wrapped/wrappedudev1_private.h +++ b/src/wrapped/wrappedudev1_private.h @@ -80,3 +80,6 @@ GO(udev_queue_get_seqnum_is_finished, iFpU) GO(udev_queue_get_seqnum_sequence_is_finished, iFpUU) GO(udev_queue_get_queued_list_entry, pFp) GO(udev_queue_get_failed_list_entry, pFp) +GOM(udev_set_log_fn, vFEpp) +GO(udev_get_log_priority, iFp) +GO(udev_set_log_priority, vFpi) \ No newline at end of file |