about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2021-03-06 11:32:49 +0100
committerptitSeb <sebastien.chev@gmail.com>2021-03-06 11:32:49 +0100
commitaba24babeafbfa8d834cc0ac214865bb214540fd (patch)
treed4789576910cbe0dfed7f44d568349bb43d50e99 /src
parentef46db650e1b9294a964aae62e1f4426756cd1c1 (diff)
downloadbox64-aba24babeafbfa8d834cc0ac214865bb214540fd.tar.gz
box64-aba24babeafbfa8d834cc0ac214865bb214540fd.zip
Added wrapped malloc function
Diffstat (limited to 'src')
-rw-r--r--src/wrapped/generated/functions_list.txt1
-rw-r--r--src/wrapped/generated/wrapper.c2
-rw-r--r--src/wrapped/generated/wrapper.h1
-rwxr-xr-xsrc/wrapped/wrappedlibc_private.h2
4 files changed, 5 insertions, 1 deletions
diff --git a/src/wrapped/generated/functions_list.txt b/src/wrapped/generated/functions_list.txt
index f9ed2567..857dc935 100644
--- a/src/wrapped/generated/functions_list.txt
+++ b/src/wrapped/generated/functions_list.txt
@@ -18,6 +18,7 @@
 #() lFp
 #() LFv
 #() pFE
+#() pFL
 #() pFp
 #() vFEp
 #() vFpp
diff --git a/src/wrapped/generated/wrapper.c b/src/wrapped/generated/wrapper.c
index 0a0b5ce4..f991d938 100644
--- a/src/wrapped/generated/wrapper.c
+++ b/src/wrapped/generated/wrapper.c
@@ -89,6 +89,7 @@ typedef double (*dFp_t)(void*);
 typedef intptr_t (*lFp_t)(void*);
 typedef uintptr_t (*LFv_t)(void);
 typedef void* (*pFE_t)(x64emu_t*);
+typedef void* (*pFL_t)(uintptr_t);
 typedef void* (*pFp_t)(void*);
 typedef void (*vFEp_t)(x64emu_t*, void*);
 typedef void (*vFpp_t)(void*, void*);
@@ -164,6 +165,7 @@ void dFp(x64emu_t *emu, uintptr_t fcn) { dFp_t fn = (dFp_t)fcn; emu->xmm[0].d[0]
 void lFp(x64emu_t *emu, uintptr_t fcn) { lFp_t fn = (lFp_t)fcn; R_RAX=(intptr_t)fn((void*)R_RDI); }
 void LFv(x64emu_t *emu, uintptr_t fcn) { LFv_t fn = (LFv_t)fcn; R_RAX=(uintptr_t)fn(); }
 void pFE(x64emu_t *emu, uintptr_t fcn) { pFE_t fn = (pFE_t)fcn; R_RAX=(uintptr_t)fn(emu); }
+void pFL(x64emu_t *emu, uintptr_t fcn) { pFL_t fn = (pFL_t)fcn; R_RAX=(uintptr_t)fn((uintptr_t)R_RDI); }
 void pFp(x64emu_t *emu, uintptr_t fcn) { pFp_t fn = (pFp_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI); }
 void vFEp(x64emu_t *emu, uintptr_t fcn) { vFEp_t fn = (vFEp_t)fcn; fn(emu, (void*)R_RDI); }
 void vFpp(x64emu_t *emu, uintptr_t fcn) { vFpp_t fn = (vFpp_t)fcn; fn((void*)R_RDI, (void*)R_RSI); }
diff --git a/src/wrapped/generated/wrapper.h b/src/wrapped/generated/wrapper.h
index 00897837..64a1cd88 100644
--- a/src/wrapped/generated/wrapper.h
+++ b/src/wrapped/generated/wrapper.h
@@ -50,6 +50,7 @@ void dFp(x64emu_t *emu, uintptr_t fnc);
 void lFp(x64emu_t *emu, uintptr_t fnc);
 void LFv(x64emu_t *emu, uintptr_t fnc);
 void pFE(x64emu_t *emu, uintptr_t fnc);
+void pFL(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);
diff --git a/src/wrapped/wrappedlibc_private.h b/src/wrapped/wrappedlibc_private.h
index 59370941..c26b9d65 100755
--- a/src/wrapped/wrappedlibc_private.h
+++ b/src/wrapped/wrappedlibc_private.h
@@ -1088,7 +1088,7 @@ GOM(__libc_start_main, iFEpippppp)
 //GOW(madvise, 
 //GOW(makecontext, 
 //GOW(mallinfo, 
-//GO(malloc, 
+GO(malloc, pFL) // need to wrap to clear allocated memory?
 //GO(malloc_get_state, 
 //GOW(malloc_info, 
 //GO(malloc_set_state,