diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2021-03-10 10:14:34 +0100 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2021-03-10 10:14:34 +0100 |
| commit | 0a7963588e2f4e088d089cbde90ee9ebad63ed85 (patch) | |
| tree | d9a594e5252edeee408603e6c53ced9217f6e7bc /src/wrapped | |
| parent | 42d281bfe3fce26f8ef8735eb7b084adc25b9435 (diff) | |
| download | box64-0a7963588e2f4e088d089cbde90ee9ebad63ed85.tar.gz box64-0a7963588e2f4e088d089cbde90ee9ebad63ed85.zip | |
Fixed the already wrapped non-valist __Xprintf_chk functions
Diffstat (limited to 'src/wrapped')
| -rw-r--r-- | src/wrapped/generated/functions_list.txt | 4 | ||||
| -rw-r--r-- | src/wrapped/generated/wrapper.c | 6 | ||||
| -rw-r--r-- | src/wrapped/generated/wrapper.h | 4 | ||||
| -rwxr-xr-x | src/wrapped/wrappedlibc.c | 15 | ||||
| -rwxr-xr-x | src/wrapped/wrappedlibc_private.h | 4 |
5 files changed, 22 insertions, 11 deletions
diff --git a/src/wrapped/generated/functions_list.txt b/src/wrapped/generated/functions_list.txt index 22705d18..7c79e560 100644 --- a/src/wrapped/generated/functions_list.txt +++ b/src/wrapped/generated/functions_list.txt @@ -349,6 +349,7 @@ #() iFEiip #() iFEiiN #() iFEipp +#() iFEipV #() iFEupp #() iFEpip #() iFEppi @@ -624,6 +625,7 @@ #() vFppupii #() vFpppppp #() iFEiippi +#() iFEpilpV #() iFEpippi #() iFEpuppp #() iFEppppp @@ -891,9 +893,7 @@ #() pFEv -> pFE #() pFppv -> pFpp #() iFEvpp -> iFEpp -#() iFEvpV -> iFEpV #() iFEpvpp -> iFEppp #() iFEpvpV -> iFEppV -#() iFEpvvpV -> iFEppV #() iFEpLvvpp -> iFEpLpp #() iFEpuvvppp -> iFEpuppp diff --git a/src/wrapped/generated/wrapper.c b/src/wrapped/generated/wrapper.c index 93e073af..1d103fb8 100644 --- a/src/wrapped/generated/wrapper.c +++ b/src/wrapped/generated/wrapper.c @@ -382,6 +382,7 @@ typedef int8_t (*cFpiii_t)(void*, int32_t, int32_t, int32_t); 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 (*iFEipV_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*); typedef int32_t (*iFEppi_t)(x64emu_t*, void*, void*, int32_t); @@ -657,6 +658,7 @@ typedef void (*vFppiipi_t)(void*, void*, int32_t, int32_t, void*, int32_t); typedef void (*vFppupii_t)(void*, void*, uint32_t, void*, int32_t, int32_t); typedef void (*vFpppppp_t)(void*, void*, void*, void*, void*, void*); typedef int32_t (*iFEiippi_t)(x64emu_t*, int32_t, int32_t, void*, void*, int32_t); +typedef int32_t (*iFEpilpV_t)(x64emu_t*, void*, int32_t, intptr_t, void*, void*); typedef int32_t (*iFEpippi_t)(x64emu_t*, void*, int32_t, void*, void*, int32_t); typedef int32_t (*iFEpuppp_t)(x64emu_t*, void*, uint32_t, void*, void*, void*); typedef int32_t (*iFEppppp_t)(x64emu_t*, void*, void*, void*, void*, void*); @@ -1277,6 +1279,7 @@ void cFpiii(x64emu_t *emu, uintptr_t fcn) { cFpiii_t fn = (cFpiii_t)fcn; R_RAX=f void iFEiip(x64emu_t *emu, uintptr_t fcn) { iFEiip_t fn = (iFEiip_t)fcn; R_RAX=fn(emu, (int32_t)R_RDI, (int32_t)R_RSI, (void*)R_RDX); } 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 iFEipV(x64emu_t *emu, uintptr_t fcn) { iFEipV_t fn = (iFEipV_t)fcn; R_RAX=fn(emu, (int32_t)R_RDI, (void*)R_RSI, (void*)(R_RSP + 8)); } 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); } void iFEppi(x64emu_t *emu, uintptr_t fcn) { iFEppi_t fn = (iFEppi_t)fcn; R_RAX=fn(emu, (void*)R_RDI, (void*)R_RSI, (int32_t)R_RDX); } @@ -1552,6 +1555,7 @@ void vFppiipi(x64emu_t *emu, uintptr_t fcn) { vFppiipi_t fn = (vFppiipi_t)fcn; f void vFppupii(x64emu_t *emu, uintptr_t fcn) { vFppupii_t fn = (vFppupii_t)fcn; fn((void*)R_RDI, (void*)R_RSI, (uint32_t)R_RDX, (void*)R_RCX, (int32_t)R_R8, (int32_t)R_R9); } void vFpppppp(x64emu_t *emu, uintptr_t fcn) { vFpppppp_t fn = (vFpppppp_t)fcn; fn((void*)R_RDI, (void*)R_RSI, (void*)R_RDX, (void*)R_RCX, (void*)R_R8, (void*)R_R9); } void iFEiippi(x64emu_t *emu, uintptr_t fcn) { iFEiippi_t fn = (iFEiippi_t)fcn; R_RAX=fn(emu, (int32_t)R_RDI, (int32_t)R_RSI, (void*)R_RDX, (void*)R_RCX, (int32_t)R_R8); } +void iFEpilpV(x64emu_t *emu, uintptr_t fcn) { iFEpilpV_t fn = (iFEpilpV_t)fcn; R_RAX=fn(emu, (void*)R_RDI, (int32_t)R_RSI, (intptr_t)R_RDX, (void*)R_RCX, (void*)(R_RSP + 8)); } void iFEpippi(x64emu_t *emu, uintptr_t fcn) { iFEpippi_t fn = (iFEpippi_t)fcn; R_RAX=fn(emu, (void*)R_RDI, (int32_t)R_RSI, (void*)R_RDX, (void*)R_RCX, (int32_t)R_R8); } void iFEpuppp(x64emu_t *emu, uintptr_t fcn) { iFEpuppp_t fn = (iFEpuppp_t)fcn; R_RAX=fn(emu, (void*)R_RDI, (uint32_t)R_RSI, (void*)R_RDX, (void*)R_RCX, (void*)R_R8); } void iFEppppp(x64emu_t *emu, uintptr_t fcn) { iFEppppp_t fn = (iFEppppp_t)fcn; R_RAX=fn(emu, (void*)R_RDI, (void*)R_RSI, (void*)R_RDX, (void*)R_RCX, (void*)R_R8); } @@ -1826,9 +1830,7 @@ void lFEv(x64emu_t *emu, uintptr_t fcn) { lFE_t fn = (lFE_t)fcn; R_RAX=(intptr_t 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); } -void iFEvpV(x64emu_t *emu, uintptr_t fcn) { iFEpV_t fn = (iFEpV_t)fcn; R_RAX=fn(emu, (void*)R_RSI, (void*)(R_RSP + 8)); } void iFEpvpp(x64emu_t *emu, uintptr_t fcn) { iFEppp_t fn = (iFEppp_t)fcn; R_RAX=fn(emu, (void*)R_RDI, (void*)R_RDX, (void*)R_RCX); } void iFEpvpV(x64emu_t *emu, uintptr_t fcn) { iFEppV_t fn = (iFEppV_t)fcn; R_RAX=fn(emu, (void*)R_RDI, (void*)R_RDX, (void*)(R_RSP + 8)); } -void iFEpvvpV(x64emu_t *emu, uintptr_t fcn) { iFEppV_t fn = (iFEppV_t)fcn; R_RAX=fn(emu, (void*)R_RDI, (void*)R_RCX, (void*)(R_RSP + 8)); } void iFEpLvvpp(x64emu_t *emu, uintptr_t fcn) { iFEpLpp_t fn = (iFEpLpp_t)fcn; R_RAX=fn(emu, (void*)R_RDI, (uintptr_t)R_RSI, (void*)R_R8, (void*)R_R9); } void iFEpuvvppp(x64emu_t *emu, uintptr_t fcn) { iFEpuppp_t fn = (iFEpuppp_t)fcn; R_RAX=fn(emu, (void*)R_RDI, (uint32_t)R_RSI, (void*)R_R8, (void*)R_R9, *(void**)(R_RSP + 8)); } diff --git a/src/wrapped/generated/wrapper.h b/src/wrapped/generated/wrapper.h index 7e240816..1e9c7411 100644 --- a/src/wrapped/generated/wrapper.h +++ b/src/wrapped/generated/wrapper.h @@ -379,6 +379,7 @@ void cFpiii(x64emu_t *emu, uintptr_t fnc); void iFEiip(x64emu_t *emu, uintptr_t fnc); void iFEiiN(x64emu_t *emu, uintptr_t fnc); void iFEipp(x64emu_t *emu, uintptr_t fnc); +void iFEipV(x64emu_t *emu, uintptr_t fnc); void iFEupp(x64emu_t *emu, uintptr_t fnc); void iFEpip(x64emu_t *emu, uintptr_t fnc); void iFEppi(x64emu_t *emu, uintptr_t fnc); @@ -654,6 +655,7 @@ void vFppiipi(x64emu_t *emu, uintptr_t fnc); void vFppupii(x64emu_t *emu, uintptr_t fnc); void vFpppppp(x64emu_t *emu, uintptr_t fnc); void iFEiippi(x64emu_t *emu, uintptr_t fnc); +void iFEpilpV(x64emu_t *emu, uintptr_t fnc); void iFEpippi(x64emu_t *emu, uintptr_t fnc); void iFEpuppp(x64emu_t *emu, uintptr_t fnc); void iFEppppp(x64emu_t *emu, uintptr_t fnc); @@ -928,10 +930,8 @@ 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); -void iFEvpV(x64emu_t *emu, uintptr_t fnc); void iFEpvpp(x64emu_t *emu, uintptr_t fnc); void iFEpvpV(x64emu_t *emu, uintptr_t fnc); -void iFEpvvpV(x64emu_t *emu, uintptr_t fnc); void iFEpLvvpp(x64emu_t *emu, uintptr_t fnc); void iFEpuvvppp(x64emu_t *emu, uintptr_t fnc); diff --git a/src/wrapped/wrappedlibc.c b/src/wrapped/wrappedlibc.c index d9c675cf..bba0a0ad 100755 --- a/src/wrapped/wrappedlibc.c +++ b/src/wrapped/wrappedlibc.c @@ -583,7 +583,12 @@ EXPORT int my_printf(x64emu_t *emu, void* fmt, void* b) { PREPARE_VALIST; return vprintf((const char*)fmt, VARARGS); } -EXPORT int my___printf_chk(x64emu_t *emu, void* fmt, void* b) __attribute__((alias("my_printf"))); +EXPORT int my___printf_chk(x64emu_t *emu, int chk, void* fmt, void* b) +{ + myStackAlign(emu, (const char*)fmt, b, emu->scratch, R_EAX, 2); + PREPARE_VALIST; + return vprintf((const char*)fmt, VARARGS); +} EXPORT int my_vprintf(x64emu_t *emu, void* fmt, x64_va_list_t b) { CONVERT_VALIST(b); @@ -689,11 +694,15 @@ EXPORT int my___snprintf_chk(x64emu_t* emu, void* buff, uint32_t s, void * fmt, EXPORT int my___snprintf(x64emu_t* emu, void* buff, uint32_t s, void * fmt, void * b, va_list V) __attribute__((alias("my_snprintf"))); #endif EXPORT int my_sprintf(x64emu_t* emu, void* buff, void * fmt, void * b) { - myStackAlign(emu, (const char*)fmt, b, emu->scratch, R_EAX, 1); + myStackAlign(emu, (const char*)fmt, b, emu->scratch, R_EAX, 2); + PREPARE_VALIST; + return vsprintf(buff, (const char*)fmt, VARARGS); +} +EXPORT int my___sprintf_chk(x64emu_t* emu, void* buff, int flag, size_t l, void * fmt, void * b) { + myStackAlign(emu, (const char*)fmt, b, emu->scratch, R_EAX, 4); PREPARE_VALIST; return vsprintf(buff, (const char*)fmt, VARARGS); } -EXPORT int my___sprintf_chk(x64emu_t* emu, void* buff, void * fmt, void * b) __attribute__((alias("my_sprintf"))); #if 0 EXPORT int my_asprintf(x64emu_t* emu, void** buff, void * fmt, void * b, va_list V) { #ifndef NOALIGN diff --git a/src/wrapped/wrappedlibc_private.h b/src/wrapped/wrappedlibc_private.h index d103be7d..4aebcf85 100755 --- a/src/wrapped/wrappedlibc_private.h +++ b/src/wrapped/wrappedlibc_private.h @@ -1347,7 +1347,7 @@ GOW(pread64, lFipLI) GO(preadv64, lFipiI) //GO(preadv64v2, GOM(printf, iFEpV) -GOM(__printf_chk, iFEvpV) +GOM(__printf_chk, iFEipV) //GO(__printf_fp, //GO(printf_size, //GO(printf_size_info, @@ -1715,7 +1715,7 @@ GOW(sleep, uFu) //GOW(socketpair, //GO(splice, GOM(sprintf, iFEppV) -GOM(__sprintf_chk, iFEpvvpV) +GOM(__sprintf_chk, iFEpilpV) //GOW(sprofil, GOW(srand, vFu) //GO(srand48, |