about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2024-08-30 15:59:07 +0200
committerptitSeb <sebastien.chev@gmail.com>2024-08-30 15:59:07 +0200
commit7ecdced4860d12b8f484e0b222d08192be4a56eb (patch)
tree99bc64ddda5255926398855eebf8ce248913296b /src
parent13b72df762476b13a6bc6e1cb1e7fa622068224d (diff)
downloadbox64-7ecdced4860d12b8f484e0b222d08192be4a56eb.tar.gz
box64-7ecdced4860d12b8f484e0b222d08192be4a56eb.zip
[BOX32] Added more 32bits wrapped function and fixes
Diffstat (limited to 'src')
-rw-r--r--src/box32.c2
-rw-r--r--src/emu/x64run_private.c2
-rwxr-xr-xsrc/emu/x86int3.c2
-rwxr-xr-xsrc/libtools/threads32.c9
-rw-r--r--src/wrapped32/generated/functions_list.txt14
-rw-r--r--src/wrapped32/generated/wrappedlibctypes32.h1
-rw-r--r--src/wrapped32/generated/wrappedlibpthreadtypes32.h5
-rw-r--r--src/wrapped32/generated/wrapper32.c16
-rw-r--r--src/wrapped32/generated/wrapper32.h8
-rwxr-xr-xsrc/wrapped32/wrappedlibc.c14
-rwxr-xr-xsrc/wrapped32/wrappedlibc_private.h38
-rwxr-xr-xsrc/wrapped32/wrappedlibpthread.c33
-rwxr-xr-xsrc/wrapped32/wrappedlibpthread_private.h8
13 files changed, 83 insertions, 69 deletions
diff --git a/src/box32.c b/src/box32.c
index 9add2a61..00b08e1a 100644
--- a/src/box32.c
+++ b/src/box32.c
@@ -135,7 +135,7 @@ ulong_t to_hash_d(uintptr_t p) {
     } else {
         ret = kh_value(hash_to, k);
         // delete both entries
-        k = kh_get(to, hash_to, p);
+        //k = kh_get(to, hash_to, p);
         kh_del(to, hash_to, k);
         k = kh_get(from, hash_from, ret);
         kh_del(from, hash_from, k);
diff --git a/src/emu/x64run_private.c b/src/emu/x64run_private.c
index 480c84d2..0616b4cf 100644
--- a/src/emu/x64run_private.c
+++ b/src/emu/x64run_private.c
@@ -1257,7 +1257,7 @@ void PrintTrace(x64emu_t* emu, uintptr_t ip, int dynarec)
             } else if((peek==0x55 /*|| peek==0x53*/) && !is32bits) {
                 if(!printFunctionAddr(*(uintptr_t*)(R_RSP), " STACK_TOP: "))
                     printf_log(LOG_NONE, " STACK_TOP: %p ", (void*)*(uintptr_t*)(R_RSP));
-            } else if((peek==0x55 || peek==0x56) && is32bits) {
+            } else if((peek==0x55 || peek==0x56 || peek==0x53) && is32bits) {
                 if(!printFunctionAddr(*(uint32_t*)(R_RSP), " STACK_TOP: "))
                     printf_log(LOG_NONE, " STACK_TOP: %p ", (void*)(uintptr_t)*(uint32_t*)(R_RSP));
             } else if(peek==0xF3 && PK(1)==0x0F && PK(2)==0x1E && PK(3)==0xFA && !is32bits) {
diff --git a/src/emu/x86int3.c b/src/emu/x86int3.c
index 540959c6..b2d800c9 100755
--- a/src/emu/x86int3.c
+++ b/src/emu/x86int3.c
@@ -113,7 +113,7 @@ void x86Int3(x64emu_t* emu, uintptr_t* addr)
                     perr = 1;
                 } else  if(!strcmp(s, "opendir")) {
                     snprintf(buff, 255, "%04d|%p: Calling %s(\"%s\")", tid, from_ptrv(*(ptr_t*)from_ptr(R_ESP)), s, from_ptrv(*(ptr_t*)from_ptr(R_ESP+4)));
-                    perr = 1;
+                    perr = 2;
                 } else  if(strstr(s, "__open")==s || !strcmp(s, "open") || !strcmp(s, "my_open64")) {
                     tmp = from_ptrv(*(ptr_t*)from_ptr(R_ESP+4));
                     snprintf(buff, 255, "%04d|%p: Calling %s(\"%s\", %d (,%d))", tid, from_ptrv(*(ptr_t*)from_ptr(R_ESP)), s, (tmp)?tmp:"(nil)", *(int*)from_ptr(R_ESP+8), *(int*)from_ptr(R_ESP+12));
diff --git a/src/libtools/threads32.c b/src/libtools/threads32.c
index 72229d70..d99a085e 100755
--- a/src/libtools/threads32.c
+++ b/src/libtools/threads32.c
@@ -816,6 +816,15 @@ EXPORT int my32_pthread_mutex_destroy(pthread_mutex_t *m)
 }
 #define getAlignedMutexWithInit(A, B)	getAlignedMutex(A)
 
+EXPORT int my32_pthread_mutexattr_init(x64emu_t* emu, pthread_mutexattr_t* att)
+{
+	// mutexattr is 4 bytes on x86, but 8 on 64bits platforms...
+	uint32_t save = att?(((uint32_t*)att)[1]):0;
+	int ret = pthread_mutexattr_init(att);
+	if(att) ((uint32_t*)att)[1] = save;
+	return ret;
+}
+
 EXPORT int my32___pthread_mutex_destroy(pthread_mutex_t *m) __attribute__((alias("my32_pthread_mutex_destroy")));
 
 EXPORT int my32_pthread_mutex_init(pthread_mutex_t *m, pthread_mutexattr_t *att)
diff --git a/src/wrapped32/generated/functions_list.txt b/src/wrapped32/generated/functions_list.txt
index 50b8c8f0..3d46842c 100644
--- a/src/wrapped32/generated/functions_list.txt
+++ b/src/wrapped32/generated/functions_list.txt
@@ -29,6 +29,7 @@
 #() LFL -> LFL
 #() LFp -> LFp
 #() pFv -> pFv
