Blame src/env/nt64/__copy_tls.c

07b681
#define _BSD_SOURCE
07b681
07b681
#include <unistd.h>
07b681
#include "psxglue.h"
07b681
#include "pthread_impl.h"
07b681
07b681
extern const struct __ldso_vtbl * __ldso_vtbl;
07b681
extern const struct __psx_vtbl *  __psx_vtbl;
07b681
07b681
void *__copy_tls(unsigned char * mem)
07b681
{
07b681
	/**
07b681
	 * this is always the simple case, since:
07b681
	 * emutls is based on PE named sections; and
07b681
	 * tls allocation and initialization are handled by clone(2)
07b681
	**/
07b681
07b681
        pthread_t td;
07b681
	uintptr_t addr;
07b681
07b681
	addr = (uintptr_t)mem;
07b681
	addr += 0xf;
07b681
	addr |= 0xf;
07b681
	addr ^= 0xf;
07b681
07b681
	td = (struct __pthread *)addr;
07b681
	td->dtv = 0;
07b681
07b681
	return td;
07b681
}