Index: asp3_tinet_ecnl_rx/trunk/ntshell/src/syscall.c
===================================================================
--- asp3_tinet_ecnl_rx/trunk/ntshell/src/syscall.c	(revision 340)
+++ asp3_tinet_ecnl_rx/trunk/ntshell/src/syscall.c	(revision 342)
@@ -1,7 +1,7 @@
 /*
  *  TOPPERS ECHONET Lite Communication Middleware
- * 
+ *
  *  Copyright (C) 2018 Cores Co., Ltd. Japan
- * 
+ *
  *  上記著作権者は，以下の(1)～(4)の条件を満たす場合に限り，本ソフトウェ
  *  ア（本ソフトウェアを改変したものを含む．以下同じ）を使用・複製・改
@@ -26,5 +26,5 @@
  *      由に基づく請求からも，上記著作権者およびTOPPERSプロジェクトを
  *      免責すること．
- * 
+ *
  *  本ソフトウェアは，無保証で提供されているものである．上記著作権者お
  *  よびTOPPERSプロジェクトは，本ソフトウェアに関して，特定の使用目的
@@ -32,6 +32,6 @@
  *  アの利用により直接的または間接的に生じたいかなる損害に関しても，そ
  *  の責任を負わない．
- * 
- *  @(#) $Id$
+ *
+ *  @(#) $Id: syscall.c 1530 2018-04-27 04:00:17Z coas-nagasima $
  */
 #include "bits/syscall.h"
@@ -42,855 +42,353 @@
 void *tid_address;
 
