Blame src/arch/nt64/crt_tls.c

716654
/**************************************************************************/
716654
/*  mmglue: midipix architecture- and target-specific bits for musl libc  */
716654
/*  Copyright (C) 2013--2023  SysDeer Technologies, LLC                   */
716654
/*  Released under the Standard MIT License; see COPYING.MMGLUE.          */
716654
/**************************************************************************/
716654
6f8ae4
#include <unistd.h>
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;
bd9527
	struct __tlca_abi * tlca = (struct __tlca_abi *)__psx_tlca();
b511db
	return tlca->pthread_dtls[dsoidx >> 16] + obj->offset;
860627
}
860627