+#() pFi -> pFi
 #() pFu -> pFu
 #() pFL -> pFL
 #() pFp -> pFp
@@ -56,6 +57,7 @@
 #() iFpu -> iFpu
 #() iFpp -> iFpp
 #() iFph -> iFph
+#() iFhp -> iFhp
 #() iFhh -> iFhh
 #() IFII -> IFII
 #() uFEu -> uFEu
@@ -74,6 +76,7 @@
 #() dFdd -> dFdd
 #() dFdD -> dFdD
 #() dFdp -> dFdp
+#() LFpL -> LFpL
 #() LFpp -> LFpp
 #() pFEv -> pFEv
 #() pFEp -> pFEp
@@ -122,6 +125,7 @@
 #() iFppL -> iFppL
 #() iFppp -> iFppp
 #() iFpOu -> iFpOu
+#() iFhpL -> iFhpL
 #() IFiIi -> IFiIi
 #() fFfff -> fFfff
 #() fFffp -> fFffp
@@ -150,20 +154,22 @@
 #() iFELup -> iFELup
 #() iFEpip -> iFEpip
 #() iFEpup -> iFEpup
-#() iFEppu -> iFEppu
 #() iFEppL -> iFEppL
 #() iFEppp -> iFEppp
 #() iFEppV -> iFEppV
 #() iFEpOu -> iFEpOu
 #() iFEhpV -> iFEhpV
+#() iFiiiN -> iFiiiN
 #() iFiiII -> iFiiII
 #() iFiuui -> iFiuui
+#() iFhpiL -> iFhpiL
 #() LFpLLh -> LFpLLh
 #() pFEppi -> pFEppi
 #() pFEppp -> pFEppp
 #() pFpiLL -> pFpiLL
 #() pFppLL -> pFppLL
 #() iFEpprLL_ -> iFEppB
+#() LFpLpriiiiiiiiilt_ -> LFpLpB
 #() vFEpLLp -> vFEpLLp
 #() iFEppiV -> iFEppiV
 #() iFEpppi -> iFEpppi
@@ -225,6 +231,7 @@ wrappedlibc:
 - pFip:
   - signal
 - pFpp:
+  - gmtime_r
   - localtime_r
 - hFpp:
 - vFipV:
@@ -356,6 +363,7 @@ wrappedlibpthread:
   - __pthread_mutex_lock
   - __pthread_mutex_trylock
   - __pthread_mutex_unlock
+  - __pthread_mutexattr_init
   - pthread_attr_destroy
   - pthread_attr_init
   - pthread_cond_broadcast
@@ -368,6 +376,7 @@ wrappedlibpthread:
   - pthread_mutex_lock
   - pthread_mutex_trylock
   - pthread_mutex_unlock
+  - pthread_mutexattr_init
   - pthread_rwlock_rdlock
   - pthread_rwlock_unlock
   - pthread_rwlock_wrlock
@@ -410,7 +419,6 @@ wrappedlibpthread:
   - pthread_mutex_timedlock
   - pthread_once
   - pthread_rwlock_init
-  - pthread_setname_np
 - vFppp:
   - _pthread_cleanup_push
   - _pthread_cleanup_push_defer
@@ -419,8 +427,6 @@ wrappedlibpthread:
 - iFpup:
   - pthread_attr_setaffinity_np
   - pthread_getaffinity_np
-- iFppu:
-  - pthread_getname_np
 - iFppL:
   - pthread_attr_setstack
 - iFppp:
diff --git a/src/wrapped32/generated/wrappedlibctypes32.h b/src/wrapped32/generated/wrappedlibctypes32.h
index 21801fad..12cc4e30 100644
--- a/src/wrapped32/generated/wrappedlibctypes32.h
+++ b/src/wrapped32/generated/wrappedlibctypes32.h
@@ -68,6 +68,7 @@ typedef int32_t (*iFpuvvppp_t)(void*, uint32_t, void, void, void*, void*, void*)
 	GO(alphasort64, iFpp_t) \
 	GO(statvfs64, iFhp_t) \
 	GO(signal, pFip_t) \
+	GO(gmtime_r, pFpp_t) \
 	GO(localtime_r, pFpp_t) \
 	GO(__libc_init, vFpppp_t)
 
diff --git a/src/wrapped32/generated/wrappedlibpthreadtypes32.h b/src/wrapped32/generated/wrappedlibpthreadtypes32.h
index 256839dc..78f7040d 100644
--- a/src/wrapped32/generated/wrappedlibpthreadtypes32.h
+++ b/src/wrapped32/generated/wrappedlibpthreadtypes32.h
@@ -22,7 +22,6 @@ typedef int32_t (*iFpp_t)(void*, void*);
 typedef void (*vFppp_t)(void*, void*, void*);
 typedef int32_t (*iFLup_t)(uintptr_t, uint32_t, void*);
 typedef int32_t (*iFpup_t)(void*, uint32_t, void*);
-typedef int32_t (*iFppu_t)(void*, void*, uint32_t);
 typedef int32_t (*iFppL_t)(void*, void*, uintptr_t);
 typedef int32_t (*iFppp_t)(void*, void*, void*);
 typedef int32_t (*iFppLL_t)(void*, void*, uintptr_t, uintptr_t);
@@ -37,6 +36,7 @@ typedef int32_t (*iFhppp_t)(uintptr_t, void*, void*, void*);
 	GO(__pthread_mutex_lock, iFp_t) \
 	GO(__pthread_mutex_trylock, iFp_t) \
 	GO(__pthread_mutex_unlock, iFp_t) \
+	GO(__pthread_mutexattr_init, iFp_t) \
 	GO(pthread_attr_destroy, iFp_t) \
 	GO(pthread_attr_init, iFp_t) \
 	GO(pthread_cond_broadcast, iFp_t) \
@@ -49,6 +49,7 @@ typedef int32_t (*iFhppp_t)(uintptr_t, void*, void*, void*);
 	GO(pthread_mutex_lock, iFp_t) \
 	GO(pthread_mutex_trylock, iFp_t) \
 	GO(pthread_mutex_unlock, iFp_t) \
