about summary refs log tree commit diff stats
path: root/src/wrapped/wrappedlibc.c
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2021-03-08 20:41:51 +0100
committerptitSeb <sebastien.chev@gmail.com>2021-03-08 20:41:51 +0100
commitfa24bbd96ad1c2c13fe5f87a90c9a2f9fa8c77a1 (patch)
tree01f1d89706a85f138932667af66cd8d906104a00 /src/wrapped/wrappedlibc.c
parent5eca802a5a110ec2f1b032886d30ff5084f59477 (diff)
downloadbox64-fa24bbd96ad1c2c13fe5f87a90c9a2f9fa8c77a1.tar.gz
box64-fa24bbd96ad1c2c13fe5f87a90c9a2f9fa8c77a1.zip
Added wrapped vfprintf and fprintf functions
Diffstat (limited to 'src/wrapped/wrappedlibc.c')
-rwxr-xr-xsrc/wrapped/wrappedlibc.c36
1 files changed, 10 insertions, 26 deletions
diff --git a/src/wrapped/wrappedlibc.c b/src/wrapped/wrappedlibc.c
index 4790b868..52826426 100755
--- a/src/wrapped/wrappedlibc.c
+++ b/src/wrapped/wrappedlibc.c
@@ -582,37 +582,21 @@ EXPORT int my_vprintf(x64emu_t *emu, void* fmt, x64_va_list_t b) {
 }
 EXPORT int my___vprintf_chk(x64emu_t *emu, void* fmt, x64_va_list_t b) __attribute__((alias("my_vprintf")));
 
-#if 0
-EXPORT int my_vfprintf(x64emu_t *emu, void* F, void* fmt, void* b) {
-    #ifndef NOALIGN
-    // need to align on arm
-    myStackAlign((const char*)fmt, (uint32_t*)b, emu->scratch);
-    PREPARE_VALIST;
-    void* f = vfprintf;
-    return ((iFppp_t)f)(F, fmt, VARARGS);
-    #else
-    // other platform don't need that
-    void* f = vfprintf;
-    return ((iFppp_t)f)(F, fmt, (uint32_t*)b);
-    #endif
+EXPORT int my_vfprintf(x64emu_t *emu, void* F, void* fmt, x64_va_list_t b) {
+    CONVERT_VALIST(b);
+    return vfprintf(F, fmt, VARARGS);
 }
-EXPORT int my___vfprintf_chk(x64emu_t *emu, void* F, void* fmt, void* b) __attribute__((alias("my_vfprintf")));
-EXPORT int my__IO_vfprintf(x64emu_t *emu, void* F, void* fmt, void* b) __attribute__((alias("my_vfprintf")));
+EXPORT int my___vfprintf_chk(x64emu_t *emu, void* F, void* fmt, x64_va_list_t b) __attribute__((alias("my_vfprintf")));
+EXPORT int my__IO_vfprintf(x64emu_t *emu, void* F, void* fmt, x64_va_list_t b) __attribute__((alias("my_vfprintf")));
 
-EXPORT int my_fprintf(x64emu_t *emu, void* F, void* fmt, void* b, va_list V)  {
-    #ifndef NOALIGN
-    // need to align on arm
-    myStackAlign((const char*)fmt, b, emu->scratch);
+EXPORT int my_fprintf(x64emu_t *emu, void* F, void* fmt, void* b)  {
+    myStackAlign(emu, (const char*)fmt, b, emu->scratch, R_EAX, 1);
     PREPARE_VALIST;
-    void* f = vfprintf;
-    return ((iFppp_t)f)(F, fmt, VARARGS);
-    #else
-    // other platform don't need that
-    return vfprintf((FILE*)F, (const char*)fmt, V);
-    #endif
+    return vfprintf(F, fmt, VARARGS);
 }
-EXPORT int my___fprintf_chk(x64emu_t *emu, void* F, void* fmt, void* b, va_list V) __attribute__((alias("my_fprintf")));
+EXPORT int my___fprintf_chk(x64emu_t *emu, void* F, void* fmt, void* b) __attribute__((alias("my_fprintf")));
 
+#if 0
 EXPORT int my_wprintf(x64emu_t *emu, void* fmt, void* b, va_list V) {
     #ifndef NOALIGN
     // need to align on arm