about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2022-04-30 14:28:11 +0200
committerptitSeb <sebastien.chev@gmail.com>2022-04-30 14:28:11 +0200
commit008f5913e915cab6d1ad82d62deb7ccc6d03d08d (patch)
treea010935c732bc6c2cd10eba891180e65dc5793e6 /src
parent349736b0a54a7488f1a4cc7e5a7372e46c9d9da3 (diff)
downloadbox64-008f5913e915cab6d1ad82d62deb7ccc6d03d08d.tar.gz
box64-008f5913e915cab6d1ad82d62deb7ccc6d03d08d.zip
Added fake libunwind wrapping
Diffstat (limited to 'src')
-rwxr-xr-xsrc/library_list.h1
-rwxr-xr-xsrc/main.c1
-rw-r--r--src/wrapped/generated/functions_list.txt8
-rw-r--r--src/wrapped/generated/wrappedunwinddefs.h8
-rw-r--r--src/wrapped/generated/wrappedunwindtypes.h24
-rw-r--r--src/wrapped/generated/wrappedunwindundefs.h8
-rw-r--r--src/wrapped/wrappedunwind.c44
-rw-r--r--src/wrapped/wrappedunwind_private.h8
8 files changed, 102 insertions, 0 deletions
diff --git a/src/library_list.h b/src/library_list.h
index 70d10f26..f43da0d0 100755
--- a/src/library_list.h
+++ b/src/library_list.h
@@ -189,4 +189,5 @@ GO("libgstvideo-1.0.so.0", gstvideo)
 
 GO("ld-linux-x86-64.so.2", ldlinux)
 
+GO("libunwind.so.8", unwind)
 GO("crashhandler.so", crashhandler)
diff --git a/src/main.c b/src/main.c
index 1a123f21..37a8b6a9 100755
--- a/src/main.c
+++ b/src/main.c
@@ -756,6 +756,7 @@ void LoadEnvVars(box64context_t *context)
     AddPath("libssl.so.1.0.0", &context->box64_emulated_libs, 0);
     AddPath("libcrypto.so.1", &context->box64_emulated_libs, 0);
     AddPath("libcrypto.so.1.0.0", &context->box64_emulated_libs, 0);
