about summary refs log tree commit diff stats
path: root/src/wrapped
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2021-03-07 12:40:17 +0100
committerptitSeb <sebastien.chev@gmail.com>2021-03-07 12:40:17 +0100
commite937df638c045ea7378e8eed8d19d9d81205e358 (patch)
tree5ef09d09f3ded78ea7a8b3c610f2eb8c4c0a5301 /src/wrapped
parent12b177a1ec213d1efaf3150a1aac31f0f97cec2b (diff)
downloadbox64-e937df638c045ea7378e8eed8d19d9d81205e358.tar.gz
box64-e937df638c045ea7378e8eed8d19d9d81205e358.zip
Added longjmp and pthread_cancel handling (and test14 works)
Diffstat (limited to 'src/wrapped')
-rw-r--r--src/wrapped/generated/functions_list.txt4
-rw-r--r--src/wrapped/generated/wrapper.c8
-rw-r--r--src/wrapped/generated/wrapper.h4
-rwxr-xr-xsrc/wrapped/wrappedlibc.c60
-rwxr-xr-xsrc/wrapped/wrappedlibc_private.h10
-rwxr-xr-xsrc/wrapped/wrappedlibpthread_private.h100
6 files changed, 104 insertions, 82 deletions
diff --git a/src/wrapped/generated/functions_list.txt b/src/wrapped/generated/functions_list.txt
index 2a7ddd9e..dc8edcc7 100644
--- a/src/wrapped/generated/functions_list.txt
+++ b/src/wrapped/generated/functions_list.txt
@@ -8,10 +8,12 @@
 #() iFu
 #() iFf
 #() iFd
+#() iFL
 #() iFp
 #() IFf
 #() IFd
 #() IFp
+#() uFu
 #() uFp
 #() UFV
 #() fFf
@@ -49,6 +51,7 @@
 #() vFEpu
 #() vFfpp
 #() vFdpp
+#() iFEpi
 #() iFEpp
 #() iFEpV
 #() iFpiu
@@ -58,6 +61,7 @@
 #() fFffp
 #() dFddd
 #() dFddp
+#() pFEip
 #() pFEpi
 #() pFEpp
 #() pFipp
diff --git a/src/wrapped/generated/wrapper.c b/src/wrapped/generated/wrapper.c
index 872238a6..7cd7cd1a 100644
--- a/src/wrapped/generated/wrapper.c
+++ b/src/wrapped/generated/wrapper.c
@@ -79,10 +79,12 @@ typedef int32_t (*iFi_t)(int32_t);
 typedef int32_t (*iFu_t)(uint32_t);
 typedef int32_t (*iFf_t)(float);
 typedef int32_t (*iFd_t)(double);
+typedef int32_t (*iFL_t)(uintptr_t);
 typedef int32_t (*iFp_t)(void*);
 typedef int64_t (*IFf_t)(float);
 typedef int64_t (*IFd_t)(double);
 typedef int64_t (*IFp_t)(void*);
+typedef uint32_t (*uFu_t)(uint32_t);
 typedef uint32_t (*uFp_t)(void*);
 typedef uint64_t (*UFV_t)(void*);
 typedef float (*fFf_t)(float);
@@ -120,6 +122,7 @@ typedef void* (*pFpV_t)(void*, void*);
 typedef void (*vFEpu_t)(x64emu_t*, void*, uint32_t);
 typedef void (*vFfpp_t)(float, void*, void*);
 typedef void (*vFdpp_t)(double, void*, void*);
+typedef int32_t (*iFEpi_t)(x64emu_t*, void*, int32_t);
 typedef int32_t (*iFEpp_t)(x64emu_t*, void*, void*);
 typedef int32_t (*iFEpV_t)(x64emu_t*, void*, void*);
 typedef int32_t (*iFpiu_t)(void*, int32_t, uint32_t);
@@ -129,6 +132,7 @@ typedef float (*fFfff_t)(float, float, float);
 typedef float (*fFffp_t)(float, float, void*);
 typedef double (*dFddd_t)(double, double, double);
 typedef double (*dFddp_t)(double, double, void*);
