diff --git a/include/syscall.h b/include/syscall.h index 3f24f622309..871c2440673 100644 --- a/include/syscall.h +++ b/include/syscall.h @@ -14,6 +14,7 @@ #ifndef _ASMLANGUAGE #include +#include #ifdef __cplusplus extern "C" { @@ -110,6 +111,7 @@ static ALWAYS_INLINE bool z_syscall_trap(void) * * @return true if the CPU is currently running with user permissions */ +__pinned_func static inline bool k_is_user_context(void) { #ifdef CONFIG_USERSPACE diff --git a/scripts/gen_syscalls.py b/scripts/gen_syscalls.py index d08a0d74ae8..f060034952f 100755 --- a/scripts/gen_syscalls.py +++ b/scripts/gen_syscalls.py @@ -80,6 +80,8 @@ syscall_template = """ #include #include +#include + #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) #pragma GCC diagnostic push #endif @@ -174,6 +176,8 @@ def wrapper_defs(func_name, func_type, args): decl_arglist = ", ".join([" ".join(argrec) for argrec in args]) or "void" wrap = "extern %s z_impl_%s(%s);\n" % (func_type, func_name, decl_arglist) + wrap += "\n" + wrap += "__pinned_func\n" wrap += "static inline %s %s(%s)\n" % (func_type, func_name, decl_arglist) wrap += "{\n" wrap += "#ifdef CONFIG_USERSPACE\n"