about summary refs log tree commit diff stats
path: root/src/libtools/threads.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-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