diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2021-03-03 16:43:42 +0100 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2021-03-03 16:43:42 +0100 |
| commit | f4829a8ce42b1abbcc8621802d6c6fad3a56cd5d (patch) | |
| tree | 211276c3587721126ded00be46487bf23b605591 /src/wrapped/wrappedldlinux.c | |
| parent | f73fbd3cee38b4c0086c934d73972375c9c8c7d6 (diff) | |
| download | box64-f4829a8ce42b1abbcc8621802d6c6fad3a56cd5d.tar.gz box64-f4829a8ce42b1abbcc8621802d6c6fad3a56cd5d.zip | |
More infrastructure added to elf and x64 emu
Diffstat (limited to 'src/wrapped/wrappedldlinux.c')
| -rwxr-xr-x | src/wrapped/wrappedldlinux.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/wrapped/wrappedldlinux.c b/src/wrapped/wrappedldlinux.c new file mode 100755 index 00000000..56b581a0 --- /dev/null +++ b/src/wrapped/wrappedldlinux.c @@ -0,0 +1,42 @@ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#define _GNU_SOURCE /* See feature_test_macros(7) */ +#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 "elfloader.h" +#include "box64context.h" + +typedef struct my_tls_s { + int i; + uint32_t o; +} my_tls_t; + +EXPORT void* my___tls_get_addr(x64emu_t* emu, void* p) +{ + my_tls_t *t = (my_tls_t*)p; + return GetDTatOffset(emu->context, t->i, t->o); +} + +EXPORT void* my____tls_get_addr(x64emu_t* emu) +{ + // the GNU version (with 3 '_') use register for the parameter! + my_tls_t *t = (my_tls_t*)R_RAX; + return GetDTatOffset(emu->context, t->i, t->o); +} + + +const char* ldlinuxName = "ld-linux-x86-64.so.2"; +#define LIBNAME ldlinux + +// define all standard library functions +#include "wrappedlib_init.h" + |