diff options
author | midipix <writeonce@midipix.org> | 2017-11-05 22:21:30 -0500 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2017-11-05 22:38:13 -0500 |
commit | 6f8ae442bbadc51a12ad6ce8fc94461bb1e632e8 (patch) | |
tree | 626b8589a247218ff422b1cfddfee21cbb8ec57e | |
parent | e6ac10e460aefea0c6215699db45a27870291705 (diff) | |
download | mmglue-6f8ae442bbadc51a12ad6ce8fc94461bb1e632e8.tar.bz2 mmglue-6f8ae442bbadc51a12ad6ce8fc94461bb1e632e8.tar.xz |
psxglue.h: defined struct __psx_vtbl and struct __ldso_vtbl more elegantly.
-rw-r--r-- | arch/nt32/psxglue.h | 63 | ||||
-rw-r--r-- | arch/nt32/src/crt_glue.c | 1 | ||||
-rw-r--r-- | arch/nt32/src/crt_tls.c | 1 | ||||
-rw-r--r-- | arch/nt32/src/syscall_disp.c | 1 | ||||
-rw-r--r-- | arch/nt32/src/vtbl.c | 2 | ||||
-rw-r--r-- | arch/nt64/psxglue.h | 63 | ||||
-rw-r--r-- | arch/nt64/src/crt_glue.c | 1 | ||||
-rw-r--r-- | arch/nt64/src/crt_tls.c | 1 | ||||
-rw-r--r-- | arch/nt64/src/syscall_disp.c | 1 | ||||
-rw-r--r-- | arch/nt64/src/vtbl.c | 2 | ||||
-rw-r--r-- | crt/nt32/Scrtldso.c | 2 | ||||
-rw-r--r-- | crt/nt32/Scrtvrfs.c | 2 | ||||
-rw-r--r-- | crt/nt32/crtdinga.c | 2 | ||||
-rw-r--r-- | crt/nt32/crtldso.c | 2 | ||||
-rw-r--r-- | crt/nt32/crtposix.c | 2 | ||||
-rw-r--r-- | crt/nt32/crtvrfs.c | 2 | ||||
-rw-r--r-- | crt/nt64/Scrtldso.c | 2 | ||||
-rw-r--r-- | crt/nt64/Scrtvrfs.c | 2 | ||||
-rw-r--r-- | crt/nt64/crtdinga.c | 2 | ||||
-rw-r--r-- | crt/nt64/crtldso.c | 2 | ||||
-rw-r--r-- | crt/nt64/crtposix.c | 2 | ||||
-rw-r--r-- | crt/nt64/crtvrfs.c | 2 | ||||
-rw-r--r-- | src/ldso/nt32/dynlink.c | 2 | ||||
-rw-r--r-- | src/ldso/nt64/dynlink.c | 2 |
24 files changed, 88 insertions, 76 deletions
diff --git a/arch/nt32/psxglue.h b/arch/nt32/psxglue.h index 0e4a440..5dbe57b 100644 --- a/arch/nt32/psxglue.h +++ b/arch/nt32/psxglue.h @@ -7,48 +7,23 @@ #define __PSXOPT_LDSO 0x4 #define __PSXOPT_VRFS 0x8 -typedef int __ldso_dladdr(const void * addr, void * info); -typedef int __ldso_dlinfo(void * dso, int req, void * res); -typedef void * __ldso_dlsym(void * p, const char * s, void * ra); -typedef void * __ldso_dlopen(const char * file, int mode, const char ** pathv, int * status); -typedef int __ldso_dlclose(void *p); -typedef char * __ldso_dlerror(void); -typedef void __ldso_reset_tls(void); - -typedef int __psx_start_main(void *, int, char **, int (*)(void *, int, char **)); -typedef void __psx_convert_thread(void); -typedef void __psx_unmapself(void *, void *); -typedef long __psx_log_output(char *, signed int); - struct __ldso_vtbl { - __ldso_dladdr * dladdr; - __ldso_dlinfo * dlinfo; - __ldso_dlsym * dlsym; - __ldso_dlopen * dlopen; - __ldso_dlclose * dlclose; - __ldso_dlerror * dlerror; - __ldso_reset_tls * reset_tls; + int (*dladdr) (const void * addr, void * info); + int (*dlinfo) (void * dso, int req, void * res); + void * (*dlsym) (void * p, const char * s, void * ra); + void * (*dlopen) (const char * file, int mode, const char ** pathv, int * status); + int (*dlclose) (void *p); + char * (*dlerror) (void); + void (*reset_tls) (void); }; struct __psx_vtbl { - void (*do_global_ctors_fn)(); - void (*do_global_dtors_fn)(); - __psx_start_main * start_main; - __psx_convert_thread * convert_thread; - __psx_unmapself * unmapself; - __psx_log_output * log_output; -}; - -struct __psx_context { - int size; - int options; - void ** sys_vtbl; - struct __ldso_vtbl * ldso_vtbl; - const struct __psx_vtbl*psx_vtbl; - unsigned int teb_sys_idx; - unsigned int teb_libc_idx; - void * pthread_surrogate_fn; - void * pthread_create_fn; + void (*do_global_ctors_fn) (); + void (*do_global_dtors_fn) (); + int (*start_main) (void *, int, char **, int (*)(void *, int, char **)); + void (*convert_thread) (void); + void (*unmapself) (void *, void *); + ssize_t (*log_output) (void *, ssize_t); }; struct __tlca_abi { @@ -59,6 +34,18 @@ struct __tlca_abi { char ** pthread_dtls; }; +struct __psx_context { + int size; + int options; + void ** sys_vtbl; + const struct __ldso_vtbl * ldso_vtbl; + const struct __psx_vtbl * psx_vtbl; + unsigned int teb_sys_idx; + unsigned int teb_libc_idx; + void * pthread_surrogate_fn; + void * pthread_create_fn; +}; + typedef int __psx_init_routine( int * argc, char *** argv, diff --git a/arch/nt32/src/crt_glue.c b/arch/nt32/src/crt_glue.c index 2967ad6..4925513 100644 --- a/arch/nt32/src/crt_glue.c +++ b/arch/nt32/src/crt_glue.c @@ -1,4 +1,5 @@ #include <unistd.h> +#include <stdint.h> #include <pthread.h> #include "atomic.h" #include "syscall.h" diff --git a/arch/nt32/src/crt_tls.c b/arch/nt32/src/crt_tls.c index da30de0..20080c6 100644 --- a/arch/nt32/src/crt_tls.c +++ b/arch/nt32/src/crt_tls.c @@ -1,3 +1,4 @@ +#include <unistd.h> #include <stdint.h> #include <stddef.h> #include "psxglue.h" diff --git a/arch/nt32/src/syscall_disp.c b/arch/nt32/src/syscall_disp.c index 3369ca0..9ea5966 100644 --- a/arch/nt32/src/syscall_disp.c +++ b/arch/nt32/src/syscall_disp.c @@ -1,3 +1,4 @@ +#include <unistd.h> #include <stdint.h> #include <stddef.h> #include "syscall.h" diff --git a/arch/nt32/src/vtbl.c b/arch/nt32/src/vtbl.c index aabd633..f21ce17 100644 --- a/arch/nt32/src/vtbl.c +++ b/arch/nt32/src/vtbl.c @@ -1,3 +1,5 @@ +#include <unistd.h> +#include <stdint.h> #include "psxglue.h" #include "errno.h" diff --git a/arch/nt64/psxglue.h b/arch/nt64/psxglue.h index 0e4a440..5dbe57b 100644 --- a/arch/nt64/psxglue.h +++ b/arch/nt64/psxglue.h @@ -7,48 +7,23 @@ #define __PSXOPT_LDSO 0x4 #define __PSXOPT_VRFS 0x8 -typedef int __ldso_dladdr(const void * addr, void * info); -typedef int __ldso_dlinfo(void * dso, int req, void * res); -typedef void * __ldso_dlsym(void * p, const char * s, void * ra); -typedef void * __ldso_dlopen(const char * file, int mode, const char ** pathv, int * status); -typedef int __ldso_dlclose(void *p); -typedef char * __ldso_dlerror(void); -typedef void __ldso_reset_tls(void); - -typedef int __psx_start_main(void *, int, char **, int (*)(void *, int, char **)); -typedef void __psx_convert_thread(void); -typedef void __psx_unmapself(void *, void *); -typedef long __psx_log_output(char *, signed int); - struct __ldso_vtbl { - __ldso_dladdr * dladdr; - __ldso_dlinfo * dlinfo; - __ldso_dlsym * dlsym; - __ldso_dlopen * dlopen; - __ldso_dlclose * dlclose; - __ldso_dlerror * dlerror; - __ldso_reset_tls * reset_tls; + int (*dladdr) (const void * addr, void * info); + int (*dlinfo) (void * dso, int req, void * res); + void * (*dlsym) (void * p, const char * s, void * ra); + void * (*dlopen) (const char * file, int mode, const char ** pathv, int * status); + int (*dlclose) (void *p); + char * (*dlerror) (void); + void (*reset_tls) (void); }; struct __psx_vtbl { - void (*do_global_ctors_fn)(); - void (*do_global_dtors_fn)(); - __psx_start_main * start_main; - __psx_convert_thread * convert_thread; - __psx_unmapself * unmapself; - __psx_log_output * log_output; -}; - -struct __psx_context { - int size; - int options; - void ** sys_vtbl; - struct __ldso_vtbl * ldso_vtbl; - const struct __psx_vtbl*psx_vtbl; - unsigned int teb_sys_idx; - unsigned int teb_libc_idx; - void * pthread_surrogate_fn; - void * pthread_create_fn; + void (*do_global_ctors_fn) (); + void (*do_global_dtors_fn) (); + int (*start_main) (void *, int, char **, int (*)(void *, int, char **)); + void (*convert_thread) (void); + void (*unmapself) (void *, void *); + ssize_t (*log_output) (void *, ssize_t); }; struct __tlca_abi { @@ -59,6 +34,18 @@ struct __tlca_abi { char ** pthread_dtls; }; +struct __psx_context { + int size; + int options; + void ** sys_vtbl; + const struct __ldso_vtbl * ldso_vtbl; + const struct __psx_vtbl * psx_vtbl; + unsigned int teb_sys_idx; + unsigned int teb_libc_idx; + void * pthread_surrogate_fn; + void * pthread_create_fn; +}; + typedef int __psx_init_routine( int * argc, char *** argv, diff --git a/arch/nt64/src/crt_glue.c b/arch/nt64/src/crt_glue.c index 2967ad6..4925513 100644 --- a/arch/nt64/src/crt_glue.c +++ b/arch/nt64/src/crt_glue.c @@ -1,4 +1,5 @@ #include <unistd.h> +#include <stdint.h> #include <pthread.h> #include "atomic.h" #include "syscall.h" diff --git a/arch/nt64/src/crt_tls.c b/arch/nt64/src/crt_tls.c index da30de0..20080c6 100644 --- a/arch/nt64/src/crt_tls.c +++ b/arch/nt64/src/crt_tls.c @@ -1,3 +1,4 @@ +#include <unistd.h> #include <stdint.h> #include <stddef.h> #include "psxglue.h" diff --git a/arch/nt64/src/syscall_disp.c b/arch/nt64/src/syscall_disp.c index 3369ca0..9ea5966 100644 --- a/arch/nt64/src/syscall_disp.c +++ b/arch/nt64/src/syscall_disp.c @@ -1,3 +1,4 @@ +#include <unistd.h> #include <stdint.h> #include <stddef.h> #include "syscall.h" diff --git a/arch/nt64/src/vtbl.c b/arch/nt64/src/vtbl.c index aabd633..f21ce17 100644 --- a/arch/nt64/src/vtbl.c +++ b/arch/nt64/src/vtbl.c @@ -1,3 +1,5 @@ +#include <unistd.h> +#include <stdint.h> #include "psxglue.h" #include "errno.h" diff --git a/crt/nt32/Scrtldso.c b/crt/nt32/Scrtldso.c index c3130b8..936a9d2 100644 --- a/crt/nt32/Scrtldso.c +++ b/crt/nt32/Scrtldso.c @@ -1,3 +1,5 @@ +#include <unistd.h> +#include <stdint.h> #include "psxglue.h" const int __crtopt_ldso = __PSXOPT_LDSO; diff --git a/crt/nt32/Scrtvrfs.c b/crt/nt32/Scrtvrfs.c index d22d444..bef26df 100644 --- a/crt/nt32/Scrtvrfs.c +++ b/crt/nt32/Scrtvrfs.c @@ -1,3 +1,5 @@ +#include <unistd.h> +#include <stdint.h> #include "psxglue.h" const int __crtopt_vrfs = __PSXOPT_VRFS; diff --git a/crt/nt32/crtdinga.c b/crt/nt32/crtdinga.c index 0ba2580..216fed8 100644 --- a/crt/nt32/crtdinga.c +++ b/crt/nt32/crtdinga.c @@ -1,3 +1,5 @@ +#include <unistd.h> +#include <stdint.h> #include "psxglue.h" const int __crtopt_dinga = __PSXOPT_DINGA; diff --git a/crt/nt32/crtldso.c b/crt/nt32/crtldso.c index bdc376e..2a46c84 100644 --- a/crt/nt32/crtldso.c +++ b/crt/nt32/crtldso.c @@ -1,3 +1,5 @@ +#include <unistd.h> +#include <stdint.h> #include "psxglue.h" #include "peldso.h" diff --git a/crt/nt32/crtposix.c b/crt/nt32/crtposix.c index b8e5113..f8e7664 100644 --- a/crt/nt32/crtposix.c +++ b/crt/nt32/crtposix.c @@ -1,3 +1,5 @@ +#include <unistd.h> +#include <stdint.h> #include "psxglue.h" const int __crtopt_posix = __PSXOPT_POSIX; diff --git a/crt/nt32/crtvrfs.c b/crt/nt32/crtvrfs.c index 3608ab8..4fa743c 100644 --- a/crt/nt32/crtvrfs.c +++ b/crt/nt32/crtvrfs.c @@ -1,3 +1,5 @@ +#include <unistd.h> +#include <stdint.h> #include "psxglue.h" #include "peldso.h" diff --git a/crt/nt64/Scrtldso.c b/crt/nt64/Scrtldso.c index c3130b8..936a9d2 100644 --- a/crt/nt64/Scrtldso.c +++ b/crt/nt64/Scrtldso.c @@ -1,3 +1,5 @@ +#include <unistd.h> +#include <stdint.h> #include "psxglue.h" const int __crtopt_ldso = __PSXOPT_LDSO; diff --git a/crt/nt64/Scrtvrfs.c b/crt/nt64/Scrtvrfs.c index d22d444..bef26df 100644 --- a/crt/nt64/Scrtvrfs.c +++ b/crt/nt64/Scrtvrfs.c @@ -1,3 +1,5 @@ +#include <unistd.h> +#include <stdint.h> #include "psxglue.h" const int __crtopt_vrfs = __PSXOPT_VRFS; diff --git a/crt/nt64/crtdinga.c b/crt/nt64/crtdinga.c index 0ba2580..216fed8 100644 --- a/crt/nt64/crtdinga.c +++ b/crt/nt64/crtdinga.c @@ -1,3 +1,5 @@ +#include <unistd.h> +#include <stdint.h> #include "psxglue.h" const int __crtopt_dinga = __PSXOPT_DINGA; diff --git a/crt/nt64/crtldso.c b/crt/nt64/crtldso.c index bdc376e..2a46c84 100644 --- a/crt/nt64/crtldso.c +++ b/crt/nt64/crtldso.c @@ -1,3 +1,5 @@ +#include <unistd.h> +#include <stdint.h> #include "psxglue.h" #include "peldso.h" diff --git a/crt/nt64/crtposix.c b/crt/nt64/crtposix.c index b8e5113..f8e7664 100644 --- a/crt/nt64/crtposix.c +++ b/crt/nt64/crtposix.c @@ -1,3 +1,5 @@ +#include <unistd.h> +#include <stdint.h> #include "psxglue.h" const int __crtopt_posix = __PSXOPT_POSIX; diff --git a/crt/nt64/crtvrfs.c b/crt/nt64/crtvrfs.c index 3608ab8..4fa743c 100644 --- a/crt/nt64/crtvrfs.c +++ b/crt/nt64/crtvrfs.c @@ -1,3 +1,5 @@ +#include <unistd.h> +#include <stdint.h> #include "psxglue.h" #include "peldso.h" diff --git a/src/ldso/nt32/dynlink.c b/src/ldso/nt32/dynlink.c index cd317d5..2426a72 100644 --- a/src/ldso/nt32/dynlink.c +++ b/src/ldso/nt32/dynlink.c @@ -1,5 +1,7 @@ #define _BSD_SOURCE +#include <unistd.h> +#include <stdint.h> #include <stdlib.h> #include <string.h> #include <dlfcn.h> diff --git a/src/ldso/nt64/dynlink.c b/src/ldso/nt64/dynlink.c index cd317d5..2426a72 100644 --- a/src/ldso/nt64/dynlink.c +++ b/src/ldso/nt64/dynlink.c @@ -1,5 +1,7 @@ #define _BSD_SOURCE +#include <unistd.h> +#include <stdint.h> #include <stdlib.h> #include <string.h> #include <dlfcn.h> |