Blame arch/nt64/src/crt_tls.c

860627
#include <stdint.h>
860627
#include <stddef.h>
860627
#include "psxglue.h"
860627
#include "pthread_arch.h"
860627
860627
typedef unsigned int __tls_word	__attribute__((mode(word)));
860627
typedef unsigned int __tls_ptr	__attribute__((mode(pointer)));
860627
860627
struct __emutls_object
860627
{
860627
	__tls_word	size;
860627
	__tls_word	align;
860627
	ptrdiff_t	offset;
860627
	void *		defval;
860627
};
860627
860627
void * __emutls_get_address (struct __emutls_object * obj)
860627
{
860627
	int dsoidx = obj->align & 0xFFFF0000;
860627
	struct __tlca * tlca = (struct __tlca *)__psx_tlca();
860627
860627
	if (dsoidx)
860627
		return (*tlca->pthread_dtls)[dsoidx >> 16] + obj->offset;
860627
	else
860627
		return tlca->pthread_tls + obj->offset;
860627
}
860627