about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2022-09-12 16:35:35 +0200
committerptitSeb <sebastien.chev@gmail.com>2022-09-12 16:35:35 +0200
commitd047dcb9836e5224847963178817908f025bda88 (patch)
tree49c6e981d4df0aab6794fa860508c1da1fa7a130 /src
parent0fc310f1c4f0c84df744b725b407f59325794462 (diff)
downloadbox64-d047dcb9836e5224847963178817908f025bda88.tar.gz
box64-d047dcb9836e5224847963178817908f025bda88.zip
Attempt at fixing wrapped __vfwprintf_chk (for #404)
Diffstat (limited to 'src')
-rw-r--r--src/wrapped/generated/functions_list.txt5
-rw-r--r--src/wrapped/generated/wrappedlibctypes.h3
-rw-r--r--src/wrapped/generated/wrapper.c3
-rw-r--r--src/wrapped/generated/wrapper.h2
-rwxr-xr-xsrc/wrapped/wrappedlibc.c10
-rwxr-xr-xsrc/wrapped/wrappedlibc_private.h2
6 files changed, 18 insertions, 7 deletions
diff --git a/src/wrapped/generated/functions_list.txt b/src/wrapped/generated/functions_list.txt
index 60466ca5..2f537346 100644
--- a/src/wrapped/generated/functions_list.txt
+++ b/src/wrapped/generated/functions_list.txt
@@ -1125,6 +1125,7 @@
 #() iFEpipi
 #() iFEpipp
 #() iFEpipV
+#() iFEpipA
 #() iFEpUup
 #() iFEpLpp
 #() iFEpLpV
@@ -2185,7 +2186,6 @@
 #() iFEvpp -> iFEpp
 #() pFEppv -> pFEpp
 #() iFEpvpp -> iFEppp
-#() iFEpvpA -> iFEppA
 #() iFEpvvppp -> iFEpppp
 #() iFEpLvvpp -> iFEpLpp
 #() iFEpuvvppp -> iFEpuppp
@@ -2995,7 +2995,6 @@ wrappedlibc:
   - sscanf
   - swscanf
 - iFppA:
-  - __vfwprintf_chk
   - obstack_vprintf
   - vasprintf
   - vfprintf
@@ -3043,6 +3042,8 @@ wrappedlibc:
   - __asprintf_chk
   - __fprintf_chk
   - __fwprintf_chk
+- iFpipA:
+  - __vfwprintf_chk
 - iFpLpp:
   - __vsnprintf_chk
 - iFpLpV:
diff --git a/src/wrapped/generated/wrappedlibctypes.h b/src/wrapped/generated/wrappedlibctypes.h
index b5f9a09b..4dfede09 100644
--- a/src/wrapped/generated/wrappedlibctypes.h
+++ b/src/wrapped/generated/wrappedlibctypes.h
@@ -64,6 +64,7 @@ typedef int64_t (*iFippi_t)(int64_t, void*, void*, int64_t);
 typedef int64_t (*iFippL_t)(int64_t, void*, void*, uintptr_t);
 typedef int64_t (*iFpipp_t)(void*, int64_t, void*, void*);
 typedef int64_t (*iFpipV_t)(void*, int64_t, void*, ...);
+typedef int64_t (*iFpipA_t)(void*, int64_t, void*, va_list);
 typedef int64_t (*iFpLpp_t)(void*, uintptr_t, void*, void*);
 typedef int64_t (*iFpLpV_t)(void*, uintptr_t, void*, ...);
 typedef int64_t (*iFpLpA_t)(void*, uintptr_t, void*, va_list);
@@ -190,7 +191,6 @@ typedef int64_t (*iFppipppp_t)(void*, void*, int64_t, void*, void*, void*, void*
 	GO(sprintf, iFppV_t) \
 	GO(sscanf, iFppV_t) \
 	GO(swscanf, iFppV_t) \
-	GO(__vfwprintf_chk, iFppA_t) \
 	GO(obstack_vprintf, iFppA_t) \
 	GO(vasprintf, iFppA_t) \
 	GO(vfprintf, iFppA_t) \
@@ -222,6 +222,7 @@ typedef int64_t (*iFppipppp_t)(void*, void*, int64_t, void*, void*, void*, void*
 	GO(__asprintf_chk, iFpipV_t) \
 	GO(__fprintf_chk, iFpipV_t) \
 	GO(__fwprintf_chk, iFpipV_t) \
+	GO(__vfwprintf_chk, iFpipA_t) \
 	GO(__vsnprintf_chk, iFpLpp_t) \
 	GO(__snprintf, iFpLpV_t) \
 	GO(snprintf, iFpLpV_t) \
diff --git a/src/wrapped/generated/wrapper.c b/src/wrapped/generated/wrapper.c
index c76d7240..babaf870 100644
--- a/src/wrapped/generated/wrapper.c
+++ b/src/wrapped/generated/wrapper.c
@@ -1159,6 +1159,7 @@ typedef int64_t (*iFEpiii_t)(x64emu_t*, void*, int64_t, int64_t, int64_t);
 typedef int64_t (*iFEpipi_t)(x64emu_t*, void*, int64_t, void*, int64_t);
 typedef int64_t (*iFEpipp_t)(x64emu_t*, void*, int64_t, void*, void*);
 typedef int64_t (*iFEpipV_t)(x64emu_t*, void*, int64_t, void*, void*);
+typedef int64_t (*iFEpipA_t)(x64emu_t*, void*, int64_t, void*, void*);
 typedef int64_t (*iFEpUup_t)(x64emu_t*, void*, uint64_t, uint64_t, void*);
 typedef int64_t (*iFEpLpp_t)(x64emu_t*, void*, uintptr_t, void*, void*);
 typedef int64_t (*iFEpLpV_t)(x64emu_t*, void*, uintptr_t, void*, void*);
@@ -3352,6 +3353,7 @@ void iFEpiii(x64emu_t *emu, uintptr_t fcn) { iFEpiii_t fn = (iFEpiii_t)fcn; R_RA
 void iFEpipi(x64emu_t *emu, uintptr_t fcn) { iFEpipi_t fn = (iFEpipi_t)fcn; R_RAX=(int64_t)fn(emu, (void*)R_RDI, (int64_t)R_RSI, (void*)R_RDX, (int64_t)R_RCX); }
 void iFEpipp(x64emu_t *emu, uintptr_t fcn) { iFEpipp_t fn = (iFEpipp_t)fcn; R_RAX=(int64_t)fn(emu, (void*)R_RDI, (int64_t)R_RSI, (void*)R_RDX, (void*)R_RCX); }
 void iFEpipV(x64emu_t *emu, uintptr_t fcn) { iFEpipV_t fn = (iFEpipV_t)fcn; R_RAX=(int64_t)fn(emu, (void*)R_RDI, (int64_t)R_RSI, (void*)R_RDX, (void*)(R_RSP + 8)); }
+void iFEpipA(x64emu_t *emu, uintptr_t fcn) { iFEpipA_t fn = (iFEpipA_t)fcn; R_RAX=(int64_t)fn(emu, (void*)R_RDI, (int64_t)R_RSI, (void*)R_RDX, (void*)R_RCX); }
 void iFEpUup(x64emu_t *emu, uintptr_t fcn) { iFEpUup_t fn = (iFEpUup_t)fcn; R_RAX=(int64_t)fn(emu, (void*)R_RDI, (uint64_t)R_RSI, (uint64_t)R_RDX, (void*)R_RCX); }
 void iFEpLpp(x64emu_t *emu, uintptr_t fcn) { iFEpLpp_t fn = (iFEpLpp_t)fcn; R_RAX=(int64_t)fn(emu, (void*)R_RDI, (uintptr_t)R_RSI, (void*)R_RDX, (void*)R_RCX); }
 void iFEpLpV(x64emu_t *emu, uintptr_t fcn) { iFEpLpV_t fn = (iFEpLpV_t)fcn; R_RAX=(int64_t)fn(emu, (void*)R_RDI, (uintptr_t)R_RSI, (void*)R_RDX, (void*)(R_RSP + 8)); }
@@ -4425,7 +4427,6 @@ void pFEv(x64emu_t *emu, uintptr_t fcn) { pFE_t fn = (pFE_t)fcn; R_RAX=(uintptr_
 void iFEvpp(x64emu_t *emu, uintptr_t fcn) { iFEpp_t fn = (iFEpp_t)fcn; R_RAX=(int64_t)fn(emu, (void*)R_RSI, (void*)R_RDX); }
 void pFEppv(x64emu_t *emu, uintptr_t fcn) { pFEpp_t fn = (pFEpp_t)fcn; R_RAX=(uintptr_t)fn(emu, (void*)R_RDI, (void*)R_RSI); }
 void iFEpvpp(x64emu_t *emu, uintptr_t fcn) { iFEppp_t fn = (iFEppp_t)fcn; R_RAX=(int64_t)fn(emu, (void*)R_RDI, (void*)R_RDX, (void*)R_RCX); }
-void iFEpvpA(x64emu_t *emu, uintptr_t fcn) { iFEppA_t fn = (iFEppA_t)fcn; R_RAX=(int64_t)fn(emu, (void*)R_RDI, (void*)R_RDX, (void*)R_RCX); }
 void iFEpvvppp(x64emu_t *emu, uintptr_t fcn) { iFEpppp_t fn = (iFEpppp_t)fcn; R_RAX=(int64_t)fn(emu, (void*)R_RDI, (void*)R_RCX, (void*)R_R8, (void*)R_R9); }
 void iFEpLvvpp(x64emu_t *emu, uintptr_t fcn) { iFEpLpp_t fn = (iFEpLpp_t)fcn; R_RAX=(int64_t)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=(int64_t)fn(emu, (void*)R_RDI, (uint64_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 aade6242..e643fd5e 100644
--- a/src/wrapped/generated/wrapper.h
+++ b/src/wrapped/generated/wrapper.h
@@ -1158,6 +1158,7 @@ void iFEpiii(x64emu_t *emu, uintptr_t fnc);
 void iFEpipi(x64emu_t *emu, uintptr_t fnc);
 void iFEpipp(x64emu_t *emu, uintptr_t fnc);
 void iFEpipV(x64emu_t *emu, uintptr_t fnc);
+void iFEpipA(x64emu_t *emu, uintptr_t fnc);
 void iFEpUup(x64emu_t *emu, uintptr_t fnc);
 void iFEpLpp(x64emu_t *emu, uintptr_t fnc);
 void iFEpLpV(x64emu_t *emu, uintptr_t fnc);
@@ -2231,7 +2232,6 @@ void pFEv(x64emu_t *emu, uintptr_t fnc);
 void iFEvpp(x64emu_t *emu, uintptr_t fnc);
 void pFEppv(x64emu_t *emu, uintptr_t fnc);
 void iFEpvpp(x64emu_t *emu, uintptr_t fnc);
-void iFEpvpA(x64emu_t *emu, uintptr_t fnc);
 void iFEpvvppp(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 12bea956..effef36c 100755
--- a/src/wrapped/wrappedlibc.c
+++ b/src/wrapped/wrappedlibc.c
@@ -654,7 +654,15 @@ EXPORT int my_vfwprintf(x64emu_t *emu, void* F, void* fmt, x64_va_list_t  b) {
     #endif
     return vfwprintf(F, fmt, VARARGS);
 }
-EXPORT int my___vfwprintf_chk(x64emu_t *emu, void* F, void* fmt, x64_va_list_t b) __attribute__((alias("my_vprintf")));
+EXPORT int my___vfwprintf_chk(x64emu_t *emu, void* F, int flag, void* fmt, x64_va_list_t b)  {
+    #ifdef CONVERT_VALIST
+    CONVERT_VALIST(b);
+    #else
+    myStackAlignWValist(emu, (const char*)fmt, emu->scratch, b);
+    PREPARE_VALIST;
+    #endif
+    return vfwprintf(F, fmt, VARARGS);
+}
 
 #if 0
 EXPORT int my_vwprintf(x64emu_t *emu, void* fmt, void* b) {
diff --git a/src/wrapped/wrappedlibc_private.h b/src/wrapped/wrappedlibc_private.h
index 5dd58cbc..64d6d553 100755
--- a/src/wrapped/wrappedlibc_private.h
+++ b/src/wrapped/wrappedlibc_private.h
@@ -2058,7 +2058,7 @@ GOM(__vfprintf_chk, iFEpvpp)
 //GO(__vfscanf, 
 GOWM(vfscanf, iFEppA)
 GOWM(vfwprintf, iFEppA)
-GOM(__vfwprintf_chk, iFEpvpA)
+GOM(__vfwprintf_chk, iFEpipA)
 //GOW(vfwscanf, iFppA)
 GO(vhangup, iFv)
 //GO(vlimit, // Deprecated