Annotation of prex/sys/kern/syscalls.c, Revision 1.1
1.1 ! nbrk 1: /*-
! 2: * Copyright (c) 2005-2007, Kohsuke Ohtani
! 3: * All rights reserved.
! 4: *
! 5: * Redistribution and use in source and binary forms, with or without
! 6: * modification, are permitted provided that the following conditions
! 7: * are met:
! 8: * 1. Redistributions of source code must retain the above copyright
! 9: * notice, this list of conditions and the following disclaimer.
! 10: * 2. Redistributions in binary form must reproduce the above copyright
! 11: * notice, this list of conditions and the following disclaimer in the
! 12: * documentation and/or other materials provided with the distribution.
! 13: * 3. Neither the name of the author nor the names of any co-contributors
! 14: * may be used to endorse or promote products derived from this software
! 15: * without specific prior written permission.
! 16: *
! 17: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
! 18: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
! 19: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
! 20: * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
! 21: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
! 22: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
! 23: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
! 24: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
! 25: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
! 26: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
! 27: * SUCH DAMAGE.
! 28: */
! 29:
! 30: /*
! 31: * syscalls.c - system call table
! 32: */
! 33:
! 34: #include <kernel.h>
! 35: #include <thread.h>
! 36: #include <timer.h>
! 37: #include <vm.h>
! 38: #include <task.h>
! 39: #include <exception.h>
! 40: #include <ipc.h>
! 41: #include <device.h>
! 42: #include <sync.h>
! 43: #include <system.h>
! 44:
! 45: typedef void (*sysfn_t)(void);
! 46:
! 47: #define SYSENT(func) (sysfn_t)(func)
! 48:
! 49: const sysfn_t syscall_table[] = {
! 50: /* 0 */ SYSENT(object_create),
! 51: /* 1 */ SYSENT(object_destroy),
! 52: /* 2 */ SYSENT(object_lookup),
! 53: /* 3 */ SYSENT(msg_send),
! 54: /* 4 */ SYSENT(msg_receive),
! 55: /* 5 */ SYSENT(msg_reply),
! 56: /* 6 */ SYSENT(vm_allocate),
! 57: /* 7 */ SYSENT(vm_free),
! 58: /* 8 */ SYSENT(vm_attribute),
! 59: /* 9 */ SYSENT(vm_map),
! 60: /* 10 */ SYSENT(task_create),
! 61: /* 11 */ SYSENT(task_terminate),
! 62: /* 12 */ SYSENT(task_self),
! 63: /* 13 */ SYSENT(task_suspend),
! 64: /* 14 */ SYSENT(task_resume),
! 65: /* 15 */ SYSENT(task_name),
! 66: /* 16 */ SYSENT(task_getcap),
! 67: /* 17 */ SYSENT(task_setcap),
! 68: /* 18 */ SYSENT(thread_create),
! 69: /* 19 */ SYSENT(thread_terminate),
! 70: /* 20 */ SYSENT(thread_load),
! 71: /* 21 */ SYSENT(thread_self),
! 72: /* 22 */ SYSENT(thread_yield),
! 73: /* 23 */ SYSENT(thread_suspend),
! 74: /* 24 */ SYSENT(thread_resume),
! 75: /* 25 */ SYSENT(thread_schedparam),
! 76: /* 26 */ SYSENT(timer_sleep),
! 77: /* 27 */ SYSENT(timer_alarm),
! 78: /* 28 */ SYSENT(timer_periodic),
! 79: /* 29 */ SYSENT(timer_waitperiod),
! 80: /* 30 */ SYSENT(exception_setup),
! 81: /* 31 */ SYSENT(exception_return),
! 82: /* 32 */ SYSENT(exception_raise),
! 83: /* 33 */ SYSENT(exception_wait),
! 84: /* 34 */ SYSENT(device_open),
! 85: /* 35 */ SYSENT(device_close),
! 86: /* 36 */ SYSENT(device_read),
! 87: /* 37 */ SYSENT(device_write),
! 88: /* 38 */ SYSENT(device_ioctl),
! 89: /* 39 */ SYSENT(mutex_init),
! 90: /* 40 */ SYSENT(mutex_destroy),
! 91: /* 41 */ SYSENT(mutex_lock),
! 92: /* 42 */ SYSENT(mutex_trylock),
! 93: /* 43 */ SYSENT(mutex_unlock),
! 94: /* 44 */ SYSENT(cond_init),
! 95: /* 45 */ SYSENT(cond_destroy),
! 96: /* 46 */ SYSENT(cond_wait),
! 97: /* 47 */ SYSENT(cond_signal),
! 98: /* 48 */ SYSENT(cond_broadcast),
! 99: /* 49 */ SYSENT(sem_init),
! 100: /* 50 */ SYSENT(sem_destroy),
! 101: /* 51 */ SYSENT(sem_wait),
! 102: /* 52 */ SYSENT(sem_trywait),
! 103: /* 53 */ SYSENT(sem_post),
! 104: /* 54 */ SYSENT(sem_getvalue),
! 105: /* 55 */ SYSENT(sys_log),
! 106: /* 56 */ SYSENT(sys_panic),
! 107: /* 57 */ SYSENT(sys_info),
! 108: /* 58 */ SYSENT(sys_time),
! 109: /* 59 */ SYSENT(sys_debug),
! 110: };
! 111: const u_int nr_syscalls = sizeof(syscall_table) / sizeof(sysfn_t);
CVSweb