-void no_implement(const char *text)
+long no_implement(const char *text)
 {
 	syslog(LOG_ERROR, text);
 	DebugBreak();
-}
-
-long __syscall(long n, ...)
+	return -ENOSYS;
+}
+
+long __syscall_nr(long n, ...)
 {
 	long ret = -ENOSYS;
 	va_list ap;
-	int fd;
-
-	shellif_into();
 
 	va_start(ap, n);
 
 	switch (n) {
-	case SYS__llseek:
-		return shell_llseek(va_arg(ap, int), va_arg(ap, off_t), va_arg(ap, off_t *), va_arg(ap, int));
-	case SYS__newselect:
-		ret = shell_select(va_arg(ap, int), va_arg(ap, fd_set *), va_arg(ap, fd_set *), va_arg(ap, fd_set *), va_arg(ap, struct timeval *));
-		break;
-	case SYS_accept:
-		ret = shell_accept(va_arg(ap, int), va_arg(ap, struct sockaddr *), va_arg(ap, socklen_t *));
-		break;
-	case SYS_access:
-		ret = shell_access(va_arg(ap, const char *), va_arg(ap, int));
-		break;
-	case SYS_acct:
-		no_implement("acct\n");
-		break;
-	case SYS_adjtimex:
-		no_implement("adjtimex\n");
-		break;
-#ifdef SYS_arch_prctl
-	case SYS_arch_prctl:
-		no_implement("arch_prctl\n");
-		break;
+	case __NR_setresgid:
+		no_implement("setresgid");
+		break;
+	case __NR_setresuid:
+		no_implement("setresuid");
+		break;
+	case __NR_setgid:
+		no_implement("setgid");
+		break;
+	case __NR_setregid:
+		no_implement("setregid");
+		break;
+	case __NR_setreuid:
+		no_implement("setreuid");
+		break;
+	case __NR_setuid:
+		no_implement("setuid");
+		break;
+	default:
+		no_implement("syscall");
+		break;
+	}
+
+	va_end(ap);
+
+	return ret;
+}
+
+long SYS__llseek(long a, long b, long c, long d, long e) {
+	return shell_llseek((int)a, ((off_t)b << 32) | (off_t)c, (off_t *)d, (int)e);
+}
+
+long SYS__newselect(long a, long b, long c, long d, long e) {
+	return shell_select((int)a, (fd_set *)b, (fd_set *)c, (fd_set *)d, (struct timeval *)e);
+}
+
+long SYS_accept(long a, long b, long c) {
+	return shell_accept((int)a, (struct sockaddr *)b, (socklen_t *)c);
+}
+
+long SYS_access(long a, long b) {
+	return shell_access((const char *)a, (int)b);
+}
+
+long SYS_bind(long a, long b, long c) {
+	return shell_bind((int)a, (const struct sockaddr *)b, (socklen_t)c);
+}
+
+long SYS_brk(long a) {
+	return (long)shell_brk((void *)a);
+}
+
+long SYS_chdir(long a) {
+	return shell_chdir((const char *)a);
+}
+
+long SYS_chmod(long a, long b) {
+	return shell_chmod((const char *)a, (mode_t)b);
+}
+
+long SYS_chroot(long a) {
+	return shell_chroot((const char *)a);
+}
+
+long SYS_clock_getres(long a, long b) {
+	return shell_clock_getres((clockid_t)a, (struct timespec *)b);
+}
+
+long SYS_clock_gettime(long a, long b) {
+	return shell_clock_gettime((clockid_t)a, (struct timespec *)b);
+}
+
+long SYS_clock_settime(long a, long b) {
+	return shell_clock_settime((clockid_t)a, (const struct timespec *)b);
+}
+
+long SYS_close(long a) {
+	return shell_close((int)a);
+}
+
+long SYS_connect(long a, long b, long c) {
+	return shell_connect((int)a, (const struct sockaddr *)b, (socklen_t)c);
+}
+
+long SYS_exit(long a) {
+	shell_exit((int)a);
+	return 0;
+}
+
+long SYS_exit_group(long a) {
+	shell_exit_group((int)a);
+	return 0;
+}
+
+long SYS_fcntl64(long a, long b, long c) {
+	return shell_fcntl((int)a, (int)b, (void *)c);
+}
+
+long SYS_fdatasync() {
+	return no_implement("fdatasync\n");
+}
+
+long SYS_fstat64(long a, long b) {
+	return shell_fstat((int)a, (struct stat *)b);
+}
+
+long SYS_fsync(long a) {
+	return shell_fsync((int)a);
+}
+
+long SYS_ftruncate64(long a, long b, long c) {
+	return shell_ftruncate((int)a, ((off_t)b << 32) | (off_t)c);
+}
+
+long SYS_futex() {
+	int futex(int *uaddr, int op, int val, const struct timespec *timeout, int *uaddr2, int val3);
+	return no_implement("futex\n");
+}
+
+long SYS_futimesat() {
+	return no_implement("futimesat\n");
+}
+
+long SYS_getcwd(long a, long b) {
+	return (long)shell_getcwd((char *)a, (size_t)b);
+}
+
+long SYS_getdents64(long a, long b, long c) {
+	return shell_getdents((int)a, (struct dirent *)b, (size_t)c);
+}
+
+long SYS_getpeername(long a, long b, long c) {
+	return shell_getpeername((int)a, (struct sockaddr *)b, (socklen_t *)c);
+}
+
+long SYS_getsockname(long a, long b, long c) {
+	return shell_getsockname((int)a, (struct sockaddr *)b, (socklen_t *)c);
+}
+
+long SYS_getpid() {
+	return shell_getpid();
+}
+
+long SYS_getsockopt(long a, long b, long c, long d, long e) {
+	return shell_getsockopt((int)a, (int)b, (int)c, (void *)d, (socklen_t *)e);
+}
+
+long SYS_gettid() {
+	return shell_gettid();
+}
+
+long SYS_gettimeofday(long a, long b) {
+	return shell_gettimeofday((struct timeval *)a, (void *)b);
+}
+
+long SYS_getuid32() {
+	return no_implement("getuid\n");
+}
+
+long SYS_ioctl(long a, long b, long c) {
+	return shell_ioctl((int)a, (int)b, (void *)c);
+}
+
+long SYS_kill(long a, long b) {
+	return shell_kill((int)a, (int)b);
+}
+
+long SYS_link(long a, long b) {
+	return shell_link((const char *)a, (const char *)b);
+}
+
+long SYS_listen(long a, long b) {
+	return shell_listen((int)a, (int)b);
+}
+
+long SYS_lstat64(long a, long b) {
+	return shell_lstat((const char *__restrict)a, (struct stat *__restrict)b);
+}
+
+long SYS_madvise(long a, long b, long c) {
+	return shell_madvise((void *)a, (size_t)b, (int)c);
+}
+
+long SYS_mkdir(long a, long b) {
+	return shell_mkdir((const char *)a, (mode_t)b);
+}
+
+long SYS_mmap2(long a, long b, long c, long d, long e, long f, long g) {
+	return (int)shell_mmap2((void *)a, (size_t)b, (int)c, (int)d, (int)e, ((off_t)f << 32) | (off_t)g);
+}
+
+long SYS_mprotect(long a, long b, long c) {
+	return shell_mprotect((void *)a, (size_t)b, (int)c);
+}
+
+long SYS_munmap() {
+	return no_implement("munmap\n");
+}
+
+long SYS_open(long a, long b, long c) {
+	return shell_open((const char *)a, (int)b, (void *)c);
+}
+
+long SYS_poll(long a, long b, long c) {
+	return shell_poll((struct pollfd *)a, (nfds_t)b, (int)c);
+}
+
+long SYS_pread64() {
+	return no_implement("pread64\n");
+}
+
+long SYS_pwrite64() {
+	return no_implement("pwrite64\n");
+}
+
+long SYS_read(long a, long b, long c) {
+	return shell_read((int)a, (void *)b, (size_t)c);
+}
+
+long SYS_readv(long a, long b, long c) {
+	return shell_readv((int)a, (const struct iovec *)b, (int)c);
+}
+
+long SYS_recv(long a, long b, long c, long d) {
+	return shell_recv((int)a, (void *)b, (size_t)c, (int)d);
+}
+
+long SYS_recvfrom(long a, long b, long c, long d, long e, long f) {
+	if (a == 0)
+		return shell_recv(a, (void *)b, (size_t)c, (int)d);
+	else
+		return shell_recvfrom(a, (void *)b, (size_t)c, (int)d, (struct sockaddr *)e, (socklen_t *)f);
+}
+
+long SYS_recvmsg(long a, long b, long c) {
+	return shell_recvmsg((int)a, (struct msghdr *)b, (size_t)c);
+}
+
+long SYS_rename(long a, long b) {
+	return shell_rename((const char *)a, (const char *)b);
+}
+
+long SYS_rmdir(long a) {
+	return shell_rmdir((const char *)a);
+}
+
+long SYS_rt_sigaction(long a, long b, long c) {
+	return shell_sigaction((int)a, (const struct sigaction *)b, (struct sigaction *)c);
+}
+
+long SYS_rt_sigprocmask(long a, long b, long c) {
+	return shell_sigprocmask((int)a, (const sigset_t *)b, (sigset_t *)c);
+}
+
+long SYS_rt_sigqueueinfo() {
+	return no_implement("rt_sigqueueinfo\n");
+}
+
+long SYS_send(long a, long b, long c, long d) {
+	return shell_send((int)a, (const void *)b, (size_t)c, (int)d);
+}
+
+long SYS_sendmsg(long a, long b, long c) {
+	return shell_sendmsg((int)a, (const struct msghdr *)b, (size_t)c);
+}
+
+long SYS_sendto(long a, long b, long c, long d, long e, long f) {
+	if (a == 0)
+		return shell_send(a, (const void *)b, (size_t)c, (int)d);
+	else
+		return shell_sendto(a, (const void *)b, (size_t)c, (int)d, (const struct sockaddr *)e, (socklen_t)f);
+}
+
+long SYS_setsockopt(long a, long b, long c, long d, long e) {
+	return shell_setsockopt((int)a, (int)b, (int)c, (const void *)d, (socklen_t)e);
+}
+
+long SYS_shutdown(long a, long b) {
+	return shell_shutdown((int)a, (int)b);
+}
+
+long SYS_sched_setscheduler() {
+	return no_implement("sched_setscheduler\n");
+}
+
+long SYS_set_robust_list() {
+	return no_implement("set_robust_list\n");
+}
+
+#ifdef SYS_set_thread_area
+long SYS_set_thread_area(long a) {
+	thread_area = (void *)a;
+	return 0;
+}
 #endif
