about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/include/auxval.h2
-rwxr-xr-xsrc/libtools/auxval.c24
-rw-r--r--src/wrapped/generated/functions_list.txt3
-rw-r--r--src/wrapped/generated/wrappedlibctypes.h2
-rw-r--r--src/wrapped/generated/wrapper.c2
-rw-r--r--src/wrapped/generated/wrapper.h1
-rwxr-xr-xsrc/wrapped/wrappedlibc_private.h2
7 files changed, 22 insertions, 14 deletions
diff --git a/src/include/auxval.h b/src/include/auxval.h
index 6688d78f..d622509e 100755
--- a/src/include/auxval.h
+++ b/src/include/auxval.h
@@ -8,6 +8,6 @@ int init_auxval(int argc, const char **argv, const char **env);
 #endif
 
 unsigned long real_getauxval(unsigned long type);
-//unsigned long my_getauxval(x64emu_t* emu, unsigned long type);
+unsigned long my_getauxval(x64emu_t* emu, unsigned long type);
 
 #endif //__AUXVAL_H__
\ No newline at end of file
diff --git a/src/libtools/auxval.c b/src/libtools/auxval.c
index 82c6fd35..e1cc87b0 100755
--- a/src/libtools/auxval.c
+++ b/src/libtools/auxval.c
@@ -15,8 +15,8 @@
 
 #include "box64context.h"
 #include "debug.h"
-//#include "x64emu.h"
-//#include "emu/x64emu_private.h"
+#include "x64emu.h"
+#include "emu/x64emu_private.h"
 #include "box64stack.h"
 #include "auxval.h"
 
@@ -49,13 +49,13 @@ unsigned long real_getauxval(unsigned long type)
     return 0;
 }
 
-//EXPORT unsigned long my_getauxval(x64emu_t* emu, unsigned long type)
-//{
-//    uintptr_t* p = emu->context->auxval_start;
-//    while(*p) {
-//        if(*p == type)
-//            return p[1];
-//        p+=2;
-//    }
-//    return 0;
-//}
+EXPORT unsigned long my_getauxval(x64emu_t* emu, unsigned long type)
+{
+    uintptr_t* p = emu->context->auxval_start;
+    while(*p) {
+        if(*p == type)
+            return p[1];
+        p+=2;
+    }
+    return 0;
+}
diff --git a/src/wrapped/generated/functions_list.txt b/src/wrapped/generated/functions_list.txt
index 332938c9..43c4e3f2 100644
--- a/src/wrapped/generated/functions_list.txt
+++ b/src/wrapped/generated/functions_list.txt
@@ -165,6 +165,7 @@
 #() lFll
 #() lFpi
 #() lFpp
+#() LFEL
 #() LFii
 #() LFLi
 #() LFLp
@@ -1403,6 +1404,8 @@ wrappedlibc:
   - fork
 - LFv:
   - syscall
+- LFL:
+  - getauxval
 - vFpi:
   - __longjmp_chk
   - _longjmp
diff --git a/src/wrapped/generated/wrappedlibctypes.h b/src/wrapped/generated/wrappedlibctypes.h
index 5473f51a..db4289cf 100644
--- a/src/wrapped/generated/wrappedlibctypes.h
+++ b/src/wrapped/generated/wrappedlibctypes.h
@@ -16,6 +16,7 @@ typedef void (*vFp_t)(void*);
 typedef int64_t (*iFp_t)(void*);
 typedef intptr_t (*lFv_t)(void);
 typedef uintptr_t (*LFv_t)(void);
+typedef uintptr_t (*LFL_t)(uintptr_t);
 typedef void (*vFpi_t)(void*, int64_t);
 typedef void (*vFpu_t)(void*, uint64_t);
 typedef int64_t (*iFpi_t)(void*, int64_t);