+	GO(pthread_mutexattr_init, iFp_t) \
 	GO(pthread_rwlock_rdlock, iFp_t) \
 	GO(pthread_rwlock_unlock, iFp_t) \
 	GO(pthread_rwlock_wrlock, iFp_t) \
@@ -86,13 +87,11 @@ typedef int32_t (*iFhppp_t)(uintptr_t, void*, void*, void*);
 	GO(pthread_mutex_timedlock, iFpp_t) \
 	GO(pthread_once, iFpp_t) \
 	GO(pthread_rwlock_init, iFpp_t) \
-	GO(pthread_setname_np, iFpp_t) \
 	GO(_pthread_cleanup_push, vFppp_t) \
 	GO(_pthread_cleanup_push_defer, vFppp_t) \
 	GO(pthread_setaffinity_np, iFLup_t) \
 	GO(pthread_attr_setaffinity_np, iFpup_t) \
 	GO(pthread_getaffinity_np, iFpup_t) \
-	GO(pthread_getname_np, iFppu_t) \
 	GO(pthread_attr_setstack, iFppL_t) \
 	GO(__pthread_atfork, iFppp_t) \
 	GO(pthread_atfork, iFppp_t) \
diff --git a/src/wrapped32/generated/wrapper32.c b/src/wrapped32/generated/wrapper32.c
index e6b9e6b0..0e2addd8 100644
--- a/src/wrapped32/generated/wrapper32.c
+++ b/src/wrapped32/generated/wrapper32.c
@@ -103,6 +103,7 @@ typedef uintptr_t (*LFv_t)(void);
 typedef uintptr_t (*LFL_t)(uintptr_t);
 typedef uintptr_t (*LFp_t)(void*);
 typedef void* (*pFv_t)(void);
+typedef void* (*pFi_t)(int32_t);
 typedef void* (*pFu_t)(uint32_t);
 typedef void* (*pFL_t)(uintptr_t);
 typedef void* (*pFp_t)(void*);
@@ -130,6 +131,7 @@ typedef int32_t (*iFpi_t)(void*, int32_t);
 typedef int32_t (*iFpu_t)(void*, uint32_t);
 typedef int32_t (*iFpp_t)(void*, void*);
 typedef int32_t (*iFph_t)(void*, uintptr_t);
+typedef int32_t (*iFhp_t)(uintptr_t, void*);
 typedef int32_t (*iFhh_t)(uintptr_t, uintptr_t);
 typedef int64_t (*IFII_t)(int64_t, int64_t);
 typedef uint32_t (*uFEu_t)(x64emu_t*, uint32_t);
@@ -148,6 +150,7 @@ typedef double (*dFdi_t)(double, int32_t);
 typedef double (*dFdd_t)(double, double);
 typedef double (*dFdD_t)(double, long double);
 typedef double (*dFdp_t)(double, void*);
+typedef uintptr_t (*LFpL_t)(void*, uintptr_t);
 typedef uintptr_t (*LFpp_t)(void*, void*);
 typedef void* (*pFEv_t)(x64emu_t*);
 typedef void* (*pFEp_t)(x64emu_t*, void*);
@@ -196,6 +199,7 @@ typedef int32_t (*iFppu_t)(void*, void*, uint32_t);
 typedef int32_t (*iFppL_t)(void*, void*, uintptr_t);
 typedef int32_t (*iFppp_t)(void*, void*, void*);
 typedef int32_t (*iFpOu_t)(void*, int32_t, uint32_t);
+typedef int32_t (*iFhpL_t)(uintptr_t, void*, uintptr_t);
 typedef int64_t (*IFiIi_t)(int32_t, int64_t, int32_t);
 typedef float (*fFfff_t)(float, float, float);
 typedef float (*fFffp_t)(float, float, void*);
@@ -224,20 +228,22 @@ typedef int32_t (*iFEipp_t)(x64emu_t*, int32_t, void*, void*);
 typedef int32_t (*iFELup_t)(x64emu_t*, uintptr_t, uint32_t, void*);
 typedef int32_t (*iFEpip_t)(x64emu_t*, void*, int32_t, void*);
 typedef int32_t (*iFEpup_t)(x64emu_t*, void*, uint32_t, void*);
-typedef int32_t (*iFEppu_t)(x64emu_t*, void*, void*, uint32_t);
 typedef int32_t (*iFEppL_t)(x64emu_t*, void*, void*, uintptr_t);
 typedef int32_t (*iFEppp_t)(x64emu_t*, void*, void*, void*);
 typedef int32_t (*iFEppV_t)(x64emu_t*, void*, void*, void*);
 typedef int32_t (*iFEpOu_t)(x64emu_t*, void*, int32_t, uint32_t);
 typedef int32_t (*iFEhpV_t)(x64emu_t*, uintptr_t, void*, void*);
+typedef int32_t (*iFiiiN_t)(int32_t, int32_t, int32_t, ...);
 typedef int32_t (*iFiiII_t)(int32_t, int32_t, int64_t, int64_t);
 typedef int32_t (*iFiuui_t)(int32_t, uint32_t, uint32_t, int32_t);
+typedef int32_t (*iFhpiL_t)(uintptr_t, void*, int32_t, uintptr_t);
 typedef uintptr_t (*LFpLLh_t)(void*, uintptr_t, uintptr_t, uintptr_t);
 typedef void* (*pFEppi_t)(x64emu_t*, void*, void*, int32_t);
 typedef void* (*pFEppp_t)(x64emu_t*, void*, void*, void*);
 typedef void* (*pFpiLL_t)(void*, int32_t, uintptr_t, uintptr_t);
 typedef void* (*pFppLL_t)(void*, void*, uintptr_t, uintptr_t);
 typedef int32_t (*iFEpprLL__t)(x64emu_t*, void*, void*, struct_LL_t*);
+typedef uintptr_t (*LFpLpriiiiiiiiilt__t)(void*, uintptr_t, void*, struct_iiiiiiiiilt_t*);
 typedef void (*vFEpLLp_t)(x64emu_t*, void*, uintptr_t, uintptr_t, void*);
 typedef int32_t (*iFEppiV_t)(x64emu_t*, void*, void*, int32_t, void*);
 typedef int32_t (*iFEpppi_t)(x64emu_t*, void*, void*, void*, int32_t);
