about summary refs log tree commit diff stats
path: root/src/wrapped
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2021-03-03 17:32:24 +0100
committerptitSeb <sebastien.chev@gmail.com>2021-03-03 17:32:24 +0100
commitbe17349a5d8e2ea323a793384b43653e3e9c22a6 (patch)
tree4b856b728da01c04f6d822887a2ce1e602730b1f /src/wrapped
parent9aabe9c97fecb77f70361e0e0df8380f1489fc81 (diff)
downloadbox64-be17349a5d8e2ea323a793384b43653e3e9c22a6.tar.gz
box64-be17349a5d8e2ea323a793384b43653e3e9c22a6.zip
Added some X86_64 RelocA and a few wrapped function (wrapper still not correct anyway)
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.c8
-rwxr-xr-xsrc/wrapped/wrappedlibc_private.h8
5 files changed, 26 insertions, 6 deletions
diff --git a/src/wrapped/generated/functions_list.txt b/src/wrapped/generated/functions_list.txt
index 357ab0bd..69ac3d89 100644
--- a/src/wrapped/generated/functions_list.txt
+++ b/src/wrapped/generated/functions_list.txt
@@ -5,15 +5,18 @@
 #() lFp
 #() pFE
 #() pFp
+#() vFEp
 #() vFpp
 #() iFEp
 #() iFip
 #() iFup
 #() pFEp
+#() vFEpu
 #() iFEpp
 #() iFpiu
 #() pFEpi
 #() pFEpp
+#() vFEpup
 #() iFEupp
 #() iFEpip
 #() iFEppp
@@ -21,4 +24,5 @@
 #() pFEppi
 #() pFEppp
 #() iFipppi
+#() iFEpippppp
 #() pFEv -> pFE
diff --git a/src/wrapped/generated/wrapper.c b/src/wrapped/generated/wrapper.c
index 1b34a0d7..d24d62c8 100644
--- a/src/wrapped/generated/wrapper.c
+++ b/src/wrapped/generated/wrapper.c
@@ -76,15 +76,18 @@ typedef int32_t (*iFp_t)(void*);
 typedef intptr_t (*lFp_t)(void*);
 typedef void* (*pFE_t)(x64emu_t*);
 typedef void* (*pFp_t)(void*);
+typedef void (*vFEp_t)(x64emu_t*, void*);
 typedef void (*vFpp_t)(void*, void*);
 typedef int32_t (*iFEp_t)(x64emu_t*, void*);
 typedef int32_t (*iFip_t)(int32_t, void*);
 typedef int32_t (*iFup_t)(uint32_t, void*);
 typedef void* (*pFEp_t)(x64emu_t*, void*);
+typedef void (*vFEpu_t)(x64emu_t*, void*, uint32_t);
 typedef int32_t (*iFEpp_t)(x64emu_t*, void*, void*);
 typedef int32_t (*iFpiu_t)(void*, int32_t, uint32_t);
 typedef void* (*pFEpi_t)(x64emu_t*, void*, int32_t);
 typedef void* (*pFEpp_t)(x64emu_t*, void*, void*);
+typedef void (*vFEpup_t)(x64emu_t*, void*, uint32_t, void*);
 typedef int32_t (*iFEupp_t)(x64emu_t*, uint32_t, void*, void*);
 typedef int32_t (*iFEpip_t)(x64emu_t*, void*, int32_t, void*);
 typedef int32_t (*iFEppp_t)(x64emu_t*, void*, void*, void*);
@@ -92,6 +95,7 @@ typedef int32_t (*iFuipp_t)(uint32_t, int32_t, void*, void*);
 typedef void* (*pFEppi_t)(x64emu_t*, void*, void*, int32_t);
 typedef void* (*pFEppp_t)(x64emu_t*, void*, void*, void*);
 typedef int32_t (*iFipppi_t)(int32_t, void*, void*, void*, int32_t);