@@ -72,6 +73,7 @@ typedef int64_t (*iFpippppp_t)(void*, int64_t, void*, void*, void*, void*, void*
 	GO(setjmp, iFp_t) \
 	GO(fork, lFv_t) \
 	GO(syscall, LFv_t) \
+	GO(getauxval, LFL_t) \
 	GO(__longjmp_chk, vFpi_t) \
 	GO(_longjmp, vFpi_t) \
 	GO(longjmp, vFpi_t) \
diff --git a/src/wrapped/generated/wrapper.c b/src/wrapped/generated/wrapper.c
index 185d2ad8..14861a6c 100644
--- a/src/wrapped/generated/wrapper.c
+++ b/src/wrapped/generated/wrapper.c
@@ -199,6 +199,7 @@ typedef double (*dFpp_t)(void*, void*);
 typedef intptr_t (*lFll_t)(intptr_t, intptr_t);
 typedef intptr_t (*lFpi_t)(void*, int64_t);
 typedef intptr_t (*lFpp_t)(void*, void*);
+typedef uintptr_t (*LFEL_t)(x64emu_t*, uintptr_t);
 typedef uintptr_t (*LFii_t)(int64_t, int64_t);
 typedef uintptr_t (*LFLi_t)(uintptr_t, int64_t);
 typedef uintptr_t (*LFLp_t)(uintptr_t, void*);
@@ -1496,6 +1497,7 @@ void dFpp(x64emu_t *emu, uintptr_t fcn) { dFpp_t fn = (dFpp_t)fcn; emu->xmm[0].d
 void lFll(x64emu_t *emu, uintptr_t fcn) { lFll_t fn = (lFll_t)fcn; R_RAX=(intptr_t)fn((intptr_t)R_RDI, (intptr_t)R_RSI); }
 void lFpi(x64emu_t *emu, uintptr_t fcn) { lFpi_t fn = (lFpi_t)fcn; R_RAX=(intptr_t)fn((void*)R_RDI, (int64_t)R_RSI); }
 void lFpp(x64emu_t *emu, uintptr_t fcn) { lFpp_t fn = (lFpp_t)fcn; R_RAX=(intptr_t)fn((void*)R_RDI, (void*)R_RSI); }
+void LFEL(x64emu_t *emu, uintptr_t fcn) { LFEL_t fn = (LFEL_t)fcn; R_RAX=(uintptr_t)fn(emu, (uintptr_t)R_RDI); }
 void LFii(x64emu_t *emu, uintptr_t fcn) { LFii_t fn = (LFii_t)fcn; R_RAX=(uintptr_t)fn((int64_t)R_RDI, (int64_t)R_RSI); }
 void LFLi(x64emu_t *emu, uintptr_t fcn) { LFLi_t fn = (LFLi_t)fcn; R_RAX=(uintptr_t)fn((uintptr_t)R_RDI, (int64_t)R_RSI); }
 void LFLp(x64emu_t *emu, uintptr_t fcn) { LFLp_t fn = (LFLp_t)fcn; R_RAX=(uintptr_t)fn((uintptr_t)R_RDI, (void*)R_RSI); }
diff --git a/src/wrapped/generated/wrapper.h b/src/wrapped/generated/wrapper.h
index 1f4bd829..2f8da5a1 100644
--- a/src/wrapped/generated/wrapper.h
+++ b/src/wrapped/generated/wrapper.h
@@ -195,6 +195,7 @@ void dFpp(x64emu_t *emu, uintptr_t fnc);
 void lFll(x64emu_t *emu, uintptr_t fnc);
 void lFpi(x64emu_t *emu, uintptr_t fnc);
 void lFpp(x64emu_t *emu, uintptr_t fnc);
+void LFEL(x64emu_t *emu, uintptr_t fnc);
 void LFii(x64emu_t *emu, uintptr_t fnc);
 void LFLi(x64emu_t *emu, uintptr_t fnc);
 void LFLp(x64emu_t *emu, uintptr_t fnc);
diff --git a/src/wrapped/wrappedlibc_private.h b/src/wrapped/wrappedlibc_private.h
index 7b5d8f72..c9baa8d7 100755
--- a/src/wrapped/wrappedlibc_private.h
+++ b/src/wrapped/wrappedlibc_private.h
@@ -480,7 +480,7 @@ GO(getaddrinfo, iFpppp)
 //GO(getaliasent, 
 //GO(getaliasent_r, 
 //GO(__getauxval, 
-//GOW(getauxval, 
+GOM(getauxval, LFEL)    //Weak
 //GOW(get_avphys_pages, 
 GOW(getc, iFp)
 GO(getchar, iFv)