diff options
author | midipix <writeonce@midipix.org> | 2015-04-05 17:05:57 -0400 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2015-04-05 17:05:57 -0400 |
commit | 296178913c5dfbc2b35842fc16ed680ef51fd402 (patch) | |
tree | 6720928dbc03c3d656229d2509eda38f6eb0628b /arch/nt32/src/crt_tls.c | |
parent | 20a5ca45ef2f5716e8f2dea42c7e8a6b3367619f (diff) | |
download | mmglue-296178913c5dfbc2b35842fc16ed680ef51fd402.tar.bz2 mmglue-296178913c5dfbc2b35842fc16ed680ef51fd402.tar.xz |
nt32: initial commit of core port files.
signed-off by Z. Gilboa; see copying.midipix (9cd0746c) for additional information.
Diffstat (limited to 'arch/nt32/src/crt_tls.c')
-rw-r--r-- | arch/nt32/src/crt_tls.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/arch/nt32/src/crt_tls.c b/arch/nt32/src/crt_tls.c new file mode 100644 index 0000000..15183d3 --- /dev/null +++ b/arch/nt32/src/crt_tls.c @@ -0,0 +1,27 @@ +#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 * tlca = (struct __tlca *)__psx_tlca(); + + if (dsoidx) + return (*tlca->pthread_dtls)[dsoidx >> 16] + obj->offset; + else + return tlca->pthread_tls + obj->offset; +} + |