about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2021-03-10 09:25:19 +0100
committerptitSeb <sebastien.chev@gmail.com>2021-03-10 09:25:19 +0100
commit3fa01e53b9f67d455851fba778aa09d1037becef (patch)
treec0fefe4c06472d3592b7a5ec4fefaa3e5ecc82c5 /src
parentecac1815dbc5b06e42093cf8cb494cd6ee455d8b (diff)
downloadbox64-3fa01e53b9f67d455851fba778aa09d1037becef.tar.gz
box64-3fa01e53b9f67d455851fba778aa09d1037becef.zip
Wrapped sprintf
Diffstat (limited to 'src')
-rw-r--r--src/wrapped/generated/functions_list.txt1
-rw-r--r--src/wrapped/generated/wrapper.c1
-rw-r--r--src/wrapped/generated/wrapper.h1
-rwxr-xr-xsrc/wrapped/wrappedlibc.c18
-rwxr-xr-xsrc/wrapped/wrappedlibc_private.h4
5 files changed, 11 insertions, 14 deletions
diff --git a/src/wrapped/generated/functions_list.txt b/src/wrapped/generated/functions_list.txt
index a81e7553..22705d18 100644
--- a/src/wrapped/generated/functions_list.txt
+++ b/src/wrapped/generated/functions_list.txt
@@ -894,5 +894,6 @@
 #() 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 61b3ac27..93e073af 100644
--- a/src/wrapped/generated/wrapper.c
+++ b/src/wrapped/generated/wrapper.c
@@ -1829,5 +1829,6 @@ void iFEvpp(x64emu_t *emu, uintptr_t fcn) { iFEpp_t fn = (iFEpp_t)fcn; R_RAX=fn(
 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 97278803..7e240816 100644
--- a/src/wrapped/generated/wrapper.h
+++ b/src/wrapped/generated/wrapper.h
@@ -931,6 +931,7 @@ 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 75ca7825..d9c675cf 100755
--- a/src/wrapped/wrappedlibc.c
+++ b/src/wrapped/wrappedlibc.c
@@ -687,20 +687,14 @@ EXPORT int my_snprintf(x64emu_t* emu, void* buff, uint32_t s, void * fmt, void *
 }
 EXPORT int my___snprintf_chk(x64emu_t* emu, void* buff, uint32_t s, void * fmt, void * b, va_list V) __attribute__((alias("my_snprintf")));
 EXPORT int my___snprintf(x64emu_t* emu, void* buff, uint32_t s, void * fmt, void * b, va_list V) __attribute__((alias("my_snprintf")));
-
-EXPORT int my_sprintf(x64emu_t* emu, void* buff, void * fmt, void * b, va_list V) {
-    #ifndef NOALIGN
-    // need to align on arm
-    myStackAlign((const char*)fmt, b, emu->scratch);
+#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);
     PREPARE_VALIST;
-    void* f = vsprintf;
-    return ((iFppp_t)f)(buff, fmt, VARARGS);
-    #else
-    return vsprintf((char*)buff, (char*)fmt, V);
-    #endif
+    return vsprintf(buff, (const char*)fmt, VARARGS);
 }
-EXPORT int my___sprintf_chk(x64emu_t* emu, void* buff, void * fmt, void * b, va_list V) __attribute__((alias("my_sprintf")));
-
+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
     // need to align on arm
diff --git a/src/wrapped/wrappedlibc_private.h b/src/wrapped/wrappedlibc_private.h
index 350792cf..90857848 100755
--- a/src/wrapped/wrappedlibc_private.h
+++ b/src/wrapped/wrappedlibc_private.h
@@ -1714,8 +1714,8 @@ GOW(sleep, uFu)
 //GOW(socket, 
 //GOW(socketpair, 
 //GO(splice, 
-//GO(sprintf, 
-//GO(__sprintf_chk, 
+GOM(sprintf, iFEppV)
+GOM(__sprintf_chk, iFEpvvpV)
 //GOW(sprofil, 
 GOW(srand, vFu)
 //GO(srand48,