Zephyr API Documentation
4.1.99
A Scalable Open Source RTOS
4.1.99
Toggle main menu visibility
Main Page
Related Pages
Topics
Data Structures
Data Structures
Data Structure Index
Data Fields
All
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
Variables
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerations
Enumerator
Files
File List
Globals
All
$
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Functions
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Variables
$
a
b
c
d
f
g
h
i
k
l
m
n
o
p
r
s
t
u
x
z
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Enumerations
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
z
Enumerator
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
z
Macros
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
▼
Zephyr API Documentation
►
Introduction
Deprecated List
►
Topics
►
Data Structures
▼
Files
▼
File List
►
doc
►
kernel
►
lib
►
subsys
▼
zephyr
►
acpi
►
app_memory
►
arch
►
audio
►
bluetooth
►
canbus
►
console
►
crypto
►
data
►
debug
►
devicetree
►
dfu
►
display
►
drivers
►
dsp
►
dt-bindings
►
fs
►
input
►
internal
►
ipc
►
kernel
►
linker
►
llext
►
logging
►
lorawan
►
math
►
mem_mgmt
►
mgmt
►
misc
►
modbus
►
modem
►
multi_heap
►
net
►
platform
►
pm
►
pmci
►
portability
►
posix
►
psa
►
random
►
retention
►
rtio
►
sd
►
sensing
►
settings
►
shell
►
sip_svc
►
stats
►
storage
►
sys
►
task_wdt
►
timing
►
toolchain
►
tracing
►
usb
►
usb_c
►
xen
►
zbus
►
zvfs
►
bindesc.h
►
cache.h
►
device.h
►
devicetree.h
►
fatal.h
►
fatal_types.h
►
init.h
►
irq.h
►
irq_multilevel.h
►
irq_nextlevel.h
►
irq_offload.h
►
kernel.h
kernel_includes.h
►
kernel_structs.h
►
kernel_version.h
►
net_buf.h
►
shared_irq.h
►
smf.h
►
spinlock.h
►
sw_isr_table.h
►
sys_clock.h
►
syscall.h
►
toolchain.h
types.h
►
Globals
•
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Modules
Pages
Loading...
Searching...
No Matches
syscall.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2017, Intel Corporation
3
*
4
* SPDX-License-Identifier: Apache-2.0
5
*/
6
7
8
#ifndef ZEPHYR_INCLUDE_SYSCALL_H_
9
#define ZEPHYR_INCLUDE_SYSCALL_H_
10
11
#include <zephyr/syscall_list.h>
12
#include <
zephyr/arch/syscall.h
>
13
#include <
stdbool.h
>
14
15
#ifndef _ASMLANGUAGE
16
#include <
zephyr/types.h
>
17
#include <
zephyr/linker/sections.h
>
18
19
#ifdef __cplusplus
20
extern
"C"
{
21
#endif
22
23
/*
24
* System Call Declaration macros
25
*
26
* These macros are used in public header files to declare system calls.
27
* They generate inline functions which have different implementations
28
* depending on the current compilation context:
29
*
30
* - Kernel-only code, or CONFIG_USERSPACE disabled, these inlines will
31
* directly call the implementation
32
* - User-only code, these inlines will marshal parameters and elevate
33
* privileges
34
* - Mixed or indeterminate code, these inlines will do a runtime check
35
* to determine what course of action is needed.
36
*
37
* All system calls require a verifier function and an implementation
38
* function. These must follow a naming convention. For a system call
39
* named k_foo():
40
*
41
* - The handler function will be named z_vrfy_k_foo(). Handler
42
* functions have the same type signature as the wrapped call,
43
* verify arguments passed up from userspace, and call the
44
* implementation function. See documentation for that typedef for
45
* more information. - The implementation function will be named
46
* z_impl_k_foo(). This is the actual implementation of the system
47
* call.
48
*/
49
86
typedef
uintptr_t
(*_k_syscall_handler_t)(
uintptr_t
arg1,
uintptr_t
arg2,
87
uintptr_t
arg3,
uintptr_t
arg4,
88
uintptr_t
arg5,
uintptr_t
arg6,
89
void
*ssf);
90
91
/* True if a syscall function must trap to the kernel, usually a
92
* compile-time decision.
93
*/
94
static
ALWAYS_INLINE
bool
z_syscall_trap(
void
)
95
{
96
bool
ret =
false
;
97
#ifdef CONFIG_USERSPACE
98
#if defined(__ZEPHYR_SUPERVISOR__)
99
ret =
false
;
100
#elif defined(__ZEPHYR_USER__)
101
ret =
true
;
102
#else
103
ret =
arch_is_user_context
();
104
#endif
105
#endif
106
return
ret;
107
}
108
114
__pinned_func
115
static
inline
bool
k_is_user_context
(
void
)
116
{
117
#ifdef CONFIG_USERSPACE
118
return
arch_is_user_context
();
119
#else
120
return
false
;
121
#endif
122
}
115
static
inline
bool
k_is_user_context
(
void
) {
…
}
123
124
#ifdef __cplusplus
125
}
126
#endif
127
128
#endif
/* _ASMLANGUAGE */
129
130
#endif
arch_is_user_context
static bool arch_is_user_context(void)
Definition
syscall.h:181
syscall.h
ALWAYS_INLINE
#define ALWAYS_INLINE
Definition
common.h:161
types.h
sections.h
Definitions of various linker Sections.
stdbool.h
uintptr_t
__UINTPTR_TYPE__ uintptr_t
Definition
stdint.h:105
k_is_user_context
static __pinned_func bool k_is_user_context(void)
Indicate whether the CPU is currently in user mode.
Definition
syscall.h:115
zephyr
syscall.h
Generated on Tue Apr 29 2025 09:06:04 for Zephyr API Documentation by
1.12.0