about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/wrapped/wrappedlibc.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/wrapped/wrappedlibc.c b/src/wrapped/wrappedlibc.c
index 7d24f736..39c905ec 100755
--- a/src/wrapped/wrappedlibc.c
+++ b/src/wrapped/wrappedlibc.c
@@ -763,8 +763,12 @@ EXPORT void *my_div(void *result, int numerator, int denominator) {
 #endif
 
 EXPORT int my_snprintf(x64emu_t* emu, void* buff, size_t s, void * fmt, uint64_t * b) {
+    #ifdef CREATE_VALIST_FROM_VAARG
+    CREATE_VALIST_FROM_VAARG(b, emu->scratch, 3);
+    #else
     myStackAlign(emu, (const char*)fmt, b, emu->scratch, R_EAX, 3);
     PREPARE_VALIST;
+    #endif
     int r = vsnprintf(buff, s, fmt, VARARGS);
     return r;
 }
@@ -772,21 +776,33 @@ EXPORT int my___snprintf(x64emu_t* emu, void* buff, size_t s, void * fmt, uint64
 EXPORT int my___snprintf_chk(x64emu_t* emu, void* buff, size_t s, int flags, size_t maxlen, void * fmt, uint64_t * b)
 {
     (void)flags; (void)maxlen;
+    #ifdef CREATE_VALIST_FROM_VAARG
+    CREATE_VALIST_FROM_VAARG(b, emu->scratch, 5);
+    #else
     myStackAlign(emu, (const char*)fmt, b, emu->scratch, R_EAX, 5);
     PREPARE_VALIST;
+    #endif
     int r = vsnprintf(buff, s, fmt, VARARGS);
     return r;
 }
 
 EXPORT int my_sprintf(x64emu_t* emu, void* buff, void * fmt, void * b) {
+    #ifdef CREATE_VALIST_FROM_VAARG
+    CREATE_VALIST_FROM_VAARG(b, emu->scratch, 2);
+    #else
     myStackAlign(emu, (const char*)fmt, b, emu->scratch, R_EAX, 2);
     PREPARE_VALIST;
+    #endif
     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) {
     (void)flag; (void)l;
+    #ifdef CREATE_VALIST_FROM_VAARG
+    CREATE_VALIST_FROM_VAARG(b, emu->scratch, 4);
+    #else
     myStackAlign(emu, (const char*)fmt, b, emu->scratch, R_EAX, 4);
     PREPARE_VALIST;
+    #endif
     return vsprintf(buff, (const char*)fmt, VARARGS);
 }