diff options
| author | Yang Liu <liuyang22@iscas.ac.cn> | 2023-05-20 18:32:25 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-05-20 12:32:25 +0200 |
| commit | f56181bdabdb17f46e9da8c5ff1d5d39093b9b02 (patch) | |
| tree | 9c19d14587db9355f9ec513e5d7ce58d68f5959a | |
| parent | bc40c86f10727f447380d37c60c99533eef899bc (diff) | |
| download | box64-f56181bdabdb17f46e9da8c5ff1d5d39093b9b02.tar.gz box64-f56181bdabdb17f46e9da8c5ff1d5d39093b9b02.zip | |
[WRAPPER] Added vwprintf (#794)
| -rw-r--r-- | src/wrapped/generated/functions_list.txt | 1 | ||||
| -rw-r--r-- | src/wrapped/generated/wrappedlibctypes.h | 1 | ||||
| -rwxr-xr-x | src/wrapped/wrappedlibc.c | 41 | ||||
| -rwxr-xr-x | src/wrapped/wrappedlibc_private.h | 2 |
4 files changed, 10 insertions, 35 deletions
diff --git a/src/wrapped/generated/functions_list.txt b/src/wrapped/generated/functions_list.txt index dea4ebe7..55732c29 100644 --- a/src/wrapped/generated/functions_list.txt +++ b/src/wrapped/generated/functions_list.txt @@ -3657,6 +3657,7 @@ wrappedlibc: - wprintf - iFpA: - vprintf + - vwprintf - iFSp: - _IO_file_stat - pFip: diff --git a/src/wrapped/generated/wrappedlibctypes.h b/src/wrapped/generated/wrappedlibctypes.h index 5c123523..3b492850 100644 --- a/src/wrapped/generated/wrappedlibctypes.h +++ b/src/wrapped/generated/wrappedlibctypes.h @@ -145,6 +145,7 @@ typedef int32_t (*iFppipppp_t)(void*, void*, int32_t, void*, void*, void*, void* GO(printf, iFpV_t) \ GO(wprintf, iFpV_t) \ GO(vprintf, iFpA_t) \ + GO(vwprintf, iFpA_t) \ GO(_IO_file_stat, iFSp_t) \ GO(__sysv_signal, pFip_t) \ GO(signal, pFip_t) \ diff --git a/src/wrapped/wrappedlibc.c b/src/wrapped/wrappedlibc.c index 593eada1..78f17f69 100755 --- a/src/wrapped/wrappedlibc.c +++ b/src/wrapped/wrappedlibc.c @@ -690,32 +690,17 @@ EXPORT int my___fprintf_chk(x64emu_t *emu, void* F, int flag, void* fmt, void* b return vfprintf(F, fmt, VARARGS); } -#if 0 -EXPORT int my_wprintf(x64emu_t *emu, void* fmt, void* b, va_list V) { - #ifndef NOALIGN - // need to align on arm - myStackAlignW((const char*)fmt, b, emu->scratch); - PREPARE_VALIST; - void* f = vwprintf; - return ((iFpp_t)f)(fmt, VARARGS); +EXPORT int my_vwprintf(x64emu_t *emu, void* fmt, x64_va_list_t b) { + (void)emu; + #ifdef CONVERT_VALIST + CONVERT_VALIST(b); #else - // other platform don't need that - return vwprintf((const wchar_t*)fmt, V); - #endif -} -EXPORT int my___wprintf_chk(x64emu_t *emu, int flag, void* fmt, void* b, va_list V) { - #ifndef NOALIGN - // need to align on arm - myStackAlignW((const char*)fmt, b, emu->scratch); + myStackAlignWValist(emu, (const char*)fmt, emu->scratch, b); PREPARE_VALIST; - void* f = vwprintf; - return ((iFpp_t)f)(fmt, VARARGS); - #else - // other platform don't need that - return vwprintf((const wchar_t*)fmt, V); #endif + int r = vwprintf(fmt, VARARGS); + return r; } -#endif EXPORT int my_fwprintf(x64emu_t *emu, void* F, void* fmt, void* b) { myStackAlignW(emu, (const char*)fmt, b, emu->scratch, R_EAX, 2); @@ -749,18 +734,6 @@ EXPORT int my___vfwprintf_chk(x64emu_t *emu, void* F, int flag, void* fmt, x64_v } #if 0 -EXPORT int my_vwprintf(x64emu_t *emu, void* fmt, void* b) { - #ifndef NOALIGN - myStackAlignW((const char*)fmt, b, emu->scratch); - PREPARE_VALIST; - void* f = vwprintf; - return ((iFpp_t)f)(fmt, VARARGS); - #else - void* f = vwprintf; - return ((iFpp_t)f)(fmt, b); - #endif -} - EXPORT void *my_div(void *result, int numerator, int denominator) { *(div_t *)result = div(numerator, denominator); return result; diff --git a/src/wrapped/wrappedlibc_private.h b/src/wrapped/wrappedlibc_private.h index 45ccdadd..dce1647f 100755 --- a/src/wrapped/wrappedlibc_private.h +++ b/src/wrapped/wrappedlibc_private.h @@ -2087,7 +2087,7 @@ GOM(__vsyslog_chk, vFEiipA) //GO(vtimes, // Deprecated //GO(vwarn, vFpA) //GO(vwarnx, vFpA) -//GO(vwprintf, iFpA) +GOM(vwprintf, iFEpA) //GO(__vwprintf_chk, //GO(vwscanf, iFpA) GOW(__wait, iFp) |