2004-10-29 05:37:37 +04:00
|
|
|
/* Big case statement for dispatching syscalls */
|
2002-07-09 16:24:59 +04:00
|
|
|
/*
|
|
|
|
** Copyright 2001, Travis Geiselbrecht. All rights reserved.
|
|
|
|
** Distributed under the terms of the NewOS License.
|
|
|
|
*/
|
|
|
|
|
2003-10-28 16:29:29 +03:00
|
|
|
|
2002-07-09 16:24:59 +04:00
|
|
|
#include <kernel.h>
|
|
|
|
#include <ksyscalls.h>
|
2002-10-23 21:31:10 +04:00
|
|
|
#include <syscalls.h>
|
2002-07-09 16:24:59 +04:00
|
|
|
#include <int.h>
|
|
|
|
#include <arch/int.h>
|
|
|
|
#include <debug.h>
|
|
|
|
#include <vfs.h>
|
|
|
|
#include <thread.h>
|
2002-07-12 14:15:18 +04:00
|
|
|
#include <OS.h>
|
2002-07-09 16:24:59 +04:00
|
|
|
#include <sem.h>
|
|
|
|
#include <port.h>
|
|
|
|
#include <cpu.h>
|
2004-09-10 19:20:37 +04:00
|
|
|
#include <arch_config.h>
|
2004-10-29 05:37:37 +04:00
|
|
|
#include <disk_device_manager/ddm_userland_interface.h>
|
2003-09-21 00:47:27 +04:00
|
|
|
#include <sys/resource.h>
|
2002-07-09 16:24:59 +04:00
|
|
|
#include <fd.h>
|
2003-01-18 17:18:04 +03:00
|
|
|
#include <fs/node_monitor.h>
|
2002-07-09 16:24:59 +04:00
|
|
|
#include <sysctl.h>
|
|
|
|
#include <ksocket.h>
|
2003-01-12 19:27:03 +03:00
|
|
|
#include <kimage.h>
|
2003-01-27 06:07:30 +03:00
|
|
|
#include <ksignal.h>
|
2003-10-28 16:29:29 +03:00
|
|
|
#include <real_time_clock.h>
|
2004-04-22 02:57:39 +04:00
|
|
|
#include <system_info.h>
|
2002-07-09 16:24:59 +04:00
|
|
|
#include <sys/ioccom.h>
|
2002-07-12 02:21:56 +04:00
|
|
|
#include <sys/socket.h>
|
2003-08-22 03:02:00 +04:00
|
|
|
#include <user_atomic.h>
|
2004-11-27 15:35:30 +03:00
|
|
|
#include <safemode.h>
|
2003-08-20 06:34:42 +04:00
|
|
|
|
2003-10-28 16:29:29 +03:00
|
|
|
|
2004-08-29 00:34:43 +04:00
|
|
|
static inline
|
2003-10-28 16:29:29 +03:00
|
|
|
int
|
2004-08-29 00:34:43 +04:00
|
|
|
_user_null()
|
2002-07-09 16:24:59 +04:00
|
|
|
{
|
2004-08-29 00:34:43 +04:00
|
|
|
return 0;
|
|
|
|
}
|
2003-08-20 06:34:42 +04:00
|
|
|
|
2004-10-01 03:25:55 +04:00
|
|
|
// map to the arch specific call
|
2004-08-29 00:34:43 +04:00
|
|
|
static inline
|
2004-10-01 03:25:55 +04:00
|
|
|
int64
|
2004-08-29 00:34:43 +04:00
|
|
|
_user_restore_signal_frame()
|
|
|
|
{
|
|
|
|
return arch_restore_signal_frame();
|
|
|
|
}
|
2003-01-18 17:18:04 +03:00
|
|
|
|
2004-08-29 00:34:43 +04:00
|
|
|
// 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);
|
|
|
|
}
|
2003-10-28 16:29:29 +03:00
|
|
|
|
2004-08-29 00:34:43 +04:00
|
|
|
// TODO: Replace when networking code is added to the build.
|
|
|
|
static inline
|
|
|
|
int
|
|
|
|
_user_socket(int family, int type, int proto)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
2003-10-28 16:29:29 +03:00
|
|
|
|
2003-11-14 01:08:30 +03:00
|
|
|
|
2004-08-29 00:34:43 +04:00
|
|
|
int
|
|
|
|
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);
|
2003-08-22 03:02:00 +04:00
|
|
|
|
2004-08-29 00:34:43 +04:00
|
|
|
switch (call_num) {
|
|
|
|
// the cases are auto-generated
|
|
|
|
#include "syscall_dispatcher.h"
|
2003-08-22 03:02:00 +04:00
|
|
|
|
2002-07-09 16:24:59 +04:00
|
|
|
default:
|
|
|
|
*call_ret = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// dprintf("syscall_dispatcher: done with syscall 0x%x\n", call_num);
|
|
|
|
|
2002-07-19 20:07:36 +04:00
|
|
|
return B_INVOKE_SCHEDULER;
|
2002-07-09 16:24:59 +04:00
|
|
|
}
|