summaryrefslogtreecommitdiffhomepage
path: root/src/arch/nt64/crt_tls.c
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2019-01-07 07:51:27 -0500
committermidipix <writeonce@midipix.org>2019-01-09 22:43:15 -0500
commit2f2b1c17cb9e6db0cacca52765f8bf701798ef18 (patch)
tree4d4be0b74596a5ecb3f0eed740a48db9f233e617 /src/arch/nt64/crt_tls.c
parent6f13b9b0fc0d920aa9c52ba202a85554a0788f5c (diff)
downloadmmglue-2f2b1c17cb9e6db0cacca52765f8bf701798ef18.tar.bz2
mmglue-2f2b1c17cb9e6db0cacca52765f8bf701798ef18.tar.xz
mmglue: moved arch/nt{32|64}/src --> src/arch/nt{32|64}.
Diffstat (limited to 'src/arch/nt64/crt_tls.c')
-rw-r--r--src/arch/nt64/crt_tls.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/arch/nt64/crt_tls.c b/src/arch/nt64/crt_tls.c
new file mode 100644
index 0000000..20080c6
--- /dev/null
+++ b/src/arch/nt64/crt_tls.c
@@ -0,0 +1,24 @@
+#include <unistd.h>
+#include <stdint.h>
+#include <stddef.h>
+#include "psxglue.h"
+#include "pthread_arch.h"
+
+typedef unsigned int __tls_word __attribute__((mode(word)));
+typedef unsigned int __tls_ptr __attribute__((mode(pointer)));
+
+struct __emutls_object
+{
+ __tls_word size;
+ __tls_word align;
+ ptrdiff_t offset;
+ void * defval;
+};
+
+void * __emutls_get_address (struct __emutls_object * obj)
+{
+ int dsoidx = obj->align & 0xFFFF0000;
+ struct __tlca_abi * tlca = (struct __tlca_abi *)__psx_tlca();
+ return tlca->pthread_dtls[dsoidx >> 16] + obj->offset;
+}
+