about summary refs log tree commit diff stats
path: root/src/libtools/threads.c
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2025-10-15 20:52:16 +0200
committerptitSeb <sebastien.chev@gmail.com>2025-10-15 20:52:16 +0200
commitd0045b158b30434c2077693d970e2167a1089e84 (patch)
treeb2951427e4870055cf79f6388d9755a227e843f7 /src/libtools/threads.c
parent1d4a9e8863d7e32f0bb1472674a94f05df1409b5 (diff)
downloadbox64-d0045b158b30434c2077693d970e2167a1089e84.tar.gz
box64-d0045b158b30434c2077693d970e2167a1089e84.zip
Some Segments/Selector handling refactoring , removing some pthread_getspecific use
Diffstat (limited to 'src/libtools/threads.c')
-rw-r--r--src/libtools/threads.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/libtools/threads.c b/src/libtools/threads.c
index 6fd7ffe6..1076b3e2 100644
--- a/src/libtools/threads.c
+++ b/src/libtools/threads.c
@@ -24,6 +24,7 @@
 #include "x64trace.h"
 #include "bridge.h"
 #include "myalign.h"
+#include "x64tls.h"
 #ifdef DYNAREC
 #include "dynablock.h"
 #include "dynarec/native_lock.h"
@@ -215,6 +216,7 @@ x64emu_t* thread_get_emu()
 			setProtection_stack((uintptr_t)stack, stacksize, PROT_READ|PROT_WRITE);
 		x64emu_t *emu = NewX64Emu(my_context, my_context->exit_bridge, (uintptr_t)stack, stacksize, 1);
 		SetupX64Emu(emu, NULL);
+		getTLSData(emu);
 		thread_set_emu(emu);
 		return emu;
 	}
@@ -248,6 +250,7 @@ static void* pthread_routine(void* p)
 	et->emu->type = EMUTYPE_MAIN;
 	// setup callstack and run...
 	x64emu_t* emu = et->emu;
+	getTLSData(emu);
 	ResetSegmentsCache(emu);
 	Push64(emu, 0);	// PUSH 0 (backtrace marker: return address is 0)
 	Push64(emu, 0);	// PUSH BP