MOS Source Code
Loading...
Searching...
No Matches
ksyscall_entry.cpp
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-3.0-or-later
2
4
7
9#include <mos/syscall/table.h>
10#include <mos/types.hpp>
11#include <mos_stdio.hpp>
12
13reg_t ksyscall_enter(reg_t number, reg_t arg1, reg_t arg2, reg_t arg3, reg_t arg4, reg_t arg5, reg_t arg6)
14{
15 const pf_point_t ev = profile_enter();
16 const reg_t ret = dispatch_syscall(number, arg1, arg2, arg3, arg4, arg5, arg6);
17 profile_leave(ev, "syscall.%lu.%s", number, get_syscall_names(number));
18
19 if (IS_ERR_VALUE(ret))
20 {
21 // handle -EFAULT by sending SIGSEGV to the current thread
22 if (ret == (reg_t) -EFAULT)
24 }
25
26 MOS_ASSERT_X(current_thread->state == THREAD_STATE_RUNNING, "thread %pt is not in 'running' state", current_thread);
27 return ret;
28}
#define MOS_ASSERT_X(cond, msg,...)
Definition assert.hpp:15
should_inline reg_t dispatch_syscall(const reg_t number, reg_t arg1, reg_t arg2, reg_t arg3, reg_t arg4, reg_t arg5, reg_t arg6)
Definition dispatcher.h:23
long signal_send_to_thread(Thread *target, signal_t signal)
Send a signal to a thread.
Definition signal.cpp:87
reg_t ksyscall_enter(reg_t number, reg_t arg1, reg_t arg2, reg_t arg3, reg_t arg4, reg_t arg5, reg_t arg6)
#define IS_ERR_VALUE(x)
Definition mos_global.h:137
#define current_thread
Definition platform.hpp:32
@ THREAD_STATE_RUNNING
thread is currently running
Definition platform.hpp:69
#define profile_enter()
Definition profiling.hpp:33
u64 pf_point_t
Definition profiling.hpp:8
#define profile_leave(p,...)
Definition profiling.hpp:35
static const char * get_syscall_names(int nr)
Definition table.h:20
uintn reg_t
Definition types.h:47