Blame src/ldso/nt32/dynlink.c
|
|
296178 |
#define _BSD_SOURCE
|
|
|
296178 |
|
|
|
296178 |
#include <dlfcn.h>
|
|
|
296178 |
#include "psxglue.h"
|
|
|
296178 |
#include "pthread_impl.h"
|
|
|
296178 |
|
|
|
296178 |
extern struct __ldso_vtbl * __ldso_vtbl;
|
|
|
296178 |
|
|
|
296178 |
int __dladdr(const void * addr, Dl_info * info)
|
|
|
296178 |
{
|
|
|
296178 |
return __ldso_vtbl->dladdr(addr,info);
|
|
|
296178 |
}
|
|
|
296178 |
|
|
|
296178 |
int __dlinfo(void * dso, int req, void * res)
|
|
|
296178 |
{
|
|
|
296178 |
return __ldso_vtbl->dlinfo(dso,req,res);
|
|
|
296178 |
}
|
|
|
296178 |
|
|
|
296178 |
void *__dlsym(void * restrict p, const char * restrict s, void * restrict ra)
|
|
|
296178 |
{
|
|
|
296178 |
return __ldso_vtbl->dlsym(p,s,ra);
|
|
|
296178 |
}
|
|
|
296178 |
|
|
|
296178 |
void * dlopen(const char * file, int mode)
|
|
|
296178 |
{
|
|
|
296178 |
return __ldso_vtbl->dlopen(file,mode);
|
|
|
296178 |
}
|
|
|
296178 |
|
|
|
296178 |
int dlclose(void *p)
|
|
|
296178 |
{
|
|
|
296178 |
return __ldso_vtbl->dlclose(p);
|
|
|
296178 |
}
|
|
|
296178 |
|
|
|
296178 |
char * dlerror(void)
|
|
|
296178 |
{
|
|
|
296178 |
return __ldso_vtbl->dlerror();
|
|
|
296178 |
}
|
|
|
296178 |
|
|
|
296178 |
void __reset_tls(void)
|
|
|
296178 |
{
|
|
|
296178 |
__ldso_vtbl->reset_tls();
|
|
|
296178 |
}
|
|
|
296178 |
|
|
|
296178 |
void *__copy_tls(unsigned char * mem)
|
|
|
296178 |
{
|
|
|
296178 |
/**
|
|
|
296178 |
* this is always the simple case, since:
|
|
|
296178 |
* emutls is based on PE named sections; and
|
|
|
296178 |
* tls allocation and initialization are handled by clone(2)
|
|
|
296178 |
**/
|
|
|
296178 |
|
|
|
296178 |
pthread_t td;
|
|
|
5085e9 |
uintptr_t addr;
|
|
|
296178 |
|
|
|
5085e9 |
addr = (uintptr_t)mem;
|
|
|
5085e9 |
addr >>= 4;
|
|
|
5085e9 |
addr <<= 4;
|
|
|
5085e9 |
addr += 16;
|
|
|
296178 |
|
|
|
5085e9 |
td = (struct __pthread *)addr;
|
|
|
5085e9 |
td->dtv = 0;
|
|
|
296178 |
|
|
|
296178 |
return td;
|
|
|
296178 |
}
|