@@ -297,6 +303,7 @@ void LFv_32(x64emu_t *emu, uintptr_t fcn) { LFv_t fn = (LFv_t)fcn; R_EAX = to_ul
 void LFL_32(x64emu_t *emu, uintptr_t fcn) { LFL_t fn = (LFL_t)fcn; R_EAX = to_ulong(fn(to_ulong(from_ptri(ulong_t, R_ESP + 4)))); }
 void LFp_32(x64emu_t *emu, uintptr_t fcn) { LFp_t fn = (LFp_t)fcn; R_EAX = to_ulong(fn(from_ptriv(R_ESP + 4))); }
 void pFv_32(x64emu_t *emu, uintptr_t fcn) { pFv_t fn = (pFv_t)fcn; R_EAX = to_ptrv(fn()); }
+void pFi_32(x64emu_t *emu, uintptr_t fcn) { pFi_t fn = (pFi_t)fcn; R_EAX = to_ptrv(fn(from_ptri(int32_t, R_ESP + 4))); }
 void pFu_32(x64emu_t *emu, uintptr_t fcn) { pFu_t fn = (pFu_t)fcn; R_EAX = to_ptrv(fn(from_ptri(uint32_t, R_ESP + 4))); }
 void pFL_32(x64emu_t *emu, uintptr_t fcn) { pFL_t fn = (pFL_t)fcn; R_EAX = to_ptrv(fn(to_ulong(from_ptri(ulong_t, R_ESP + 4)))); }
 void pFp_32(x64emu_t *emu, uintptr_t fcn) { pFp_t fn = (pFp_t)fcn; R_EAX = to_ptrv(fn(from_ptriv(R_ESP + 4))); }
@@ -324,6 +331,7 @@ void iFpi_32(x64emu_t *emu, uintptr_t fcn) { iFpi_t fn = (iFpi_t)fcn; R_EAX = fn
 void iFpu_32(x64emu_t *emu, uintptr_t fcn) { iFpu_t fn = (iFpu_t)fcn; R_EAX = fn(from_ptriv(R_ESP + 4), from_ptri(uint32_t, R_ESP + 8)); }
 void iFpp_32(x64emu_t *emu, uintptr_t fcn) { iFpp_t fn = (iFpp_t)fcn; R_EAX = fn(from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8)); }
 void iFph_32(x64emu_t *emu, uintptr_t fcn) { iFph_t fn = (iFph_t)fcn; R_EAX = fn(from_ptriv(R_ESP + 4), from_hash(from_ptri(ptr_t, R_ESP + 8))); }
+void iFhp_32(x64emu_t *emu, uintptr_t fcn) { iFhp_t fn = (iFhp_t)fcn; R_EAX = fn(from_hash(from_ptri(ptr_t, R_ESP + 4)), from_ptriv(R_ESP + 8)); }
 void iFhh_32(x64emu_t *emu, uintptr_t fcn) { iFhh_t fn = (iFhh_t)fcn; R_EAX = fn(from_hash(from_ptri(ptr_t, R_ESP + 4)), from_hash(from_ptri(ptr_t, R_ESP + 8))); }
 void IFII_32(x64emu_t *emu, uintptr_t fcn) { IFII_t fn = (IFII_t)fcn; ui64_t r; r.i = fn(from_ptri(int64_t, R_ESP + 4), from_ptri(int64_t, R_ESP + 12)); R_EAX = r.d[0]; R_EDX = r.d[1]; }
 void uFEu_32(x64emu_t *emu, uintptr_t fcn) { uFEu_t fn = (uFEu_t)fcn; R_EAX = (uint32_t)fn(emu, from_ptri(uint32_t, R_ESP + 4)); }
@@ -342,6 +350,7 @@ void dFdi_32(x64emu_t *emu, uintptr_t fcn) { dFdi_t fn = (dFdi_t)fcn; double db
 void dFdd_32(x64emu_t *emu, uintptr_t fcn) { dFdd_t fn = (dFdd_t)fcn; double db = fn(from_ptri(double, R_ESP + 4), from_ptri(double, R_ESP + 12)); fpu_do_push(emu); ST0val = db; }
 void dFdD_32(x64emu_t *emu, uintptr_t fcn) { dFdD_t fn = (dFdD_t)fcn; double db = fn(from_ptri(double, R_ESP + 4), LD2localLD(from_ptrv(R_ESP + 12))); fpu_do_push(emu); ST0val = db; }
 void dFdp_32(x64emu_t *emu, uintptr_t fcn) { dFdp_t fn = (dFdp_t)fcn; double db = fn(from_ptri(double, R_ESP + 4), from_ptriv(R_ESP + 12)); fpu_do_push(emu); ST0val = db; }
+void LFpL_32(x64emu_t *emu, uintptr_t fcn) { LFpL_t fn = (LFpL_t)fcn; R_EAX = to_ulong(fn(from_ptriv(R_ESP + 4), to_ulong(from_ptri(ulong_t, R_ESP + 8)))); }
 void LFpp_32(x64emu_t *emu, uintptr_t fcn) { LFpp_t fn = (LFpp_t)fcn; R_EAX = to_ulong(fn(from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8))); }
 void pFEv_32(x64emu_t *emu, uintptr_t fcn) { pFEv_t fn = (pFEv_t)fcn; R_EAX = to_ptrv(fn(emu)); }
 void pFEp_32(x64emu_t *emu, uintptr_t fcn) { pFEp_t fn = (pFEp_t)fcn; R_EAX = to_ptrv(fn(emu, from_ptriv(R_ESP + 4))); }
@@ -390,6 +399,7 @@ void iFppu_32(x64emu_t *emu, uintptr_t fcn) { iFppu_t fn = (iFppu_t)fcn; R_EAX =
 void iFppL_32(x64emu_t *emu, uintptr_t fcn) { iFppL_t fn = (iFppL_t)fcn; R_EAX = fn(from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), to_ulong(from_ptri(ulong_t, R_ESP + 12))); }
 void iFppp_32(x64emu_t *emu, uintptr_t fcn) { iFppp_t fn = (iFppp_t)fcn; R_EAX = fn(from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12)); }
 void iFpOu_32(x64emu_t *emu, uintptr_t fcn) { iFpOu_t fn = (iFpOu_t)fcn; R_EAX = fn(from_ptriv(R_ESP + 4), of_convert32(from_ptri(int32_t, R_ESP + 8)), from_ptri(uint32_t, R_ESP + 12)); }