+    AddPath("libunwind.so.8", &context->box64_emulated_libs, 0);
 
     if(getenv("BOX64_PREFER_WRAPPED")) {
         if (strcmp(getenv("BOX64_PREFER_WRAPPED"), "1")==0) {
diff --git a/src/wrapped/generated/functions_list.txt b/src/wrapped/generated/functions_list.txt
index 2b0b9570..32f60470 100644
--- a/src/wrapped/generated/functions_list.txt
+++ b/src/wrapped/generated/functions_list.txt
@@ -3710,6 +3710,14 @@ wrappedudev0:
 wrappedudev1:
 - vFpp:
   - udev_set_log_fn
+wrappedunwind:
+- iFp:
+  - _ULx86_64_step
+- iFpp:
+  - _ULx86_64_get_proc_info
+  - _ULx86_64_init_local
+- iFpip:
+  - _ULx86_64_get_reg
 wrappedutil:
 - iFpppp:
   - forkpty
diff --git a/src/wrapped/generated/wrappedunwinddefs.h b/src/wrapped/generated/wrappedunwinddefs.h
new file mode 100644
index 00000000..be816fdc
--- /dev/null
+++ b/src/wrapped/generated/wrappedunwinddefs.h
@@ -0,0 +1,8 @@
+/*******************************************************************
+ * File automatically generated by rebuild_wrappers.py (v2.1.0.16) *
+ *******************************************************************/
+#ifndef __wrappedunwindDEFS_H_
+#define __wrappedunwindDEFS_H_
+
+
+#endif // __wrappedunwindDEFS_H_
diff --git a/src/wrapped/generated/wrappedunwindtypes.h b/src/wrapped/generated/wrappedunwindtypes.h
new file mode 100644
index 00000000..602462ec
--- /dev/null
+++ b/src/wrapped/generated/wrappedunwindtypes.h
@@ -0,0 +1,24 @@
+/*******************************************************************
+ * File automatically generated by rebuild_wrappers.py (v2.1.0.16) *
+ *******************************************************************/
+#ifndef __wrappedunwindTYPES_H_
+#define __wrappedunwindTYPES_H_
+
+#ifndef LIBNAME
+#error You should only #include this file inside a wrapped*.c file
+#endif
+#ifndef ADDED_FUNCTIONS
+#define ADDED_FUNCTIONS() 
+#endif
+
+typedef int64_t (*iFp_t)(void*);
+typedef int64_t (*iFpp_t)(void*, void*);
+typedef int64_t (*iFpip_t)(void*, int64_t, void*);
+
+#define SUPER() ADDED_FUNCTIONS() \
+	GO(_ULx86_64_step, iFp_t) \
+	GO(_ULx86_64_get_proc_info, iFpp_t) \
+	GO(_ULx86_64_init_local, iFpp_t) \
+	GO(_ULx86_64_get_reg, iFpip_t)
+
+#endif // __wrappedunwindTYPES_H_
diff --git a/src/wrapped/generated/wrappedunwindundefs.h b/src/wrapped/generated/wrappedunwindundefs.h
new file mode 100644
index 00000000..26753452
--- /dev/null
+++ b/src/wrapped/generated/wrappedunwindundefs.h
@@ -0,0 +1,8 @@
+/*******************************************************************
+ * File automatically generated by rebuild_wrappers.py (v2.1.0.16) *
+ *******************************************************************/
+#ifndef __wrappedunwindUNDEFS_H_
+#define __wrappedunwindUNDEFS_H_
+
+
+#endif // __wrappedunwindUNDEFS_H_
diff --git a/src/wrapped/wrappedunwind.c b/src/wrapped/wrappedunwind.c
new file mode 100644
index 00000000..ba503be2
--- /dev/null
+++ b/src/wrapped/wrappedunwind.c
@@ -0,0 +1,44 @@
+#define _GNU_SOURCE
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <dlfcn.h>
+
+#include "wrappedlibs.h"
+
+#include "debug.h"
+#include "wrapper.h"
+#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"
+
+const char* unwindName = "libunwind.so.8";
+#define LIBNAME unwind
+
+EXPORT int my__ULx86_64_step(x64emu_t* emu, void* cursor) {
+    return -1;
+}
+EXPORT int my__ULx86_64_get_reg(x64emu_t* emu, void* cursor, int rep, void* buf) {
+    return -1;
+}
+EXPORT int my__ULx86_64_get_proc_info(x64emu_t* emu, void* cursor, void* ctx) {
+    return -1;
+}
+EXPORT int my__ULx86_64_init_local(x64emu_t* emu, void* cursor, void* ctx) {
+    return -1;
+}
+
+
+#define PRE_INIT                                                \
+    if(1)                                                       \
+        lib->priv.w.lib = dlopen(NULL, RTLD_LAZY | RTLD_GLOBAL);\
+    else
+
+
+#include "wrappedlib_init.h"
+
diff --git a/src/wrapped/wrappedunwind_private.h b/src/wrapped/wrappedunwind_private.h
new file mode 100644
index 00000000..7a4013a9
--- /dev/null
+++ b/src/wrapped/wrappedunwind_private.h
@@ -0,0 +1,8 @@
+#if !(defined(GO) && defined(GOM) && defined(GO2) && defined(DATA))
+#error Meh....
+#endif
+
+GOM(_ULx86_64_step, iFEp)
+GOM(_ULx86_64_get_reg, iFEpip)
+GOM(_ULx86_64_get_proc_info, iFEpp)
+GOM(_ULx86_64_init_local, iFEpp)