MOS Source Code
Loading...
Searching...
No Matches
ksyscall_entry.c
Go to the documentation of this file.
1
// SPDX-License-Identifier: GPL-3.0-or-later
2
3
#include "
mos/ksyscall_entry.h
"
4
5
#include "
mos/misc/profiling.h
"
6
#include "
mos/tasks/signal.h
"
7
8
#include <
mos/syscall/dispatcher.h
>
9
#include <
mos/syscall/table.h
>
10
#include <
mos/types.h
>
11
#include <
mos_stdio.h
>
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,
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"
, (
void
*)
current_thread
);
27
return
ret;
28
}
MOS_ASSERT_X
#define MOS_ASSERT_X(cond, msg,...)
Definition
assert.h: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_t *target, signal_t signal)
Send a signal to a thread.
Definition
signal.c:92
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.c:13
ksyscall_entry.h
IS_ERR_VALUE
#define IS_ERR_VALUE(x)
Definition
mos_global.h:126
mos_stdio.h
current_thread
#define current_thread
Definition
platform.h:30
THREAD_STATE_RUNNING
@ THREAD_STATE_RUNNING
thread is currently running
Definition
platform.h:64
profiling.h
profile_enter
#define profile_enter()
Definition
profiling.h:33
pf_point_t
u64 pf_point_t
Definition
profiling.h:8
profile_leave
#define profile_leave(p,...)
Definition
profiling.h:35
signal.h
table.h
syscall_names
static const char * syscall_names[]
Definition
table.h:20
types.h
reg_t
uintn reg_t
Definition
types.h:51
kernel
ksyscall_entry.c
Generated on Sun Sep 1 2024 18:22:52 for MOS Source Code by
1.12.0