about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2021-05-22 16:32:57 +0200
committerptitSeb <sebastien.chev@gmail.com>2021-05-22 16:32:57 +0200
commitfc5f5dab29c614a15a9cd96715ad70145f02eed5 (patch)
treeaa8179a6603087be497f65361af1d7296e46b8e1 /src
parent4be307820bab87e8bcd219b95ac0f5cb9b3acc3e (diff)
downloadbox64-fc5f5dab29c614a15a9cd96715ad70145f02eed5.tar.gz
box64-fc5f5dab29c614a15a9cd96715ad70145f02eed5.zip
Added a few libc wrapped functions
Diffstat (limited to 'src')
-rw-r--r--src/wrapped/generated/functions_list.txt1
-rw-r--r--src/wrapped/generated/wrapper.c3
-rw-r--r--src/wrapped/generated/wrapper.h1
-rwxr-xr-xsrc/wrapped/wrappedlibc_private.h4
4 files changed, 7 insertions, 2 deletions
diff --git a/src/wrapped/generated/functions_list.txt b/src/wrapped/generated/functions_list.txt
index 3bcbd35e..9a49e687 100644
--- a/src/wrapped/generated/functions_list.txt
+++ b/src/wrapped/generated/functions_list.txt
@@ -26,6 +26,7 @@
 #() IFd
 #() IFp
 #() WFi
+#() WFW
 #() WFp
 #() uFv
 #() uFi
diff --git a/src/wrapped/generated/wrapper.c b/src/wrapped/generated/wrapper.c
index f856f596..a6001235 100644
--- a/src/wrapped/generated/wrapper.c
+++ b/src/wrapped/generated/wrapper.c
@@ -60,6 +60,7 @@ typedef int64_t (*IFf_t)(float);
 typedef int64_t (*IFd_t)(double);
 typedef int64_t (*IFp_t)(void*);
 typedef uint16_t (*WFi_t)(int64_t);
+typedef uint16_t (*WFW_t)(uint16_t);
 typedef uint16_t (*WFp_t)(void*);
 typedef uint64_t (*uFv_t)(void);
 typedef uint64_t (*uFi_t)(int64_t);
@@ -1292,6 +1293,7 @@ void IFf(x64emu_t *emu, uintptr_t fcn) { IFf_t fn = (IFf_t)fcn; R_RAX=(int64_t)f
 void IFd(x64emu_t *emu, uintptr_t fcn) { IFd_t fn = (IFd_t)fcn; R_RAX=(int64_t)fn(emu->xmm[0].d[0]); }
 void IFp(x64emu_t *emu, uintptr_t fcn) { IFp_t fn = (IFp_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI); }
 void WFi(x64emu_t *emu, uintptr_t fcn) { WFi_t fn = (WFi_t)fcn; R_RAX=(unsigned short)fn((int64_t)R_RDI); }
+void WFW(x64emu_t *emu, uintptr_t fcn) { WFW_t fn = (WFW_t)fcn; R_RAX=(unsigned short)fn((uint16_t)R_RDI); }
 void WFp(x64emu_t *emu, uintptr_t fcn) { WFp_t fn = (WFp_t)fcn; R_RAX=(unsigned short)fn((void*)R_RDI); }
 void uFv(x64emu_t *emu, uintptr_t fcn) { uFv_t fn = (uFv_t)fcn; R_RAX=(uint64_t)fn(); }
 void uFi(x64emu_t *emu, uintptr_t fcn) { uFi_t fn = (uFi_t)fcn; R_RAX=(uint64_t)fn((int64_t)R_RDI); }
@@ -2532,6 +2534,7 @@ int isSimpleWrapper(wrapper_t fun) {
 	if (fun == &IFd) return 1;
 	if (fun == &IFp) return 1;
 	if (fun == &WFi) return 1;
+	if (fun == &WFW) return 1;
 	if (fun == &WFp) return 1;
 	if (fun == &uFv) return 1;
 	if (fun == &uFi) return 1;
diff --git a/src/wrapped/generated/wrapper.h b/src/wrapped/generated/wrapper.h
index 5e320dfa..fcd80506 100644
--- a/src/wrapped/generated/wrapper.h
+++ b/src/wrapped/generated/wrapper.h
@@ -56,6 +56,7 @@ 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 WFi(x64emu_t *emu, uintptr_t fnc);
+void WFW(x64emu_t *emu, uintptr_t fnc);
 void WFp(x64emu_t *emu, uintptr_t fnc);
 void uFv(x64emu_t *emu, uintptr_t fnc);
 void uFi(x64emu_t *emu, uintptr_t fnc);
diff --git a/src/wrapped/wrappedlibc_private.h b/src/wrapped/wrappedlibc_private.h
index 01588b74..c87009e2 100755
--- a/src/wrapped/wrappedlibc_private.h
+++ b/src/wrapped/wrappedlibc_private.h
@@ -1245,8 +1245,8 @@ GO(nrand48, lFp)
 //GO(__nss_passwd_lookup, 
 //GO(__nss_passwd_lookup2, 
 //GO(__nss_services_lookup2, 
-//GOW(ntohl, 
-//GOW(ntohs, 
+GOW(ntohl, uFu)
+GOW(ntohs, WFW)
 //GOW(ntp_adjtime, 
 //GO(ntp_gettime, 
 //GO(ntp_gettimex,