+void iFhpL_32(x64emu_t *emu, uintptr_t fcn) { iFhpL_t fn = (iFhpL_t)fcn; R_EAX = fn(from_hash(from_ptri(ptr_t, R_ESP + 4)), from_ptriv(R_ESP + 8), to_ulong(from_ptri(ulong_t, R_ESP + 12))); }
 void IFiIi_32(x64emu_t *emu, uintptr_t fcn) { IFiIi_t fn = (IFiIi_t)fcn; ui64_t r; r.i = fn(from_ptri(int32_t, R_ESP + 4), from_ptri(int64_t, R_ESP + 8), from_ptri(int32_t, R_ESP + 16)); R_EAX = r.d[0]; R_EDX = r.d[1]; }
 void fFfff_32(x64emu_t *emu, uintptr_t fcn) { fFfff_t fn = (fFfff_t)fcn; float fl = fn(from_ptri(float, R_ESP + 4), from_ptri(float, R_ESP + 8), from_ptri(float, R_ESP + 12)); fpu_do_push(emu); ST0val = fl; }
 void fFffp_32(x64emu_t *emu, uintptr_t fcn) { fFffp_t fn = (fFffp_t)fcn; float fl = fn(from_ptri(float, R_ESP + 4), from_ptri(float, R_ESP + 8), from_ptriv(R_ESP + 12)); fpu_do_push(emu); ST0val = fl; }
@@ -418,20 +428,22 @@ void iFEipp_32(x64emu_t *emu, uintptr_t fcn) { iFEipp_t fn = (iFEipp_t)fcn; R_EA
 void iFELup_32(x64emu_t *emu, uintptr_t fcn) { iFELup_t fn = (iFELup_t)fcn; R_EAX = fn(emu, to_ulong(from_ptri(ulong_t, R_ESP + 4)), from_ptri(uint32_t, R_ESP + 8), from_ptriv(R_ESP + 12)); }
 void iFEpip_32(x64emu_t *emu, uintptr_t fcn) { iFEpip_t fn = (iFEpip_t)fcn; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ptri(int32_t, R_ESP + 8), from_ptriv(R_ESP + 12)); }
 void iFEpup_32(x64emu_t *emu, uintptr_t fcn) { iFEpup_t fn = (iFEpup_t)fcn; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ptri(uint32_t, R_ESP + 8), from_ptriv(R_ESP + 12)); }
-void iFEppu_32(x64emu_t *emu, uintptr_t fcn) { iFEppu_t fn = (iFEppu_t)fcn; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ptri(uint32_t, R_ESP + 12)); }
 void iFEppL_32(x64emu_t *emu, uintptr_t fcn) { iFEppL_t fn = (iFEppL_t)fcn; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), to_ulong(from_ptri(ulong_t, R_ESP + 12))); }
 void iFEppp_32(x64emu_t *emu, uintptr_t fcn) { iFEppp_t fn = (iFEppp_t)fcn; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12)); }
 void iFEppV_32(x64emu_t *emu, uintptr_t fcn) { iFEppV_t fn = (iFEppV_t)fcn; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ptrv(R_ESP + 12)); }
 void iFEpOu_32(x64emu_t *emu, uintptr_t fcn) { iFEpOu_t fn = (iFEpOu_t)fcn; R_EAX = fn(emu, from_ptriv(R_ESP + 4), of_convert32(from_ptri(int32_t, R_ESP + 8)), from_ptri(uint32_t, R_ESP + 12)); }
 void iFEhpV_32(x64emu_t *emu, uintptr_t fcn) { iFEhpV_t fn = (iFEhpV_t)fcn; R_EAX = fn(emu, from_hash(from_ptri(ptr_t, R_ESP + 4)), from_ptriv(R_ESP + 8), from_ptrv(R_ESP + 12)); }
+void iFiiiN_32(x64emu_t *emu, uintptr_t fcn) { iFiiiN_t fn = (iFiiiN_t)fcn; R_EAX = fn(from_ptri(int32_t, R_ESP + 4), from_ptri(int32_t, R_ESP + 8), from_ptri(int32_t, R_ESP + 12), from_ptriv(R_ESP + 16)); }
 void iFiiII_32(x64emu_t *emu, uintptr_t fcn) { iFiiII_t fn = (iFiiII_t)fcn; R_EAX = fn(from_ptri(int32_t, R_ESP + 4), from_ptri(int32_t, R_ESP + 8), from_ptri(int64_t, R_ESP + 12), from_ptri(int64_t, R_ESP + 20)); }
 void iFiuui_32(x64emu_t *emu, uintptr_t fcn) { iFiuui_t fn = (iFiuui_t)fcn; R_EAX = fn(from_ptri(int32_t, R_ESP + 4), from_ptri(uint32_t, R_ESP + 8), from_ptri(uint32_t, R_ESP + 12), from_ptri(int32_t, R_ESP + 16)); }
