summaryrefslogtreecommitdiffhomepage
path: root/arch/nt64/src
diff options
context:
space:
mode:
Diffstat (limited to 'arch/nt64/src')
-rw-r--r--arch/nt64/src/_dlstart.c10
-rw-r--r--arch/nt64/src/crt_glue.c124
-rw-r--r--arch/nt64/src/crt_pe.c7
-rw-r--r--arch/nt64/src/crt_tls.c24
-rw-r--r--arch/nt64/src/syscall_disp.c23
-rw-r--r--arch/nt64/src/vtbl.c25
6 files changed, 0 insertions, 213 deletions
diff --git a/arch/nt64/src/_dlstart.c b/arch/nt64/src/_dlstart.c
deleted file mode 100644
index 40498da..0000000
--- a/arch/nt64/src/_dlstart.c
+++ /dev/null
@@ -1,10 +0,0 @@
-typedef unsigned int uint32_t;
-
-int _dlstart(
- void * hinstance,
- uint32_t reason,
- void * reserved)
-{
- return 1;
-}
-
diff --git a/arch/nt64/src/crt_glue.c b/arch/nt64/src/crt_glue.c
deleted file mode 100644
index c5af4b0..0000000
--- a/arch/nt64/src/crt_glue.c
+++ /dev/null
@@ -1,124 +0,0 @@
-#include <unistd.h>
-#include <stdint.h>
-#include <pthread.h>
-#include "atomic.h"
-#include "syscall.h"
-#include "psxglue.h"
-#include "pthread_impl.h"
-
-extern const struct __ldso_vtbl * __ldso_vtbl;
-extern const struct __psx_vtbl * __psx_vtbl;
-
-typedef int __app_main();
-typedef int __pthread_surrogate_routine(struct pthread *);
-
-static int __pthread_surrogate_init(struct pthread * self);
-
-extern int __libc_start_main(
- void * main,
- int argc,
- char ** argv);
-
-static void (*__global_ctors_fn)();
-static void (*__global_dtors_fn)();
-
-void _init()
-{
- __global_ctors_fn();
-}
-
-void _fini()
-{
- __global_dtors_fn();
-}
-
-struct __tls {
- void * pad[16/sizeof(void *)];
- struct pthread pt;
-} __builtin_tls = {{0}};
-
-void __init_tls (size_t * auxv)
-{
- #define T __builtin_tls
-
- __set_thread_area(&T.pt);
-
- T.pt.self = &T.pt;
- T.pt.locale = &libc.global_locale;
- T.pt.tid = __syscall(SYS_set_tid_address, &T.pt.tid);
-
- libc.can_do_threads = 1;
- libc.tls_size = sizeof(struct __tls);
-};
-
-void __libc_entry_routine(
- __app_main * __main,
- __psx_init_routine * __psx_init,
- const unsigned short * __ctty,
- int options)
-{
- int argc;
- char ** argv;
- char ** envp;
- struct __psx_context ctx;
-
- /* ctx init */
- ctx.size = sizeof(ctx);
- ctx.options = options;
- ctx.refaddr = __main;
- ctx.libcaddr = _init;
- ctx.ctty = __ctty;
- ctx.pthread_create_fn = pthread_create;
- ctx.pthread_surrogate_fn= __pthread_surrogate_init;
-
- /* __psx_init must succeed... */
- if (__psx_init(&argc,&argv,&envp,&ctx))
- a_crash();
-
- /* ...and conform */
- else if (envp != argv + (argc + 1))
- a_crash();
-
- /* write once */
- __syscall_vtbl = (unsigned long **)ctx.sys_vtbl;
- __ldso_vtbl = ctx.ldso_vtbl;
- __psx_vtbl = ctx.psx_vtbl;
- __teb_sys_idx = ctx.teb_sys_idx;
- __teb_libc_idx = ctx.teb_libc_idx;
-
- /* surrogate init/fini arrays */
- __global_ctors_fn = __psx_vtbl->do_global_ctors_fn;
- __global_dtors_fn = __psx_vtbl->do_global_dtors_fn;
-
- /* enter libc */
- __psx_vtbl->start_main(__main,argc,argv,__libc_start_main);
-
- /* guard */
- a_crash();
-}
-
-static int __pthread_surrogate_init(struct pthread * self)
-{
- /**
- * invoked by psxscl upon creation of a surrogate libc
- * thread, which in turn may only call pthread_create();
- *
- * the purpose of this mecahnism is to support a scenario
- * where a third-party library creates a non-posix thread
- * which then calls, be it directly or via a callback
- * function, a libc api that depends on a valid
- * pthread_self.
- *
- * self: a pointer to an already zero'ed memory page
- *
- * struct pthread relevant members:
- * --------------------------------
- * cancel (already zero)
- * canary (already zero)
- *
- * pthread_create() reference:
- * 1a47ed15eebf96d0c8d5de4aea54108bc8cc3f53
- **/
-
- return 0;
-}
diff --git a/arch/nt64/src/crt_pe.c b/arch/nt64/src/crt_pe.c
deleted file mode 100644
index 0dc75a4..0000000
--- a/arch/nt64/src/crt_pe.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include "pthread_impl.h"
-#include <threads.h>
-
-void * __pthread_getspecific_impl(pthread_key_t k)
-{
- return (__pthread_self())->tsd[k];
-}
diff --git a/arch/nt64/src/crt_tls.c b/arch/nt64/src/crt_tls.c
deleted file mode 100644
index 20080c6..0000000
--- a/arch/nt64/src/crt_tls.c
+++ /dev/null
@@ -1,24 +0,0 @@
-#include <unistd.h>
-#include <stdint.h>
-#include <stddef.h>
-#include "psxglue.h"
-#include "pthread_arch.h"
-
-typedef unsigned int __tls_word __attribute__((mode(word)));
-typedef unsigned int __tls_ptr __attribute__((mode(pointer)));
-
-struct __emutls_object
-{
- __tls_word size;
- __tls_word align;
- ptrdiff_t offset;
- void * defval;
-};
-
-void * __emutls_get_address (struct __emutls_object * obj)
-{
- int dsoidx = obj->align & 0xFFFF0000;
- struct __tlca_abi * tlca = (struct __tlca_abi *)__psx_tlca();
- return tlca->pthread_dtls[dsoidx >> 16] + obj->offset;
-}
-
diff --git a/arch/nt64/src/syscall_disp.c b/arch/nt64/src/syscall_disp.c
deleted file mode 100644
index 9ea5966..0000000
--- a/arch/nt64/src/syscall_disp.c
+++ /dev/null
@@ -1,23 +0,0 @@
-#include <unistd.h>
-#include <stdint.h>
-#include <stddef.h>
-#include "syscall.h"
-#include "psxglue.h"
-
-extern struct __psx_vtbl * __psx_vtbl;
-
-void __unmapself(void * base, size_t size)
-{
- __psx_vtbl->unmapself(base,(void *)size);
-}
-
-uintptr_t __syscall_disp(long n,
- uintptr_t a1,
- uintptr_t a2,
- uintptr_t a3,
- uintptr_t a4,
- uintptr_t a5,
- uintptr_t a6)
-{
- return __syscall(n,a1,a2,a3,a4,a5,a6);
-}
diff --git a/arch/nt64/src/vtbl.c b/arch/nt64/src/vtbl.c
deleted file mode 100644
index f21ce17..0000000
--- a/arch/nt64/src/vtbl.c
+++ /dev/null
@@ -1,25 +0,0 @@
-#include <unistd.h>
-#include <stdint.h>
-#include "psxglue.h"
-#include "errno.h"
-
-const struct __ldso_vtbl * __ldso_vtbl = 0;
-const struct __psx_vtbl * __psx_vtbl = 0;
-unsigned long ** __syscall_vtbl = 0;
-unsigned long __teb_sys_idx = 0;
-unsigned long __teb_libc_idx = 0;
-
-long __syscall_alert(long n)
-{
- char __lmsg[] = "DING ALARM! UNIMPLEMENTED SYSCALL 000\n";
-
- __lmsg[36] = '0' + n % 10; n /= 10;
- __lmsg[35] = '0' + n % 10; n /= 10;
- __lmsg[34] = '0' + n % 10;
-
- __psx_vtbl->log_output(
- __lmsg,
- sizeof(__lmsg));
-
- return -ENOSYS;
-}