diff options
author | midipix <writeonce@midipix.org> | 2015-04-05 17:05:57 -0400 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2015-04-05 17:05:57 -0400 |
commit | 296178913c5dfbc2b35842fc16ed680ef51fd402 (patch) | |
tree | 6720928dbc03c3d656229d2509eda38f6eb0628b /src/ldso | |
parent | 20a5ca45ef2f5716e8f2dea42c7e8a6b3367619f (diff) | |
download | mmglue-296178913c5dfbc2b35842fc16ed680ef51fd402.tar.bz2 mmglue-296178913c5dfbc2b35842fc16ed680ef51fd402.tar.xz |
nt32: initial commit of core port files.
signed-off by Z. Gilboa; see copying.midipix (9cd0746c) for additional information.
Diffstat (limited to 'src/ldso')
-rw-r--r-- | src/ldso/nt32/dl_iterate_phdr.c | 10 | ||||
-rw-r--r-- | src/ldso/nt32/dynlink.c | 62 | ||||
-rw-r--r-- | src/ldso/nt32/start.s | 2 | ||||
-rw-r--r-- | src/ldso/nt32/tlsdesc.c | 8 |
4 files changed, 82 insertions, 0 deletions
diff --git a/src/ldso/nt32/dl_iterate_phdr.c b/src/ldso/nt32/dl_iterate_phdr.c new file mode 100644 index 0000000..f98a509 --- /dev/null +++ b/src/ldso/nt32/dl_iterate_phdr.c @@ -0,0 +1,10 @@ +#include <stddef.h> +#include <dlfcn.h> +#include <link.h> + +typedef int __ldso_phdr_callback(struct dl_phdr_info * info, size_t size, void * data); + +int dl_iterate_phdr(__ldso_phdr_callback * callback, void * data) +{ + return -1; +} diff --git a/src/ldso/nt32/dynlink.c b/src/ldso/nt32/dynlink.c new file mode 100644 index 0000000..c3cb23e --- /dev/null +++ b/src/ldso/nt32/dynlink.c @@ -0,0 +1,62 @@ +#define _BSD_SOURCE + +#include <dlfcn.h> +#include "psxglue.h" +#include "pthread_impl.h" + +extern struct __ldso_vtbl * __ldso_vtbl; + +int __dladdr(const void * addr, Dl_info * info) +{ + return __ldso_vtbl->dladdr(addr,info); +} + +int __dlinfo(void * dso, int req, void * res) +{ + return __ldso_vtbl->dlinfo(dso,req,res); +} + +void *__dlsym(void * restrict p, const char * restrict s, void * restrict ra) +{ + return __ldso_vtbl->dlsym(p,s,ra); +} + +void * dlopen(const char * file, int mode) +{ + return __ldso_vtbl->dlopen(file,mode); +} + +int dlclose(void *p) +{ + return __ldso_vtbl->dlclose(p); +} + +char * dlerror(void) +{ + return __ldso_vtbl->dlerror(); +} + +void __reset_tls(void) +{ + __ldso_vtbl->reset_tls(); +} + +void *__copy_tls(unsigned char * mem) +{ + /** + * this is always the simple case, since: + * emutls is based on PE named sections; and + * tls allocation and initialization are handled by clone(2) + **/ + + pthread_t td; + void ** dtv; + + dtv = (void **)mem; + dtv[0] = 0; + + td = (void *)(dtv + 1); + td->dtv = dtv; + + return td; +} diff --git a/src/ldso/nt32/start.s b/src/ldso/nt32/start.s new file mode 100644 index 0000000..32dc52f --- /dev/null +++ b/src/ldso/nt32/start.s @@ -0,0 +1,2 @@ +# standard dynamic loader is not required +# optional dynamic loader [to be] provided by libldso/libpsxscl diff --git a/src/ldso/nt32/tlsdesc.c b/src/ldso/nt32/tlsdesc.c new file mode 100644 index 0000000..7015e30 --- /dev/null +++ b/src/ldso/nt32/tlsdesc.c @@ -0,0 +1,8 @@ +#include <stddef.h> + +ptrdiff_t __tlsdesc_static(void) +{ + return 0; +} + +ptrdiff_t __tlsdesc_dynamic(void) __attribute__((alias("__tlsdesc_static"))); |