about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/wrapped/generated/functions_list.txt6
-rw-r--r--src/wrapped/generated/wrappedgmptypes.h5
-rw-r--r--src/wrapped/generated/wrapper.c9
-rw-r--r--src/wrapped/generated/wrapper.h3
-rw-r--r--src/wrapped/wrappedgmp.c138
-rw-r--r--src/wrapped/wrappedgmp_private.h100
6 files changed, 211 insertions, 50 deletions
diff --git a/src/wrapped/generated/functions_list.txt b/src/wrapped/generated/functions_list.txt
index ae6af286..dadbd5a3 100644
--- a/src/wrapped/generated/functions_list.txt
+++ b/src/wrapped/generated/functions_list.txt
@@ -1106,9 +1106,11 @@
 #() LFpLpp
 #() LFppii
 #() LFppip
+#() LFppLu
 #() LFppLL
 #() LFppLp
 #() LFpppi
+#() LFpppL
 #() LFpppp
 #() pFEipp
 #() pFEupp
@@ -1588,6 +1590,7 @@
 #() LFELppi
 #() LFEpppp
 #() LFuiCiu
+#() LFLpppL
 #() LFpuipp
 #() LFpuppi
 #() LFpLuuu
@@ -3403,6 +3406,9 @@ wrappedglib2:
   - g_spawn_async_with_pipes
 wrappedgmodule2:
 wrappedgmp:
+- vFppp:
+  - __gmp_get_memory_functions
+  - __gmp_set_memory_functions
 wrappedgnutls:
 - vFp:
   - gnutls_global_set_log_function
diff --git a/src/wrapped/generated/wrappedgmptypes.h b/src/wrapped/generated/wrappedgmptypes.h
index 7ad626cf..73208eb4 100644
--- a/src/wrapped/generated/wrappedgmptypes.h
+++ b/src/wrapped/generated/wrappedgmptypes.h
@@ -11,7 +11,10 @@
 #define ADDED_FUNCTIONS() 
 #endif
 
+typedef void (*vFppp_t)(void*, void*, void*);
 
-#define SUPER() ADDED_FUNCTIONS()
+#define SUPER() ADDED_FUNCTIONS() \
+	GO(__gmp_get_memory_functions, vFppp_t) \
+	GO(__gmp_set_memory_functions, vFppp_t)
 
 #endif // __wrappedgmpTYPES_H_
diff --git a/src/wrapped/generated/wrapper.c b/src/wrapped/generated/wrapper.c
index 99e9424c..32747b3f 100644
--- a/src/wrapped/generated/wrapper.c
+++ b/src/wrapped/generated/wrapper.c
@@ -1142,9 +1142,11 @@ typedef uintptr_t (*LFpLpL_t)(void*, uintptr_t, void*, uintptr_t);
 typedef uintptr_t (*LFpLpp_t)(void*, uintptr_t, void*, void*);
 typedef uintptr_t (*LFppii_t)(void*, void*, int32_t, int32_t);
 typedef uintptr_t (*LFppip_t)(void*, void*, int32_t, void*);
+typedef uintptr_t (*LFppLu_t)(void*, void*, uintptr_t, uint32_t);
 typedef uintptr_t (*LFppLL_t)(void*, void*, uintptr_t, uintptr_t);
 typedef uintptr_t (*LFppLp_t)(void*, void*, uintptr_t, void*);
 typedef uintptr_t (*LFpppi_t)(void*, void*, void*, int32_t);
+typedef uintptr_t (*LFpppL_t)(void*, void*, void*, uintptr_t);
 typedef uintptr_t (*LFpppp_t)(void*, void*, void*, void*);
 typedef void* (*pFEipp_t)(x64emu_t*, int32_t, void*, void*);
 typedef void* (*pFEupp_t)(x64emu_t*, uint32_t, void*, void*);
@@ -1624,6 +1626,7 @@ typedef intptr_t (*lFppLpp_t)(void*, void*, uintptr_t, void*, void*);
 typedef uintptr_t (*LFELppi_t)(x64emu_t*, uintptr_t, void*, void*, int32_t);
 typedef uintptr_t (*LFEpppp_t)(x64emu_t*, void*, void*, void*, void*);
 typedef uintptr_t (*LFuiCiu_t)(uint32_t, int32_t, uint8_t, int32_t, uint32_t);