-	case SYS_bind:
-		ret = shell_bind(va_arg(ap, int), va_arg(ap, const struct sockaddr *), va_arg(ap, socklen_t));
-		break;
-	case SYS_brk:
-		ret = (long)shell_brk(va_arg(ap, void *));
-		break;
-#ifdef SYS_cachectl
-	case SYS_cachectl:
-		no_implement("cachectl\n");
-		break;
-#endif
-#ifdef SYS_cacheflush
-	case SYS_cacheflush:
-		no_implement("cacheflush\n");
-		break;
-#endif
-	case SYS_capget:
-		no_implement("capget\n");
-		break;
-	case SYS_capset:
-		no_implement("capset\n");
-		break;
-	case SYS_chdir:
-		ret = shell_chdir(va_arg(ap, const char *));
-		break;
-	case SYS_chmod:
-		ret = shell_chmod(va_arg(ap, const char *), va_arg(ap, mode_t));
-		break;
-	case SYS_chown32:
-		no_implement("chown\n");
-		break;
-	case SYS_chroot:
-		ret = shell_chroot(va_arg(ap, const char *));
-		break;
-	case SYS_clock_adjtime:
-		no_implement("clock_adjtime\n");
-		break;
-	case SYS_clock_getres:
-		ret = shell_clock_getres(va_arg(ap, clockid_t), va_arg(ap, struct timespec *));
-		break;
-	case SYS_clock_gettime:
-		ret = shell_clock_gettime(va_arg(ap, clockid_t), va_arg(ap, struct timespec *));
-		break;
-	case SYS_clock_nanosleep:
-		no_implement("clock_nanosleep\n");
-		break;
-	case SYS_clock_settime:
-		ret = shell_clock_settime(va_arg(ap, clockid_t), va_arg(ap, const struct timespec *));
-		break;
-	case SYS_clone:
-		no_implement("clone\n");
-		break;
-	case SYS_close:
-		ret = shell_close(va_arg(ap, int));
-		break;
-	case SYS_connect:
-		ret = shell_connect(va_arg(ap, int), va_arg(ap, const struct sockaddr *), va_arg(ap, socklen_t));
-		break;
-	case SYS_delete_module:
-		no_implement("delete_module\n");
-		break;
-	case SYS_dup:
-		no_implement("dup\n");
-		break;
-	case SYS_dup2:
-		no_implement("dup2\n");
-		break;
-	case SYS_dup3:
-		no_implement("dup3\n");
-		break;
-	case SYS_epoll_create:
-		no_implement("epoll_create\n");
-		break;
-	case SYS_epoll_create1:
-		no_implement("epoll_create1\n");
-		break;
-	case SYS_epoll_ctl:
-		no_implement("epoll_ctl\n");
-		break;
-	case SYS_epoll_pwait:
-		no_implement("epoll_pwait\n");
-		break;
-	case SYS_epoll_wait:
-		no_implement("epoll_wait\n");
-		break;
-	case SYS_eventfd:
-		no_implement("eventfd\n");
-		break;
-	case SYS_eventfd2:
-		no_implement("eventfd2\n");
-		break;
-	case SYS_execve:
-		no_implement("execve\n");
-		break;
-	case SYS_exit:
-		shell_exit(va_arg(ap, int));
-		ret = 0;
-		break;
-	case SYS_exit_group:
-		shell_exit_group(va_arg(ap, int));
-		ret = 0;
-		break;
-	case SYS_faccessat:
-		no_implement("faccessat\n");
-		break;
-	case SYS_fadvise64_64:
-		no_implement("fadvise64_64\n");
-		break;
-	case SYS_fallocate:
-		no_implement("fallocate\n");
-		break;
-	case SYS_fanotify_init:
-		no_implement("fanotify_init\n");
-		break;
-	case SYS_fanotify_mark:
-		no_implement("fanotify_mark\n");
-		break;
-	case SYS_fchdir:
-		no_implement("fchdir\n");
-		break;
-	case SYS_fchmod:
-		no_implement("fchmod\n");
-		break;
-	case SYS_fchmodat:
-		no_implement("fchmodat\n");
-		break;
-	case SYS_fchown32:
-		no_implement("fchown\n");
-		break;
-	case SYS_fchownat:
-		no_implement("fchownat\n");
-		break;
-	case SYS_fcntl64:
-		ret = shell_fcntl(va_arg(ap, int), va_arg(ap, int), va_arg(ap, void *));
-		break;
-	case SYS_fdatasync:
-		no_implement("fdatasync\n");
-		break;
-	case SYS_fgetxattr:
-		no_implement("fgetxattr\n");
-		break;
-	case SYS_flistxattr:
-		no_implement("flistxattr\n");
-		break;
-	case SYS_flock:
-		no_implement("flock\n");
-		break;
-	case SYS_fork:
-		no_implement("fork\n");
-		break;
-	case SYS_fremovexattr:
-		no_implement("fremovexattr\n");
-		break;
-	case SYS_fsetxattr:
-		no_implement("fsetxattr\n");
-		break;
-	case SYS_fstat64:
-		ret = shell_fstat(va_arg(ap, int), va_arg(ap, struct stat *));
-		break;
-	case SYS_fstatat64:
-		no_implement("fstatat64\n");
-		break;
-	case SYS_fstatfs:
-		no_implement("fstatfs\n");
-		break;
-	case SYS_fstatfs64:
-		no_implement("fstatfs64\n");
-		break;
-	case SYS_fsync:
-		ret = shell_fsync(va_arg(ap, int));
-		break;
-	case SYS_ftruncate64:
-		ret = shell_ftruncate(va_arg(ap, int), va_arg(ap, off_t));
-		break;
-	case SYS_futex:
-		no_implement("futex\n");
-		break;
-	case SYS_futimesat:
-		no_implement("futimesat\n");
-		break;
-	case SYS_getcpu:
-		no_implement("getcpu\n");
-		break;
-	case SYS_getcwd:
-		ret = (long)shell_getcwd(va_arg(ap, char *), va_arg(ap, size_t));
-		break;
-	case SYS_getdents64:
-		ret = shell_getdents(va_arg(ap, int), va_arg(ap, struct dirent *), va_arg(ap, size_t));	// TODO
-		break;
-	case SYS_getegid32:
-		no_implement("getegid\n");
-		break;
-	case SYS_geteuid32:
-		no_implement("geteuid\n");
-		break;
-	case SYS_getgid32:
-		no_implement("getgid\n");
-		break;
-	case SYS_getgroups32:
-		no_implement("getgroups\n");
-		break;
-	case SYS_getitimer:
-		no_implement("getitimer\n");
-		break;
-	case SYS_getpeername:
-		ret = shell_getpeername(va_arg(ap, int), va_arg(ap, struct sockaddr *), va_arg(ap, socklen_t *));
-		break;
-	case SYS_getsockname:
-		ret = shell_getsockname(va_arg(ap, int), va_arg(ap, struct sockaddr *), va_arg(ap, socklen_t *));
-		break;
-	case SYS_getpgid:
-		no_implement("getpgid\n");
-		break;
-	case SYS_getpid:
-		ret = shell_getpid();
-		break;
-	case SYS_getppid:
-		no_implement("getppid\n");
-		break;
-	case SYS_getpriority:
-		no_implement("getpriority\n");
-		break;
-	case SYS_getresgid32:
-		no_implement("getresgid\n");
-		break;
-	case SYS_getresuid32:
-		no_implement("getresuid\n");
-		break;
-#ifdef SYS_getrlimit
-	case SYS_getrlimit:
-		no_implement("getrlimit\n");
-		break;
-#endif
-	case SYS_getrusage:
-		no_implement("getrusage\n");
-		break;
-	case SYS_getsid:
-		no_implement("getsid\n");
-		break;
-	case SYS_getsockopt:
-		ret = shell_getsockopt(va_arg(ap, int), va_arg(ap, int), va_arg(ap, int), va_arg(ap, void *), va_arg(ap, socklen_t *));
-		break;
-	case SYS_gettid:
-		ret = shell_gettid();
-		break;
-	case SYS_gettimeofday:
-		ret = shell_gettimeofday(va_arg(ap, struct timeval *), va_arg(ap, void *));
-		break;
-	case SYS_getuid32:
-		no_implement("getuid\n");
-		break;
-	case SYS_getxattr:
-		no_implement("getxattr\n");
-		break;
-	case SYS_init_module:
-		no_implement("init_module\n");
-		break;
-	case SYS_inotify_add_watch:
-		no_implement("inotify_add_watch\n");
-		break;
-	case SYS_inotify_init:
-		no_implement("inotify_init\n");
-		break;
-	case SYS_inotify_init1:
-		no_implement("inotify_init1\n");
-		break;
-	case SYS_inotify_rm_watch:
-		no_implement("inotify_rm_watch\n");
-		break;
-	case SYS_ioctl:
-		ret = shell_ioctl(va_arg(ap, int), va_arg(ap, int), va_arg(ap, void *));
-		break;
-#ifdef SYS_ioperm
-	case SYS_ioperm:
-		no_implement("ioperm\n");
-		break;
-#endif
-#ifdef SYS_iopl
-	case SYS_iopl:
-		no_implement("iopl\n");
-		break;
-#endif
-#ifdef SYS_ipc
-	case SYS_ipc:
-		no_implement("ipc\n");
-		break;
-#endif
-#ifdef SYS_ipc
-	case SYS_ipc:
-		no_implement("ipc\n");
-		break;
-#endif
-	case SYS_kill:
-		ret = shell_kill(va_arg(ap, int), va_arg(ap, int));
-		break;
-	case SYS_lchown32:
-		no_implement("lchown\n");
-		break;
-	case SYS_lgetxattr:
-		no_implement("lgetxattr\n");
-		break;
-	case SYS_link:
-		ret = shell_link(va_arg(ap, const char *), va_arg(ap, const char *));
-		break;
-	case SYS_linkat:
-		no_implement("linkat\n");
-		break;
-	case SYS_listen:
-		ret = shell_listen(va_arg(ap, int), va_arg(ap, int));
-		break;
-	case SYS_listxattr:
-		no_implement("listxattr\n");
-		break;
-	case SYS_llistxattr:
-		no_implement("llistxattr\n");
-		break;
-	case SYS_lremovexattr:
-		no_implement("lremovexattr\n");
-		break;
-	case SYS_lsetxattr:
-		no_implement("lsetxattr\n");
-		break;
-	case SYS_lstat64:
-		ret = shell_lstat(va_arg(ap, const char *__restrict), va_arg(ap, struct stat *__restrict));
-		break;
-	case SYS_madvise:
-		ret = shell_madvise(va_arg(ap, void *), va_arg(ap, size_t), va_arg(ap, int));	// TODO
-		break;
-	case SYS_mincore:
-		no_implement("mincore\n");
-		break;
-	case SYS_mkdir:
-		ret = shell_mkdir(va_arg(ap, const char *), va_arg(ap, mode_t));
-		break;
-	case SYS_mkdirat:
-		no_implement("mkdirat\n");
-		break;
-	case SYS_mknod:
-		no_implement("mknod\n");
-		break;
-	case SYS_mknodat:
-		no_implement("mknodat\n");
-		break;
-	case SYS_mlock:
-		no_implement("mlock\n");
-		break;
-	case SYS_mlockall:
-		no_implement("mlockall\n");
-		break;
-	case SYS_mmap2:
-		ret = (int)shell_mmap2(va_arg(ap, void *), va_arg(ap, size_t), va_arg(ap, int), va_arg(ap, int), va_arg(ap, int), va_arg(ap, off_t));
-		break;
-	case SYS_mount:
-		no_implement("mount\n");
-		break;
-	case SYS_mprotect:
-		return shell_mprotect(va_arg(ap, void *), va_arg(ap, size_t), va_arg(ap, int));
-		break;
-	case SYS_mq_getsetattr:
-		no_implement("mq_getsetattr\n");
-		break;
-	case SYS_mq_notify:
-		no_implement("mq_notify\n");
-		break;
-	case SYS_mq_open:
-		no_implement("mq_open\n");
-		break;
-	case SYS_mq_timedreceive:
-		no_implement("mq_timedreceive\n");
-		break;
-	case SYS_mq_timedsend:
-		no_implement("mq_timedsend\n");
-		break;
-	case SYS_mq_unlink:
-		no_implement("mq_unlink\n");
-		break;
-	case SYS_mremap:
-		no_implement("mremap\n");
-		break;
-	case SYS_msgctl:
-		no_implement("msgctl\n");
-		break;
-	case SYS_msgget:
-		no_implement("msgget\n");
-		break;
-	case SYS_msgrcv:
-		no_implement("msgrcv\n");
-		break;
-	case SYS_msgsnd:
-		no_implement("msgsnd\n");
-		break;
-	case SYS_msync:
-		no_implement("msync\n");
-		break;
-	case SYS_munlock:
-		no_implement("munlock\n");
-		break;
-	case SYS_munlockall:
-		no_implement("munlockall\n");
-		break;
-	case SYS_munmap:
-		no_implement("munmap\n");
-		break;
-	case SYS_nanosleep:
-		no_implement("nanosleep\n");
-		break;
-	case SYS_nice:
-		no_implement("nice\n");
-		break;
-	case SYS_open:
-		ret = shell_open(va_arg(ap, const char *), va_arg(ap, int), va_arg(ap, void *));
-		break;
-	case SYS_openat:
-		no_implement("openat\n");
-		break;
-	case SYS_pause:
-		no_implement("pause\n");
-		break;
-	case SYS_personality:
-		no_implement("personality\n");
-		break;
-	case SYS_pipe:
-		no_implement("pipe\n");
-		break;
-	case SYS_pipe2:
-		no_implement("pipe2\n");
-		break;
-	case SYS_pivot_root:
-		no_implement("pivot_root\n");
-		break;
-	case SYS_poll:
-		ret = shell_poll(va_arg(ap, struct pollfd *), va_arg(ap, nfds_t), va_arg(ap, int));
-		break;
-	case SYS_ppoll:
-		no_implement("ppoll\n");
-		break;
-	case SYS_prctl:
-		no_implement("prctl\n");
-		break;
-	case SYS_pread64:
-		no_implement("pread64\n");
-		break;
-	case SYS_preadv:
-		no_implement("preadv\n");
-		break;
-	case SYS_prlimit64:
-		no_implement("prlimit64\n");
-		break;
-	case SYS_process_vm_readv:
-		no_implement("process_vm_readv\n");
-		break;
-	case SYS_process_vm_writev:
-		no_implement("process_vm_writev\n");
-		break;
-	case SYS_pselect6:
-		no_implement("pselect6\n");
-		break;
-	case SYS_ptrace:
-		no_implement("ptrace\n");
-		break;
-	case SYS_pwrite64:
-		no_implement("pwrite64\n");
-		break;
-	case SYS_pwritev:
-		no_implement("pwritev\n");
-		break;
-	case SYS_quotactl:
-		no_implement("quotactl\n");
-		break;
-	case SYS_read:
-		ret = shell_read(va_arg(ap, int), va_arg(ap, void *), va_arg(ap, size_t));
-		break;
-	case SYS_readahead:
-		no_implement("readahead\n");
-		break;
-	case SYS_readlink:
-		no_implement("readlink\n");
-		break;
-	case SYS_readlinkat:
-		no_implement("readlinkat\n");
-		break;
-	case SYS_readv:
-		ret = shell_readv(va_arg(ap, int), va_arg(ap, const struct iovec *), va_arg(ap, int));
-		break;
-	case SYS_recv:
-		ret = shell_recv(va_arg(ap, int), va_arg(ap, void *), va_arg(ap, size_t), va_arg(ap, int));
-		break;
-	case SYS_recvfrom:
-		fd = va_arg(ap, int);
-		if (fd == 0)
-			ret = shell_recv(fd, va_arg(ap, void *), va_arg(ap, size_t), va_arg(ap, int));
-		else
-			ret = shell_recvfrom(fd, va_arg(ap, void *), va_arg(ap, size_t), va_arg(ap, int), va_arg(ap, struct sockaddr *), va_arg(ap, socklen_t *));
-		break;
-	case SYS_recvmsg:
-		ret = shell_recvmsg(va_arg(ap, int), va_arg(ap, struct msghdr *), va_arg(ap, size_t));
-		break;
-	case SYS_reboot:
-		no_implement("reboot\n");
-		break;
-	case SYS_recvmmsg:
-		no_implement("recvmmsg\n");
-		break;
-	case SYS_remap_file_pages:
-		no_implement("remap_file_pages\n");
-		break;
-	case SYS_removexattr:
-		no_implement("removexattr\n");
-		break;
-	case SYS_rename:
-		ret = shell_rename(va_arg(ap, const char *), va_arg(ap, const char *));
-		break;
-	case SYS_renameat:
-		no_implement("renameat\n");
-		break;
-	case SYS_rmdir:
-		ret = shell_rmdir(va_arg(ap, const char *));
-		break;
-	case SYS_rt_sigaction:
-		ret = shell_sigaction(va_arg(ap, int), va_arg(ap, const struct sigaction *), va_arg(ap, struct sigaction *));
-		break;
-	case SYS_rt_sigpending:
-		no_implement("rt_sigpending\n");
-		break;
-	case SYS_rt_sigprocmask:
-		ret = shell_sigprocmask(va_arg(ap, int), va_arg(ap, const sigset_t *), va_arg(ap, sigset_t *));
-		break;
-	case SYS_rt_sigqueueinfo:
-		no_implement("rt_sigqueueinfo\n");
-		break;
-	case SYS_rt_sigsuspend:
-		no_implement("rt_sigsuspend\n");
-		break;
-	case SYS_rt_sigtimedwait:
-		no_implement("rt_sigtimedwait\n");
-		break;
-	case SYS_send:
-		ret = shell_send(va_arg(ap, int), va_arg(ap, const void *), va_arg(ap, size_t), va_arg(ap, int));
-		break;
-	case SYS_sendmsg:
-		ret = shell_sendmsg(va_arg(ap, int), va_arg(ap, const struct msghdr *), va_arg(ap, size_t));
-		break;
-	case SYS_sendto:
-		fd = va_arg(ap, int);
-		if (fd == 0)
-			ret = shell_send(fd, va_arg(ap, const void *), va_arg(ap, size_t), va_arg(ap, int));
-		else
-			ret = shell_sendto(fd, va_arg(ap, const void *), va_arg(ap, size_t), va_arg(ap, int), va_arg(ap, const struct sockaddr *), va_arg(ap, socklen_t));
-		break;
-	case SYS_setsockopt:
-		ret = shell_setsockopt(va_arg(ap, int), va_arg(ap, int), va_arg(ap, int), va_arg(ap, const void *), va_arg(ap, socklen_t));
-		break;
-	case SYS_shutdown:
-		ret = shell_shutdown(va_arg(ap, int), va_arg(ap, int));
-		break;
-	case SYS_sched_get_priority_max:
-		no_implement("sched_get_priority_max\n");
-		break;
-	case SYS_sched_get_priority_min:
-		no_implement("sched_get_priority_min\n");
-		break;
-	case SYS_sched_getaffinity:
-		no_implement("sched_getaffinity\n");
-		break;
-	case SYS_sched_getparam:
-		no_implement("sched_getparam\n");
-		break;
-	case SYS_sched_getscheduler:
-		no_implement("sched_getscheduler\n");
-		break;
-	case SYS_sched_rr_get_interval:
-		no_implement("sched_rr_get_interval\n");
-		break;
-	case SYS_sched_setaffinity:
-		no_implement("sched_setaffinity\n");
-		break;
-	case SYS_sched_setparam:
-		no_implement("sched_setparam\n");
-		break;
-	case SYS_sched_setscheduler:
-		no_implement("sched_setscheduler\n");
-		break;
-	case SYS_sched_yield:
-		no_implement("sched_yield\n");
-		break;
-	case SYS_semctl:
-		no_implement("semctl\n");
-		break;
-	case SYS_semget:
-		no_implement("semget\n");
-		break;
-	case SYS_semop:
-		no_implement("semop\n");
-		break;
-	case SYS_semtimedop:
-		no_implement("semtimedop\n");
-		break;
-	case SYS_sendfile64:
-		no_implement("sendfile\n");
-		break;
-	case SYS_sendmmsg:
-		no_implement("sendmmsg\n");
-		break;
-	case SYS_set_robust_list:
-		no_implement("set_robust_list\n");
-		break;
-#ifdef SYS_set_thread_area
-	case SYS_set_thread_area:
-		thread_area = va_arg(ap, void *);
-		ret = 0;
-		break;
-#endif
-	case SYS_set_tid_address:
-		tid_address = va_arg(ap, void *);
-		ret = 0;
-		break;
-	case SYS_setdomainname:
-		no_implement("setdomainname\n");
-		break;
-	case SYS_setfsgid32:
-		no_implement("setfsgid\n");
-		break;
-	case SYS_setfsuid32:
-		no_implement("setfsuid\n");
-		break;
-	case SYS_setgroups32:
-		no_implement("setgroups\n");
-		break;
-	case SYS_sethostname:
-		no_implement("sethostname\n");
-		break;
-	case SYS_setitimer:
-		no_implement("setitimer\n");
-		break;
-	case SYS_setns:
-		no_implement("setns\n");
-		break;
-	case SYS_setpgid:
-		no_implement("setpgid\n");
-		break;
-	case SYS_setpriority:
-		no_implement("setpriority\n");
-		break;
-	case SYS_setrlimit:
-		no_implement("setrlimit\n");
-		break;
-	case SYS_setsid:
-		no_implement("setsid\n");
-		break;
-	case SYS_settimeofday:
-		no_implement("settimeofday\n");
-		break;
-	case SYS_setxattr:
-		no_implement("setxattr\n");
-		break;
-	case SYS_shmat:
-		no_implement("shmat\n");
-		break;
-	case SYS_shmctl:
-		no_implement("shmctl\n");
-		break;
-	case SYS_shmdt:
-		no_implement("shmdt\n");
-		break;
-	case SYS_shmget:
-		no_implement("shmget\n");
-		break;
-	case SYS_sigaltstack:
-		no_implement("sigaltstack\n");
-		break;
-	case SYS_signalfd:
-		no_implement("signalfd\n");
-		break;
-	case SYS_signalfd4:
-		no_implement("signalfd4\n");
-		break;
-	case SYS_socket:
-		ret = shell_socket(va_arg(ap, int), va_arg(ap, int), va_arg(ap, int));
-		break;
-	case SYS_splice:
-		no_implement("splice\n");
-		break;
-	case SYS_stat64:
-		ret = shell_stat(va_arg(ap, const char *), va_arg(ap, struct stat *));
-		break;
-	case SYS_statfs64:
-		no_implement("statfs64\n");
-		break;
-	case SYS_swapoff:
-		no_implement("swapoff\n");
-		break;
-	case SYS_swapon:
-		no_implement("swapon\n");
-		break;
-	case SYS_symlink:
-		no_implement("symlink\n");
-		break;
-	case SYS_symlinkat:
-		no_implement("symlinkat\n");
-		break;
-	case SYS_sync:
-		no_implement("sync\n");
-		break;
-#ifdef SYS_sync_file_range
-	case SYS_sync_file_range:
-		no_implement("sync_file_range\n");
-		break;
-#endif
-	case SYS_sync_file_range2:
-		no_implement("sync_file_range2\n");
-		break;
-	case SYS_syncfs:
-		no_implement("syncfs\n");
-		break;
-	case SYS_sysinfo:
-		no_implement("sysinfo\n");
-		break;
-	case SYS_syslog:
-		no_implement("syslog\n");
-		break;
-	case SYS_tee:
-		no_implement("tee\n");
-		break;
-	case SYS_tgkill:
-		no_implement("tgkill\n");
-		break;
-	case SYS_timer_create:
-		no_implement("timer_create\n");
-		break;
-	case SYS_timer_delete:
-		no_implement("timer_delete\n");
-		break;
-	case SYS_timer_getoverrun:
-		no_implement("timer_getoverrun\n");
-		break;
-	case SYS_timer_gettime:
-		no_implement("timer_gettime\n");
-		break;
-	case SYS_timer_settime:
-		no_implement("timer_settime\n");
-		break;
-	case SYS_timerfd_create:
-		no_implement("timerfd_create\n");
-		break;
-	case SYS_timerfd_gettime:
-		no_implement("timerfd_gettime\n");
-		break;
-	case SYS_timerfd_settime:
-		no_implement("timerfd_settime\n");
-		break;
-	case SYS_times:
-		no_implement("times\n");
-		break;
-	case SYS_tkill:
-		ret = shell_tkill(va_arg(ap, int), va_arg(ap, int));
-		break;
-	case SYS_truncate64:
-		no_implement("truncate\n");
-		break;
-	case SYS_ugetrlimit:
-		no_implement("ugetrlimit\n");
-		break;
-	case SYS_umask:
-		no_implement("umask\n");
-		break;
-	case SYS_umount2:
-		no_implement("umount2\n");
-		break;
-	case SYS_uname:
-		ret = shell_uname(va_arg(ap, struct utsname *));
-		break;
-	case SYS_unlink:
-		ret = shell_unlink(va_arg(ap, const char *));
-		break;
-	case SYS_unlinkat:
-		no_implement("unlinkat\n");
-		break;
-	case SYS_unshare:
-		no_implement("unshare\n");
-		break;
-	case SYS_utimensat:
-		no_implement("utimensat\n");
-		break;
-	case SYS_utimes:
-		no_implement("utimes\n");
-		break;
-	case SYS_vhangup:
-		no_implement("vhangup\n");
-		break;
-	case SYS_vmsplice:
-		no_implement("vmsplice\n");
-		break;
-	case SYS_wait4:
-		no_implement("wait4\n");
-		break;
-	case SYS_waitid:
-		no_implement("waitid\n");
-		break;
-	case SYS_write:
-		ret = shell_write(va_arg(ap, int), va_arg(ap, const void *), va_arg(ap, size_t));
-		break;
-	case SYS_writev:
-		ret = shell_writev(va_arg(ap, int), va_arg(ap, const struct iovec *), va_arg(ap, size_t));
-		break;
-	default:
-		DebugBreak();
-	}
-
-	va_end(ap);
-
-	shellif_outof();
-
-	return ret;
-}
+
+long SYS_set_tid_address(long a) {
+	tid_address = (void *)a;
+	return 0;
+}
+
+long SYS_socket(long a, long b, long c) {
+	return shell_socket((int)a, (int)b, (int)c);
+}
+
+long SYS_stat64(long a, long b) {
+	return shell_stat((const char *)a, (struct stat *)b);
+}
+
+long SYS_tkill(long a, long b) {
+	return shell_tkill((int)a, (int)b);
+}
+
+long SYS_uname(long a) {
+	return shell_uname((struct utsname *)a);
+}
+
+long SYS_unlink(long a) {
+	return shell_unlink((const char *)a);
+}
+
+long SYS_utimensat() {
+	return no_implement("utimensat\n");
+}
+
+long SYS_utimes() {
+	return no_implement("utimes\n");
+}
+
+long SYS_write(long a, long b, long c) {
+	return shell_write((int)a, (const void *)b, (size_t)c);
+}
+
+long SYS_writev(long a, long b, long c) {
+	return shell_writev((int)a, (const struct iovec *)b, (size_t)c);
+}