+void iFhpiL_32(x64emu_t *emu, uintptr_t fcn) { iFhpiL_t fn = (iFhpiL_t)fcn; R_EAX = fn(from_hash(from_ptri(ptr_t, R_ESP + 4)), from_ptriv(R_ESP + 8), from_ptri(int32_t, R_ESP + 12), to_ulong(from_ptri(ulong_t, R_ESP + 16))); }
 void LFpLLh_32(x64emu_t *emu, uintptr_t fcn) { LFpLLh_t fn = (LFpLLh_t)fcn; R_EAX = to_ulong(fn(from_ptriv(R_ESP + 4), to_ulong(from_ptri(ulong_t, R_ESP + 8)), to_ulong(from_ptri(ulong_t, R_ESP + 12)), from_hash(from_ptri(ptr_t, R_ESP + 16)))); }
 void pFEppi_32(x64emu_t *emu, uintptr_t fcn) { pFEppi_t fn = (pFEppi_t)fcn; R_EAX = to_ptrv(fn(emu, from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ptri(int32_t, R_ESP + 12))); }
 void pFEppp_32(x64emu_t *emu, uintptr_t fcn) { pFEppp_t fn = (pFEppp_t)fcn; R_EAX = to_ptrv(fn(emu, from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12))); }
 void pFpiLL_32(x64emu_t *emu, uintptr_t fcn) { pFpiLL_t fn = (pFpiLL_t)fcn; R_EAX = to_ptrv(fn(from_ptriv(R_ESP + 4), from_ptri(int32_t, R_ESP + 8), to_ulong(from_ptri(ulong_t, R_ESP + 12)), to_ulong(from_ptri(ulong_t, R_ESP + 16)))); }
 void pFppLL_32(x64emu_t *emu, uintptr_t fcn) { pFppLL_t fn = (pFppLL_t)fcn; R_EAX = to_ptrv(fn(from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), to_ulong(from_ptri(ulong_t, R_ESP + 12)), to_ulong(from_ptri(ulong_t, R_ESP + 16)))); }
 void iFEpprLL__32(x64emu_t *emu, uintptr_t fcn) { iFEpprLL__t fn = (iFEpprLL__t)fcn; struct_LL_t arg_12; from_struct_LL(&arg_12, *(ptr_t*)(from_ptr((R_ESP + 12)))); R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), *(ptr_t*)(from_ptr((R_ESP + 12))) ? &arg_12 : NULL); }
+void LFpLpriiiiiiiiilt__32(x64emu_t *emu, uintptr_t fcn) { LFpLpriiiiiiiiilt__t fn = (LFpLpriiiiiiiiilt__t)fcn; struct_iiiiiiiiilt_t arg_16; from_struct_iiiiiiiiilt(&arg_16, *(ptr_t*)(from_ptr((R_ESP + 16)))); R_EAX = to_ulong(fn(from_ptriv(R_ESP + 4), to_ulong(from_ptri(ulong_t, R_ESP + 8)), from_ptriv(R_ESP + 12), *(ptr_t*)(from_ptr((R_ESP + 16))) ? &arg_16 : NULL)); }
 void vFEpLLp_32(x64emu_t *emu, uintptr_t fcn) { vFEpLLp_t fn = (vFEpLLp_t)fcn; fn(emu, from_ptriv(R_ESP + 4), to_ulong(from_ptri(ulong_t, R_ESP + 8)), to_ulong(from_ptri(ulong_t, R_ESP + 12)), from_ptriv(R_ESP + 16)); }
 void iFEppiV_32(x64emu_t *emu, uintptr_t fcn) { iFEppiV_t fn = (iFEppiV_t)fcn; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ptri(int32_t, R_ESP + 12), from_ptrv(R_ESP + 16)); }
 void iFEpppi_32(x64emu_t *emu, uintptr_t fcn) { iFEpppi_t fn = (iFEpppi_t)fcn; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12), from_ptri(int32_t, R_ESP + 16)); }
diff --git a/src/wrapped32/generated/wrapper32.h b/src/wrapped32/generated/wrapper32.h
index fabe8035..d92b89e4 100644
--- a/src/wrapped32/generated/wrapper32.h
+++ b/src/wrapped32/generated/wrapper32.h
@@ -69,6 +69,7 @@ void LFv_32(x64emu_t *emu, uintptr_t fnc);
 void LFL_32(x64emu_t *emu, uintptr_t fnc);
 void LFp_32(x64emu_t *emu, uintptr_t fnc);
 void pFv_32(x64emu_t *emu, uintptr_t fnc);
+void pFi_32(x64emu_t *emu, uintptr_t fnc);
 void pFu_32(x64emu_t *emu, uintptr_t fnc);
 void pFL_32(x64emu_t *emu, uintptr_t fnc);
 void pFp_32(x64emu_t *emu, uintptr_t fnc);
@@ -96,6 +97,7 @@ void iFpi_32(x64emu_t *emu, uintptr_t fnc);
 void iFpu_32(x64emu_t *emu, uintptr_t fnc);
 void iFpp_32(x64emu_t *emu, uintptr_t fnc);
 void iFph_32(x64emu_t *emu, uintptr_t fnc);
+void iFhp_32(x64emu_t *emu, uintptr_t fnc);
 void iFhh_32(x64emu_t *emu, uintptr_t fnc);
 void IFII_32(x64emu_t *emu, uintptr_t fnc);
 void uFEu_32(x64emu_t *emu, uintptr_t fnc);
@@ -114,6 +116,7 @@ void dFdi_32(x64emu_t *emu, uintptr_t fnc);
 void dFdd_32(x64emu_t *emu, uintptr_t fnc);
 void dFdD_32(x64emu_t *emu, uintptr_t fnc);
 void dFdp_32(x64emu_t *emu, uintptr_t fnc);
+void LFpL_32(x64emu_t *emu, uintptr_t fnc);
 void LFpp_32(x64emu_t *emu, uintptr_t fnc);
 void pFEv_32(x64emu_t *emu, uintptr_t fnc);
 void pFEp_32(x64emu_t *emu, uintptr_t fnc);
@@ -162,6 +165,7 @@ void iFppu_32(x64emu_t *emu, uintptr_t fnc);
 void iFppL_32(x64emu_t *emu, uintptr_t fnc);
 void iFppp_32(x64emu_t *emu, uintptr_t fnc);
 void iFpOu_32(x64emu_t *emu, uintptr_t fnc);
+void iFhpL_32(x64emu_t *emu, uintptr_t fnc);
 void IFiIi_32(x64emu_t *emu, uintptr_t fnc);
 void fFfff_32(x64emu_t *emu, uintptr_t fnc);
 void fFffp_32(x64emu_t *emu, uintptr_t fnc);
@@ -190,20 +194,22 @@ void iFEipp_32(x64emu_t *emu, uintptr_t fnc);
 void iFELup_32(x64emu_t *emu, uintptr_t fnc);
 void iFEpip_32(x64emu_t *emu, uintptr_t fnc);
 void iFEpup_32(x64emu_t *emu, uintptr_t fnc);
