Blame arch/nt32/src/crt_tls.c

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