diff options
-rw-r--r-- | project/headers.mk | 1 | ||||
-rw-r--r-- | src/cmds/ntux_cmd_chmod.c | 16 | ||||
-rw-r--r-- | src/cmds/ntux_cmd_spawn.c | 1 | ||||
-rw-r--r-- | src/cmds/ntux_cmd_stat.c | 4 | ||||
-rw-r--r-- | src/cmds/ntux_cmd_strace.c | 1 | ||||
-rw-r--r-- | src/driver/ntux_driver_ctx.c | 14 | ||||
-rw-r--r-- | src/init/ntux_init_ldso.c | 4 | ||||
-rw-r--r-- | src/init/ntux_init_static.c | 1 | ||||
-rw-r--r-- | src/init/ntux_init_vrfs.c | 1 | ||||
-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 |
15 files changed, 54 insertions, 91 deletions
diff --git a/project/headers.mk b/project/headers.mk index 3a75ef5..f784a76 100644 --- a/project/headers.mk +++ b/project/headers.mk @@ -7,7 +7,6 @@ INTERNAL_HEADERS = \ $(SOURCE_DIR)/src/internal/$(PACKAGE)_dprintf_impl.h \ $(SOURCE_DIR)/src/internal/$(PACKAGE)_driver_impl.h \ $(SOURCE_DIR)/src/internal/$(PACKAGE)_errinfo_impl.h \ - $(SOURCE_DIR)/src/internal/$(PACKAGE)_init_impl.h \ $(SOURCE_DIR)/src/internal/$(PACKAGE)_memfn_impl.h \ $(SOURCE_DIR)/src/internal/$(PACKAGE)_nolibc_impl.h \ $(SOURCE_DIR)/src/internal/$(PACKAGE)_strerr_impl.h \ diff --git a/src/cmds/ntux_cmd_chmod.c b/src/cmds/ntux_cmd_chmod.c index 03ab8f5..55b517d 100644 --- a/src/cmds/ntux_cmd_chmod.c +++ b/src/cmds/ntux_cmd_chmod.c @@ -4,15 +4,19 @@ /* Released under GPLv2 and GPLv3; see COPYING.NTUX. */ /***********************************************************/ -#include <ntapi/ntapi.h> #include <psxabi/sys_sysapi.h> #include <psxabi/sys_stat.h> #include <psxabi/sys_errno.h> +#include <psxxfi/xfi_base.h> +#include <psxxfi/xfi_acl.h> #include <psxxfi/xfi_fs.h> #include <psxxfi/xfi_ofd.h> #include <psxxfi/xfi_unicode.h> +#include <ntapi/nt_acl.h> +#include <ntapi/nt_file.h> + #include <ntux/ntux.h> #include "ntux_driver_impl.h" #include "ntux_nolibc_impl.h" @@ -21,7 +25,7 @@ static int ntux_cmd_chmod_ret(int fd, struct __ofd * ofd, void * hasync, int ret) { if (hasync) - ntapi->zw_close(hasync); + __xfi_close_handle(hasync); if (ofd) __xfi_ofd_ref_dec(ofd); @@ -103,7 +107,7 @@ int ntux_cmd_chmod(const struct ntux_driver_ctx * dctx, const char * dunit) /* srcsd */ srcsd = (nt_sd *)buf; - if ((status = ntapi->zw_query_security_object( + if ((status = __xfi_query_security_object( hasync, NT_OWNER_SECURITY_INFORMATION | NT_GROUP_SECURITY_INFORMATION @@ -113,7 +117,7 @@ int ntux_cmd_chmod(const struct ntux_driver_ctx * dctx, const char * dunit) fd,ofd,hasync, NTUX_SYSTEM_ERROR(dctx)); - if ((status = ntapi->acl_init_common_descriptor_meta( + if ((status = __xfi_acl_init_common_descriptor_meta( &meta,srcsd, NT_ACL_INIT_COMMON_DESCRIPTION_META_STRICT_MODE))) return ntux_cmd_chmod_ret( @@ -129,13 +133,13 @@ int ntux_cmd_chmod(const struct ntux_driver_ctx * dctx, const char * dunit) access_admin = access_owner | NT_SEC_WRITE_DAC; /* updated dacl */ - ntapi->acl_init_common_descriptor( + __xfi_acl_init_common_descriptor( &dstsd, meta.owner,meta.group,0,0, access_owner,access_group,access_other, access_admin,meta.system_acc); - if ((status = ntapi->zw_set_security_object( + if ((status = __xfi_set_security_object( hasync, NT_DACL_SECURITY_INFORMATION, &dstsd.sd))) diff --git a/src/cmds/ntux_cmd_spawn.c b/src/cmds/ntux_cmd_spawn.c index cb88696..f488e3e 100644 --- a/src/cmds/ntux_cmd_spawn.c +++ b/src/cmds/ntux_cmd_spawn.c @@ -4,7 +4,6 @@ /* Released under GPLv2 and GPLv3; see COPYING.NTUX. */ /***********************************************************/ -#include <ntapi/ntapi.h> #include <psxabi/sys_sysapi.h> #include <psxabi/sys_errno.h> diff --git a/src/cmds/ntux_cmd_stat.c b/src/cmds/ntux_cmd_stat.c index 8634c4a..f043ddb 100644 --- a/src/cmds/ntux_cmd_stat.c +++ b/src/cmds/ntux_cmd_stat.c @@ -4,12 +4,12 @@ /* Released under GPLv2 and GPLv3; see COPYING.NTUX. */ /***********************************************************/ -#include <ntapi/ntapi.h> #include <psxabi/sys_sysapi.h> #include <psxabi/sys_stat.h> #include <psxabi/sys_errno.h> #include <psxxfi/xfi_ofd.h> +#include <psxxfi/xfi_stat.h> #include <psxxfi/xfi_unicode.h> #include <ntux/ntux.h> @@ -100,7 +100,7 @@ int ntux_cmd_stat(const struct ntux_driver_ctx * dctx, const char * dunit) nstat = (nt_stat *)sbuf; /* stat */ - if ((status = ntapi->tt_stat( + if ((status = __xfi_stat( ofd->info.hfile, nstat,bufsize, buf,bufsize, diff --git a/src/cmds/ntux_cmd_strace.c b/src/cmds/ntux_cmd_strace.c index 4f23e39..bdc1308 100644 --- a/src/cmds/ntux_cmd_strace.c +++ b/src/cmds/ntux_cmd_strace.c @@ -4,7 +4,6 @@ /* Released under GPLv2 and GPLv3; see COPYING.NTUX. */ /***********************************************************/ -#include <ntapi/ntapi.h> #include <ntapi/nt_termios.h> #include <psxabi/sys_sysapi.h> diff --git a/src/driver/ntux_driver_ctx.c b/src/driver/ntux_driver_ctx.c index 370c69b..8445b3e 100644 --- a/src/driver/ntux_driver_ctx.c +++ b/src/driver/ntux_driver_ctx.c @@ -4,13 +4,14 @@ /* Released under GPLv2 and GPLv3; see COPYING.NTUX. */ /***********************************************************/ -#include <ntapi/ntapi.h> -#include <psxscl/psxscl.h> +#include <psxabi/sys_abitypes.h> #include <psxabi/sys_fcntl.h> +#include <psxscl/psxscl.h> + +#include <ntapi/nt_tty.h> #include <stdint.h> #include <ntux/ntux.h> -#include "ntux_init_impl.h" #include "ntux_nolibc_impl.h" #define ARGV_DRIVER @@ -27,9 +28,6 @@ static const nt_tty_affiliation tty_affiliation __attr_section__(".midipix") = NT_TTY_AFFILIATION_DEFAULT; -/* ntapi accessor table */ -const ntapi_vtbl * ntux_ntapi; - /* ntux command names */ static const char * const ntux_cmd_name[NTUX_CMD_CAP] = { [NTUX_CMD_STAT] = "stat", @@ -309,10 +307,6 @@ int ntux_get_driver_ctx( ARGV_MODE_SCAN, 0,0,0,0,0,0,0}; - /* init */ - if (ntux_init()) - return -1; - /* fdctx */ if (!fdctx) { fdctx = &(const struct ntux_fd_ctx) { diff --git a/src/init/ntux_init_ldso.c b/src/init/ntux_init_ldso.c index 361f5d2..a7adbd1 100644 --- a/src/init/ntux_init_ldso.c +++ b/src/init/ntux_init_ldso.c @@ -8,9 +8,11 @@ #define PE_LDSO 1 #endif +#include <ntapi/nt_status.h> +#include <ntapi/nt_process.h> + #include <psxtypes/psxtypes.h> #include <pemagine/pemagine.h> -#include <ntapi/ntapi.h> #include <psxscl/psxglue.h> #include <ntux/ntux.h> diff --git a/src/init/ntux_init_static.c b/src/init/ntux_init_static.c index 39ed7a7..ba9cbd1 100644 --- a/src/init/ntux_init_static.c +++ b/src/init/ntux_init_static.c @@ -6,7 +6,6 @@ #include <psxtypes/psxtypes.h> #include <pemagine/pemagine.h> -#include <ntapi/ntapi.h> #include <psxscl/psxglue.h> #include <ntux/ntux.h> diff --git a/src/init/ntux_init_vrfs.c b/src/init/ntux_init_vrfs.c index 3dcd49c..c7cc82e 100644 --- a/src/init/ntux_init_vrfs.c +++ b/src/init/ntux_init_vrfs.c @@ -10,7 +10,6 @@ #include <psxtypes/psxtypes.h> #include <pemagine/pemagine.h> -#include <ntapi/ntapi.h> #include <psxscl/psxglue.h> #include <ntux/ntux.h> 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; } |