Multithreaded kernel and improvement of signal handling.
Pardon the big ass-commit, this took months to develop and debug and the
refactoring got so far that a clean merge became impossible. The good news
is that this commit does quite a bit of cleaning up and generally improves
the kernel quality.
This makes the kernel fully pre-emptive and multithreaded. This was done
by rewriting the interrupt code, the scheduler, introducing new threading
primitives, and rewriting large parts of the kernel. During the past few
commits the kernel has had its device drivers thread secured; this commit
thread secures large parts of the core kernel. There still remains some
parts of the kernel that is _not_ thread secured, but this is not a problem
at this point. Each user-space thread has an associated kernel stack that
it uses when it goes into kernel mode. This stack is by default 8 KiB since
that value works for me and is also used by Linux. Strange things tends to
happen on x86 in case of a stack overflow - there is no ideal way to catch
such a situation right now.
The system call conventions were changed, too. The %edx register is now
used to provide the errno value of the call, instead of the kernel writing
it into a registered global variable. The system call code has also been
updated to better reflect the native calling conventions: not all registers
have to be preserved. This makes system calls faster and simplifies the
assembly. In the kernel, there is no longer the event.h header or the hacky
method of 'resuming system calls' that closely resembles cooperative
multitasking. If a system call wants to block, it should just block.
The signal handling was also improved significantly. At this point, signals
cannot interrupt kernel threads (but can always interrupt user-space threads
if enabled), which introduces some problems with how a SIGINT could
interrupt a blocking read, for instance. This commit introduces and uses a
number of new primitives such as kthread_lock_mutex_signal() that attempts
to get the lock but fails if a signal is pending. In this manner, the kernel
is safer as kernel threads cannot be shut down inconveniently, but in return
for complexity as blocking operations must check they if they should fail.
Process exiting has also been refactored significantly. The _exit(2) system
call sets the exit code and sends SIGKILL to all the threads in the process.
Once all the threads have cleaned themselves up and exited, a worker thread
calls the process's LastPrayer() method that unmaps memory, deletes the
address space, notifies the parent, etc. This provides a very robust way to
terminate processes as even half-constructed processes (during a failing fork
for instance) can be gracefully terminated.
I have introduced a number of kernel threads to help avoid threading problems
and simplify kernel design. For instance, there is now a functional generic
kernel worker thread that any kernel thread can schedule jobs for. Interrupt
handlers run with interrupts off (hence they cannot call kthread_ functions
as it may deadlock the system if another thread holds the lock) therefore
they cannot use the standard kernel worker threads. Instead, they use a
special purpose interrupt worker thread that works much like the generic one
expect that interrupt handlers can safely queue work with interrupts off.
Note that this also means that interrupt handlers cannot allocate memory or
print to the kernel log/screen as such mechanisms uses locks. I'll introduce
a lock free algorithm for such cases later on.
The boot process has also changed. The original kernel init thread in
kernel.cpp creates a new bootstrap thread and becomes the system idle thread.
Note that pid=0 now means the kernel, as there is no longer a system idle
process. The bootstrap thread launches all the kernel worker threads and then
creates a new process and loads /bin/init into it and then creates a thread
in pid=1, which starts the system. The bootstrap thread then quietly waits
for pid=1 to exit after which it shuts down/reboots/panics the system.
In general, the introduction of race conditions and dead locks have forced me
to revise a lot of the design and make sure it was thread secure. Since early
parts of the kernel was quite hacky, I had to refactor such code. So it seems
that the risk of dead locks forces me to write better code.
Note that a real preemptive multithreaded kernel simplifies the construction
of blocking system calls. My hope is that this will trigger a clean up of
the filesystem code that current is almost beyond repair.
Almost all of the kernel was modified during this refactoring. To the extent
possible, these changes have been backported to older non-multithreaded
kernel, but many changes were tightly coupled and went into this commit.
Of interest is the implementation of the kthread_ api based on the design
of pthreads; this library allows easy synchronization mechanisms and
includes C++-style scoped locks. This commit also introduces new worker
threads and tested mechanisms for interrupt handlers to schedule work in a
kernel worker thread.
A lot of code have been rewritten from scratch and has become a lot more
stable and correct.
Share and enjoy!
2012-08-01 11:30:34 -04:00
|
|
|
/*******************************************************************************
|
2011-08-05 08:25:00 -04:00
|
|
|
|
2015-05-13 11:48:53 -04:00
|
|
|
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012, 2013, 2014, 2015.
|
2011-08-05 08:25:00 -04:00
|
|
|
|
2013-07-10 09:26:01 -04:00
|
|
|
This file is part of Sortix.
|
2011-08-05 08:25:00 -04:00
|
|
|
|
2013-07-10 09:26:01 -04:00
|
|
|
Sortix is free software: you can redistribute it and/or modify it under the
|
|
|
|
terms of the GNU General Public License as published by the Free Software
|
|
|
|
Foundation, either version 3 of the License, or (at your option) any later
|
|
|
|
version.
|
2011-08-05 08:25:00 -04:00
|
|
|
|
2013-07-10 09:26:01 -04:00
|
|
|
Sortix is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
|
|
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
|
|
details.
|
2011-08-05 08:25:00 -04:00
|
|
|
|
2013-07-10 09:26:01 -04:00
|
|
|
You should have received a copy of the GNU General Public License along with
|
|
|
|
Sortix. If not, see <http://www.gnu.org/licenses/>.
|
2011-08-05 08:25:00 -04:00
|
|
|
|
2013-07-10 09:26:01 -04:00
|
|
|
syscall.cpp
|
|
|
|
Handles system calls from user-space.
|
2011-08-05 08:25:00 -04:00
|
|
|
|
Multithreaded kernel and improvement of signal handling.
Pardon the big ass-commit, this took months to develop and debug and the
refactoring got so far that a clean merge became impossible. The good news
is that this commit does quite a bit of cleaning up and generally improves
the kernel quality.
This makes the kernel fully pre-emptive and multithreaded. This was done
by rewriting the interrupt code, the scheduler, introducing new threading
primitives, and rewriting large parts of the kernel. During the past few
commits the kernel has had its device drivers thread secured; this commit
thread secures large parts of the core kernel. There still remains some
parts of the kernel that is _not_ thread secured, but this is not a problem
at this point. Each user-space thread has an associated kernel stack that
it uses when it goes into kernel mode. This stack is by default 8 KiB since
that value works for me and is also used by Linux. Strange things tends to
happen on x86 in case of a stack overflow - there is no ideal way to catch
such a situation right now.
The system call conventions were changed, too. The %edx register is now
used to provide the errno value of the call, instead of the kernel writing
it into a registered global variable. The system call code has also been
updated to better reflect the native calling conventions: not all registers
have to be preserved. This makes system calls faster and simplifies the
assembly. In the kernel, there is no longer the event.h header or the hacky
method of 'resuming system calls' that closely resembles cooperative
multitasking. If a system call wants to block, it should just block.
The signal handling was also improved significantly. At this point, signals
cannot interrupt kernel threads (but can always interrupt user-space threads
if enabled), which introduces some problems with how a SIGINT could
interrupt a blocking read, for instance. This commit introduces and uses a
number of new primitives such as kthread_lock_mutex_signal() that attempts
to get the lock but fails if a signal is pending. In this manner, the kernel
is safer as kernel threads cannot be shut down inconveniently, but in return
for complexity as blocking operations must check they if they should fail.
Process exiting has also been refactored significantly. The _exit(2) system
call sets the exit code and sends SIGKILL to all the threads in the process.
Once all the threads have cleaned themselves up and exited, a worker thread
calls the process's LastPrayer() method that unmaps memory, deletes the
address space, notifies the parent, etc. This provides a very robust way to
terminate processes as even half-constructed processes (during a failing fork
for instance) can be gracefully terminated.
I have introduced a number of kernel threads to help avoid threading problems
and simplify kernel design. For instance, there is now a functional generic
kernel worker thread that any kernel thread can schedule jobs for. Interrupt
handlers run with interrupts off (hence they cannot call kthread_ functions
as it may deadlock the system if another thread holds the lock) therefore
they cannot use the standard kernel worker threads. Instead, they use a
special purpose interrupt worker thread that works much like the generic one
expect that interrupt handlers can safely queue work with interrupts off.
Note that this also means that interrupt handlers cannot allocate memory or
print to the kernel log/screen as such mechanisms uses locks. I'll introduce
a lock free algorithm for such cases later on.
The boot process has also changed. The original kernel init thread in
kernel.cpp creates a new bootstrap thread and becomes the system idle thread.
Note that pid=0 now means the kernel, as there is no longer a system idle
process. The bootstrap thread launches all the kernel worker threads and then
creates a new process and loads /bin/init into it and then creates a thread
in pid=1, which starts the system. The bootstrap thread then quietly waits
for pid=1 to exit after which it shuts down/reboots/panics the system.
In general, the introduction of race conditions and dead locks have forced me
to revise a lot of the design and make sure it was thread secure. Since early
parts of the kernel was quite hacky, I had to refactor such code. So it seems
that the risk of dead locks forces me to write better code.
Note that a real preemptive multithreaded kernel simplifies the construction
of blocking system calls. My hope is that this will trigger a clean up of
the filesystem code that current is almost beyond repair.
Almost all of the kernel was modified during this refactoring. To the extent
possible, these changes have been backported to older non-multithreaded
kernel, but many changes were tightly coupled and went into this commit.
Of interest is the implementation of the kthread_ api based on the design
of pthreads; this library allows easy synchronization mechanisms and
includes C++-style scoped locks. This commit also introduces new worker
threads and tested mechanisms for interrupt handlers to schedule work in a
kernel worker thread.
A lot of code have been rewritten from scratch and has become a lot more
stable and correct.
Share and enjoy!
2012-08-01 11:30:34 -04:00
|
|
|
*******************************************************************************/
|
2011-08-05 08:25:00 -04:00
|
|
|
|
2014-10-16 18:04:47 -04:00
|
|
|
#include <errno.h>
|
2014-01-03 20:57:25 -05:00
|
|
|
#include <stddef.h>
|
|
|
|
|
2014-06-27 10:15:30 -04:00
|
|
|
#include <sortix/syscall.h>
|
2013-01-08 18:41:35 -05:00
|
|
|
|
2014-10-16 18:04:47 -04:00
|
|
|
#include <sortix/kernel/log.h>
|
2013-10-26 20:42:10 -04:00
|
|
|
#include <sortix/kernel/syscall.h>
|
2011-10-26 18:05:20 -04:00
|
|
|
|
2013-01-08 18:41:35 -05:00
|
|
|
namespace Sortix {
|
|
|
|
|
2014-10-16 18:04:47 -04:00
|
|
|
extern "C" {
|
|
|
|
void* syscall_list[SYSCALL_MAX_NUM + 1] =
|
2013-01-08 18:41:35 -05:00
|
|
|
{
|
2014-10-16 18:04:47 -04:00
|
|
|
[SYSCALL_BAD_SYSCALL] = (void*) sys_bad_syscall,
|
|
|
|
[SYSCALL_EXIT] = (void*) sys_bad_syscall,
|
|
|
|
[SYSCALL_SLEEP] = (void*) sys_bad_syscall,
|
|
|
|
[SYSCALL_USLEEP] = (void*) sys_bad_syscall,
|
|
|
|
[SYSCALL_PRINT_STRING] = (void*) sys_bad_syscall,
|
|
|
|
[SYSCALL_CREATE_FRAME] = (void*) sys_bad_syscall,
|
|
|
|
[SYSCALL_CHANGE_FRAME] = (void*) sys_bad_syscall,
|
|
|
|
[SYSCALL_DELETE_FRAME] = (void*) sys_bad_syscall,
|
|
|
|
[SYSCALL_RECEIVE_KEYSTROKE] = (void*) sys_bad_syscall,
|
|
|
|
[SYSCALL_SET_FREQUENCY] = (void*) sys_bad_syscall,
|
|
|
|
[SYSCALL_EXECVE] = (void*) sys_execve,
|
|
|
|
[SYSCALL_PRINT_PATH_FILES] = (void*) sys_bad_syscall,
|
|
|
|
[SYSCALL_FORK] = (void*) sys_bad_syscall,
|
|
|
|
[SYSCALL_GETPID] = (void*) sys_getpid,
|
|
|
|
[SYSCALL_GETPPID] = (void*) sys_getppid,
|
|
|
|
[SYSCALL_GET_FILEINFO] = (void*) sys_bad_syscall,
|
|
|
|
[SYSCALL_GET_NUM_FILES] = (void*) sys_bad_syscall,
|
|
|
|
[SYSCALL_WAITPID] = (void*) sys_waitpid,
|
|
|
|
[SYSCALL_READ] = (void*) sys_read,
|
|
|
|
[SYSCALL_WRITE] = (void*) sys_write,
|
|
|
|
[SYSCALL_PIPE] = (void*) sys_bad_syscall,
|
|
|
|
[SYSCALL_CLOSE] = (void*) sys_close,
|
|
|
|
[SYSCALL_DUP] = (void*) sys_dup,
|
|
|
|
[SYSCALL_OPEN] = (void*) sys_bad_syscall,
|
|
|
|
[SYSCALL_READDIRENTS] = (void*) sys_readdirents,
|
|
|
|
[SYSCALL_CHDIR] = (void*) sys_bad_syscall,
|
|
|
|
[SYSCALL_GETCWD] = (void*) sys_bad_syscall,
|
|
|
|
[SYSCALL_UNLINK] = (void*) sys_bad_syscall,
|
|
|
|
[SYSCALL_REGISTER_ERRNO] = (void*) sys_bad_syscall,
|
|
|
|
[SYSCALL_REGISTER_SIGNAL_HANDLER] = (void*) sys_bad_syscall,
|
|
|
|
[SYSCALL_SIGRETURN] = (void*) sys_bad_syscall,
|
|
|
|
[SYSCALL_KILL] = (void*) sys_kill,
|
|
|
|
[SYSCALL_MEMSTAT] = (void*) sys_memstat,
|
|
|
|
[SYSCALL_ISATTY] = (void*) sys_isatty,
|
|
|
|
[SYSCALL_UPTIME] = (void*) sys_bad_syscall,
|
2014-06-18 19:48:20 -04:00
|
|
|
[SYSCALL_SBRK] = (void*) sys_bad_syscall,
|
2014-10-16 18:04:47 -04:00
|
|
|
[SYSCALL_LSEEK] = (void*) sys_lseek,
|
|
|
|
[SYSCALL_GETPAGESIZE] = (void*) sys_getpagesize,
|
|
|
|
[SYSCALL_MKDIR] = (void*) sys_bad_syscall,
|
|
|
|
[SYSCALL_RMDIR] = (void*) sys_bad_syscall,
|
|
|
|
[SYSCALL_TRUNCATE] = (void*) sys_bad_syscall,
|
|
|
|
[SYSCALL_FTRUNCATE] = (void*) sys_ftruncate,
|
|
|
|
[SYSCALL_SETTERMMODE] = (void*) sys_settermmode,
|
|
|
|
[SYSCALL_GETTERMMODE] = (void*) sys_gettermmode,
|
|
|
|
[SYSCALL_STAT] = (void*) sys_bad_syscall,
|
|
|
|
[SYSCALL_FSTAT] = (void*) sys_fstat,
|
|
|
|
[SYSCALL_FCNTL] = (void*) sys_fcntl,
|
|
|
|
[SYSCALL_ACCESS] = (void*) sys_bad_syscall,
|
|
|
|
[SYSCALL_KERNELINFO] = (void*) sys_kernelinfo,
|
|
|
|
[SYSCALL_PREAD] = (void*) sys_pread,
|
|
|
|
[SYSCALL_PWRITE] = (void*) sys_pwrite,
|
|
|
|
[SYSCALL_TFORK] = (void*) sys_tfork,
|
|
|
|
[SYSCALL_TCGETWINSIZE] = (void*) sys_tcgetwinsize,
|
|
|
|
[SYSCALL_RAISE] = (void*) sys_raise,
|
|
|
|
[SYSCALL_OPENAT] = (void*) sys_openat,
|
|
|
|
[SYSCALL_DISPMSG_ISSUE] = (void*) sys_dispmsg_issue,
|
|
|
|
[SYSCALL_FSTATAT] = (void*) sys_fstatat,
|
|
|
|
[SYSCALL_CHMOD] = (void*) sys_bad_syscall,
|
|
|
|
[SYSCALL_CHOWN] = (void*) sys_bad_syscall,
|
|
|
|
[SYSCALL_LINK] = (void*) sys_bad_syscall,
|
|
|
|
[SYSCALL_DUP2] = (void*) sys_dup2,
|
|
|
|
[SYSCALL_UNLINKAT] = (void*) sys_unlinkat,
|
|
|
|
[SYSCALL_FACCESSAT] = (void*) sys_faccessat,
|
|
|
|
[SYSCALL_MKDIRAT] = (void*) sys_mkdirat,
|
|
|
|
[SYSCALL_FCHDIR] = (void*) sys_fchdir,
|
|
|
|
[SYSCALL_TRUNCATEAT] = (void*) sys_truncateat,
|
|
|
|
[SYSCALL_FCHOWNAT] = (void*) sys_fchownat,
|
|
|
|
[SYSCALL_FCHOWN] = (void*) sys_fchown,
|
|
|
|
[SYSCALL_FCHMOD] = (void*) sys_fchmod,
|
|
|
|
[SYSCALL_FCHMODAT] = (void*) sys_fchmodat,
|
|
|
|
[SYSCALL_LINKAT] = (void*) sys_linkat,
|
|
|
|
[SYSCALL_FSM_FSBIND] = (void*) sys_fsm_fsbind,
|
|
|
|
[SYSCALL_PPOLL] = (void*) sys_ppoll,
|
|
|
|
[SYSCALL_RENAMEAT] = (void*) sys_renameat,
|
|
|
|
[SYSCALL_READLINKAT] = (void*) sys_readlinkat,
|
|
|
|
[SYSCALL_FSYNC] = (void*) sys_fsync,
|
|
|
|
[SYSCALL_GETUID] = (void*) sys_getuid,
|
|
|
|
[SYSCALL_GETGID] = (void*) sys_getgid,
|
|
|
|
[SYSCALL_SETUID] = (void*) sys_setuid,
|
|
|
|
[SYSCALL_SETGID] = (void*) sys_setgid,
|
|
|
|
[SYSCALL_GETEUID] = (void*) sys_geteuid,
|
|
|
|
[SYSCALL_GETEGID] = (void*) sys_getegid,
|
|
|
|
[SYSCALL_SETEUID] = (void*) sys_seteuid,
|
|
|
|
[SYSCALL_SETEGID] = (void*) sys_setegid,
|
|
|
|
[SYSCALL_IOCTL] = (void*) sys_ioctl,
|
|
|
|
[SYSCALL_UTIMENSAT] = (void*) sys_utimensat,
|
|
|
|
[SYSCALL_FUTIMENS] = (void*) sys_futimens,
|
|
|
|
[SYSCALL_RECV] = (void*) sys_recv,
|
|
|
|
[SYSCALL_SEND] = (void*) sys_send,
|
|
|
|
[SYSCALL_ACCEPT4] = (void*) sys_accept4,
|
|
|
|
[SYSCALL_BIND] = (void*) sys_bind,
|
|
|
|
[SYSCALL_CONNECT] = (void*) sys_connect,
|
|
|
|
[SYSCALL_LISTEN] = (void*) sys_listen,
|
|
|
|
[SYSCALL_READV] = (void*) sys_readv,
|
|
|
|
[SYSCALL_WRITEV] = (void*) sys_writev,
|
|
|
|
[SYSCALL_PREADV] = (void*) sys_preadv,
|
|
|
|
[SYSCALL_PWRITEV] = (void*) sys_pwritev,
|
|
|
|
[SYSCALL_TIMER_CREATE] = (void*) sys_timer_create,
|
|
|
|
[SYSCALL_TIMER_DELETE] = (void*) sys_timer_delete,
|
|
|
|
[SYSCALL_TIMER_GETOVERRUN] = (void*) sys_timer_getoverrun,
|
|
|
|
[SYSCALL_TIMER_GETTIME] = (void*) sys_timer_gettime,
|
|
|
|
[SYSCALL_TIMER_SETTIME] = (void*) sys_timer_settime,
|
|
|
|
[SYSCALL_ALARMNS] = (void*) sys_alarmns,
|
|
|
|
[SYSCALL_CLOCK_GETTIMERES] = (void*) sys_clock_gettimeres,
|
|
|
|
[SYSCALL_CLOCK_SETTIMERES] = (void*) sys_clock_settimeres,
|
|
|
|
[SYSCALL_CLOCK_NANOSLEEP] = (void*) sys_clock_nanosleep,
|
|
|
|
[SYSCALL_TIMENS] = (void*) sys_timens,
|
|
|
|
[SYSCALL_UMASK] = (void*) sys_umask,
|
|
|
|
[SYSCALL_FCHDIRAT] = (void*) sys_fchdirat,
|
|
|
|
[SYSCALL_FCHROOT] = (void*) sys_fchroot,
|
|
|
|
[SYSCALL_FCHROOTAT] = (void*) sys_fchrootat,
|
|
|
|
[SYSCALL_MKPARTITION] = (void*) sys_mkpartition,
|
|
|
|
[SYSCALL_GETPGID] = (void*) sys_getpgid,
|
|
|
|
[SYSCALL_SETPGID] = (void*) sys_setpgid,
|
|
|
|
[SYSCALL_TCGETPGRP] = (void*) sys_tcgetpgrp,
|
|
|
|
[SYSCALL_TCSETPGRP] = (void*) sys_tcsetpgrp,
|
|
|
|
[SYSCALL_MMAP_WRAPPER] = (void*) sys_mmap_wrapper,
|
|
|
|
[SYSCALL_MPROTECT] = (void*) sys_mprotect,
|
|
|
|
[SYSCALL_MUNMAP] = (void*) sys_munmap,
|
|
|
|
[SYSCALL_GETPRIORITY] = (void*) sys_getpriority,
|
|
|
|
[SYSCALL_SETPRIORITY] = (void*) sys_setpriority,
|
|
|
|
[SYSCALL_PRLIMIT] = (void*) sys_prlimit,
|
|
|
|
[SYSCALL_DUP3] = (void*) sys_dup3,
|
|
|
|
[SYSCALL_SYMLINKAT] = (void*) sys_symlinkat,
|
|
|
|
[SYSCALL_TCGETWINCURPOS] = (void*) sys_tcgetwincurpos,
|
|
|
|
[SYSCALL_PIPE2] = (void*) sys_pipe2,
|
|
|
|
[SYSCALL_GETUMASK] = (void*) sys_getumask,
|
|
|
|
[SYSCALL_FSTATVFS] = (void*) sys_fstatvfs,
|
|
|
|
[SYSCALL_FSTATVFSAT] = (void*) sys_fstatvfsat,
|
|
|
|
[SYSCALL_RDMSR] = (void*) sys_rdmsr,
|
|
|
|
[SYSCALL_WRMSR] = (void*) sys_wrmsr,
|
|
|
|
[SYSCALL_SCHED_YIELD] = (void*) sys_sched_yield,
|
|
|
|
[SYSCALL_EXIT_THREAD] = (void*) sys_exit_thread,
|
|
|
|
[SYSCALL_SIGACTION] = (void*) sys_sigaction,
|
|
|
|
[SYSCALL_SIGALTSTACK] = (void*) sys_sigaltstack,
|
|
|
|
[SYSCALL_SIGPENDING] = (void*) sys_sigpending,
|
|
|
|
[SYSCALL_SIGPROCMASK] = (void*) sys_sigprocmask,
|
|
|
|
[SYSCALL_SIGSUSPEND] = (void*) sys_sigsuspend,
|
|
|
|
[SYSCALL_SENDMSG] = (void*) sys_sendmsg,
|
|
|
|
[SYSCALL_RECVMSG] = (void*) sys_recvmsg,
|
|
|
|
[SYSCALL_GETSOCKOPT] = (void*) sys_getsockopt,
|
|
|
|
[SYSCALL_SETSOCKOPT] = (void*) sys_setsockopt,
|
|
|
|
[SYSCALL_TCGETBLOB] = (void*) sys_tcgetblob,
|
|
|
|
[SYSCALL_TCSETBLOB] = (void*) sys_tcsetblob,
|
|
|
|
[SYSCALL_GETPEERNAME] = (void*) sys_getpeername,
|
|
|
|
[SYSCALL_GETSOCKNAME] = (void*) sys_getsockname,
|
|
|
|
[SYSCALL_SHUTDOWN] = (void*) sys_shutdown,
|
|
|
|
[SYSCALL_GETENTROPY] = (void*) sys_getentropy,
|
|
|
|
[SYSCALL_GETHOSTNAME] = (void*) sys_gethostname,
|
|
|
|
[SYSCALL_SETHOSTNAME] = (void*) sys_sethostname,
|
2014-05-07 08:14:38 -04:00
|
|
|
[SYSCALL_UNMOUNTAT] = (void*) sys_unmountat,
|
|
|
|
[SYSCALL_FSM_MOUNTAT] = (void*) sys_fsm_mountat,
|
2015-05-13 11:48:53 -04:00
|
|
|
[SYSCALL_CLOSEFROM] = (void*) sys_closefrom,
|
2015-07-30 19:20:39 -04:00
|
|
|
[SYSCALL_RESERVED1] = (void*) sys_bad_syscall,
|
|
|
|
[SYSCALL_PSCTL] = (void*) sys_psctl,
|
2015-10-27 12:34:54 -04:00
|
|
|
[SYSCALL_RESERVED2] = (void*) sys_bad_syscall,
|
|
|
|
[SYSCALL_RESERVED3] = (void*) sys_bad_syscall,
|
|
|
|
[SYSCALL_RESERVED4] = (void*) sys_bad_syscall,
|
|
|
|
[SYSCALL_RESERVED5] = (void*) sys_bad_syscall,
|
|
|
|
[SYSCALL_RESERVED6] = (void*) sys_bad_syscall,
|
|
|
|
[SYSCALL_RESERVED7] = (void*) sys_bad_syscall,
|
|
|
|
[SYSCALL_RESERVED8] = (void*) sys_bad_syscall,
|
|
|
|
[SYSCALL_SCRAM] = (void*) sys_scram,
|
2014-10-16 18:04:47 -04:00
|
|
|
[SYSCALL_MAX_NUM] = (void*) sys_bad_syscall,
|
|
|
|
};
|
2015-05-13 12:11:02 -04:00
|
|
|
} /* extern "C" */
|
2014-10-16 18:04:47 -04:00
|
|
|
|
|
|
|
int sys_bad_syscall(void)
|
2011-08-05 08:25:00 -04:00
|
|
|
{
|
2013-01-08 18:41:35 -05:00
|
|
|
// TODO: Send signal, set errno, or crash/abort process?
|
2014-01-03 20:57:25 -05:00
|
|
|
Log::PrintF("I am the bad system call!\n");
|
2014-10-16 18:04:47 -04:00
|
|
|
return errno = EINVAL, -1;
|
2013-01-08 18:41:35 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace Sortix
|