+typedef void* (*pFEip_t)(x64emu_t*, int32_t, void*);
 typedef void* (*pFEpi_t)(x64emu_t*, void*, int32_t);
 typedef void* (*pFEpp_t)(x64emu_t*, void*, void*);
 typedef void* (*pFipp_t)(int32_t, void*, void*);
@@ -171,10 +175,12 @@ void iFi(x64emu_t *emu, uintptr_t fcn) { iFi_t fn = (iFi_t)fcn; R_RAX=fn((int32_
 void iFu(x64emu_t *emu, uintptr_t fcn) { iFu_t fn = (iFu_t)fcn; R_RAX=fn((uint32_t)R_RDI); }
 void iFf(x64emu_t *emu, uintptr_t fcn) { iFf_t fn = (iFf_t)fcn; R_RAX=fn(emu->xmm[0].f[0]); }
 void iFd(x64emu_t *emu, uintptr_t fcn) { iFd_t fn = (iFd_t)fcn; R_RAX=fn(emu->xmm[0].d[0]); }
+void iFL(x64emu_t *emu, uintptr_t fcn) { iFL_t fn = (iFL_t)fcn; R_RAX=fn((uintptr_t)R_RDI); }
 void iFp(x64emu_t *emu, uintptr_t fcn) { iFp_t fn = (iFp_t)fcn; R_RAX=fn((void*)R_RDI); }
 void IFf(x64emu_t *emu, uintptr_t fcn) { IFf_t fn = (IFf_t)fcn; R_RAX=(uint64_t)fn(emu->xmm[0].f[0]); }
 void IFd(x64emu_t *emu, uintptr_t fcn) { IFd_t fn = (IFd_t)fcn; R_RAX=(uint64_t)fn(emu->xmm[0].d[0]); }
 void IFp(x64emu_t *emu, uintptr_t fcn) { IFp_t fn = (IFp_t)fcn; R_RAX=(uint64_t)fn((void*)R_RDI); }
+void uFu(x64emu_t *emu, uintptr_t fcn) { uFu_t fn = (uFu_t)fcn; R_RAX=(uint32_t)fn((uint32_t)R_RDI); }
 void uFp(x64emu_t *emu, uintptr_t fcn) { uFp_t fn = (uFp_t)fcn; R_RAX=(uint32_t)fn((void*)R_RDI); }
 void UFV(x64emu_t *emu, uintptr_t fcn) { UFV_t fn = (UFV_t)fcn; R_RAX=fn((void*)(R_RSP + 8)); }
 void fFf(x64emu_t *emu, uintptr_t fcn) { fFf_t fn = (fFf_t)fcn; emu->xmm[0].f[0]=fn(emu->xmm[0].f[0]); }
@@ -212,6 +218,7 @@ void pFpV(x64emu_t *emu, uintptr_t fcn) { pFpV_t fn = (pFpV_t)fcn; R_RAX=(uintpt
 void vFEpu(x64emu_t *emu, uintptr_t fcn) { vFEpu_t fn = (vFEpu_t)fcn; fn(emu, (void*)R_RDI, (uint32_t)R_RSI); }
 void vFfpp(x64emu_t *emu, uintptr_t fcn) { vFfpp_t fn = (vFfpp_t)fcn; fn(emu->xmm[0].f[0], (void*)R_RDI, (void*)R_RSI); }
 void vFdpp(x64emu_t *emu, uintptr_t fcn) { vFdpp_t fn = (vFdpp_t)fcn; fn(emu->xmm[0].d[0], (void*)R_RDI, (void*)R_RSI); }
+void iFEpi(x64emu_t *emu, uintptr_t fcn) { iFEpi_t fn = (iFEpi_t)fcn; R_RAX=fn(emu, (void*)R_RDI, (int32_t)R_RSI); }
 void iFEpp(x64emu_t *emu, uintptr_t fcn) { iFEpp_t fn = (iFEpp_t)fcn; R_RAX=fn(emu, (void*)R_RDI, (void*)R_RSI); }
 void iFEpV(x64emu_t *emu, uintptr_t fcn) { iFEpV_t fn = (iFEpV_t)fcn; R_RAX=fn(emu, (void*)R_RDI, (void*)(R_RSP + 8)); }
 void iFpiu(x64emu_t *emu, uintptr_t fcn) { iFpiu_t fn = (iFpiu_t)fcn; R_RAX=fn((void*)R_RDI, (int32_t)R_RSI, (uint32_t)R_RDX); }
@@ -221,6 +228,7 @@ void fFfff(x64emu_t *emu, uintptr_t fcn) { fFfff_t fn = (fFfff_t)fcn; emu->xmm[0
 void fFffp(x64emu_t *emu, uintptr_t fcn) { fFffp_t fn = (fFffp_t)fcn; emu->xmm[0].f[0]=fn(emu->xmm[0].f[0], emu->xmm[1].f[0], (void*)R_RDI); }
 void dFddd(x64emu_t *emu, uintptr_t fcn) { dFddd_t fn = (dFddd_t)fcn; emu->xmm[0].d[0]=fn(emu->xmm[0].d[0], emu->xmm[1].d[0], emu->xmm[2].d[0]); }
 void dFddp(x64emu_t *emu, uintptr_t fcn) { dFddp_t fn = (dFddp_t)fcn; emu->xmm[0].d[0]=fn(emu->xmm[0].d[0], emu->xmm[1].d[0], (void*)R_RDI); }
+void pFEip(x64emu_t *emu, uintptr_t fcn) { pFEip_t fn = (pFEip_t)fcn; R_RAX=(uintptr_t)fn(emu, (int32_t)R_RDI, (void*)R_RSI); }
 void pFEpi(x64emu_t *emu, uintptr_t fcn) { pFEpi_t fn = (pFEpi_t)fcn; R_RAX=(uintptr_t)fn(emu, (void*)R_RDI, (int32_t)R_RSI); }
 void pFEpp(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 pFipp(x64emu_t *emu, uintptr_t fcn) { pFipp_t fn = (pFipp_t)fcn; R_RAX=(uintptr_t)fn((int32_t)R_RDI, (void*)R_RSI, (void*)R_RDX); }
diff --git a/src/wrapped/generated/wrapper.h b/src/wrapped/generated/wrapper.h
index b134b8fb..9b59212d 100644
--- a/src/wrapped/generated/wrapper.h
+++ b/src/wrapped/generated/wrapper.h
@@ -40,10 +40,12 @@ void iFi(x64emu_t *emu, uintptr_t fnc);
 void iFu(x64emu_t *emu, uintptr_t fnc);
 void iFf(x64emu_t *emu, uintptr_t fnc);
 void iFd(x64emu_t *emu, uintptr_t fnc);
+void iFL(x64emu_t *emu, uintptr_t fnc);
 void iFp(x64emu_t *emu, uintptr_t fnc);
 void IFf(x64emu_t *emu, uintptr_t fnc);
 void IFd(x64emu_t *emu, uintptr_t fnc);
 void IFp(x64emu_t *emu, uintptr_t fnc);
+void uFu(x64emu_t *emu, uintptr_t fnc);
 void uFp(x64emu_t *emu, uintptr_t fnc);
 void UFV(x64emu_t *emu, uintptr_t fnc);
 void fFf(x64emu_t *emu, uintptr_t fnc);
@@ -81,6 +83,7 @@ void pFpV(x64emu_t *emu, uintptr_t fnc);
 void vFEpu(x64emu_t *emu, uintptr_t fnc);
 void vFfpp(x64emu_t *emu, uintptr_t fnc);
 void vFdpp(x64emu_t *emu, uintptr_t fnc);
+void iFEpi(x64emu_t *emu, uintptr_t fnc);
 void iFEpp(x64emu_t *emu, uintptr_t fnc);
 void iFEpV(x64emu_t *emu, uintptr_t fnc);
 void iFpiu(x64emu_t *emu, uintptr_t fnc);
@@ -90,6 +93,7 @@ void fFfff(x64emu_t *emu, uintptr_t fnc);
 void fFffp(x64emu_t *emu, uintptr_t fnc);
 void dFddd(x64emu_t *emu, uintptr_t fnc);
 void dFddp(x64emu_t *emu, uintptr_t fnc);
+void pFEip(x64emu_t *emu, uintptr_t fnc);
 void pFEpi(x64emu_t *emu, uintptr_t fnc);
 void pFEpp(x64emu_t *emu, uintptr_t fnc);
 void pFipp(x64emu_t *emu, uintptr_t fnc);
diff --git a/src/wrapped/wrappedlibc.c b/src/wrapped/wrappedlibc.c
index b86980e7..ed3c7982 100755
--- a/src/wrapped/wrappedlibc.c
+++ b/src/wrapped/wrappedlibc.c
@@ -559,7 +559,7 @@ EXPORT uint32_t my__ITM_RU4(const uint32_t * a) { printf("warning _ITM_RU4 calle
 EXPORT uint64_t my__ITM_RU8(const uint64_t * a) { printf("warning _ITM_RU8 called\n"); return 0; }
 EXPORT void my__ITM_memcpyRtWn(void * a, const void * b, size_t c) {printf("warning _ITM_memcpyRtWn called\n");  }
 EXPORT void my__ITM_memcpyRnWt(void * a, const void * b, size_t c) {printf("warning _ITM_memcpyRtWn called\n"); }
-#if 0
+
 EXPORT void my_longjmp(x64emu_t* emu, /*struct __jmp_buf_tag __env[1]*/void *p, int32_t __val);
 EXPORT void my__longjmp(x64emu_t* emu, /*struct __jmp_buf_tag __env[1]*/void *p, int32_t __val) __attribute__((alias("my_longjmp")));
 EXPORT void my_siglongjmp(x64emu_t* emu, /*struct __jmp_buf_tag __env[1]*/void *p, int32_t __val) __attribute__((alias("my_longjmp")));
@@ -568,7 +568,6 @@ EXPORT void my___longjmp_chk(x64emu_t* emu, /*struct __jmp_buf_tag __env[1]*/voi
 EXPORT int32_t my_setjmp(x64emu_t* emu, /*struct __jmp_buf_tag __env[1]*/void *p);
 EXPORT int32_t my__setjmp(x64emu_t* emu, /*struct __jmp_buf_tag __env[1]*/void *p) __attribute__((alias("my_setjmp")));
 EXPORT int32_t my___sigsetjmp(x64emu_t* emu, /*struct __jmp_buf_tag __env[1]*/void *p) __attribute__((alias("my_setjmp")));
-#endif
 
 EXPORT int my_printf(x64emu_t *emu, void* fmt, void* b) {
     myStackAlign(emu, (const char*)fmt, b, emu->scratch, R_EAX, 1);
@@ -2090,35 +2089,39 @@ EXPORT void* my___deregister_frame_info(void* a)
 }
 
 EXPORT void* my____brk_addr = NULL;
-#if 0
+
 // longjmp / setjmp
-typedef struct jump_buff_i386_s {
- uint32_t save_ebx;
- uint32_t save_esi;
- uint32_t save_edi;
- uint32_t save_ebp;
- uint32_t save_esp;
- uint32_t save_eip;
-} jump_buff_i386_t;
+typedef struct jump_buff_x64_s {
+    uint64_t save_rbx;
+    uint64_t save_rbp;
+    uint64_t save_r12;
+    uint64_t save_r13;
+    uint64_t save_r14;
+    uint64_t save_r15;
+    uint64_t save_rsp;
+    uint64_t save_rip;
+} jump_buff_x64_t;
 
 typedef struct __jmp_buf_tag_s {
-    jump_buff_i386_t __jmpbuf;
+    jump_buff_x64_t __jmpbuf;
     int              __mask_was_saved;
     __sigset_t       __saved_mask;
 } __jmp_buf_tag_t;
 
 void EXPORT my_longjmp(x64emu_t* emu, /*struct __jmp_buf_tag __env[1]*/void *p, int32_t __val)
 {
-    jump_buff_i386_t *jpbuff = &((__jmp_buf_tag_t*)p)->__jmpbuf;
+    jump_buff_x64_t *jpbuff = &((__jmp_buf_tag_t*)p)->__jmpbuf;
     //restore  regs
-    R_EBX = jpbuff->save_ebx;
-    R_ESI = jpbuff->save_esi;
-    R_EDI = jpbuff->save_edi;
-    R_EBP = jpbuff->save_ebp;
-    R_ESP = jpbuff->save_esp;
+    R_RBX = jpbuff->save_rbx;
+    R_RBP = jpbuff->save_rbp;
+    R_R12 = jpbuff->save_r12;
+    R_R13 = jpbuff->save_r13;
+    R_R14 = jpbuff->save_r14;
+    R_R15 = jpbuff->save_r15;
+    R_RSP = jpbuff->save_rsp;
     // jmp to saved location, plus restore val to eax
     R_EAX = __val;
-    R_EIP = jpbuff->save_eip;
+    R_RIP = jpbuff->save_rip;
     if(emu->quitonlongjmp) {
         emu->longjmp = 1;
         emu->quit = 1;
@@ -2127,14 +2130,17 @@ void EXPORT my_longjmp(x64emu_t* emu, /*struct __jmp_buf_tag __env[1]*/void *p,
 
 EXPORT int32_t my_setjmp(x64emu_t* emu, /*struct __jmp_buf_tag __env[1]*/void *p)
 {
-    jump_buff_i386_t *jpbuff = &((__jmp_buf_tag_t*)p)->__jmpbuf;
+    jump_buff_x64_t *jpbuff = &((__jmp_buf_tag_t*)p)->__jmpbuf;
     // save the buffer
-    jpbuff->save_ebx = R_EBX;
-    jpbuff->save_esi = R_ESI;
-    jpbuff->save_edi = R_EDI;
-    jpbuff->save_ebp = R_EBP;
-    jpbuff->save_esp = R_ESP+4; // include "return address"
-    jpbuff->save_eip = *(uint32_t*)(R_ESP);
+    jpbuff->save_rbx = R_RBX;
+    jpbuff->save_rbp = R_RBP;
+    jpbuff->save_r12 = R_R12;
+    jpbuff->save_r13 = R_R13;
+    jpbuff->save_r14 = R_R14;
+    jpbuff->save_r15 = R_R15;
+    jpbuff->save_rsp = R_RSP;
+    jpbuff->save_rsp = R_RSP+sizeof(uintptr_t); // include "return address"
+    jpbuff->save_rip = *(uintptr_t*)(R_RSP);
     // and that's it.. Nothing more for now
     return 0;
 }
@@ -2152,7 +2158,7 @@ EXPORT void* my_realpath(x64emu_t* emu, void* path, void* resolved_path)
     }
         return realpath(path, resolved_path);
 }
-
+#if 0
 EXPORT void* my_mmap(x64emu_t* emu, void *addr, unsigned long length, int prot, int flags, int fd, int offset)
 {
     if(prot&PROT_WRITE) 
diff --git a/src/wrapped/wrappedlibc_private.h b/src/wrapped/wrappedlibc_private.h
index 1451abbb..eaef9a7a 100755
--- a/src/wrapped/wrappedlibc_private.h
+++ b/src/wrapped/wrappedlibc_private.h
@@ -1605,8 +1605,8 @@ GOW(puts, iFp)
 //GO(sethostname, 
 //GO(setipv4sourcefilter, 
 //GOW(setitimer, 
-//GO(_setjmp, 
-//GO(setjmp, 
+GOM(_setjmp, iFEp)
+GOM(setjmp, iFEp)
 //GO(setlinebuf, 
 //GO(setlocale, 
 //GO(setlogin, 
@@ -1686,8 +1686,8 @@ GOW(puts, iFp)
 //GOW(sigqueue, 
 //GO(sigrelse, 
 //GOW(sigreturn, 
-//GO(sigset, 
-//GO(__sigsetjmp, 
+GOM(sigset, pFEip)
+GOM(__sigsetjmp, iFEp)
 //GOW(sigsetmask, 
 //GO(sigstack, 
 //GO(__sigsuspend, 
@@ -1697,7 +1697,7 @@ GOW(puts, iFp)
 //GO(sigvec, 
 //GOW(sigwait, 
 //GOW(sigwaitinfo, 
-//GOW(sleep, 
+GOW(sleep, uFu)
 //GO(__snprintf, 
 //GOW(snprintf, 
 //GO(__snprintf_chk, 
diff --git a/src/wrapped/wrappedlibpthread_private.h b/src/wrapped/wrappedlibpthread_private.h
index 92989389..aeccee66 100755
--- a/src/wrapped/wrappedlibpthread_private.h
+++ b/src/wrapped/wrappedlibpthread_private.h
@@ -23,11 +23,11 @@ GOM(pthread_attr_destroy, iFEp)
 //GO(pthread_attr_getinheritsched, iFpp)
 //GO(pthread_attr_getschedparam, iFpp)
 //GO(pthread_attr_getschedpolicy, iFpp)
-//GO(pthread_attr_getscope, iFpp)
+GO(pthread_attr_getscope, iFpp)
 //GOM(pthread_attr_getstack, iFEppp)
 //GO(pthread_attr_getstackaddr, iFpp)
 //GO(pthread_attr_getstacksize, iFpp)
-//GO(pthread_attr_init, iFp)
+GO(pthread_attr_init, iFp)
 //GOM(pthread_attr_setaffinity_np, iFEpup)
 //GO(pthread_attr_setdetachstate, iFpi)
 //GO(pthread_attr_setguardsize, iFpL)
@@ -45,24 +45,24 @@ GOM(pthread_attr_destroy, iFEp)
 //GO(pthread_barrier_destroy, iFp)
 //GO(pthread_barrier_init, iFppu)
 //GO(pthread_barrier_wait, iFp)
-//GO(pthread_cancel, iFi)
+GO(pthread_cancel, iFL)
 //GOM(_pthread_cleanup_pop, vFEpi)
 //GOM(_pthread_cleanup_pop_restore, vFEpi)
 //GOM(_pthread_cleanup_push, vFEppp)
 //GOM(_pthread_cleanup_push_defer, vFEppp)
 // __pthread_cleanup_routine
-//GO(pthread_condattr_destroy, iFp)
-//GO(pthread_condattr_getclock, iFpp)
-//GO(pthread_condattr_getpshared, iFpp)
-//GO(pthread_condattr_init, iFp)
-//GO(pthread_condattr_setclock, iFpp)
-//GO(pthread_condattr_setpshared, iFpi)
-//GOM(pthread_cond_broadcast, iFEp)
-//GOM(pthread_cond_destroy, iFEp)
-//GOM(pthread_cond_init, iFEpp)
-//GOM(pthread_cond_signal, iFEp)
-//GOM(pthread_cond_timedwait, iFEppp)
-//GOM(pthread_cond_wait, iFEpp)
+GO(pthread_condattr_destroy, iFp)
+GO(pthread_condattr_getclock, iFpp)
+GO(pthread_condattr_getpshared, iFpp)
+GO(pthread_condattr_init, iFp)
+GO(pthread_condattr_setclock, iFpp)
+GO(pthread_condattr_setpshared, iFpi)
+GOM(pthread_cond_broadcast, iFEp)
+GOM(pthread_cond_destroy, iFEp)
+GOM(pthread_cond_init, iFEpp)
+GOM(pthread_cond_signal, iFEp)
+GOM(pthread_cond_timedwait, iFEppp)
+GOM(pthread_cond_wait, iFEpp)
 GOM(pthread_create, iFEpppp)
 //GO(pthread_detach, iFu)
 GO(pthread_equal, iFLL)
@@ -80,54 +80,54 @@ GO(pthread_equal, iFLL)
 GO(pthread_join, iFLp)
 GOM(__pthread_key_create, iFEpp)
 GOM(pthread_key_create, iFEpp)
-GO(pthread_key_delete, iFu)
-//GO(pthread_kill, iFEpi)
+GO(pthread_key_delete, iFL)
+GO(pthread_kill, iFEpi)
 // pthread_kill_other_threads_np
-//GO(__pthread_mutexattr_destroy, iFp)
-//GO(pthread_mutexattr_destroy, iFp)
+GO(__pthread_mutexattr_destroy, iFp)
+GO(pthread_mutexattr_destroy, iFp)
 // pthread_mutexattr_getprioceiling
 // pthread_mutexattr_getprotocol
 // pthread_mutexattr_getpshared
 // pthread_mutexattr_getrobust_np
-//GO(pthread_mutexattr_gettype, iFpp)
-//GO(__pthread_mutexattr_init, iFp)
-//GO(pthread_mutexattr_init, iFp)
+GO(pthread_mutexattr_gettype, iFpp)
+GO(__pthread_mutexattr_init, iFp)
+GO(pthread_mutexattr_init, iFp)
 // pthread_mutexattr_setprioceiling
-//GO(pthread_mutexattr_setprotocol, iFpp)
-//GO(pthread_mutexattr_setpshared, iFpi)
+GO(pthread_mutexattr_setprotocol, iFpp)
+GO(pthread_mutexattr_setpshared, iFpi)
 // pthread_mutexattr_setrobust_np
-//GO(__pthread_mutexattr_settype, iFpi)
-//GO(pthread_mutexattr_settype, iFpi)
+GO(__pthread_mutexattr_settype, iFpi)
+GO(pthread_mutexattr_settype, iFpi)
 // pthread_mutex_consistent_np
-//GO(__pthread_mutex_destroy, iFp)
-//GO(pthread_mutex_destroy, iFp)
+GO(__pthread_mutex_destroy, iFp)
+GO(pthread_mutex_destroy, iFp)
 // pthread_mutex_getprioceiling
-//GO(__pthread_mutex_init, iFpp)
-//GO(pthread_mutex_init, iFpp)
-//GO(__pthread_mutex_lock, iFp)
-//GO(pthread_mutex_lock, iFp)
+GO(__pthread_mutex_init, iFpp)
+GO(pthread_mutex_init, iFpp)
+GO(__pthread_mutex_lock, iFp)
+GO(pthread_mutex_lock, iFp)
 // pthread_mutex_setprioceiling
-//GO(pthread_mutex_timedlock, iFpp)
-//GO(__pthread_mutex_trylock, iFp)
-//GO(pthread_mutex_trylock, iFp)
-//GO(__pthread_mutex_unlock, iFp)
-//GO(pthread_mutex_unlock, iFp)
+GO(pthread_mutex_timedlock, iFpp)
+GO(__pthread_mutex_trylock, iFp)
+GO(pthread_mutex_trylock, iFp)
+GO(__pthread_mutex_unlock, iFp)
+GO(pthread_mutex_unlock, iFp)
 GOM(pthread_once, iFEpp)
 GOM(__pthread_once, iFEpp)
-//GOM(__pthread_register_cancel, vFEp)
+GOM(__pthread_register_cancel, vFEp)
 // __pthread_register_cancel_defer
-//GO(pthread_rwlockattr_destroy, vFp)
-//GO(pthread_rwlockattr_getkind_np, iFpp)
+GO(pthread_rwlockattr_destroy, vFp)
+GO(pthread_rwlockattr_getkind_np, iFpp)
 // pthread_rwlockattr_getpshared
-//GO(pthread_rwlockattr_init, iFp)
-//GO(pthread_rwlockattr_setkind_np, iFpi)
+GO(pthread_rwlockattr_init, iFp)
+GO(pthread_rwlockattr_setkind_np, iFpi)
 // pthread_rwlockattr_setpshared
 // __pthread_rwlock_destroy
-//GO(pthread_rwlock_destroy, iFp)
-//GO(__pthread_rwlock_init, iFpp)
-//GO(pthread_rwlock_init, iFpp)
-//GO(__pthread_rwlock_rdlock, iFp)
-//GO2(pthread_rwlock_rdlock, iFp, __pthread_rwlock_rdlock)    // not always defined
+GO(pthread_rwlock_destroy, iFp)
+GO(__pthread_rwlock_init, iFpp)
+GO(pthread_rwlock_init, iFpp)
+GO(__pthread_rwlock_rdlock, iFp)
+GO(pthread_rwlock_rdlock, iFp)
 // pthread_rwlock_timedrdlock
 // pthread_rwlock_timedwrlock
 // __pthread_rwlock_tryrdlock
@@ -157,11 +157,11 @@ GO(pthread_self, LFv)
 //GO(pthread_testcancel, vFv)
 //GO(pthread_timedjoin_np, iFppp)
 //GO(pthread_tryjoin_np, iFpp)
-//GOM(__pthread_unregister_cancel, vFEp)
+GOM(__pthread_unregister_cancel, vFEp)
 // __pthread_unregister_cancel_restore
 // __pthread_unwind
-//GOM(__pthread_unwind_next, vFEp)
-//GO(pthread_yield, iFv)
+GOM(__pthread_unwind_next, vFEp)
+GO(pthread_yield, iFv)
 // raise
 // __res_state
 //GO(sem_close, iFp)