about summary refs log tree commit diff stats
path: root/src/wrapped
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2023-03-12 21:43:20 +0100
committerptitSeb <sebastien.chev@gmail.com>2023-03-12 21:43:20 +0100
commita08f3c4c9eca36ef2415d8428434ca4af41aa84e (patch)
tree19a473f8220c366379ad7d887a4b2488e6035d22 /src/wrapped
parentc0f98bb0ec8b996d7fe35b1b311ec421587a94fd (diff)
downloadbox64-a08f3c4c9eca36ef2415d8428434ca4af41aa84e.tar.gz
box64-a08f3c4c9eca36ef2415d8428434ca4af41aa84e.zip
Tried to optimize TLS fetching
Diffstat (limited to 'src/wrapped')
-rwxr-xr-xsrc/wrapped/wrappedldlinux.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/wrapped/wrappedldlinux.c b/src/wrapped/wrappedldlinux.c
index d88c10c2..b5dc0da6 100755
--- a/src/wrapped/wrappedldlinux.c
+++ b/src/wrapped/wrappedldlinux.c
@@ -14,6 +14,7 @@
 #include "emu/x64emu_private.h"
 #include "elfloader.h"
 #include "box64context.h"
+#include "x64tls.h"
 
 typedef struct my_tls_s {
     unsigned long int   i;
@@ -23,8 +24,8 @@ typedef struct my_tls_s {
 EXPORT void* my___tls_get_addr(void* p)
 {
     my_tls_t *t = (my_tls_t*)p;
-    void* ret = (void*)((char*)GetTLSPointer(my_context, my_context->elfs[t->i])+t->o);
-    return ret;
+    tlsdatasize_t* ptr = getTLSData(my_context);
+    return ptr->data+GetTLSBase(my_context->elfs[t->i])+t->o;
 }
 
 // don't try to load the actual ld-linux (because name is variable), just use box64 itself, as it's linked to ld-linux