-void iFEppu_32(x64emu_t *emu, uintptr_t fnc);
 void iFEppL_32(x64emu_t *emu, uintptr_t fnc);
 void iFEppp_32(x64emu_t *emu, uintptr_t fnc);
 void iFEppV_32(x64emu_t *emu, uintptr_t fnc);
 void iFEpOu_32(x64emu_t *emu, uintptr_t fnc);
 void iFEhpV_32(x64emu_t *emu, uintptr_t fnc);
+void iFiiiN_32(x64emu_t *emu, uintptr_t fnc);
 void iFiiII_32(x64emu_t *emu, uintptr_t fnc);
 void iFiuui_32(x64emu_t *emu, uintptr_t fnc);
+void iFhpiL_32(x64emu_t *emu, uintptr_t fnc);
 void LFpLLh_32(x64emu_t *emu, uintptr_t fnc);
 void pFEppi_32(x64emu_t *emu, uintptr_t fnc);
 void pFEppp_32(x64emu_t *emu, uintptr_t fnc);
 void pFpiLL_32(x64emu_t *emu, uintptr_t fnc);
 void pFppLL_32(x64emu_t *emu, uintptr_t fnc);
 void iFEpprLL__32(x64emu_t *emu, uintptr_t fnc);
+void LFpLpriiiiiiiiilt__32(x64emu_t *emu, uintptr_t fnc);
 void vFEpLLp_32(x64emu_t *emu, uintptr_t fnc);
 void iFEppiV_32(x64emu_t *emu, uintptr_t fnc);
 void iFEpppi_32(x64emu_t *emu, uintptr_t fnc);
diff --git a/src/wrapped32/wrappedlibc.c b/src/wrapped32/wrappedlibc.c
index 85801bda..5e67f57e 100755
--- a/src/wrapped32/wrappedlibc.c
+++ b/src/wrapped32/wrappedlibc.c
@@ -2067,6 +2067,20 @@ EXPORT void* my32_localtime_r(x64emu_t* emu, void* t, void* res)
     return NULL;
 }
 