+typedef int32_t (*iFEpippppp_t)(x64emu_t*, void*, int32_t, void*, void*, void*, void*, void*);
 
 void vFE(x64emu_t *emu, uintptr_t fcn) { vFE_t fn = (vFE_t)fcn; fn(emu); }
 void vFv(x64emu_t *emu, uintptr_t fcn) { vFv_t fn = (vFv_t)fcn; fn(); }
@@ -100,15 +104,18 @@ void iFp(x64emu_t *emu, uintptr_t fcn) { iFp_t fn = (iFp_t)fcn; R_RAX=fn(*(void*
 void lFp(x64emu_t *emu, uintptr_t fcn) { lFp_t fn = (lFp_t)fcn; R_RAX=(intptr_t)fn(*(void**)(R_RSP + 4)); }
 void pFE(x64emu_t *emu, uintptr_t fcn) { pFE_t fn = (pFE_t)fcn; R_RAX=(uintptr_t)fn(emu); }
 void pFp(x64emu_t *emu, uintptr_t fcn) { pFp_t fn = (pFp_t)fcn; R_RAX=(uintptr_t)fn(*(void**)(R_RSP + 4)); }
+void vFEp(x64emu_t *emu, uintptr_t fcn) { vFEp_t fn = (vFEp_t)fcn; fn(emu, *(void**)(R_RSP + 4)); }
 void vFpp(x64emu_t *emu, uintptr_t fcn) { vFpp_t fn = (vFpp_t)fcn; fn(*(void**)(R_RSP + 4), *(void**)(R_RSP + 12)); }
 void iFEp(x64emu_t *emu, uintptr_t fcn) { iFEp_t fn = (iFEp_t)fcn; R_RAX=fn(emu, *(void**)(R_RSP + 4)); }
 void iFip(x64emu_t *emu, uintptr_t fcn) { iFip_t fn = (iFip_t)fcn; R_RAX=fn(*(int32_t*)(R_RSP + 4), *(void**)(R_RSP + 8)); }
 void iFup(x64emu_t *emu, uintptr_t fcn) { iFup_t fn = (iFup_t)fcn; R_RAX=fn(*(uint32_t*)(R_RSP + 4), *(void**)(R_RSP + 8)); }
 void pFEp(x64emu_t *emu, uintptr_t fcn) { pFEp_t fn = (pFEp_t)fcn; R_RAX=(uintptr_t)fn(emu, *(void**)(R_RSP + 4)); }
+void vFEpu(x64emu_t *emu, uintptr_t fcn) { vFEpu_t fn = (vFEpu_t)fcn; fn(emu, *(void**)(R_RSP + 4), *(uint32_t*)(R_RSP + 12)); }
 void iFEpp(x64emu_t *emu, uintptr_t fcn) { iFEpp_t fn = (iFEpp_t)fcn; R_RAX=fn(emu, *(void**)(R_RSP + 4), *(void**)(R_RSP + 12)); }
 void iFpiu(x64emu_t *emu, uintptr_t fcn) { iFpiu_t fn = (iFpiu_t)fcn; R_RAX=fn(*(void**)(R_RSP + 4), *(int32_t*)(R_RSP + 12), *(uint32_t*)(R_RSP + 16)); }
 void pFEpi(x64emu_t *emu, uintptr_t fcn) { pFEpi_t fn = (pFEpi_t)fcn; R_RAX=(uintptr_t)fn(emu, *(void**)(R_RSP + 4), *(int32_t*)(R_RSP + 12)); }
 void pFEpp(x64emu_t *emu, uintptr_t fcn) { pFEpp_t fn = (pFEpp_t)fcn; R_RAX=(uintptr_t)fn(emu, *(void**)(R_RSP + 4), *(void**)(R_RSP + 12)); }
+void vFEpup(x64emu_t *emu, uintptr_t fcn) { vFEpup_t fn = (vFEpup_t)fcn; fn(emu, *(void**)(R_RSP + 4), *(uint32_t*)(R_RSP + 12), *(void**)(R_RSP + 16)); }
 void iFEupp(x64emu_t *emu, uintptr_t fcn) { iFEupp_t fn = (iFEupp_t)fcn; R_RAX=fn(emu, *(uint32_t*)(R_RSP + 4), *(void**)(R_RSP + 8), *(void**)(R_RSP + 16)); }
 void iFEpip(x64emu_t *emu, uintptr_t fcn) { iFEpip_t fn = (iFEpip_t)fcn; R_RAX=fn(emu, *(void**)(R_RSP + 4), *(int32_t*)(R_RSP + 12), *(void**)(R_RSP + 16)); }
 void iFEppp(x64emu_t *emu, uintptr_t fcn) { iFEppp_t fn = (iFEppp_t)fcn; R_RAX=fn(emu, *(void**)(R_RSP + 4), *(void**)(R_RSP + 12), *(void**)(R_RSP + 20)); }
@@ -116,5 +123,6 @@ void iFuipp(x64emu_t *emu, uintptr_t fcn) { iFuipp_t fn = (iFuipp_t)fcn; R_RAX=f
 void pFEppi(x64emu_t *emu, uintptr_t fcn) { pFEppi_t fn = (pFEppi_t)fcn; R_RAX=(uintptr_t)fn(emu, *(void**)(R_RSP + 4), *(void**)(R_RSP + 12), *(int32_t*)(R_RSP + 20)); }
 void pFEppp(x64emu_t *emu, uintptr_t fcn) { pFEppp_t fn = (pFEppp_t)fcn; R_RAX=(uintptr_t)fn(emu, *(void**)(R_RSP + 4), *(void**)(R_RSP + 12), *(void**)(R_RSP + 20)); }
 void iFipppi(x64emu_t *emu, uintptr_t fcn) { iFipppi_t fn = (iFipppi_t)fcn; R_RAX=fn(*(int32_t*)(R_RSP + 4), *(void**)(R_RSP + 8), *(void**)(R_RSP + 16), *(void**)(R_RSP + 24), *(int32_t*)(R_RSP + 32)); }
+void iFEpippppp(x64emu_t *emu, uintptr_t fcn) { iFEpippppp_t fn = (iFEpippppp_t)fcn; R_RAX=fn(emu, *(void**)(R_RSP + 4), *(int32_t*)(R_RSP + 12), *(void**)(R_RSP + 16), *(void**)(R_RSP + 24), *(void**)(R_RSP + 32), *(void**)(R_RSP + 40), *(void**)(R_RSP + 48)); }
 
 void pFEv(x64emu_t *emu, uintptr_t fcn) { pFE_t fn = (pFE_t)fcn; R_RAX=(uintptr_t)fn(emu); }
diff --git a/src/wrapped/generated/wrapper.h b/src/wrapped/generated/wrapper.h
index 4700b365..6feb7f67 100644
--- a/src/wrapped/generated/wrapper.h
+++ b/src/wrapped/generated/wrapper.h
@@ -37,15 +37,18 @@ void iFp(x64emu_t *emu, uintptr_t fnc);
 void lFp(x64emu_t *emu, uintptr_t fnc);
 void pFE(x64emu_t *emu, uintptr_t fnc);
 void pFp(x64emu_t *emu, uintptr_t fnc);
+void vFEp(x64emu_t *emu, uintptr_t fnc);
 void vFpp(x64emu_t *emu, uintptr_t fnc);
 void iFEp(x64emu_t *emu, uintptr_t fnc);
 void iFip(x64emu_t *emu, uintptr_t fnc);
 void iFup(x64emu_t *emu, uintptr_t fnc);
 void pFEp(x64emu_t *emu, uintptr_t fnc);
+void vFEpu(x64emu_t *emu, uintptr_t fnc);
 void iFEpp(x64emu_t *emu, uintptr_t fnc);
 void iFpiu(x64emu_t *emu, uintptr_t fnc);
 void pFEpi(x64emu_t *emu, uintptr_t fnc);
 void pFEpp(x64emu_t *emu, uintptr_t fnc);
+void vFEpup(x64emu_t *emu, uintptr_t fnc);
 void iFEupp(x64emu_t *emu, uintptr_t fnc);
 void iFEpip(x64emu_t *emu, uintptr_t fnc);
 void iFEppp(x64emu_t *emu, uintptr_t fnc);
@@ -53,6 +56,7 @@ void iFuipp(x64emu_t *emu, uintptr_t fnc);
 void pFEppi(x64emu_t *emu, uintptr_t fnc);
 void pFEppp(x64emu_t *emu, uintptr_t fnc);
 void iFipppi(x64emu_t *emu, uintptr_t fnc);
+void iFEpippppp(x64emu_t *emu, uintptr_t fnc);
 
 void pFEv(x64emu_t *emu, uintptr_t fnc);
 
diff --git a/src/wrapped/wrappedlibc.c b/src/wrapped/wrappedlibc.c
index dce09009..dbd79dcc 100755
--- a/src/wrapped/wrappedlibc.c
+++ b/src/wrapped/wrappedlibc.c
@@ -393,7 +393,7 @@ void EXPORT my___gmon_start__(x64emu_t *emu)
 {
     printf_log(LOG_DEBUG, "__gmon_start__ called (dummy call)\n");
 }
-#if 0
+
 int EXPORT my___cxa_atexit(x64emu_t* emu, void* p, void* a, void* d)
 {
     AddCleanup1Arg(emu, p, a);
@@ -413,7 +413,7 @@ int EXPORT my_atexit(x64emu_t* emu, void *p)
     AddCleanup(emu, p);
     return 0;
 }
-
+#if 0
 int my_getcontext(x64emu_t* emu, void* ucp);
 int my_setcontext(x64emu_t* emu, void* ucp);
 int my_makecontext(x64emu_t* emu, void* ucp, void* fnc, int32_t argc, void* argv);
@@ -935,7 +935,7 @@ EXPORT int my_swprintf(x64emu_t* emu, void* s, uint32_t n, void* fmt, void *b)
     return r;
     #endif
 }
-
+#endif
 EXPORT void my__ITM_addUserCommitAction(x64emu_t* emu, void* cb, uint32_t b, void* c)
 {
     // disabled for now... Are all this _ITM_ stuff really mendatory?
@@ -952,7 +952,7 @@ EXPORT void my__ITM_addUserCommitAction(x64emu_t* emu, void* cb, uint32_t b, voi
 EXPORT void my__ITM_registerTMCloneTable(x64emu_t* emu, void* p, uint32_t s) {}
 EXPORT void my__ITM_deregisterTMCloneTable(x64emu_t* emu, void* p) {}
 
-
+#if 0
 struct i386_stat {
 	uint64_t  st_dev;
 	uint32_t  __pad1;
diff --git a/src/wrapped/wrappedlibc_private.h b/src/wrapped/wrappedlibc_private.h
index 4efac07b..bdeddf0d 100755
--- a/src/wrapped/wrappedlibc_private.h
+++ b/src/wrapped/wrappedlibc_private.h
@@ -178,7 +178,7 @@
 //GO(cuserid, 
 //GO(__cxa_atexit, 
 //GO(__cxa_at_quick_exit, 
-//GO(__cxa_finalize, 
+GOM(__cxa_finalize, vFEp)
 //GO(__cxa_thread_atexit_impl, 
 //GO(__cyg_profile_func_enter, 
 //GO(__cyg_profile_func_exit, 
@@ -1049,7 +1049,7 @@
 //GO(__libc_scratch_buffer_set_array_size, 
 //GOW(__libc_secure_getenv, 
 //GO(__libc_siglongjmp, 
-//GO(__libc_start_main, 
+GOM(__libc_start_main, iFEpippppp)
 //GO(__libc_system, 
 //GO(__libc_thread_freeres, 
 //GO(__libc_valloc, 
@@ -2234,5 +2234,9 @@ GOW(tzset, vFv)
 //GO(__xstat, 
 //GO(__xstat64, 
 
+GOM(_ITM_addUserCommitAction, vFEpup)
+GOM(_ITM_registerTMCloneTable, vFEpu)
+GOM(_ITM_deregisterTMCloneTable, vFEp)
+
 GOM(__register_frame_info, vFpp)    // faked function
 GOM(__deregister_frame_info, pFp)