diff options
Diffstat (limited to 'src/internal')
-rw-r--r-- | src/internal/ntux_dprintf_impl.c | 6 | ||||
-rw-r--r-- | src/internal/ntux_driver_impl.h | 7 | ||||
-rw-r--r-- | src/internal/ntux_init_impl.h | 25 | ||||
-rw-r--r-- | src/internal/ntux_memfn_impl.c | 15 | ||||
-rw-r--r-- | src/internal/ntux_nolibc_impl.c | 20 | ||||
-rw-r--r-- | src/internal/ntux_ntaio_impl.c | 29 |
6 files changed, 35 insertions, 67 deletions
diff --git a/src/internal/ntux_dprintf_impl.c b/src/internal/ntux_dprintf_impl.c index 1f87eb6..c39b4da 100644 --- a/src/internal/ntux_dprintf_impl.c +++ b/src/internal/ntux_dprintf_impl.c @@ -1,6 +1,6 @@ -#include <ntapi/ntapi.h> #include <psxabi/sys_sysapi.h> #include <psxabi/sys_errno.h> +#include <psxxfi/xfi_base.h> #include <ntux/ntux.h> #include "ntux_driver_impl.h" @@ -24,7 +24,7 @@ int ntux_dprintf(int fd, const char * fmt, ...) va_start(ap,fmt); size = sizeof(chbuf); - buf = ((cnt = ntapi->vsnprintf(chbuf,size,fmt,ap)) < size) + buf = ((cnt = __xfi_vsnprintf(chbuf,size,fmt,ap)) < size) ? chbuf : calloc(1, cnt + 1); va_end(ap); @@ -34,7 +34,7 @@ int ntux_dprintf(int fd, const char * fmt, ...) } else if (buf) { va_start(ap,fmt); - ntapi->vsprintf(buf,fmt,ap); + __xfi_vsprintf(buf,fmt,ap); va_end(ap); } else { diff --git a/src/internal/ntux_driver_impl.h b/src/internal/ntux_driver_impl.h index 0ab0394..06a5c8f 100644 --- a/src/internal/ntux_driver_impl.h +++ b/src/internal/ntux_driver_impl.h @@ -1,8 +1,10 @@ #ifndef NTUX_DRIVER_IMPL_H #define NTUX_DRIVER_IMPL_H -#include <ntapi/ntapi.h> +#include <psxabi/sys_abitypes.h> +#include <psxabi/sys_fcntl.h> #include <psxscl/psxscl.h> + #include <stdint.h> #include <stdio.h> @@ -16,9 +18,6 @@ extern const struct argv_option ntux_default_options[]; extern const struct argv_option ntux_spawn_options[]; extern const struct argv_option ntux_strace_options[]; extern const struct argv_option ntux_chmod_options[]; -extern const struct _ntapi_vtbl * ntux_ntapi; - -#define ntapi ntux_ntapi enum app_tags { TAG_HELP, diff --git a/src/internal/ntux_init_impl.h b/src/internal/ntux_init_impl.h deleted file mode 100644 index 69d008a..0000000 --- a/src/internal/ntux_init_impl.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef NTUX_INIT_IMPL_H -#define NTUX_INIT_IMPL_H - -#include <psxxfi/xfi_ntapi.h> -#include <ntapi/ntapi.h> -#include <ntapi/nt_atomic.h> - -extern const ntapi_vtbl * ntux_ntapi; - -static int ntux_init(void) -{ - int32_t status; - ntapi_vtbl * pvtbl; - - if ((status = __xfi_ntapi_init(&pvtbl))) - return status; - - at_locked_cas( - (intptr_t *)&ntux_ntapi, - 0,(intptr_t)pvtbl); - - return 0; -} - -#endif diff --git a/src/internal/ntux_memfn_impl.c b/src/internal/ntux_memfn_impl.c index cf930bb..7780fc6 100644 --- a/src/internal/ntux_memfn_impl.c +++ b/src/internal/ntux_memfn_impl.c @@ -4,8 +4,15 @@ /* Released under GPLv2 and GPLv3; see COPYING.NTUX. */ /***********************************************************/ +#include <psxxfi/xfi_base.h> +#include <psxxfi/xfi_acl.h> + +#include <ntapi/nt_memory.h> +#include <ntapi/nt_file.h> +#include <ntapi/nt_process.h> + #include <stddef.h> -#include <ntapi/ntapi.h> + #include "ntux_memfn_impl.h" #include "ntux_driver_impl.h" @@ -23,7 +30,7 @@ void * ntux_calloc(size_t n, size_t size) block.addr = 0; block.size = size + sizeof(block); - if (ntapi->zw_allocate_virtual_memory( + if (__xfi_allocate_virtual_memory( NT_CURRENT_PROCESS_HANDLE, &block.addr, 0, @@ -64,7 +71,7 @@ void * ntux_balloc( baddr = addr; baddr -= offsetof(struct ntux_memory_block,buffer); - ntapi->tt_aligned_block_memcpy( + __xfi_memcpy( (uintptr_t *)block, (uintptr_t *)baddr, sizeof(*block)); @@ -86,7 +93,7 @@ void ntux_free(void * addr) block.addr = addr; block.size = 0; - ntapi->zw_free_virtual_memory( + __xfi_free_virtual_memory( NT_CURRENT_PROCESS_HANDLE, &block.addr, &block.size, diff --git a/src/internal/ntux_nolibc_impl.c b/src/internal/ntux_nolibc_impl.c index c027fe9..b5a016b 100644 --- a/src/internal/ntux_nolibc_impl.c +++ b/src/internal/ntux_nolibc_impl.c @@ -4,40 +4,38 @@ /* Released under GPLv2 and GPLv3; see COPYING.NTUX. */ /***********************************************************/ -#include <ntapi/ntapi.h> - -extern const ntapi_vtbl * ntux_ntapi; +#include <psxxfi/xfi_base.h> void * ntux_memcpy(void * dst, const void * src, size_t n) { - return ntux_ntapi->tt_generic_memcpy(dst,src,n); + return __xfi_memcpy(dst,src,n); } void * ntux_memset(void * ch, int c, size_t n) { - return ntux_ntapi->tt_generic_memset(ch,c,n); + return __xfi_memset(ch,c,n); } char * ntux_strcpy(char * dst, const char * src) { - return ntux_ntapi->tt_generic_memcpy( + return __xfi_memcpy( dst,src, - ntux_ntapi->tt_string_null_offset_multibyte(src)); + __xfi_strlen(src)); } size_t ntux_strlen(const char * ch) { - return ntux_ntapi->tt_string_null_offset_multibyte(ch); + return __xfi_strlen(ch); } int ntux_strcmp(const char * a, const char * b) { - return ntux_ntapi->tt_strcmp_multibyte(a,b); + return __xfi_strcmp(a,b); } int ntux_strncmp(const char * a, const char * b, size_t n) { - return ntux_ntapi->tt_strncmp_multibyte(a,b,n); + return __xfi_strncmp(a,b,n); } char * ntux_strchr(const char * ch, int c) @@ -53,7 +51,7 @@ char * ntux_strrchr(const char * ch, int c) const char * base; base = ch; - ch += ntux_ntapi->tt_string_null_offset_multibyte(ch); + ch += __xfi_strlen(ch); for (; ch >= base; ch--) if (*ch == c) diff --git a/src/internal/ntux_ntaio_impl.c b/src/internal/ntux_ntaio_impl.c index 772df64..ec3389d 100644 --- a/src/internal/ntux_ntaio_impl.c +++ b/src/internal/ntux_ntaio_impl.c @@ -4,11 +4,15 @@ /* Released under GPLv2 and GPLv3; see COPYING.NTUX. */ /***********************************************************/ -#include <ntapi/ntapi.h> #include <psxabi/sys_sysapi.h> #include <psxabi/sys_errno.h> -extern const ntapi_vtbl * ntux_ntapi; +#include <psxxfi/xfi_base.h> +#include <psxxfi/xfi_acl.h> + +#include <ntapi/nt_memory.h> +#include <ntapi/nt_file.h> +#include <ntapi/nt_process.h> int ntux_sprintf(char * str, const char * fmt, ...) { @@ -16,7 +20,7 @@ int ntux_sprintf(char * str, const char * fmt, ...) va_list ap; va_start(ap, fmt); - ret = ntux_ntapi->vsprintf(str, fmt, ap); + ret = __xfi_vsprintf(str, fmt, ap); va_end(ap); return ret; @@ -28,7 +32,7 @@ int ntux_snprintf(char * str, size_t n, const char * fmt, ...) va_list ap; va_start(ap, fmt); - ret = ntux_ntapi->vsnprintf(str, n, fmt, ap); + ret = __xfi_vsnprintf(str, n, fmt, ap); va_end(ap); return ret; @@ -36,20 +40,5 @@ int ntux_snprintf(char * str, size_t n, const char * fmt, ...) int ntux_isatty(int fildes) { - nt_runtime_data * rtdata; - - if ((ntux_ntapi->tt_get_runtime_data(&rtdata,0))) - return 0; - - if (fildes == 0) - return (rtdata->stdin_type == NT_FILE_TYPE_PTY); - - else if (fildes == 1) - return (rtdata->stdout_type == NT_FILE_TYPE_PTY); - - else if (fildes == 2) - return (rtdata->stderr_type == NT_FILE_TYPE_PTY); - - else - return 0; + return __xfi_get_runtime_data_file_type(fildes) == NT_FILE_TYPE_PTY; } |