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
3
#include "
mos/ksyscall_entry.hpp
"
4
5
#include "
mos/misc/profiling.hpp
"
6
#include "
mos/tasks/signal.hpp
"
7
8
#include <
mos/syscall/dispatcher.h
>
9
#include <
mos/syscall/table.h
>
10
#include <
mos/types.hpp
>
11
#include <
mos_stdio.hpp
>
12
13
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)
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)
23
signal_send_to_thread
(
current_thread
, SIGSEGV);
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
}
MOS_ASSERT_X
#define MOS_ASSERT_X(cond, msg,...)
Definition
assert.hpp:15
dispatcher.h
dispatch_syscall
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
signal_send_to_thread
long signal_send_to_thread(Thread *target, signal_t signal)
Send a signal to a thread.
Definition
signal.cpp:87
ksyscall_enter
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)
Definition
ksyscall_entry.cpp:13
ksyscall_entry.hpp
IS_ERR_VALUE
#define IS_ERR_VALUE(x)
Definition
mos_global.h:137
mos_stdio.hpp
current_thread
#define current_thread
Definition
platform.hpp:32
THREAD_STATE_RUNNING
@ THREAD_STATE_RUNNING
thread is currently running
Definition
platform.hpp:69
profiling.hpp
profile_enter
#define profile_enter()
Definition
profiling.hpp:33
pf_point_t
u64 pf_point_t
Definition
profiling.hpp:8
profile_leave
#define profile_leave(p,...)
Definition
profiling.hpp:35
signal.hpp
table.h
get_syscall_names
static const char * get_syscall_names(int nr)
Definition
table.h:20
reg_t
uintn reg_t
Definition
types.h:47
types.hpp
kernel
ksyscall_entry.cpp
Generated on Tue Feb 18 2025 16:41:40 for MOS Source Code by
1.13.2