Make syscall table initialization clearer. Add comments to the sys_waitpid function.

This commit is contained in:
Enrico Fraccaroli (Galfurian)
2023-01-27 10:50:04 -05:00
parent 7a8ce1066a
commit e926850ce3
4 changed files with 306 additions and 148 deletions
+8 -4
View File
@@ -285,12 +285,16 @@ int sys_sigaction(int signum, const sigaction_t *act, sigaction_t *oldact, uint3
/// @param set The set of signals to manage by the function.
/// @param oldset If non-NULL, the previous value of the signal mask is stored here.
/// @return returns 0 on success, and -1 on error (errno is set to indicate the cause).
/// @details
/// If set is NULL, then the signal mask is unchanged (i.e., how is
/// ignored), but the current value of the signal mask is
/// nevertheless returned in oldset (if it is not NULL).
/// @details If set is NULL, then the signal mask is unchanged (i.e., how is
/// ignored), but the current value of the signal mask is nevertheless returned
/// in oldset (if it is not NULL).
int sys_sigprocmask(int how, const sigset_t *set, sigset_t *oldset);
/// @brief Provides a snapshot of pending signals.
/// @param set where the set of pending signals is returned.
/// @return 0 on success, -1 on failure and errno is set to indicate the error.
int sys_sigpending(sigset_t *set);
/// @brief Returns the string describing the given signal.
/// @param sig The signal to inquire.
/// @return String representing the signal.
+1 -1
View File
@@ -465,7 +465,7 @@ pid_t sys_waitpid(pid_t pid, int *status, int options)
list_for_each_decl(it, &current_process->children)
{
// Get the entry.
task_struct *entry = list_entry(it, task_struct, sibling);
entry = list_entry(it, task_struct, sibling);
// Check the entry.
if (entry == NULL) {
continue;
+109 -81
View File
@@ -60,14 +60,24 @@ static const char *sys_siglist[] = {
NULL,
};
static inline void __copy_sigaction(sigaction_t *to, const sigaction_t *from)
{
memcpy(to, from, sizeof(sigaction_t));
}
static inline void __copy_sigset(sigset_t *to, const sigset_t *from)
{
memcpy(to, from, sizeof(sigset_t));
}
static inline void __copy_siginfo(siginfo_t *to, const siginfo_t *from)
{
memcpy(to, from, sizeof(*to));
memcpy(to, from, sizeof(siginfo_t));
}
static inline void __clear_siginfo(siginfo_t *info)
{
memset(info, 0, sizeof(*info));
memset(info, 0, sizeof(siginfo_t));
}
static inline void __lock_task_sighand(struct task_struct *t)
@@ -157,7 +167,7 @@ static int __send_signal(int sig, siginfo_t *info, struct task_struct *t)
}
list_head_insert_before(&q->list, &t->pending.list);
if (info != SEND_SIG_NOINFO)
memcpy(&q->info, info, sizeof(siginfo_t));
__copy_siginfo(&q->info, info);
// Set that there is a signal pending.
sigaddset(&t->pending.signal, sig);
pr_debug("Added pending signal (%2d)`%s` to task (%2d)`%s`, pending `%d, %d`.\n",
@@ -227,15 +237,16 @@ static inline void __collect_signal(int sig, sigpending_t *list, siginfo_t *info
// Ok, it wasn't in the queue, zero out the info.
__clear_siginfo(info);
// Get the current process.
struct task_struct *current = scheduler_get_current_process();
assert(current && "There is no running process.");
task_struct *current_process = scheduler_get_current_process();
// Check the current task.
assert(current_process && "There is no current process!");
// Initialize the info.
info->si_signo = sig;
info->si_code = SI_USER;
info->si_value.sival_int = 0;
info->si_errno = 0;
info->si_pid = current->pid;
info->si_uid = current->uid;
info->si_pid = current_process->pid;
info->si_uid = current_process->uid;
info->si_addr = NULL;
info->si_status = 0;
info->si_band = 0;
@@ -258,26 +269,26 @@ static inline int __dequeue_signal(sigpending_t *pending, sigset_t *mask, siginf
static inline int __handle_signal(int signr, siginfo_t *info, sigaction_t *ka, struct pt_regs *regs)
{
pr_debug("__handle_signal(%d, %p, %p, %p)\n", signr, info, ka, regs);
// The do_signal() function is usually only invoked when the CPU is going
// to return in User Mode.
struct task_struct *current = scheduler_get_current_process();
assert(current && "There is no running process.");
// Get the current process.
task_struct *current_process = scheduler_get_current_process();
// Check the current task.
assert(current_process && "There is no current process!");
// Skip the `init` process, always.
if (current->pid == 1) {
if (current_process->pid == 1) {
errno = ESRCH;
return 0;
}
// Save the previous signal mask.
memcpy(&current->saved_sigmask, &current->blocked, sizeof(sigset_t));
__copy_sigset(&current_process->saved_sigmask, &current_process->blocked);
// Add the signal to the list of blocked signals.
sigaddset(&current->blocked, signr);
sigaddset(&current_process->blocked, signr);
// Store the registers before setting the ones required by the signal handling.
current->thread.signal_regs = *regs;
current_process->thread.signal_regs = *regs;
// Restore the registers for the process that has set the signal.
*regs = current->thread.regs;
*regs = current_process->thread.regs;
// Set the instruction pointer.
regs->eip = (uintptr_t)ka->sa_handler;
@@ -298,7 +309,7 @@ static inline int __handle_signal(int signr, siginfo_t *info, sigaction_t *ka, s
PUSH_VALUE_ON_STACK(regs->useresp, signr);
// Push on the stack the function required to handle the signal return.
PUSH_VALUE_ON_STACK(regs->useresp, current->sigreturn_addr);
PUSH_VALUE_ON_STACK(regs->useresp, current_process->sigreturn_addr);
return 1;
}
@@ -306,14 +317,16 @@ static inline int __handle_signal(int signr, siginfo_t *info, sigaction_t *ka, s
long sys_sigreturn(struct pt_regs *f)
{
pr_debug("sys_sigreturn(%p)\n", f);
struct task_struct *current = scheduler_get_current_process();
assert(current && "There is no running process.");
// Get the current process.
task_struct *current_process = scheduler_get_current_process();
// Check the current task.
assert(current_process && "There is no current process!");
// Restore the registers before the signal handling.
*f = current->thread.signal_regs;
*f = current_process->thread.signal_regs;
// Restore the previous signal mask.
memcpy(&current->blocked, &current->saved_sigmask, sizeof(sigset_t));
__copy_sigset(&current_process->blocked, &current_process->saved_sigmask);
// Switch to process page directory
paging_switch_directory_va(current->mm->pgd);
paging_switch_directory_va(current_process->mm->pgd);
pr_debug("sys_sigreturn(%p) : done!\n", f);
return 0;
}
@@ -373,10 +386,10 @@ int do_signal(struct pt_regs *f)
{
// The do_signal() function is usually only invoked when the CPU is going
// to return in User Mode.
struct task_struct *current = scheduler_get_current_process();
if (current == NULL)
return 0;
// Get the current process.
task_struct *current_process = scheduler_get_current_process();
// Check the current task.
assert(current_process && "There is no current process!");
// First, checks whether the function itself was triggered by an interrupt;
// if so, it simply returns. Otherwise, if the function was triggered by an
// exception that was raised while the process was running in User Mode,
@@ -390,14 +403,14 @@ int do_signal(struct pt_regs *f)
int signr, exit_code;
// Lock the signal handling for the given task.
__lock_task_sighand(current);
__lock_task_sighand(current_process);
// The heart of the do_signal( ) function consists of a loop that
// repeatedly invokes the __dequeue_signal( ) function until no
// non-blocked pending signals are left.
while (!list_head_empty(&current->pending.list)) {
while (!list_head_empty(&current_process->pending.list)) {
// Get the signal to deliver.
signr = exit_code = __dequeue_signal(&current->pending, &current->blocked, &info);
signr = exit_code = __dequeue_signal(&current_process->pending, &current_process->blocked, &info);
// Check the signal that we want to send.
if ((signr < 0) || (signr >= NSIG)) {
@@ -409,16 +422,16 @@ int do_signal(struct pt_regs *f)
// handled and do_signal( ) can finish.
if (signr == 0) {
pr_debug("There are no more signals to handle.\n");
__unlock_task_sighand(current);
__unlock_task_sighand(current_process);
return 0;
}
// Get the associated signal action.
sigaction_t *ka = &current->sighand.action[signr - 1];
sigaction_t *ka = &current_process->sighand.action[signr - 1];
// The only exception comes when the receiving process is init, in
// which case the signal is discarded.
if (current->pid == 1)
if (current_process->pid == 1)
continue;
// When a delivered signal is explicitly ignored, the do_signal( )
@@ -454,13 +467,13 @@ int do_signal(struct pt_regs *f)
case SIGTSTP:
case SIGTTIN:
case SIGTTOU:
if (is_orphaned_pgrp(current->pgid))
if (is_orphaned_pgrp(current_process->pgid))
continue;
case SIGSTOP:
__unlock_task_sighand(current);
__do_signal_stop(current, f, signr);
__lock_task_sighand(current);
__unlock_task_sighand(current_process);
__do_signal_stop(current_process, f, signr);
__lock_task_sighand(current_process);
continue;
case SIGQUIT:
@@ -483,20 +496,20 @@ int do_signal(struct pt_regs *f)
#endif
default:
#if 0
current->flags |= PF_SIGNALED;
current_process->flags |= PF_SIGNALED;
#endif
sys_exit(exit_code);
__unlock_task_sighand(current);
__unlock_task_sighand(current_process);
return 1;
}
}
if (__handle_signal(signr, &info, ka, f) == 1) {
__unlock_task_sighand(current);
__unlock_task_sighand(current_process);
return 1;
}
pr_emerg("Failed to handle signal.\n");
}
__unlock_task_sighand(current);
__unlock_task_sighand(current_process);
return 0;
}
@@ -609,9 +622,9 @@ int __send_sig_info(int sig, siginfo_t *info, struct task_struct *p)
int sys_kill(pid_t pid, int sig)
{
pr_debug("sys_kill(%d, %d)\n", pid, sig);
struct task_struct *current = scheduler_get_running_process(pid);
struct task_struct *process = scheduler_get_running_process(pid);
// Check the task associated with the pid.
if (!current)
if (!process)
return -ESRCH;
// Check the signal that we want to send.
if ((sig < 0) || (sig >= NSIG))
@@ -621,12 +634,12 @@ int sys_kill(pid_t pid, int sig)
info.si_code = SI_USER;
info.si_value.sival_int = 0;
info.si_errno = 0;
info.si_pid = current->pid;
info.si_uid = current->uid;
info.si_pid = process->pid;
info.si_uid = process->uid;
info.si_addr = NULL;
info.si_status = 0;
info.si_band = 0;
return __send_sig_info(sig, &info, current);
return __send_sig_info(sig, &info, process);
}
sighandler_t sys_signal(int signum, sighandler_t handler, uint32_t sigreturn_addr)
@@ -637,12 +650,12 @@ sighandler_t sys_signal(int signum, sighandler_t handler, uint32_t sigreturn_add
pr_err("sys_signal(%d, %p): Wrong signal number!\n", signum, handler);
return SIG_ERR;
}
// The do_signal() function is usually only invoked when the CPU is going
// to return in User Mode.
struct task_struct *current = scheduler_get_current_process();
assert(current && "There is no running process.");
// Get the current process.
task_struct *current_process = scheduler_get_current_process();
// Check the current task.
assert(current_process && "There is no current process!");
// Skip the `init` process, always.
if (current->pid == 1) {
if (current_process->pid == 1) {
pr_err("sys_signal(%d, %p): Cannot signal init!\n", signum, handler);
return SIG_ERR;
}
@@ -655,19 +668,19 @@ sighandler_t sys_signal(int signum, sighandler_t handler, uint32_t sigreturn_add
// Reset the set for the signal action.
sigemptyset(&new_sigaction.sa_mask);
// Lock the signal handling for the given task.
__lock_task_sighand(current);
__lock_task_sighand(current_process);
// Set the address of the sigreturn.
current->sigreturn_addr = sigreturn_addr;
current_process->sigreturn_addr = sigreturn_addr;
// Get the old sigaction.
sigaction_t *old_sigaction = &current->sighand.action[signum - 1];
sigaction_t *old_sigaction = &current_process->sighand.action[signum - 1];
pr_err("sys_signal(%d, %p): Signal action ptr %p\n", signum, handler, old_sigaction);
pr_err("sys_signal(%d, %p): Old signal handler %p\n", signum, handler, old_sigaction->sa_handler);
// Get the old handler (to return).
sighandler_t old_handler = current->sighand.action[signum - 1].sa_handler;
sighandler_t old_handler = current_process->sighand.action[signum - 1].sa_handler;
// Set the new action.
memcpy(old_sigaction, &new_sigaction, sizeof(sigaction_t));
__copy_sigaction(old_sigaction, &new_sigaction);
// Unlock the signal handling for the given task.
__unlock_task_sighand(current);
__unlock_task_sighand(current_process);
// Return the old sighandler.
return old_handler;
}
@@ -680,30 +693,30 @@ int sys_sigaction(int signum, const sigaction_t *act, sigaction_t *oldact, uint3
pr_err("sys_sigaction(%d, %p, %p): Wrong signal number!\n", signum, act, oldact);
return -EINVAL;
}
// The do_signal() function is usually only invoked when the CPU is going
// to return in User Mode.
struct task_struct *current = scheduler_get_current_process();
assert(current && "There is no running process.");
// Get the current process.
task_struct *current_process = scheduler_get_current_process();
// Check the current task.
assert(current_process && "There is no current process!");
// Skip the `init` process, always.
if (current->pid == 1) {
if (current_process->pid == 1) {
pr_err("sys_sigaction(%d, %p, %p): Cannot set signal for init!\n", signum, act, oldact);
return -EINVAL;
}
// Lock the signal handling for the given task.
__lock_task_sighand(current);
__lock_task_sighand(current_process);
// Set the address of the sigreturn.
current->sigreturn_addr = sigreturn_addr;
current_process->sigreturn_addr = sigreturn_addr;
// Get a pointer to the entry in the sighand.action array.
sigaction_t *current_sigaction = &current->sighand.action[signum - 1];
pr_debug("sys_sigaction(%d, %p, %p): : Signal old action ptr %p\n", signum, act, oldact, current_sigaction);
sigaction_t *current_process_sigaction = &current_process->sighand.action[signum - 1];
pr_debug("sys_sigaction(%d, %p, %p): : Signal old action ptr %p\n", signum, act, oldact, current_process_sigaction);
// If requested, get the old sigaction.
if (oldact) {
memcpy(oldact, current_sigaction, sizeof(sigaction_t));
__copy_sigaction(oldact, current_process_sigaction);
}
// Set the new action.
memcpy(current_sigaction, act, sizeof(sigaction_t));
__copy_sigaction(current_process_sigaction, act);
// Unlock the signal handling for the given task.
__unlock_task_sighand(current);
__unlock_task_sighand(current_process);
// Return the old sighandler.
return 0;
}
@@ -717,42 +730,57 @@ int sys_sigprocmask(int how, const sigset_t *set, sigset_t *oldset)
if ((how < SIG_BLOCK) || (how > SIG_SETMASK)) {
return -EINVAL;
}
// The do_signal() function is usually only invoked when the CPU is going
// to return in User Mode.
struct task_struct *current = scheduler_get_current_process();
assert(current && "There is no running process.");
// Get the current process.
task_struct *current_process = scheduler_get_current_process();
// Check the current task.
assert(current_process && "There is no current process!");
// Skip the `init` process, always.
if (current->pid == 1) {
if (current_process->pid == 1) {
pr_warning("sys_sigprocmask(%d, %p, %p): Cannot set signal for init!\n", how, set, oldset);
return -EINVAL;
}
// If `oldset` is not, return the old set.
if (oldset) {
oldset->sig[0] = current->blocked.sig[0];
oldset->sig[1] = current->blocked.sig[1];
oldset->sig[0] = current_process->blocked.sig[0];
oldset->sig[1] = current_process->blocked.sig[1];
}
// Set the new signal mask.
if (set) {
if (how == SIG_BLOCK) {
// The set of blocked signals is the union of the current set
// and the set argument.
current->blocked.sig[0] |= set->sig[0];
current->blocked.sig[1] |= set->sig[1];
current_process->blocked.sig[0] |= set->sig[0];
current_process->blocked.sig[1] |= set->sig[1];
} else if (how == SIG_UNBLOCK) {
// The signals in set are removed from the current set of
// blocked signals. It is permissible to attempt to unblock
// a signal which is not blocked.
current->blocked.sig[0] &= ~(set->sig[0]);
current->blocked.sig[1] &= ~(set->sig[1]);
current_process->blocked.sig[0] &= ~(set->sig[0]);
current_process->blocked.sig[1] &= ~(set->sig[1]);
} else if (how == SIG_SETMASK) {
// The set of blocked signals is set to the argument set.
current->blocked.sig[0] = set->sig[0];
current->blocked.sig[1] = set->sig[1];
current_process->blocked.sig[0] = set->sig[0];
current_process->blocked.sig[1] = set->sig[1];
}
}
return 0;
}
int sys_sigpending(sigset_t *set)
{
// Get the current process.
task_struct *current_process = scheduler_get_current_process();
// Check the current task.
assert(current_process && "There is no current process!");
// Check the pointer we were provided with.
if (set == NULL) {
return -EFAULT;
}
// Copy the pending set.
__copy_sigset(set, &current_process->pending.signal);
return 0;
}
const char *strsignal(int sig)
{
if ((sig >= SIGHUP) && (sig < NSIG))
+188 -62
View File
@@ -49,68 +49,194 @@ static inline int sys_ni_syscall()
void syscall_init()
{
// Initialize the list of system calls.
for (uint32_t it = 0; it < SYSCALL_NUMBER; ++it) {
sys_call_table[it] = sys_ni_syscall;
}
sys_call_table[__NR_exit] = (SystemCall)sys_exit;
sys_call_table[__NR_read] = (SystemCall)sys_read;
sys_call_table[__NR_write] = (SystemCall)sys_write;
sys_call_table[__NR_open] = (SystemCall)sys_open;
sys_call_table[__NR_close] = (SystemCall)sys_close;
sys_call_table[__NR_stat] = (SystemCall)sys_stat;
sys_call_table[__NR_fstat] = (SystemCall)sys_fstat;
sys_call_table[__NR_mkdir] = (SystemCall)sys_mkdir;
sys_call_table[__NR_rmdir] = (SystemCall)sys_rmdir;
sys_call_table[__NR_creat] = (SystemCall)sys_creat;
sys_call_table[__NR_unlink] = (SystemCall)sys_unlink;
sys_call_table[__NR_getdents] = (SystemCall)sys_getdents;
sys_call_table[__NR_lseek] = (SystemCall)sys_lseek;
sys_call_table[__NR_getpid] = (SystemCall)sys_getpid;
sys_call_table[__NR_getsid] = (SystemCall)sys_getsid;
sys_call_table[__NR_setsid] = (SystemCall)sys_setsid;
sys_call_table[__NR_getpgid] = (SystemCall)sys_getpgid;
sys_call_table[__NR_setpgid] = (SystemCall)sys_setpgid;
sys_call_table[__NR_getuid] = (SystemCall)sys_getuid;
sys_call_table[__NR_setuid] = (SystemCall)sys_setuid;
sys_call_table[__NR_getgid] = (SystemCall)sys_getgid;
sys_call_table[__NR_setgid] = (SystemCall)sys_setgid;
sys_call_table[__NR_getppid] = (SystemCall)sys_getppid;
sys_call_table[__NR_sigaction] = (SystemCall)sys_sigaction;
sys_call_table[__NR_fork] = (SystemCall)sys_fork;
sys_call_table[__NR_execve] = (SystemCall)sys_execve;
sys_call_table[__NR_nice] = (SystemCall)sys_nice;
sys_call_table[__NR_kill] = (SystemCall)sys_kill;
sys_call_table[__NR_reboot] = (SystemCall)sys_reboot;
sys_call_table[__NR_uname] = (SystemCall)sys_uname;
sys_call_table[__NR_sigreturn] = (SystemCall)sys_sigreturn;
sys_call_table[__NR_waitpid] = (SystemCall)sys_waitpid;
sys_call_table[__NR_chdir] = (SystemCall)sys_chdir;
sys_call_table[__NR_fchdir] = (SystemCall)sys_fchdir;
sys_call_table[__NR_time] = (SystemCall)sys_time;
sys_call_table[__NR_sigprocmask] = (SystemCall)sys_sigprocmask;
sys_call_table[__NR_brk] = (SystemCall)sys_brk;
sys_call_table[__NR_signal] = (SystemCall)sys_signal;
sys_call_table[__NR_ioctl] = (SystemCall)sys_ioctl;
sys_call_table[__NR_sched_setparam] = (SystemCall)sys_sched_setparam;
sys_call_table[__NR_sched_getparam] = (SystemCall)sys_sched_getparam;
sys_call_table[__NR_nanosleep] = (SystemCall)sys_nanosleep;
sys_call_table[__NR_getcwd] = (SystemCall)sys_getcwd;
sys_call_table[__NR_waitperiod] = (SystemCall)sys_waitperiod;
sys_call_table[__NR_msgctl] = (SystemCall)sys_msgctl;
sys_call_table[__NR_msgget] = (SystemCall)sys_msgget;
sys_call_table[__NR_msgrcv] = (SystemCall)sys_msgrcv;
sys_call_table[__NR_msgsnd] = (SystemCall)sys_msgsnd;
sys_call_table[__NR_semctl] = (SystemCall)sys_semctl;
sys_call_table[__NR_semget] = (SystemCall)sys_semget;
sys_call_table[__NR_semop] = (SystemCall)sys_semop;
sys_call_table[__NR_shmat] = (SystemCall)sys_shmat;
sys_call_table[__NR_shmctl] = (SystemCall)sys_shmctl;
sys_call_table[__NR_shmdt] = (SystemCall)sys_shmdt;
sys_call_table[__NR_shmget] = (SystemCall)sys_shmget;
sys_call_table[__NR_alarm] = (SystemCall)sys_alarm;
sys_call_table[__NR_setitimer] = (SystemCall)sys_setitimer;
sys_call_table[__NR_getitimer] = (SystemCall)sys_getitimer;
sys_call_table[__NR_exit] = (SystemCall)sys_exit;
sys_call_table[__NR_fork] = (SystemCall)sys_fork;
sys_call_table[__NR_read] = (SystemCall)sys_read;
sys_call_table[__NR_write] = (SystemCall)sys_write;
sys_call_table[__NR_open] = (SystemCall)sys_open;
sys_call_table[__NR_close] = (SystemCall)sys_close;
sys_call_table[__NR_waitpid] = (SystemCall)sys_waitpid;
sys_call_table[__NR_creat] = (SystemCall)sys_creat;
sys_call_table[__NR_link] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_unlink] = (SystemCall)sys_unlink;
sys_call_table[__NR_execve] = (SystemCall)sys_execve;
sys_call_table[__NR_chdir] = (SystemCall)sys_chdir;
sys_call_table[__NR_time] = (SystemCall)sys_time;
sys_call_table[__NR_mknod] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_chmod] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_lchown] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_stat] = (SystemCall)sys_stat;
sys_call_table[__NR_lseek] = (SystemCall)sys_lseek;
sys_call_table[__NR_getpid] = (SystemCall)sys_getpid;
sys_call_table[__NR_mount] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_oldumount] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_setuid] = (SystemCall)sys_setuid;
sys_call_table[__NR_getuid] = (SystemCall)sys_getuid;
sys_call_table[__NR_stime] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_ptrace] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_alarm] = (SystemCall)sys_alarm;
sys_call_table[__NR_fstat] = (SystemCall)sys_fstat;
sys_call_table[__NR_pause] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_utime] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_access] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_nice] = (SystemCall)sys_nice;
sys_call_table[__NR_sync] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_kill] = (SystemCall)sys_kill;
sys_call_table[__NR_rename] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_mkdir] = (SystemCall)sys_mkdir;
sys_call_table[__NR_rmdir] = (SystemCall)sys_rmdir;
sys_call_table[__NR_dup] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_pipe] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_times] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_brk] = (SystemCall)sys_brk;
sys_call_table[__NR_setgid] = (SystemCall)sys_setgid;
sys_call_table[__NR_getgid] = (SystemCall)sys_getgid;
sys_call_table[__NR_signal] = (SystemCall)sys_signal;
sys_call_table[__NR_geteuid] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_getegid] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_acct] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_umount] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_ioctl] = (SystemCall)sys_ioctl;
sys_call_table[__NR_fcntl] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_setpgid] = (SystemCall)sys_setpgid;
sys_call_table[__NR_olduname] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_umask] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_chroot] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_ustat] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_dup2] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_getppid] = (SystemCall)sys_getppid;
sys_call_table[__NR_getpgrp] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_setsid] = (SystemCall)sys_setsid;
sys_call_table[__NR_sigaction] = (SystemCall)sys_sigaction;
sys_call_table[__NR_sgetmask] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_ssetmask] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_setreuid] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_setregid] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_sigsuspend] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_sigpending] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_sethostname] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_setrlimit] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_getrlimit] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_getrusage] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_gettimeofday] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_settimeofday] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_getgroups] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_setgroups] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_symlink] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_lstat] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_readlink] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_uselib] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_swapon] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_reboot] = (SystemCall)sys_reboot;
sys_call_table[__NR_readdir] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_mmap] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_munmap] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_truncate] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_ftruncate] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_fchmod] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_fchown] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_getpriority] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_setpriority] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_statfs] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_fstatfs] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_ioperm] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_socketcall] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_syslog] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_setitimer] = (SystemCall)sys_setitimer;
sys_call_table[__NR_getitimer] = (SystemCall)sys_getitimer;
sys_call_table[__NR_newstat] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_newlstat] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_newfstat] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_uname] = (SystemCall)sys_uname;
sys_call_table[__NR_iopl] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_vhangup] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_idle] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_vm86old] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_wait4] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_swapoff] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_sysinfo] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_ipc] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_fsync] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_sigreturn] = (SystemCall)sys_sigreturn;
sys_call_table[__NR_clone] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_setdomainname] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_newuname] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_modify_ldt] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_adjtimex] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_mprotect] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_sigprocmask] = (SystemCall)sys_sigprocmask;
sys_call_table[__NR_create_module] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_init_module] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_delete_module] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_get_kernel_syms] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_quotactl] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_getpgid] = (SystemCall)sys_getpgid;
sys_call_table[__NR_fchdir] = (SystemCall)sys_fchdir;
sys_call_table[__NR_bdflush] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_sysfs] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_personality] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_setfsuid] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_setfsgid] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_llseek] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_getdents] = (SystemCall)sys_getdents;
sys_call_table[__NR_select] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_flock] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_msync] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_readv] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_writev] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_getsid] = (SystemCall)sys_getsid;
sys_call_table[__NR_fdatasync] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_sysctl] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_mlock] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_munlock] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_mlockall] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_munlockall] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_sched_setparam] = (SystemCall)sys_sched_setparam;
sys_call_table[__NR_sched_getparam] = (SystemCall)sys_sched_getparam;
sys_call_table[__NR_sched_setscheduler] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_sched_getscheduler] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_sched_yield] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_sched_get_priority_max] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_sched_get_priority_min] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_sched_rr_get_interval] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_nanosleep] = (SystemCall)sys_nanosleep;
sys_call_table[__NR_mremap] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_setresuid] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_getresuid] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_vm86] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_query_module] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_poll] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_nfsservctl] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_setresgid] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_getresgid] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_prctl] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_rt_sigreturn] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_rt_sigaction] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_rt_sigprocmask] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_rt_sigpending] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_rt_sigtimedwait] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_rt_sigqueueinfo] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_rt_sigsuspend] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_pread] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_pwrite] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_chown] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_getcwd] = (SystemCall)sys_getcwd;
sys_call_table[__NR_capget] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_capset] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_sigaltstack] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_sendfile] = (SystemCall)sys_ni_syscall;
sys_call_table[__NR_waitperiod] = (SystemCall)sys_waitperiod;
sys_call_table[__NR_msgctl] = (SystemCall)sys_msgctl;
sys_call_table[__NR_msgget] = (SystemCall)sys_msgget;
sys_call_table[__NR_msgrcv] = (SystemCall)sys_msgrcv;
sys_call_table[__NR_msgsnd] = (SystemCall)sys_msgsnd;
sys_call_table[__NR_semctl] = (SystemCall)sys_semctl;
sys_call_table[__NR_semget] = (SystemCall)sys_semget;
sys_call_table[__NR_semop] = (SystemCall)sys_semop;
sys_call_table[__NR_shmat] = (SystemCall)sys_shmat;
sys_call_table[__NR_shmctl] = (SystemCall)sys_shmctl;
sys_call_table[__NR_shmdt] = (SystemCall)sys_shmdt;
sys_call_table[__NR_shmget] = (SystemCall)sys_shmget;
isr_install_handler(SYSTEM_CALL, &syscall_handler, "syscall_handler");
}