+EXPORT void* my32_gmtime_r(x64emu_t* emu, void* t, void* res)
+{
+    struct_L_t t_ = {0};
+    struct_iiiiiiiiilt_t res_ = {0};
+    if(t) from_struct_L(&t_, to_ptrv(t));
+    if(res) from_struct_iiiiiiiiilt(&res_, to_ptrv(res));
+    void* ret = gmtime_r(t?((void*)&t_):NULL, res?((void*)&res_):NULL);
+    if(ret==&res_) {
+        to_struct_iiiiiiiiilt(to_ptrv(res), &res_);
+        return res;
+    }
+    return NULL;
+}
+
 #if 0
 EXPORT int32_t my32_getrandom(x64emu_t* emu, void* buf, uint32_t buflen, uint32_t flags)
 {
diff --git a/src/wrapped32/wrappedlibc_private.h b/src/wrapped32/wrappedlibc_private.h
index 3153d617..cc9df49f 100755
--- a/src/wrapped32/wrappedlibc_private.h
+++ b/src/wrapped32/wrappedlibc_private.h
@@ -152,7 +152,7 @@ GO(clock, LFv)
 // __clone
 GOW(close, iFi)
 // __close  // Weak
-//GOW(closedir, iFp)
+GOW(closedir, iFp)
 GO(closelog, vFv)
 //GO(__cmsg_nxthdr, pFpp)
 //GO(confstr, uFipu)
@@ -309,7 +309,7 @@ GOM(fcntl64, iFEiiN) //%%
 GO(fdatasync, iFi)
 // fdetach
 //GO(fdopen, pFip)
-//GOW(fdopendir, pFi)
+GOW(fdopendir, pFi)
 //GOW(feof, iFp)
 //GO(feof_unlocked, iFp)
 //GOW(ferror, iFp)
@@ -378,7 +378,7 @@ GOW(fputs, iFph)    // Weak
 //GO(fputwc_unlocked, iFip)
 //GO(fputws, iFpp)
 //GO(fputws_unlocked, iFpp)
-//GOW(fread, LFpLLp)
+GOW(fread, LFpLLh)
 //GO(__freadable, iFp)
 //GO(__fread_chk, uFpuuup)
 //GO(__freading, iFp)
@@ -618,7 +618,7 @@ GO(getwchar_unlocked, iFv)
 // glob_pattern_p   // Weak
 //GO(gmtime, pFp)
 //GO(__gmtime_r, pFpp)
-//GOW(gmtime_r, pFpp)
+GOWM(gmtime_r, pFEpp)
 GO(gnu_dev_major, uFU)
 GO(gnu_dev_makedev, UFii)       // dev_t seems to be a u64
 GO(gnu_dev_minor, uFU)
@@ -1202,7 +1202,7 @@ GOWM(open64, iFEpOu)  //%%
 //GOW(openat64, iFipON)
 //GO(__openat64_2, iFipON)
 // __open_catalog
-//GOW(opendir, pFp)
+GOW(opendir, pFp)
 //GO(openlog, vFpii)
 // open_memstream
 // open_wmemstream
@@ -1341,7 +1341,7 @@ GOM(read, lFipL) //%%,noE
 // readahead    // Weak
 //GO(__read_chk, lFipLL)
 //GOM(readdir, pFEp)  //%% should also be weak
-//GO(readdir64, pFp)  // check if alignement is correct
+GO(readdir64, pFp)  // check if alignement is correct
 // readdir64_r
 //GOM(readdir_r, iFEppp)  //%% should also be weak
 GOM(readlink, iFEppL) //%%
@@ -1452,7 +1452,7 @@ GO(secure_getenv, pFp)
 //GO(seekdir, vFpi)
 //GOW(select, iFipppp)
 //GO(__select, iFipppp)
-//GO(semctl, iFiiiN)
+GO(semctl, iFiiiN)
 GOW(semget, iFuii)
 //GOW(semop, iFipL)
 //GO(semtimedop, iFipup)
@@ -1519,7 +1519,7 @@ GOW(setuid, iFu)
 // setusershell
 GOW(setutent, vFv)
 // setutxent
-//GOW(setvbuf, iFppiL)
+GOW(setvbuf, iFhpiL)
 //GO(setxattr, iFpppui)
 // sgetspent
 // sgetspent_r  // Weak
@@ -1639,7 +1639,7 @@ GO(strcspn, LFpp)
 // __strfmon_l
 // strfmon_l    // Weak
 // strfry
-//GO(strftime, LFpLpp)
+GO(strftime, LFpLpriiiiiiiiilt_)
 //GO(__strftime_l, LFpLppL)
 //GOW(strftime_l, LFpLppL)
 GO(strlen, LFp)
@@ -1647,13 +1647,13 @@ GOW(strncasecmp, iFppL)
 // __strncasecmp_l
 // strncasecmp_l    // Weak
 GO(strncat, pFppL)
-//GO(__strncat_chk, pFppLL)
+GO(__strncat_chk, pFppLL)
 GO(strncmp, iFppL)
-//GO(strncpy, pFppL)
-//GO(__strncpy_chk, pFppLL)
-//GOW(strndup, pFpL)
-//GO(__strndup, pFpL)
-//GO(strnlen, LFpL)
+GO(strncpy, pFppL)
+GO(__strncpy_chk, pFppLL)
+GOW(strndup, pFpL)
+GO(__strndup, pFpL)
+GO(strnlen, LFpL)
 //GO(strpbrk, pFpp)
 // __strpbrk_c2
 // __strpbrk_c3
@@ -1936,15 +1936,15 @@ GOM(__vsnprintf_chk, iFEpuvvppp)  //%%
 //GOW(wcscoll, iFpp)
 //GO(__wcscoll_l, iFppp)
 //GOW(wcscoll_l, iFppp)
-//GO(wcscpy, pFpp)
+GO(wcscpy, pFpp)
 //GO(__wcscpy_chk, pFppu)
 //GO(wcscspn, uFpp)
-//GO(wcsdup, pFp)
+GO(wcsdup, pFp)
 //GO(wcsftime, LFpLpp)
 //GO(__wcsftime_l, LFpLppp)
 //GOW(wcsftime_l, LFpLppp)
-//GOW(wcslen, LFp)
-//GOW(wcsncasecmp, iFppu)
+GOW(wcslen, LFp)
+GOW(wcsncasecmp, iFppL)
 // __wcsncasecmp_l
 //GOW(wcsncasecmp_l, iFppup)
 //GO(wcsncat, pFppu)
diff --git a/src/wrapped32/wrappedlibpthread.c b/src/wrapped32/wrappedlibpthread.c
index d7881f6b..5c3be2e4 100755
--- a/src/wrapped32/wrappedlibpthread.c
+++ b/src/wrapped32/wrappedlibpthread.c
@@ -20,39 +20,6 @@
 static const char* libpthreadName = "libpthread.so.0";
 #define LIBNAME libpthread
 
-typedef int (*iFpp_t)(void*, void*);
-typedef int (*iFppu_t)(void*, void*, uint32_t);
-EXPORT int my32_pthread_setname_np(x64emu_t* emu, void* t, void* n)
-{
-    static void* f = NULL;
-    static int need_load = 1;
-    if(need_load) {
-        library_t* lib = GetLibInternal(libpthreadName);
-        if(!lib) return 0;
-        f = dlsym(lib->w.lib, "pthread_setname_np");
-        need_load = 0;
-    }
-    if(f)
-        return ((iFpp_t)f)(t, n);
-    return 0;
-}
-EXPORT int my32_pthread_getname_np(x64emu_t* emu, void* t, void* n, uint32_t s)
-{
-    static void* f = NULL;
-    static int need_load = 1;
-    if(need_load) {
-        library_t* lib = GetLibInternal(libpthreadName);
-        if(!lib) return 0;
-        f = dlsym(lib->w.lib, "pthread_getname_np");
-        need_load = 0;
-    }
-    if(f)
-        return ((iFppu_t)f)(t, n, s);
-    else 
-        strncpy((char*)n, "dummy", s);
-    return 0;
-}
-
 EXPORT int my32_pthread_rwlock_wrlock(pthread_rwlock_t *rwlock)
 {
     return pthread_rwlock_wrlock(rwlock);
diff --git a/src/wrapped32/wrappedlibpthread_private.h b/src/wrapped32/wrappedlibpthread_private.h
index 933f8489..9ff748d2 100755
--- a/src/wrapped32/wrappedlibpthread_private.h
+++ b/src/wrapped32/wrappedlibpthread_private.h
@@ -81,7 +81,7 @@ GO(pthread_getcpuclockid, iFup)
 GO(pthread_getschedparam, iFupp)
 GO(__pthread_getspecific, pFu)
 GO(pthread_getspecific, pFu)
-GOM(pthread_getname_np, iFEppu)  //not present on Pandora
+GO(pthread_getname_np, iFhpL)
 GOM(__pthread_initialize, vFv)  //%noE doesn't exist anymore...
 // __pthread_initialize_minimal
 GO(pthread_join, iFHBp_)
@@ -97,8 +97,8 @@ GO(pthread_mutexattr_getprotocol, iFpp)
 // pthread_mutexattr_getpshared
 // pthread_mutexattr_getrobust_np
 GO(pthread_mutexattr_gettype, iFpp)
-GO(__pthread_mutexattr_init, iFp)
-GO(pthread_mutexattr_init, iFp)
+GO2(__pthread_mutexattr_init, iFp, my32_pthread_mutexattr_init)
+GOM(pthread_mutexattr_init, iFEp)
 GO(pthread_mutexattr_setprioceiling, iFpi)
 GO(pthread_mutexattr_setprotocol, iFpp)
 GO(pthread_mutexattr_setpshared, iFpi)
@@ -150,7 +150,7 @@ GOM(pthread_setaffinity_np, iFELup)
 GO(pthread_setcancelstate, iFip)
 GO(pthread_setcanceltype, iFip)
 GO(pthread_setconcurrency, iFi)
-GOM(pthread_setname_np, iFEpp)   // not present on the Pandora
+GO(pthread_setname_np, iFhp)
 GO(pthread_setschedparam, iFuip)
 GO(pthread_setschedprio, iFpi)
 GO(__pthread_setspecific, iFup)