+typedef uintptr_t (*LFLpppL_t)(uintptr_t, void*, void*, void*, uintptr_t);
 typedef uintptr_t (*LFpuipp_t)(void*, uint32_t, int32_t, void*, void*);
 typedef uintptr_t (*LFpuppi_t)(void*, uint32_t, void*, void*, int32_t);
 typedef uintptr_t (*LFpLuuu_t)(void*, uintptr_t, uint32_t, uint32_t, uint32_t);
@@ -4042,9 +4045,11 @@ void LFpLpL(x64emu_t *emu, uintptr_t fcn) { LFpLpL_t fn = (LFpLpL_t)fcn; R_RAX=(
 void LFpLpp(x64emu_t *emu, uintptr_t fcn) { LFpLpp_t fn = (LFpLpp_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (uintptr_t)R_RSI, (void*)R_RDX, (void*)R_RCX); }
 void LFppii(x64emu_t *emu, uintptr_t fcn) { LFppii_t fn = (LFppii_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (void*)R_RSI, (int32_t)R_RDX, (int32_t)R_RCX); }
 void LFppip(x64emu_t *emu, uintptr_t fcn) { LFppip_t fn = (LFppip_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (void*)R_RSI, (int32_t)R_RDX, (void*)R_RCX); }
+void LFppLu(x64emu_t *emu, uintptr_t fcn) { LFppLu_t fn = (LFppLu_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (void*)R_RSI, (uintptr_t)R_RDX, (uint32_t)R_RCX); }
 void LFppLL(x64emu_t *emu, uintptr_t fcn) { LFppLL_t fn = (LFppLL_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (void*)R_RSI, (uintptr_t)R_RDX, (uintptr_t)R_RCX); }
 void LFppLp(x64emu_t *emu, uintptr_t fcn) { LFppLp_t fn = (LFppLp_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (void*)R_RSI, (uintptr_t)R_RDX, (void*)R_RCX); }
 void LFpppi(x64emu_t *emu, uintptr_t fcn) { LFpppi_t fn = (LFpppi_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (void*)R_RSI, (void*)R_RDX, (int32_t)R_RCX); }
+void LFpppL(x64emu_t *emu, uintptr_t fcn) { LFpppL_t fn = (LFpppL_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (void*)R_RSI, (void*)R_RDX, (uintptr_t)R_RCX); }
 void LFpppp(x64emu_t *emu, uintptr_t fcn) { LFpppp_t fn = (LFpppp_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (void*)R_RSI, (void*)R_RDX, (void*)R_RCX); }
 void pFEipp(x64emu_t *emu, uintptr_t fcn) { pFEipp_t fn = (pFEipp_t)fcn; R_RAX=(uintptr_t)fn(emu, (int32_t)R_RDI, (void*)R_RSI, (void*)R_RDX); }
 void pFEupp(x64emu_t *emu, uintptr_t fcn) { pFEupp_t fn = (pFEupp_t)fcn; R_RAX=(uintptr_t)fn(emu, (uint32_t)R_RDI, (void*)R_RSI, (void*)R_RDX); }
@@ -4524,6 +4529,7 @@ void lFppLpp(x64emu_t *emu, uintptr_t fcn) { lFppLpp_t fn = (lFppLpp_t)fcn; R_RA
 void LFELppi(x64emu_t *emu, uintptr_t fcn) { LFELppi_t fn = (LFELppi_t)fcn; R_RAX=(uintptr_t)fn(emu, (uintptr_t)R_RDI, (void*)R_RSI, (void*)R_RDX, (int32_t)R_RCX); }
 void LFEpppp(x64emu_t *emu, uintptr_t fcn) { LFEpppp_t fn = (LFEpppp_t)fcn; R_RAX=(uintptr_t)fn(emu, (void*)R_RDI, (void*)R_RSI, (void*)R_RDX, (void*)R_RCX); }
 void LFuiCiu(x64emu_t *emu, uintptr_t fcn) { LFuiCiu_t fn = (LFuiCiu_t)fcn; R_RAX=(uintptr_t)fn((uint32_t)R_RDI, (int32_t)R_RSI, (uint8_t)R_RDX, (int32_t)R_RCX, (uint32_t)R_R8); }
+void LFLpppL(x64emu_t *emu, uintptr_t fcn) { LFLpppL_t fn = (LFLpppL_t)fcn; R_RAX=(uintptr_t)fn((uintptr_t)R_RDI, (void*)R_RSI, (void*)R_RDX, (void*)R_RCX, (uintptr_t)R_R8); }
 void LFpuipp(x64emu_t *emu, uintptr_t fcn) { LFpuipp_t fn = (LFpuipp_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (uint32_t)R_RSI, (int32_t)R_RDX, (void*)R_RCX, (void*)R_R8); }
 void LFpuppi(x64emu_t *emu, uintptr_t fcn) { LFpuppi_t fn = (LFpuppi_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (uint32_t)R_RSI, (void*)R_RDX, (void*)R_RCX, (int32_t)R_R8); }
 void LFpLuuu(x64emu_t *emu, uintptr_t fcn) { LFpLuuu_t fn = (LFpLuuu_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (uintptr_t)R_RSI, (uint32_t)R_RDX, (uint32_t)R_RCX, (uint32_t)R_R8); }
@@ -6785,9 +6791,11 @@ int isSimpleWrapper(wrapper_t fun) {
 	if (fun == &LFpLpp) return 1;
 	if (fun == &LFppii) return 1;
 	if (fun == &LFppip) return 1;
+	if (fun == &LFppLu) return 1;
 	if (fun == &LFppLL) return 1;
 	if (fun == &LFppLp) return 1;
 	if (fun == &LFpppi) return 1;
+	if (fun == &LFpppL) return 1;
 	if (fun == &LFpppp) return 1;
 	if (fun == &pFiiii) return 1;
 	if (fun == &pFiiiu) return 1;
@@ -7192,6 +7200,7 @@ int isSimpleWrapper(wrapper_t fun) {
 	if (fun == &lFppupp) return 1;
 	if (fun == &lFppLpp) return 1;
 	if (fun == &LFuiCiu) return 1;
+	if (fun == &LFLpppL) return 1;
 	if (fun == &LFpuipp) return 1;
 	if (fun == &LFpuppi) return 1;
 	if (fun == &LFpLuuu) return 1;
diff --git a/src/wrapped/generated/wrapper.h b/src/wrapped/generated/wrapper.h
index 24b12feb..57f7aae1 100644
--- a/src/wrapped/generated/wrapper.h
+++ b/src/wrapped/generated/wrapper.h
@@ -1143,9 +1143,11 @@ void LFpLpL(x64emu_t *emu, uintptr_t fnc);
 void LFpLpp(x64emu_t *emu, uintptr_t fnc);
 void LFppii(x64emu_t *emu, uintptr_t fnc);
 void LFppip(x64emu_t *emu, uintptr_t fnc);
+void LFppLu(x64emu_t *emu, uintptr_t fnc);
 void LFppLL(x64emu_t *emu, uintptr_t fnc);
 void LFppLp(x64emu_t *emu, uintptr_t fnc);
 void LFpppi(x64emu_t *emu, uintptr_t fnc);
+void LFpppL(x64emu_t *emu, uintptr_t fnc);
 void LFpppp(x64emu_t *emu, uintptr_t fnc);
 void pFEipp(x64emu_t *emu, uintptr_t fnc);
 void pFEupp(x64emu_t *emu, uintptr_t fnc);
@@ -1625,6 +1627,7 @@ void lFppLpp(x64emu_t *emu, uintptr_t fnc);
 void LFELppi(x64emu_t *emu, uintptr_t fnc);
 void LFEpppp(x64emu_t *emu, uintptr_t fnc);
 void LFuiCiu(x64emu_t *emu, uintptr_t fnc);
+void LFLpppL(x64emu_t *emu, uintptr_t fnc);
 void LFpuipp(x64emu_t *emu, uintptr_t fnc);
 void LFpuppi(x64emu_t *emu, uintptr_t fnc);
 void LFpLuuu(x64emu_t *emu, uintptr_t fnc);
diff --git a/src/wrapped/wrappedgmp.c b/src/wrapped/wrappedgmp.c
index e29da8e9..731d2d8c 100644
--- a/src/wrapped/wrappedgmp.c
+++ b/src/wrapped/wrappedgmp.c
@@ -11,8 +11,146 @@
 #include "bridge.h"
 #include "librarian/library_private.h"
 #include "x64emu.h"
+#include "emu/x64emu_private.h"
+#include "callback.h"
+#include "librarian.h"
+#include "box64context.h"
+#include "emu/x64emu_private.h"
+#include "callback.h"
 
 const char* gmpName = "libgmp.so.10";
 #define LIBNAME gmp
 
+#include "generated/wrappedgmptypes.h"
+
+#include "wrappercallback.h"
+
+// utility functions
+#define SUPER() \
+GO(0)   \
+GO(1)   \
+GO(2)   \
+GO(3)   \
+GO(4)
+
+// alloc_func
+#define GO(A)   \
+static uintptr_t my_alloc_func_fct_##A = 0;                         \
+static void* my_alloc_func_##A(size_t a)                            \
+{                                                                   \
+    return (void*)RunFunctionFmt(my_alloc_func_fct_##A, "L", a);    \
+}
+SUPER()
+#undef GO
+static void* find_alloc_func_Fct(void* fct)
+{
+    if(!fct) return NULL;
+    void* p;
+    if((p = GetNativeFnc((uintptr_t)fct))) return p;
+    #define GO(A) if(my_alloc_func_fct_##A == (uintptr_t)fct) return my_alloc_func_##A;
+    SUPER()
+    #undef GO
+    #define GO(A) if(my_alloc_func_fct_##A == 0) {my_alloc_func_fct_##A = (uintptr_t)fct; return my_alloc_func_##A; }
+    SUPER()
+    #undef GO
+    printf_log(LOG_NONE, "Warning, no more slot for libgmp.so.10 alloc_func callback\n");
+    return NULL;
+}
+static void* reverse_alloc_func_Fct(void* fct)
+{
+    if(!fct) return fct;
+    if(CheckBridged(my_lib->w.bridge, fct))
+        return (void*)CheckBridged(my_lib->w.bridge, fct);
+    #define GO(A) if(my_alloc_func_##A == fct) return (void*)my_alloc_func_fct_##A;
+    SUPER()
+    #undef GO
+    return (void*)AddBridge(my_lib->w.bridge, pFL, fct, 0, NULL);
+}
+// realloc_func
+#define GO(A)   \
+static uintptr_t my_realloc_func_fct_##A = 0;                           \
+static void* my_realloc_func_##A(void* a, size_t b)                     \
+{                                                                       \
+    return (void*)RunFunctionFmt(my_realloc_func_fct_##A, "pL", a, b);  \
+}
+SUPER()
+#undef GO
+static void* find_realloc_func_Fct(void* fct)
+{
+    if(!fct) return NULL;
+    void* p;
+    if((p = GetNativeFnc((uintptr_t)fct))) return p;
+    #define GO(A) if(my_realloc_func_fct_##A == (uintptr_t)fct) return my_realloc_func_##A;
+    SUPER()
+    #undef GO
+    #define GO(A) if(my_realloc_func_fct_##A == 0) {my_realloc_func_fct_##A = (uintptr_t)fct; return my_realloc_func_##A; }
+    SUPER()
+    #undef GO
+    printf_log(LOG_NONE, "Warning, no more slot for libgmp.so.10 realloc_func callback\n");
+    return NULL;
+}
+static void* reverse_realloc_func_Fct(void* fct)
+{
+    if(!fct) return fct;
+    if(CheckBridged(my_lib->w.bridge, fct))
+        return (void*)CheckBridged(my_lib->w.bridge, fct);
+    #define GO(A) if(my_realloc_func_##A == fct) return (void*)my_realloc_func_fct_##A;
+    SUPER()
+    #undef GO
+    return (void*)AddBridge(my_lib->w.bridge, pFpL, fct, 0, NULL);
+}
+// free_func
+#define GO(A)   \
+static uintptr_t my_free_func_fct_##A = 0;          \
+static void my_free_func_##A(void* a)               \
+{                                                   \
+    RunFunctionFmt(my_free_func_fct_##A, "p", a);   \
+}
+SUPER()
+#undef GO
+static void* find_free_func_Fct(void* fct)
+{
+    if(!fct) return NULL;
+    void* p;
+    if((p = GetNativeFnc((uintptr_t)fct))) return p;
+    #define GO(A) if(my_free_func_fct_##A == (uintptr_t)fct) return my_free_func_##A;
+    SUPER()
+    #undef GO
+    #define GO(A) if(my_free_func_fct_##A == 0) {my_free_func_fct_##A = (uintptr_t)fct; return my_free_func_##A; }
+    SUPER()
+    #undef GO
+    printf_log(LOG_NONE, "Warning, no more slot for libgmp.so.10 free_func callback\n");
+    return NULL;
+}
+static void* reverse_free_func_Fct(void* fct)
+{
+    if(!fct) return fct;
+    if(CheckBridged(my_lib->w.bridge, fct))
+        return (void*)CheckBridged(my_lib->w.bridge, fct);
+    #define GO(A) if(my_free_func_##A == fct) return (void*)my_free_func_fct_##A;
+    SUPER()
+    #undef GO
+    return (void*)AddBridge(my_lib->w.bridge, vFp, fct, 0, NULL);
+}
+
+#undef SUPER
+
+EXPORT void my___gmp_get_memory_functions(x64emu_t* emu, void** f_alloc, void** f_realloc, void** f_free)
+{
+    my->__gmp_get_memory_functions(f_alloc, f_realloc, f_free);
+    *f_alloc = reverse_alloc_func_Fct(*f_alloc);
+    *f_realloc = reverse_realloc_func_Fct(*f_realloc);
+    *f_free = reverse_free_func_Fct(*f_free);
+}
+EXPORT void my___gmp_set_memory_functions(x64emu_t* emu, void* f_alloc, void* f_realloc, void* f_free)
+{
+    my->__gmp_set_memory_functions(find_alloc_func_Fct(f_alloc), find_realloc_func_Fct(f_realloc), find_free_func_Fct(f_free));
+}
+
+#define CUSTOM_INIT \
+    getMy(lib);
+
+#define CUSTOM_FINI \
+    freeMy();
+
 #include "wrappedlib_init.h"
diff --git a/src/wrapped/wrappedgmp_private.h b/src/wrapped/wrappedgmp_private.h
index 1a28497d..3aa119b0 100644
--- a/src/wrapped/wrappedgmp_private.h
+++ b/src/wrapped/wrappedgmp_private.h
@@ -2,6 +2,8 @@
 #error meh!
 #endif
 
+// mp_bitcnt_t unsigned long int
+
 //DATA(__gmp_allocate_func, 
 //GO(__gmp_asprintf, 
 //GO(__gmp_asprintf_final, 
@@ -95,7 +97,7 @@
 //GO(__gmpf_ui_div, 
 //GO(__gmpf_ui_sub, 
 //GO(__gmpf_urandomb, 
-//GO(__gmp_get_memory_functions, 
+GOM(__gmp_get_memory_functions, vFEppp)
 //GO(__gmp_init_primesieve, 
 //GO(__gmp_invalid_operation, 
 //DATAB(__gmp_junk, 
@@ -107,8 +109,8 @@
 //GO(__gmpn_add_err3_n, 
 //GO(__gmpn_addlsh1_n, 
 //GO(__gmpn_addlsh2_n, 
-//GO(__gmpn_addmul_1, 
-//GO(__gmpn_add_n, 
+GO(__gmpn_addmul_1, LFppLL)
+GO(__gmpn_add_n, LFpppL)
 //GO(__gmpn_add_nc, 
 //GO(__gmpn_add_n_sub_n, 
 //GO(__gmpn_and_n, 
@@ -129,13 +131,13 @@
 //GO(__gmpn_bsqrt, 
 //GO(__gmpn_bsqrtinv, 
 //GO(__gmpn_cmp, 
-//GO(__gmpn_cnd_add_n, 
-//GO(__gmpn_cnd_sub_n, 
+GO(__gmpn_cnd_add_n, LFLpppL)
+GO(__gmpn_cnd_sub_n, LFLpppL)
 //GO(__gmpn_cnd_swap, 
 //GO(__gmpn_com, 
 //GO(__gmpn_compute_powtab, 
-//GO(__gmpn_copyd, 
-//GO(__gmpn_copyi, 
+GO(__gmpn_copyd, vFppL)
+GO(__gmpn_copyi, vFppL)
 //GO(__gmpn_dcpi1_bdiv_q, 
 //GO(__gmpn_dcpi1_bdiv_qr, 
 //GO(__gmpn_dcpi1_bdiv_qr_n, 
@@ -229,7 +231,7 @@
 //GO(__gmpn_mu_div_qr, 
 //GO(__gmpn_mu_div_qr_itch, 
 //GO(__gmpn_mul, 
-//GO(__gmpn_mul_1, 
+GO(__gmpn_mul_1, LFppLL)
 //GO(__gmpn_mul_1c, 
 //GO(__gmpn_mul_basecase, 
 //GO(__gmpn_mul_fft, 
@@ -240,14 +242,14 @@
 //GO(__gmpn_mulmid_n, 
 //GO(__gmpn_mulmod_bnm1, 
 //GO(__gmpn_mulmod_bnm1_next_size, 
-//GO(__gmpn_mul_n, 
+GO(__gmpn_mul_n, vFpppL)
 //GO(__gmpn_nand_n, 
 //GO(__gmpn_neg, 
 //GO(__gmpn_ni_invertappr, 
 //GO(__gmpn_nior_n, 
 //GO(__gmpn_nussbaumer_mul, 
 //GO(__gmpn_perfect_power_p, 
-//GO(__gmpn_perfect_square_p, 
+GO(__gmpn_perfect_square_p, iFpL)
 //GO(__gmpn_pi1_bdiv_q_1, 
 //GO(__gmpn_popcount, 
 //GO(__gmpn_pow_1, 
@@ -268,7 +270,7 @@
 //GO(__gmpn_rsblsh2_n, 
 //GO(__gmpn_rsh1add_n, 
 //GO(__gmpn_rsh1sub_n, 
-//GO(__gmpn_rshift, 
+GO(__gmpn_rshift, LFppLu)
 //GO(__gmpn_sbpi1_bdiv_q, 
 //GO(__gmpn_sbpi1_bdiv_qr, 
 //GO(__gmpn_sbpi1_bdiv_r, 
@@ -298,7 +300,7 @@
 //GO(__gmpn_sec_tabselect, 
 //GO(__gmpn_set_str, 
 //GO(__gmpn_sizeinbase, 
-//GO(__gmpn_sqr, 
+GO(__gmpn_sqr, vFppL)
 //GO(__gmpn_sqr_basecase, 
 //GO(__gmpn_sqr_diag_addlsh1, 
 //GO(__gmpn_sqrlo, 
@@ -314,8 +316,8 @@
 //GO(__gmpn_sub_err3_n, 
 //GO(__gmpn_sublsh1_n, 
 //GO(__gmpn_sublsh2_n, 
-//GO(__gmpn_submul_1, 
-//GO(__gmpn_sub_n, 
+GO(__gmpn_submul_1, LFppLL)
+GO(__gmpn_sub_n, LFpppL)
 //GO(__gmpn_sub_nc, 
 //GO(__gmpn_tdiv_qr, 
 //GO(__gmpn_toom22_mul, 
@@ -353,7 +355,7 @@
 //GO(__gmpn_trialdiv, 
 //GO(__gmpn_xnor_n, 
 //GO(__gmpn_xor_n, 
-//GO(__gmpn_zero, 
+GO(__gmpn_zero, vFpL)
 //GO(__gmpn_zero_p, 
 //GO(__gmp_obstack_printf, 
 //DATA(__gmp_obstack_printf_funs, 
@@ -412,7 +414,7 @@
 //DATAB(__gmp_rands_initialized, 
 //DATA(__gmp_reallocate_func, 
 //GO(__gmp_scanf, 
-//GO(__gmp_set_memory_functions, 
+GOM(__gmp_set_memory_functions, vFEppp)
 //GO(__gmp_snprintf, 
 //DATA(__gmp_snprintf_funs, 
 //GO(__gmp_sprintf, 
@@ -435,16 +437,16 @@
 //GO(__gmp_vsscanf, 
 //GO(__gmpz_2fac_ui, 
 //GO(__gmpz_abs, 
-//GO(__gmpz_add, 
+GO(__gmpz_add, vFppp)
 //GO(__gmpz_addmul, 
 //GO(__gmpz_addmul_ui, 
-//GO(__gmpz_add_ui, 
+GO(__gmpz_add_ui, vFppL)
 //GO(__gmpz_and, 
 //GO(__gmpz_aorsmul_1, 
 //GO(__gmpz_array_init, 
 //GO(__gmpz_bin_ui, 
 //GO(__gmpz_bin_uiui, 
-//GO(__gmpz_cdiv_q, 
+GO(__gmpz_cdiv_q, vFppp)
 //GO(__gmpz_cdiv_q_2exp, 
 //GO(__gmpz_cdiv_qr, 
 //GO(__gmpz_cdiv_qr_ui, 
@@ -463,10 +465,10 @@ GO(__gmpz_cmp, iFpp)
 //GO(__gmpz_cmp_d, 
 //GO(__gmpz_cmp_si, 
 GO(__gmpz_cmp_ui, iFpu)
-//GO(__gmpz_com, 
+GO(__gmpz_com, vFpp)
 //GO(__gmpz_combit, 
 //GO(__gmpz_congruent_2exp_p, 
-//GO(__gmpz_congruent_p, 
+GO(__gmpz_congruent_p, iFppp)
 //GO(__gmpz_congruent_ui_p, 
 //GO(__gmpz_divexact, 
 //GO(__gmpz_divexact_gcd, 
@@ -477,13 +479,13 @@ GO(__gmpz_cmp_ui, iFpu)
 //GO(__gmpz_dump, 
 GO(__gmpz_export, vFppiLiLp)
 //GO(__gmpz_fac_ui, 
-//GO(__gmpz_fdiv_q, 
-//GO(__gmpz_fdiv_q_2exp, 
+GO(__gmpz_fdiv_q, vFppp)
+GO(__gmpz_fdiv_q_2exp, vFppL)
 //GO(__gmpz_fdiv_qr, 
 //GO(__gmpz_fdiv_qr_ui, 
 //GO(__gmpz_fdiv_q_ui, 
-//GO(__gmpz_fdiv_r, 
-//GO(__gmpz_fdiv_r_2exp, 
+GO(__gmpz_fdiv_r, vFppp)
+GO(__gmpz_fdiv_r_2exp, vFppL)
 //GO(__gmpz_fdiv_r_ui, 
 //GO(__gmpz_fdiv_ui, 
 //GO(__gmpz_fib2_ui, 
@@ -494,7 +496,7 @@ GO(__gmpz_export, vFppiLiLp)
 //GO(__gmpz_fits_uint_p, 
 //GO(__gmpz_fits_ulong_p, 
 //GO(__gmpz_fits_ushort_p, 
-//GO(__gmpz_gcd, 
+GO(__gmpz_gcd, vFppp)
 //GO(__gmpz_gcdext, 
 //GO(__gmpz_gcd_ui, 
 //GO(__gmpz_get_d, 
@@ -508,15 +510,15 @@ GO(__gmpz_import, vFpLiLiLp)
 GO(__gmpz_init, vFp)
 //GO(__gmpz_init2, 
 //GO(__gmpz_inits, 
-//GO(__gmpz_init_set, 
+GO(__gmpz_init_set, vFpp)
 //GO(__gmpz_init_set_d, 
 //GO(__gmpz_init_set_si, 
 //GO(__gmpz_init_set_str, 
-//GO(__gmpz_init_set_ui, 
+GO(__gmpz_init_set_ui, vFpL)
 //GO(__gmpz_inp_raw, 
 //GO(__gmpz_inp_str, 
 //GO(__gmpz_inp_str_nowhite, 
-//GO(__gmpz_invert, 
+GO(__gmpz_invert, iFppp)
 //GO(__gmpz_ior, 
 //GO(__gmpz_jacobi, 
 //GO(__gmpz_kronecker_si, 
@@ -524,20 +526,20 @@ GO(__gmpz_init, vFp)
 //GO(__gmpz_lcm, 
 //GO(__gmpz_lcm_ui, 
 //GO(__gmpz_legendre, 
-//GO(__gmpz_limbs_finish, 
-//GO(__gmpz_limbs_modify, 
-//GO(__gmpz_limbs_read, 
-//GO(__gmpz_limbs_write, 
+GO(__gmpz_limbs_finish, vFpL)
+GO(__gmpz_limbs_modify, pFpL)
+GO(__gmpz_limbs_read, pFp)
+GO(__gmpz_limbs_write, pFpL)
 //GO(__gmpz_lucas_mod, 
 //GO(__gmpz_lucnum2_ui, 
 //GO(__gmpz_lucnum_ui, 
 //GO(__gmpz_mfac_uiui, 
 //GO(__gmpz_millerrabin, 
 GO(__gmpz_mod, vFppp)
-//GO(__gmpz_mul, 
-//GO(__gmpz_mul_2exp, 
+GO(__gmpz_mul, vFppp)
+GO(__gmpz_mul_2exp, vFppL)
 //GO(__gmpz_mul_si, 
-//GO(__gmpz_mul_ui, 
+GO(__gmpz_mul_ui, vFppL)
 //GO(__gmpz_neg, 
 //GO(__gmpz_nextprime, 
 //GO(__gmpz_n_pow_ui, 
@@ -548,52 +550,52 @@ GO(__gmpz_mod, vFppp)
 //GO(__gmpz_perfect_square_p, 
 //GO(__gmpz_popcount, 
 GO(__gmpz_powm, vFpppp)
-//GO(__gmpz_powm_sec, 
-//GO(__gmpz_powm_ui, 
+GO(__gmpz_powm_sec, vFpppp)
+GO(__gmpz_powm_ui, vFppLp)
 //GO(__gmpz_pow_ui, 
 //GO(__gmpz_primorial_ui, 
-//GO(__gmpz_probab_prime_p, 
+GO(__gmpz_probab_prime_p, iFpi)
 //GO(__gmpz_prodlimbs, 
 //GO(__gmpz_random, 
 //GO(__gmpz_random2, 
 //GO(__gmpz_realloc, 
 //GO(__gmpz_realloc2, 
 //GO(__gmpz_remove, 
-//GO(__gmpz_roinit_n, 
+GO(__gmpz_roinit_n, pFppL)
 //GO(__gmpz_root, 
 //GO(__gmpz_rootrem, 
 //GO(__gmpz_rrandomb, 
 //GO(__gmpz_scan0, 
-//GO(__gmpz_scan1, 
-//GO(__gmpz_set, 
-//GO(__gmpz_setbit, 
+GO(__gmpz_scan1, LFpL)
+GO(__gmpz_set, vFpp)
+GO(__gmpz_setbit, vFpL)
 //GO(__gmpz_set_d, 
 //GO(__gmpz_set_f, 
 //GO(__gmpz_set_q, 
 //GO(__gmpz_set_si, 
 //GO(__gmpz_set_str, 
-//GO(__gmpz_set_ui, 
+GO(__gmpz_set_ui, vFpL)
 //GO(__gmpz_si_kronecker, 
 //GO(__gmpz_size, 
 GO(__gmpz_sizeinbase, LFpi)
 //GO(__gmpz_sqrt, 
 //GO(__gmpz_sqrtrem, 
 //GO(__gmpz_stronglucas, 
-//GO(__gmpz_sub, 
+GO(__gmpz_sub, vFppp)
 //GO(__gmpz_submul, 
-//GO(__gmpz_submul_ui, 
+GO(__gmpz_submul_ui, vFppL)
 GO(__gmpz_sub_ui, vFppu)
 //GO(__gmpz_swap, 
 //GO(__gmpz_tdiv_q, 
-//GO(__gmpz_tdiv_q_2exp, 
-//GO(__gmpz_tdiv_qr, 
+GO(__gmpz_tdiv_q_2exp, vFppL)
+GO(__gmpz_tdiv_qr, vFpppp)
 //GO(__gmpz_tdiv_qr_ui, 
 //GO(__gmpz_tdiv_q_ui, 
 //GO(__gmpz_tdiv_r, 
 //GO(__gmpz_tdiv_r_2exp, 
 //GO(__gmpz_tdiv_r_ui, 
 //GO(__gmpz_tdiv_ui, 
-//GO(__gmpz_tstbit, 
+GO(__gmpz_tstbit, iFpL)
 //GO(__gmpz_ui_kronecker, 
 //GO(__gmpz_ui_pow_ui, 
 //GO(__gmpz_ui_sub,