We automatically generate what information are available from syscalls.h,

which from now on relieves us from the duty to maintain syscalls.S and
syscalls.c manually. Either includes a generated file.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8699 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2004-08-28 20:34:43 +00:00
parent d7206d7e3b
commit 6fec58934a
5 changed files with 56 additions and 791 deletions

View File

@ -7,153 +7,6 @@
#include <sys/types.h>
enum {
SYSCALL_NULL = 0, /* 0 */
SYSCALL_MOUNT,
SYSCALL_UNMOUNT,
SYSCALL_SYNC,
SYSCALL_OPEN,
SYSCALL_CLOSE, /* 5 */
SYSCALL_FSYNC,
SYSCALL_READ,
SYSCALL_WRITE,
SYSCALL_SEEK,
SYSCALL_IOCTL, /* 10 */
SYSCALL_CREATE,
SYSCALL_UNLINK,
SYSCALL_RENAME,
SYSCALL_READ_PATH_STAT,
SYSCALL_WRITE_PATH_STAT, /* 15 */
SYSCALL_SYSTEM_TIME,
SYSCALL_SNOOZE_ETC,
SYSCALL_SEM_CREATE,
SYSCALL_SEM_DELETE,
SYSCALL_SEM_ACQUIRE, /* 20 */
SYSCALL_SEM_ACQUIRE_ETC,
SYSCALL_SEM_RELEASE,
SYSCALL_SEM_RELEASE_ETC,
SYSCALL_FIND_THREAD,
SYSCALL_EXIT_THREAD, /* 25 */
SYSCALL_CREATE_TEAM,
SYSCALL_WAIT_FOR_THREAD,
SYSCALL_WAIT_FOR_TEAM,
SYSCALL_CREATE_AREA,
SYSCALL_CLONE_AREA, /* 30 */
SYSCALL_VM_MAP_FILE,
SYSCALL_DELETE_AREA,
SYSCALL_GET_AREA_INFO,
SYSCALL_FIND_AREA,
SYSCALL_SPAWN_THREAD, /* 45 */
SYSCALL_KILL_THREAD,
SYSCALL_SUSPEND_THREAD,
SYSCALL_RESUME_THREAD,
SYSCALL_KILL_TEAM,
SYSCALL_GET_CURRENT_TEAM_ID, /* 40 */
SYSCALL_GETCWD,
SYSCALL_SETCWD,
SYSCALL_PORT_CREATE,
SYSCALL_PORT_CLOSE,
SYSCALL_PORT_DELETE, /* 45 */
SYSCALL_PORT_FIND,
SYSCALL_PORT_GET_INFO,
SYSCALL_PORT_GET_NEXT_PORT_INFO,
SYSCALL_PORT_BUFFER_SIZE,
SYSCALL_PORT_BUFFER_SIZE_ETC, /* 50 */
SYSCALL_PORT_COUNT,
SYSCALL_PORT_READ,
SYSCALL_PORT_READ_ETC,
SYSCALL_PORT_SET_OWNER,
SYSCALL_PORT_WRITE, /* 55 */
SYSCALL_PORT_WRITE_ETC,
SYSCALL_SEM_GET_COUNT,
SYSCALL_SEM_GET_SEM_INFO,
SYSCALL_SEM_GET_NEXT_SEM_INFO,
SYSCALL_SEM_SET_SEM_OWNER, /* 60 */
SYSCALL_FDDUP,
SYSCALL_FDDUP2,
SYSCALL_GET_PROC_TABLE,
SYSCALL_GETRLIMIT,
SYSCALL_SETRLIMIT, /* 65 */
SYSCALL_READ_FS_INFO,
SYSCALL_WRITE_FS_INFO,
SYSCALL_NEXT_DEVICE,
SYSCALL_unused_69,
SYSCALL_unused_70, /* 70 */
SYSCALL_SYSCTL,
SYSCALL_SOCKET,
SYSCALL_ACCESS,
SYSCALL_READ_STAT,
SYSCALL_READ_DIR, /* 75 */
SYSCALL_REWIND_DIR,
SYSCALL_OPEN_DIR,
SYSCALL_CREATE_DIR,
SYSCALL_SETENV,
SYSCALL_GETENV, /* 80 */
SYSCALL_OPEN_ENTRY_REF,
SYSCALL_OPEN_DIR_ENTRY_REF,
SYSCALL_OPEN_DIR_NODE_REF,
SYSCALL_CREATE_ENTRY_REF,
SYSCALL_CREATE_DIR_ENTRY_REF, /* 85 */
SYSCALL_CREATE_SYMLINK,
SYSCALL_READ_LINK,
SYSCALL_GET_THREAD_INFO,
SYSCALL_GET_NEXT_THREAD_INFO,
SYSCALL_GET_TEAM_INFO, /* 90 */
SYSCALL_GET_NEXT_TEAM_INFO,
SYSCALL_CREATE_LINK,
SYSCALL_REMOVE_DIR,
SYSCALL_SEND_DATA,
SYSCALL_RECEIVE_DATA, /* 95 */
SYSCALL_HAS_DATA,
SYSCALL_OPEN_ATTR_DIR,
SYSCALL_CREATE_ATTR,
SYSCALL_OPEN_ATTR,
SYSCALL_WRITE_STAT, /* 100 */
SYSCALL_REMOVE_ATTR,
SYSCALL_RENAME_ATTR,
SYSCALL_RETURN_FROM_SIGNAL,
SYSCALL_unused_104,
SYSCALL_SIGACTION, /* 105 */
SYSCALL_OPEN_INDEX_DIR,
SYSCALL_CREATE_INDEX,
SYSCALL_READ_INDEX_STAT,
SYSCALL_REMOVE_INDEX,
SYSCALL_SEND_SIGNAL, /* 110 */
SYSCALL_SET_ALARM,
SYSCALL_SELECT,
SYSCALL_POLL,
SYSCALL_REGISTER_IMAGE,
SYSCALL_UNREGISTER_IMAGE, /* 115 */
SYSCALL_GET_IMAGE_INFO,
SYSCALL_GET_NEXT_IMAGE_INFO,
SYSCALL_START_WATCHING,
SYSCALL_STOP_WATCHING,
SYSCALL_STOP_NOTIFYING, /* 120 */
SYSCALL_SET_THREAD_PRIORITY,
SYSCALL_GET_NEXT_AREA_INFO,
SYSCALL_SET_AREA_PROTECTION,
SYSCALL_RESIZE_AREA,
SYSCALL_AREA_FOR, /* 125 */
SYSCALL_ATOMIC_SET,
SYSCALL_ATOMIC_TEST_AND_SET,
SYSCALL_ATOMIC_ADD,
SYSCALL_ATOMIC_AND,
SYSCALL_ATOMIC_OR, /* 130 */
SYSCALL_ATOMIC_GET,
SYSCALL_ATOMIC_SET64,
SYSCALL_ATOMIC_TEST_AND_SET64,
SYSCALL_ATOMIC_ADD64,
SYSCALL_ATOMIC_AND64, /* 135 */
SYSCALL_ATOMIC_OR64,
SYSCALL_ATOMIC_GET64,
SYSCALL_SET_REAL_TIME_CLOCK,
SYSCALL_DEBUG_OUTPUT,
SYSCALL_GET_SYSTEM_INFO, /* 140 */
SYSCALL_RENAME_THREAD,
SYSCALL_DIR_NODE_REF_TO_PATH,
};
int syscall_dispatcher(unsigned long call_num, void *arg_buffer, uint64 *call_ret);
#endif /* _KERNEL_SYSCALLS_H */

