Blame src/arch/nt32/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>
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;
bd9527
	struct __tlca_abi * tlca = (struct __tlca_abi *)__psx_tlca();
b511db
	return tlca->pthread_dtls[dsoidx >> 16] + obj->offset;
296178
}
296178