diff options
| author | Trevor Stiles <tstiles@shel.org> | 2022-05-01 00:12:40 -0700 |
|---|---|---|
| committer | Trevor Stiles <tstiles@shel.org> | 2022-05-01 00:12:40 -0700 |
| commit | 681f0ef111ceb9101e3328689ae04b9512b49431 (patch) | |
| tree | 5a9e0cd53873b2de537022c1e4f2c877e63064ed /src | |
| parent | 42e926e27cb24d9f8dcd7d3a9370c2698332fc3a (diff) | |
| parent | 098317ed29038cf93d891ef74fe43d409e8aef9d (diff) | |
| download | box64-681f0ef111ceb9101e3328689ae04b9512b49431.tar.gz box64-681f0ef111ceb9101e3328689ae04b9512b49431.zip | |
Merge branch 'main' into misc-fixes
Diffstat (limited to 'src')
| -rwxr-xr-x | src/library_list.h | 1 | ||||
| -rwxr-xr-x | src/main.c | 1 | ||||
| -rw-r--r-- | src/steam.c | 6 | ||||
| -rw-r--r-- | src/wrapped/generated/functions_list.txt | 14 | ||||
| -rw-r--r-- | src/wrapped/generated/wrappedlibctypes.h | 5 | ||||
| -rw-r--r-- | src/wrapped/generated/wrappedunwinddefs.h | 8 | ||||
| -rw-r--r-- | src/wrapped/generated/wrappedunwindtypes.h | 24 | ||||
| -rw-r--r-- | src/wrapped/generated/wrappedunwindundefs.h | 8 | ||||
| -rw-r--r-- | src/wrapped/generated/wrapper.c | 2 | ||||
| -rw-r--r-- | src/wrapped/generated/wrapper.h | 1 | ||||
| -rwxr-xr-x | src/wrapped/wrappedlibc.c | 9 | ||||
| -rwxr-xr-x | src/wrapped/wrappedlibc_private.h | 3 | ||||
| -rw-r--r-- | src/wrapped/wrappedunwind.c | 44 | ||||
| -rw-r--r-- | src/wrapped/wrappedunwind_private.h | 8 |
14 files changed, 131 insertions, 3 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/steam.c b/src/steam.c index f4de17d8..07ff1fce 100644 --- a/src/steam.c +++ b/src/steam.c @@ -66,13 +66,13 @@ void pressure_vessel(int argc, const char** argv, int nextarg) setenv("BOX64_PREFER_EMULATED", "1", 1); setenv("BOX86_PREFER_EMULATED", "1", 1); -setenv("BOX64_TRACE_FILE", "/home/seb/trace64-%pid.txt", 1); +//setenv("BOX64_TRACE_FILE", "/home/seb/trace64-%pid.txt", 1); //setenv("BOX86_TRACE_FILE", "/home/seb/trace86-%pid.txt", 1); //setenv("BOX86_LOG", "1", 1); -setenv("BOX64_LOG", "1", 1); +//setenv("BOX64_LOG", "1", 1); //setenv("BOX86_SHOWSEGV", "1", 1); //setenv("BOX64_SHOWSEGV", "1", 1); -setenv("BOX64_DYNAREC_LOG", "1", 1); +//setenv("BOX64_DYNAREC_LOG", "1", 1); printf_log(LOG_DEBUG, "Run %s %s and wait\n", x86?"i386":(x64?"x86_64":""), argv[nextarg]); pid_t v = vfork(); diff --git a/src/wrapped/generated/functions_list.txt b/src/wrapped/generated/functions_list.txt index f10a0886..e0c91f61 100644 --- a/src/wrapped/generated/functions_list.txt +++ b/src/wrapped/generated/functions_list.txt @@ -1059,6 +1059,7 @@ #() vFppppp #() iFEiipp #() iFEiipV +#() iFEippi #() iFEippL #() iFEippp #() iFEpiii @@ -2681,6 +2682,8 @@ wrappedlibc: - vFpV: - warn - warnx +- iFip: + - fstat - iFpi: - __sigsetjmp - backtrace @@ -2691,6 +2694,7 @@ wrappedlibc: - dl_iterate_phdr - execv - execvp + - lstat - sigaltstack - stat - swapcontext @@ -2796,6 +2800,8 @@ wrappedlibc: - semctl - iFipii: - epoll_wait +- iFippi: + - fstatat - iFippL: - readlinkat - iFpipp: @@ -3705,6 +3711,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/wrappedlibctypes.h b/src/wrapped/generated/wrappedlibctypes.h index f0a1e0c3..8aabf49e 100644 --- a/src/wrapped/generated/wrappedlibctypes.h +++ b/src/wrapped/generated/wrappedlibctypes.h @@ -24,6 +24,7 @@ typedef void (*vFpi_t)(void*, int64_t); typedef void (*vFpu_t)(void*, uint64_t); typedef void (*vFpp_t)(void*, void*); typedef void (*vFpV_t)(void*, ...); +typedef int64_t (*iFip_t)(int64_t, void*); typedef int64_t (*iFpi_t)(void*, int64_t); typedef int64_t (*iFpL_t)(void*, uintptr_t); typedef int64_t (*iFpp_t)(void*, void*); @@ -56,6 +57,7 @@ typedef void (*vFpLLp_t)(void*, uintptr_t, uintptr_t, void*); typedef int64_t (*iFiiip_t)(int64_t, int64_t, int64_t, void*); typedef int64_t (*iFiiiN_t)(int64_t, int64_t, int64_t, ...); typedef int64_t (*iFipii_t)(int64_t, void*, int64_t, int64_t); +typedef int64_t (*iFippi_t)(int64_t, void*, void*, int64_t); typedef int64_t (*iFippL_t)(int64_t, void*, void*, uintptr_t); typedef int64_t (*iFpipp_t)(void*, int64_t, void*, void*); typedef int64_t (*iFpipV_t)(void*, int64_t, void*, ...); @@ -109,6 +111,7 @@ typedef int64_t (*iFppipppp_t)(void*, void*, int64_t, void*, void*, void*, void* GO(tdestroy, vFpp_t) \ GO(warn, vFpV_t) \ GO(warnx, vFpV_t) \ + GO(fstat, iFip_t) \ GO(__sigsetjmp, iFpi_t) \ GO(backtrace, iFpi_t) \ GO(munmap, iFpL_t) \ @@ -116,6 +119,7 @@ typedef int64_t (*iFppipppp_t)(void*, void*, int64_t, void*, void*, void*, void* GO(dl_iterate_phdr, iFpp_t) \ GO(execv, iFpp_t) \ GO(execvp, iFpp_t) \ + GO(lstat, iFpp_t) \ GO(sigaltstack, iFpp_t) \ GO(stat, iFpp_t) \ GO(swapcontext, iFpp_t) \ @@ -192,6 +196,7 @@ typedef int64_t (*iFppipppp_t)(void*, void*, int64_t, void*, void*, void*, void* GO(epoll_ctl, iFiiip_t) \ GO(semctl, iFiiiN_t) \ GO(epoll_wait, iFipii_t) \ + GO(fstatat, iFippi_t) \ GO(readlinkat, iFippL_t) \ GO(__vasprintf_chk, iFpipp_t) \ GO(glob, iFpipp_t) \ 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/generated/wrapper.c b/src/wrapped/generated/wrapper.c index 916a00f9..65c4a370 100644 --- a/src/wrapped/generated/wrapper.c +++ b/src/wrapped/generated/wrapper.c @@ -1093,6 +1093,7 @@ typedef void (*vFppppL_t)(void*, void*, void*, void*, uintptr_t); typedef void (*vFppppp_t)(void*, void*, void*, void*, void*); typedef int64_t (*iFEiipp_t)(x64emu_t*, int64_t, int64_t, void*, void*); typedef int64_t (*iFEiipV_t)(x64emu_t*, int64_t, int64_t, void*, void*); +typedef int64_t (*iFEippi_t)(x64emu_t*, int64_t, void*, void*, int64_t); typedef int64_t (*iFEippL_t)(x64emu_t*, int64_t, void*, void*, uintptr_t); typedef int64_t (*iFEippp_t)(x64emu_t*, int64_t, void*, void*, void*); typedef int64_t (*iFEpiii_t)(x64emu_t*, void*, int64_t, int64_t, int64_t); @@ -3163,6 +3164,7 @@ void vFppppL(x64emu_t *emu, uintptr_t fcn) { vFppppL_t fn = (vFppppL_t)fcn; fn(( void vFppppp(x64emu_t *emu, uintptr_t fcn) { vFppppp_t fn = (vFppppp_t)fcn; fn((void*)R_RDI, (void*)R_RSI, (void*)R_RDX, (void*)R_RCX, (void*)R_R8); } void iFEiipp(x64emu_t *emu, uintptr_t fcn) { iFEiipp_t fn = (iFEiipp_t)fcn; R_RAX=(int64_t)fn(emu, (int64_t)R_RDI, (int64_t)R_RSI, (void*)R_RDX, (void*)R_RCX); } void iFEiipV(x64emu_t *emu, uintptr_t fcn) { iFEiipV_t fn = (iFEiipV_t)fcn; R_RAX=(int64_t)fn(emu, (int64_t)R_RDI, (int64_t)R_RSI, (void*)R_RDX, (void*)(R_RSP + 8)); } +void iFEippi(x64emu_t *emu, uintptr_t fcn) { iFEippi_t fn = (iFEippi_t)fcn; R_RAX=(int64_t)fn(emu, (int64_t)R_RDI, (void*)R_RSI, (void*)R_RDX, (int64_t)R_RCX); } void iFEippL(x64emu_t *emu, uintptr_t fcn) { iFEippL_t fn = (iFEippL_t)fcn; R_RAX=(int64_t)fn(emu, (int64_t)R_RDI, (void*)R_RSI, (void*)R_RDX, (uintptr_t)R_RCX); } void iFEippp(x64emu_t *emu, uintptr_t fcn) { iFEippp_t fn = (iFEippp_t)fcn; R_RAX=(int64_t)fn(emu, (int64_t)R_RDI, (void*)R_RSI, (void*)R_RDX, (void*)R_RCX); } void iFEpiii(x64emu_t *emu, uintptr_t fcn) { iFEpiii_t fn = (iFEpiii_t)fcn; R_RAX=(int64_t)fn(emu, (void*)R_RDI, (int64_t)R_RSI, (int64_t)R_RDX, (int64_t)R_RCX); } diff --git a/src/wrapped/generated/wrapper.h b/src/wrapped/generated/wrapper.h index 030d7616..842d2fac 100644 --- a/src/wrapped/generated/wrapper.h +++ b/src/wrapped/generated/wrapper.h @@ -1092,6 +1092,7 @@ void vFppppL(x64emu_t *emu, uintptr_t fnc); void vFppppp(x64emu_t *emu, uintptr_t fnc); void iFEiipp(x64emu_t *emu, uintptr_t fnc); void iFEiipV(x64emu_t *emu, uintptr_t fnc); +void iFEippi(x64emu_t *emu, uintptr_t fnc); void iFEippL(x64emu_t *emu, uintptr_t fnc); void iFEippp(x64emu_t *emu, uintptr_t fnc); void iFEpiii(x64emu_t *emu, uintptr_t fnc); diff --git a/src/wrapped/wrappedlibc.c b/src/wrapped/wrappedlibc.c index b33d67bd..6105f347 100755 --- a/src/wrapped/wrappedlibc.c +++ b/src/wrapped/wrappedlibc.c @@ -1100,6 +1100,15 @@ EXPORT int my_fstat(x64emu_t *emu, int fd, void* buf) return r; } +EXPORT int my_fstatat(x64emu_t *emu, int fd, const char* path, void* buf, int flags) +{ + (void)emu; + struct stat64 st; + int r = fstatat(fd, path, (struct stat*)&st, flags); + UnalignStat64(&st, buf); + return r; +} + EXPORT int my__IO_file_stat(x64emu_t* emu, void* f, void* buf) { struct stat64 st; diff --git a/src/wrapped/wrappedlibc_private.h b/src/wrapped/wrappedlibc_private.h index a141f246..ef87f842 100755 --- a/src/wrapped/wrappedlibc_private.h +++ b/src/wrapped/wrappedlibc_private.h @@ -426,6 +426,8 @@ GO(__fsetlocking, iFpi) GO(fsetpos, iFpp) GO(fsetpos64, iFpp) GO(fsetxattr, iFippLi) +GOM(fstat, iFEip) +GOM(fstatat, iFEippi) GOW(fstatfs, iFip) GOW(fstatfs64, iFip) GOW(fstatvfs, iFip) @@ -1101,6 +1103,7 @@ GO(__lseek, IFiIi) GOW(lseek, lFili) GOW(lseek64, lFili) GO(lsetxattr, iFpppLi) +GOM(lstat, iFEpp) GO(lutimes, iFpp) GOM(__lxstat, iFEipp) GOM(__lxstat64, iFEipp) 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) |