View File

@ -45,6 +45,9 @@ KernelMergeObject kernel_core.o :
-fno-pic -D_KERNEL_MODE
;
# We need to specify the dependency on the generated syscalls file explicitly.
Includes [ FGristFiles syscalls.c ] : <syscalls>syscall_dispatcher.h ;
KernelLd linkhack.so :
<$(SOURCE_GRIST)>linkhack.o
:

View File

@ -31,489 +31,60 @@
#include <sys/socket.h>
#include <user_atomic.h>
#define INT32TOINT64(x, y) ((int64)(x) | ((int64)(y) << 32))
#define arg0 (((uint32 *)arg_buffer)[0])
#define arg1 (((uint32 *)arg_buffer)[1])
#define arg2 (((uint32 *)arg_buffer)[2])
#define arg3 (((uint32 *)arg_buffer)[3])
#define arg4 (((uint32 *)arg_buffer)[4])
#define arg5 (((uint32 *)arg_buffer)[5])
#define arg6 (((uint32 *)arg_buffer)[6])
#define arg7 (((uint32 *)arg_buffer)[7])
#define arg8 (((uint32 *)arg_buffer)[8])
#define arg9 (((uint32 *)arg_buffer)[9])
#define arg10 (((uint32 *)arg_buffer)[10])
#define arg11 (((uint32 *)arg_buffer)[11])
#define arg12 (((uint32 *)arg_buffer)[12])
#define arg13 (((uint32 *)arg_buffer)[13])
#define arg14 (((uint32 *)arg_buffer)[14])
#define arg15 (((uint32 *)arg_buffer)[15])
static inline
int
_user_null()
{
return 0;
}
//
static inline
bigtime_t
_user_system_time()
{
return system_time();
}
// XXX: Do we need this?
// Once there was
// case SYSCALL_RETURN_FROM_SIGNAL: *call_ret = _user_restore_signal_frame();
// But it is not defined in syscalls.h.
static inline
uint64
_user_restore_signal_frame()
{
return arch_restore_signal_frame();
}
// XXX: _kern_exit() was formerly mapped to _user_exit_thread(). That's
// probably not correct.
static inline
void
_user_exit(int returnCode)
{
_user_exit_thread(returnCode);
}
// TODO: Replace when networking code is added to the build.
static inline
int
_user_socket(int family, int type, int proto)
{
return 0;
}
int
syscall_dispatcher(unsigned long call_num, void *arg_buffer, uint64 *call_ret)
syscall_dispatcher(unsigned long call_num, void *args, uint64 *call_ret)
{
// dprintf("syscall_dispatcher: thread 0x%x call 0x%x, arg0 0x%x, arg1 0x%x arg2 0x%x arg3 0x%x arg4 0x%x\n",
// thread_get_current_thread_id(), call_num, arg0, arg1, arg2, arg3, arg4);
switch (call_num) {
case SYSCALL_NULL:
*call_ret = 0;
break;
case SYSCALL_MOUNT:
*call_ret = _user_mount((const char *)arg0, (const char *)arg1, (const char *)arg2, (void *)arg3);
break;
case SYSCALL_UNMOUNT:
*call_ret = _user_unmount((const char *)arg0);
break;
case SYSCALL_READ_FS_INFO:
*call_ret = _user_read_fs_info((dev_t)arg0, (struct fs_info *)arg1);
break;
case SYSCALL_WRITE_FS_INFO:
*call_ret = _user_write_fs_info((dev_t)arg0, (struct fs_info *)arg1, (int)arg2);
break;
case SYSCALL_NEXT_DEVICE:
*call_ret = _user_next_device((int32 *)arg0);
break;
case SYSCALL_SYNC:
*call_ret = _user_sync();
break;
case SYSCALL_OPEN_ENTRY_REF:
*call_ret = _user_open_entry_ref((dev_t)arg0, (ino_t)INT32TOINT64(arg1, arg2), (const char *)arg3, (int)arg4);
break;
case SYSCALL_OPEN:
*call_ret = _user_open((const char *)arg0, (int)arg1);
break;
case SYSCALL_CLOSE:
*call_ret = _user_close((int)arg0);
break;
case SYSCALL_FSYNC:
*call_ret = _user_fsync((int)arg0);
break;
case SYSCALL_READ:
*call_ret = _user_read((int)arg0, (off_t)INT32TOINT64(arg1, arg2), (void *)arg3, (ssize_t)arg4);
break;
case SYSCALL_WRITE:
*call_ret = _user_write((int)arg0, (off_t)INT32TOINT64(arg1, arg2), (const void *)arg3, (ssize_t)arg4);
break;
case SYSCALL_SEEK:
*call_ret = _user_seek((int)arg0, (off_t)INT32TOINT64(arg1, arg2), (int)arg3);
break;
case SYSCALL_DIR_NODE_REF_TO_PATH:
*call_ret = _user_dir_node_ref_to_path((dev_t)arg0, (ino_t)INT32TOINT64(arg1,arg2), (char *)arg3, (size_t)arg4);
break;
case SYSCALL_OPEN_DIR_ENTRY_REF:
*call_ret = _user_open_dir_entry_ref((dev_t)arg0, (ino_t)INT32TOINT64(arg1,arg2), (const char *)arg3);
break;
case SYSCALL_OPEN_DIR_NODE_REF:
*call_ret = _user_open_dir_node_ref((dev_t)arg0, (ino_t)INT32TOINT64(arg1,arg2));
break;
case SYSCALL_OPEN_DIR:
*call_ret = _user_open_dir((const char *)arg0);
break;
case SYSCALL_READ_DIR:
*call_ret = _user_read_dir((int)arg0, (struct dirent *)arg1, (size_t)arg2, (uint32)arg3);
break;
case SYSCALL_REWIND_DIR:
*call_ret = _user_rewind_dir((int)arg0);
break;
case SYSCALL_IOCTL:
*call_ret = _user_ioctl((int)arg0, (ulong)arg1, (void *)arg2, (size_t)arg3);
break;
case SYSCALL_CREATE_ENTRY_REF:
*call_ret = _user_create_entry_ref((dev_t)arg0, (ino_t)INT32TOINT64(arg1,arg2), (const char *)arg3, (int)arg4, (int)arg5);
break;
case SYSCALL_CREATE:
*call_ret = _user_create((const char *)arg0, (int)arg1, (int)arg2);
break;
case SYSCALL_CREATE_DIR_ENTRY_REF:
*call_ret = _user_create_dir_entry_ref((dev_t)arg0, (ino_t)INT32TOINT64(arg1,arg2), (const char *)arg3, (int)arg4);
break;
case SYSCALL_CREATE_DIR:
*call_ret = _user_create_dir((const char *)arg0, (int)arg1);
break;
case SYSCALL_CREATE_SYMLINK:
*call_ret = _user_create_symlink((const char *)arg0, (const char *)arg1, (int)arg2);
break;
case SYSCALL_CREATE_LINK:
*call_ret = _user_create_link((const char *)arg0, (const char *)arg1);
break;
case SYSCALL_READ_LINK:
*call_ret = _user_read_link((const char *)arg0, (char *)arg1, (size_t)arg2);
break;
case SYSCALL_REMOVE_DIR:
*call_ret = _user_remove_dir((const char *)arg0);
break;
case SYSCALL_UNLINK:
*call_ret = _user_unlink((const char *)arg0);
break;
case SYSCALL_RENAME:
*call_ret = _user_rename((const char *)arg0, (const char *)arg1);
break;
case SYSCALL_READ_PATH_STAT:
*call_ret = _user_read_path_stat((const char *)arg0, (bool)arg1, (struct stat *)arg2, (size_t)arg3);
break;
case SYSCALL_WRITE_PATH_STAT:
*call_ret = _user_write_path_stat((const char *)arg0, (bool)arg1, (const struct stat *)arg2, (size_t)arg3, (int)arg4);
break;
case SYSCALL_READ_STAT:
*call_ret = _user_read_stat((int)arg0, (struct stat *)arg1, (size_t)arg2);
break;
case SYSCALL_WRITE_STAT:
*call_ret = _user_write_stat((int)arg0, (const struct stat *)arg1, (size_t)arg2, (int)arg3);
break;
case SYSCALL_ACCESS:
*call_ret = _user_access((const char *)arg0, (int)arg1);
break;
case SYSCALL_SELECT:
*call_ret = _user_select((int)arg0, (fd_set *)arg1, (fd_set *)arg2, (fd_set *)arg3, (bigtime_t)INT32TOINT64(arg4, arg5), (sigset_t *)arg6);
break;
case SYSCALL_POLL:
*call_ret = _user_poll((struct pollfd *)arg0, (int)arg1, (bigtime_t)INT32TOINT64(arg2, arg3));
break;
case SYSCALL_OPEN_ATTR_DIR:
*call_ret = _user_open_attr_dir((int)arg0, (const char *)arg1);
break;
case SYSCALL_CREATE_ATTR:
*call_ret = _user_create_attr((int)arg0, (const char *)arg1, (uint32)arg2, (int)arg3);
break;
case SYSCALL_OPEN_ATTR:
*call_ret = _user_open_attr((int)arg0, (const char *)arg1, (int)arg2);
break;
case SYSCALL_REMOVE_ATTR:
*call_ret = _user_remove_attr((int)arg0, (const char *)arg1);
break;
case SYSCALL_RENAME_ATTR:
*call_ret = _user_rename_attr((int)arg0, (const char *)arg1, (int)arg2, (const char *)arg3);
break;
case SYSCALL_OPEN_INDEX_DIR:
*call_ret = _user_open_index_dir((dev_t)arg0);
break;
case SYSCALL_CREATE_INDEX:
*call_ret = _user_create_index((dev_t)arg0, (const char *)arg1, (uint32)arg2, (uint32)arg3);
break;
case SYSCALL_READ_INDEX_STAT:
*call_ret = _user_read_index_stat((dev_t)arg0, (const char *)arg1, (struct stat *)arg2);
break;
case SYSCALL_REMOVE_INDEX:
*call_ret = _user_remove_index((dev_t)arg0, (const char *)arg1);
break;
case SYSCALL_FDDUP:
*call_ret = _user_dup(arg0);
break;
case SYSCALL_FDDUP2:
*call_ret = _user_dup2(arg0, arg1);
break;
case SYSCALL_GETCWD:
*call_ret = _user_getcwd((char*)arg0, (size_t)arg1);
break;
case SYSCALL_SETCWD:
*call_ret = _user_setcwd((int)arg0, (const char *)arg1);
break;
case SYSCALL_SYSTEM_TIME:
*call_ret = system_time();
break;
case SYSCALL_SNOOZE_ETC:
*call_ret = _user_snooze_etc((bigtime_t)INT32TOINT64(arg0, arg1), (int)arg2, (int32)arg3);
break;
/* semaphore syscalls */
case SYSCALL_SEM_CREATE:
*call_ret = user_create_sem((int)arg0, (const char *)arg1);
break;
case SYSCALL_SEM_DELETE:
*call_ret = user_delete_sem((sem_id)arg0);
break;
case SYSCALL_SEM_ACQUIRE:
*call_ret = user_acquire_sem_etc((sem_id)arg0, 1, 0, 0);
break;
case SYSCALL_SEM_ACQUIRE_ETC:
*call_ret = user_acquire_sem_etc((sem_id)arg0, (int)arg1, (int)arg2, (bigtime_t)INT32TOINT64(arg3, arg4));
break;
case SYSCALL_SEM_RELEASE:
*call_ret = user_release_sem((sem_id)arg0);
break;
case SYSCALL_SEM_RELEASE_ETC:
*call_ret = user_release_sem_etc((sem_id)arg0, (int)arg1, (int)arg2);
break;
/* VM/area syscalls */
case SYSCALL_CREATE_AREA:
*call_ret = _user_create_area((char *)arg0, (void **)arg1, (uint32)arg2,
(size_t)arg3, (uint32)arg4, (uint32)arg5);
break;
case SYSCALL_CLONE_AREA:
*call_ret = _user_clone_area((char *)arg0, (void **)arg1, (uint32)arg2,
(uint32)arg3, (area_id)arg4);
break;
case SYSCALL_VM_MAP_FILE:
*call_ret = user_vm_map_file(
(char *)arg0, (void **)arg1, (int)arg2,
(addr)arg3, (int)arg4, (int)arg5, (const char *)arg6,
(off_t)INT32TOINT64(arg7, arg8));
break;
case SYSCALL_FIND_AREA:
*call_ret = _user_find_area((const char *)arg0);
break;
case SYSCALL_DELETE_AREA:
*call_ret = _user_delete_area((area_id)arg0);
break;
case SYSCALL_GET_AREA_INFO:
*call_ret = _user_get_area_info((area_id)arg0, (area_info *)arg1);
break;
case SYSCALL_GET_NEXT_AREA_INFO:
*call_ret = _user_get_next_area_info((team_id)arg0, (int32 *)arg1, (area_info *)arg2);
break;
case SYSCALL_SET_AREA_PROTECTION:
*call_ret = _user_set_area_protection((area_id)arg0, (uint32)arg1);
break;
case SYSCALL_AREA_FOR:
*call_ret = _user_area_for((void *)arg0);
break;
/* Thread/team syscalls */
case SYSCALL_FIND_THREAD:
*call_ret = _user_find_thread((const char *)arg0);
break;
case SYSCALL_EXIT_THREAD:
_user_exit_thread((status_t)arg0);
*call_ret = 0;
break;
case SYSCALL_CREATE_TEAM:
*call_ret = _user_create_team((const char *)arg0, (const char *)arg1, (char **)arg2, (int)arg3, (char **)arg4, (int)arg5, (int)arg6);
break;
case SYSCALL_WAIT_FOR_THREAD:
*call_ret = _user_wait_for_thread((thread_id)arg0, (status_t *)arg1);
break;
case SYSCALL_WAIT_FOR_TEAM:
*call_ret = _user_wait_for_team((team_id)arg0, (status_t *)arg1);
break;
case SYSCALL_SPAWN_THREAD:
*call_ret = _user_spawn_thread((thread_func)arg0, (const char *)arg1, (int)arg2, (void *)arg3, (void *)arg4);
break;
case SYSCALL_SET_THREAD_PRIORITY:
*call_ret = _user_set_thread_priority((thread_id)arg0, (int32)arg1);
break;
case SYSCALL_KILL_THREAD:
*call_ret = _user_kill_thread((thread_id)arg0);
break;
case SYSCALL_GET_THREAD_INFO:
*call_ret = _user_get_thread_info((thread_id)arg0, (thread_info *)arg1);
break;
case SYSCALL_GET_NEXT_THREAD_INFO:
*call_ret = _user_get_next_thread_info((team_id)arg0, (int32 *)arg1, (thread_info *)arg2);
break;
case SYSCALL_GET_TEAM_INFO:
*call_ret = _user_get_team_info((team_id)arg0, (team_info *)arg1);
break;
case SYSCALL_GET_NEXT_TEAM_INFO:
*call_ret = _user_get_next_team_info((int32 *)arg0, (team_info *)arg1);
break;
case SYSCALL_SUSPEND_THREAD:
*call_ret = _user_suspend_thread((thread_id)arg0);
break;
case SYSCALL_RESUME_THREAD:
*call_ret = _user_resume_thread((thread_id)arg0);
break;
case SYSCALL_RENAME_THREAD:
*call_ret = _user_rename_thread((thread_id)arg0, (const char *)arg1);
break;
case SYSCALL_SEND_DATA:
*call_ret = _user_send_data((thread_id)arg0, (int32)arg1, (const void *)arg2, (size_t)arg3);
break;
case SYSCALL_RECEIVE_DATA:
*call_ret = _user_receive_data((thread_id *)arg0, (void *)arg1, (size_t)arg2);
break;
case SYSCALL_HAS_DATA:
*call_ret = _user_has_data((thread_id)arg0);
break;
case SYSCALL_KILL_TEAM:
*call_ret = _user_kill_team((team_id)arg0);
break;
case SYSCALL_GET_CURRENT_TEAM_ID:
*call_ret = _user_get_current_team();
break;
case SYSCALL_PORT_CREATE:
*call_ret = user_create_port((int32)arg0, (const char *)arg1);
break;
case SYSCALL_PORT_CLOSE:
*call_ret = user_close_port((port_id)arg0);
break;
case SYSCALL_PORT_DELETE:
*call_ret = user_delete_port((port_id)arg0);
break;
case SYSCALL_PORT_FIND:
*call_ret = user_find_port((const char *)arg0);
break;
case SYSCALL_PORT_GET_INFO:
*call_ret = user_get_port_info((port_id)arg0, (struct port_info *)arg1);
break;
case SYSCALL_PORT_GET_NEXT_PORT_INFO:
*call_ret = user_get_next_port_info((port_id)arg0, (uint32 *)arg1, (struct port_info *)arg2);
break;
case SYSCALL_PORT_BUFFER_SIZE:
*call_ret = user_port_buffer_size_etc((port_id)arg0, B_CAN_INTERRUPT, 0);
break;
case SYSCALL_PORT_BUFFER_SIZE_ETC:
*call_ret = user_port_buffer_size_etc((port_id)arg0, (uint32)arg1 | B_CAN_INTERRUPT, (bigtime_t)INT32TOINT64(arg2, arg3));
break;
case SYSCALL_PORT_COUNT:
*call_ret = user_port_count((port_id)arg0);
break;
case SYSCALL_PORT_READ:
*call_ret = user_read_port_etc((port_id)arg0, (int32*)arg1, (void*)arg2, (size_t)arg3, B_CAN_INTERRUPT, 0);
break;
case SYSCALL_PORT_READ_ETC:
*call_ret = user_read_port_etc((port_id)arg0, (int32*)arg1, (void*)arg2, (size_t)arg3, (uint32)arg4 | B_CAN_INTERRUPT, (bigtime_t)INT32TOINT64(arg5, arg6));
break;
case SYSCALL_PORT_SET_OWNER:
*call_ret = user_set_port_owner((port_id)arg0, (team_id)arg1);
break;
case SYSCALL_PORT_WRITE:
*call_ret = user_write_port_etc((port_id)arg0, (int32)arg1, (void *)arg2, (size_t)arg3, B_CAN_INTERRUPT, 0);
break;
case SYSCALL_PORT_WRITE_ETC:
*call_ret = user_write_port_etc((port_id)arg0, (int32)arg1, (void *)arg2, (size_t)arg3, (uint32)arg4 | B_CAN_INTERRUPT, (bigtime_t)INT32TOINT64(arg5, arg6));
break;
case SYSCALL_SEM_GET_COUNT:
*call_ret = user_get_sem_count((sem_id)arg0, (int32*)arg1);
break;
case SYSCALL_SEM_GET_SEM_INFO:
*call_ret = user_get_sem_info((sem_id)arg0, (struct sem_info *)arg1, (size_t)arg2);
break;
case SYSCALL_SEM_GET_NEXT_SEM_INFO:
*call_ret = user_get_next_sem_info((team_id)arg0, (uint32 *)arg1, (struct sem_info *)arg2,
(size_t)arg3);
break;
case SYSCALL_SEM_SET_SEM_OWNER:
*call_ret = user_set_sem_owner((sem_id)arg0, (team_id)arg1);
break;
/* obsolete; replaced by get_next_team_info
case SYSCALL_GET_PROC_TABLE:
*call_ret = user_team_get_table((struct team_info *)arg0, (size_t)arg1);
break;
*/
case SYSCALL_GETRLIMIT:
*call_ret = _user_getrlimit((int)arg0, (struct rlimit *)arg1);
break;
case SYSCALL_SETRLIMIT:
*call_ret = _user_setrlimit((int)arg0, (const struct rlimit *)arg1);
break;
// image calls
case SYSCALL_REGISTER_IMAGE:
*call_ret = _user_register_image((image_info *)arg0, (size_t)arg1);
break;
case SYSCALL_UNREGISTER_IMAGE:
*call_ret = _user_unregister_image((image_id)arg0);
break;
case SYSCALL_GET_IMAGE_INFO:
*call_ret = _user_get_image_info((image_id)arg0, (image_info *)arg1, (size_t)arg2);
break;
case SYSCALL_GET_NEXT_IMAGE_INFO:
*call_ret = _user_get_next_image_info((team_id)arg0, (int32 *)arg1, (image_info *)arg2, (size_t)arg3);
break;
// node monitor calls
case SYSCALL_START_WATCHING:
*call_ret = _user_start_watching((dev_t)arg0, (ino_t)INT32TOINT64(arg1, arg2), (uint32)arg3, (port_id)arg4, (uint32)arg5);
break;
case SYSCALL_STOP_WATCHING:
*call_ret = _user_stop_watching((dev_t)arg0, (ino_t)INT32TOINT64(arg1, arg2), (uint32)arg3, (port_id)arg4, (uint32)arg5);
break;
case SYSCALL_STOP_NOTIFYING:
*call_ret = _user_stop_notifying((port_id)arg0, (uint32)arg1);
break;
case SYSCALL_SYSCTL:
*call_ret = user_sysctl((int *)arg0, (uint)arg1, (void *)arg2,
(size_t *)arg3, (void *)arg4,
(size_t)arg5);
break;
// time calls
case SYSCALL_SET_REAL_TIME_CLOCK:
_user_set_real_time_clock((uint32)arg0);
break;
/* removed until net code has goneback into build
case SYSCALL_SOCKET:
*call_ret = socket((int)arg0, (int)arg1, (int)arg2, false);
break;
*/
case SYSCALL_SETENV:
*call_ret = user_setenv((const char *)arg0, (const char *)arg1, (int)arg2);
break;
case SYSCALL_GETENV:
*call_ret = user_getenv((const char *)arg0, (char **)arg1);
break;
case SYSCALL_DEBUG_OUTPUT:
_user_debug_output((const char *)arg0);
break;
case SYSCALL_RETURN_FROM_SIGNAL:
*call_ret = arch_restore_signal_frame();
break;
case SYSCALL_SIGACTION:
*call_ret = user_sigaction((int)arg0, (const struct sigaction *)arg1, (struct sigaction *)arg2);
break;
case SYSCALL_SEND_SIGNAL:
*call_ret = user_send_signal((pid_t)arg0, (uint)arg1);
break;
case SYSCALL_SET_ALARM:
*call_ret = user_set_alarm((bigtime_t)INT32TOINT64(arg0, arg1), (uint32)arg2);
break;
case SYSCALL_GET_SYSTEM_INFO:
*call_ret = _user_get_system_info((system_info *)arg0, (size_t)arg1);
break;
// 32 bit atomic functions
#ifdef ATOMIC_FUNCS_ARE_SYSCALLS
case SYSCALL_ATOMIC_SET:
*call_ret = _user_atomic_set((vint32 *)arg0, (int32)arg1);
break;
case SYSCALL_ATOMIC_TEST_AND_SET:
*call_ret = _user_atomic_test_and_set((vint32 *)arg0, (int32)arg1, (int32)arg2);
break;
case SYSCALL_ATOMIC_ADD:
*call_ret = _user_atomic_add((vint32 *)arg0, (int32)arg1);
break;
case SYSCALL_ATOMIC_AND:
*call_ret = _user_atomic_and((vint32 *)arg0, (int32)arg1);
break;
case SYSCALL_ATOMIC_OR:
*call_ret = _user_atomic_or((vint32 *)arg0, (int32)arg1);
break;
case SYSCALL_ATOMIC_GET:
*call_ret = _user_atomic_get((vint32 *)arg0);
break;
#endif
// 64 bit atomic functions
#ifdef ATOMIC64_FUNCS_ARE_SYSCALLS
case SYSCALL_ATOMIC_SET64:
*call_ret = _user_atomic_set64((vint64 *)arg0, INT32TOINT64(arg1, arg2));
break;
case SYSCALL_ATOMIC_TEST_AND_SET64:
*call_ret = _user_atomic_test_and_set64((vint64 *)arg0, INT32TOINT64(arg1, arg2), INT32TOINT64(arg3, arg4));
break;
case SYSCALL_ATOMIC_ADD64:
*call_ret = _user_atomic_add64((vint64 *)arg0, INT32TOINT64(arg1, arg2));
break;
case SYSCALL_ATOMIC_AND64:
*call_ret = _user_atomic_and64((vint64 *)arg0, INT32TOINT64(arg1, arg2));
break;
case SYSCALL_ATOMIC_OR64:
*call_ret = _user_atomic_or64((vint64 *)arg0, INT32TOINT64(arg1, arg2));
break;
case SYSCALL_ATOMIC_GET64:
*call_ret = _user_atomic_get64((vint64 *)arg0);
break;
#endif
// the cases are auto-generated
#include "syscall_dispatcher.h"
default:
*call_ret = -1;

View File

@ -1,5 +1,7 @@
SubDir OBOS_TOP src kernel libroot os ;
SubDirHdrs [ FCurrentObjectsDir ] ;
KernelMergeObject os_main.o :
<$(SOURCE_GRIST)>area.c
<$(SOURCE_GRIST)>atomic.c
@ -8,7 +10,7 @@ KernelMergeObject os_main.o :
<$(SOURCE_GRIST)>fs_attr.c
<$(SOURCE_GRIST)>fs_index.c
<$(SOURCE_GRIST)>fs_info.c
<$(SOURCE_GRIST)>fs_query.c
<$(SOURCE_GRIST)>fs_query.cpp
<$(SOURCE_GRIST)>image.c
<$(SOURCE_GRIST)>parsedate.cpp
<$(SOURCE_GRIST)>port.c
@ -22,6 +24,9 @@ KernelMergeObject os_main.o :
-fPIC -DPIC
;
# We need to specify the dependency on the generated syscalls file explicitly.
Depends [ FGristFiles syscalls.o ] : <syscalls>syscalls.S.inc ;
MergeObjectFromObjects kernel_os_main.o :
<$(SOURCE_GRIST)>driver_settings.o
;

View File

@ -23,172 +23,5 @@
# include "arch/m68k/syscalls.inc"
#endif
/* ToDo: we should do something about this file; either machine generate it */
/* or make it more intelligent... it's really boring to maintain this one. */
SYSCALL0(_kern_null, 0)
/* VFS calls */
SYSCALL4(_kern_mount, 1)
SYSCALL1(_kern_unmount, 2)
SYSCALL2(_kern_read_fs_info, 66)
SYSCALL3(_kern_write_fs_info, 67)
SYSCALL1(_kern_next_device, 68)
SYSCALL0(_kern_sync, 3)
SYSCALL5(_kern_dir_node_ref_to_path, 142)
SYSCALL2(_kern_open, 4)
SYSCALL5(_kern_open_entry_ref, 81)
SYSCALL1(_kern_close, 5)
SYSCALL1(_kern_fsync, 6)
SYSCALL5(_kern_read, 7)
SYSCALL5(_kern_write, 8)
SYSCALL4(_kern_seek, 9)
SYSCALL1(_kern_open_dir, 77)
SYSCALL4(_kern_open_dir_entry_ref, 82)
SYSCALL3(_kern_open_dir_node_ref, 83)
SYSCALL2(_kern_create_dir, 78)
SYSCALL5(_kern_create_dir_entry_ref, 85)
SYSCALL1(_kern_remove_dir, 93)
SYSCALL3(_kern_create_symlink, 86)
SYSCALL2(_kern_create_link, 92)
SYSCALL3(_kern_read_link, 87)
SYSCALL4(_kern_read_dir, 75)
SYSCALL1(_kern_rewind_dir, 76)
SYSCALL4(_kern_ioctl, 10)
SYSCALL3(_kern_create, 11)
SYSCALL6(_kern_create_entry_ref, 84)
SYSCALL1(_kern_unlink, 12)
SYSCALL2(_kern_rename, 13)
SYSCALL2(_kern_access, 73);
SYSCALL3(_kern_read_stat, 74)
SYSCALL4(_kern_write_stat, 100)
SYSCALL4(_kern_read_path_stat, 14)
SYSCALL5(_kern_write_path_stat, 15)
SYSCALL2(_kern_getcwd, 41)
SYSCALL2(_kern_setcwd, 42)
SYSCALL1(_kern_dup, 61)
SYSCALL2(_kern_dup2, 62)
SYSCALL7(_kern_select, 112)
SYSCALL4(_kern_poll, 113)
/* VFS attribute calls */
SYSCALL2(_kern_open_attr_dir, 97)
SYSCALL4(_kern_create_attr, 98)
SYSCALL3(_kern_open_attr, 99)
SYSCALL2(_kern_remove_attr, 101)
SYSCALL4(_kern_rename_attr, 102)
/* VFS index calls */
SYSCALL1(_kern_open_index_dir, 106)
SYSCALL4(_kern_create_index, 107)
SYSCALL3(_kern_read_index_stat, 108)
SYSCALL2(_kern_remove_index, 109)
/* semaphore calls */
SYSCALL2(sys_create_sem, 18)
SYSCALL1(sys_delete_sem, 19)
SYSCALL1(sys_acquire_sem, 20)
SYSCALL4(sys_acquire_sem_etc, 21)
SYSCALL1(sys_release_sem, 22)
SYSCALL3(sys_release_sem_etc, 23)
SYSCALL2(sys_sem_get_count, 57)
SYSCALL3(sys_get_sem_info, 58)
SYSCALL4(sys_get_next_sem_info, 59)
SYSCALL2(sys_set_sem_owner, 60)
/* thread/team calls */
SYSCALL1(_kern_find_thread, 24)
SYSCALL5(_kern_spawn_thread, 35)
SYSCALL1(_kern_kill_thread, 36)
SYSCALL1(_kern_suspend_thread, 37)
SYSCALL1(_kern_resume_thread, 38)
SYSCALL2(_kern_rename_thread, 141)
SYSCALL4(_kern_snooze_etc, 17)
SYSCALL4(_kern_send_data, 94)
SYSCALL3(_kern_receive_data, 95)
SYSCALL1(_kern_has_data, 96)
SYSCALL2(_kern_wait_for_thread, 27)
SYSCALL2(_kern_wait_for_team, 28)
SYSCALL2(_kern_get_thread_info, 88)
SYSCALL3(_kern_get_next_thread_info, 89)
SYSCALL2(_kern_set_thread_priority, 121)
SYSCALL1(_kern_exit, 25)
SYSCALL5(_kern_create_team, 26)
SYSCALL2(_kern_get_team_info, 90)
SYSCALL2(_kern_get_next_team_info, 91)
SYSCALL1(_kern_kill_team, 39)
SYSCALL0(_kern_get_current_team, 40)
/* image calls */
SYSCALL2(_kern_register_image, 114)
SYSCALL1(_kern_unregister_image, 115)
SYSCALL3(_kern_get_image_info, 116)
SYSCALL4(_kern_get_next_image_info, 117)
/* node monitor calls */
SYSCALL6(_kern_start_watching, 118)
SYSCALL6(_kern_stop_watching, 119)
SYSCALL2(_kern_stop_notifying, 120)
/* time calls */
SYSCALL1(_kern_set_real_time_clock, 138)
/* VM calls */
SYSCALL6(_kern_create_area, 29)
SYSCALL5(_kern_clone_area, 30)
SYSCALL9(sys_vm_map_file, 31)
SYSCALL1(_kern_delete_area, 32)
SYSCALL2(_kern_get_area_info, 33)
SYSCALL1(_kern_find_area, 34)
SYSCALL3(_kern_get_next_area_info, 122)
SYSCALL2(_kern_set_area_protection, 123)
SYSCALL2(_kern_resize_area, 124)
SYSCALL1(_kern_area_for, 125)
/* port syscalls */
SYSCALL2(sys_port_create, 43)
SYSCALL1(sys_port_close, 44)
SYSCALL1(sys_port_delete, 45)
SYSCALL1(sys_port_find, 46)
SYSCALL2(sys_port_get_info, 47)
SYSCALL3(sys_port_get_next_port_info, 48)
SYSCALL1(sys_port_buffer_size, 49)
SYSCALL4(sys_port_buffer_size_etc, 50)
SYSCALL1(sys_port_count, 51)
SYSCALL4(sys_port_read, 52)
SYSCALL7(sys_port_read_etc, 53)
SYSCALL2(sys_port_set_owner, 54)
SYSCALL4(sys_port_write, 55)
SYSCALL7(sys_port_write_etc, 56)
/* misc calls */
SYSCALL0(_kern_system_time, 16)
//SYSCALL2(sys_team_get_table, 63)
SYSCALL2(_kern_getrlimit, 64)
SYSCALL2(_kern_setrlimit, 65)
SYSCALL6(sys_sysctl, 71)
//SYSCALL3(sys_socket, 72)
SYSCALL3(sys_setenv, 79)
SYSCALL2(sys_getenv, 80)
SYSCALL1(_kern_debug_output, 139)
SYSCALL2(_kern_get_system_info, 140);
/* atomic calls */
SYSCALL2(_kern_atomic_set, 126)
SYSCALL3(_kern_atomic_test_and_set, 127)
SYSCALL2(_kern_atomic_add, 128)
SYSCALL2(_kern_atomic_and, 129)
SYSCALL2(_kern_atomic_or, 130)
SYSCALL1(_kern_atomic_get, 131)
SYSCALL3(_kern_atomic_set64, 132)
SYSCALL5(_kern_atomic_test_and_set64, 133)
SYSCALL3(_kern_atomic_add64, 134)
SYSCALL3(_kern_atomic_and64, 135)
SYSCALL3(_kern_atomic_or64, 136)
SYSCALL1(_kern_atomic_get64, 137)
/* Signal handling calls */
SYSCALL0(sys_return_from_signal, 103)
SYSCALL3(sys_sigaction, 105)
SYSCALL2(sys_send_signal, 110)
SYSCALL3(sys_set_alarm, 111)
/* include the auto-generated file syscalls file */
#include "syscalls.S.inc"