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