kernel: Cmake: Add __ZEPHYR_SUPERVISOR__ macro for kernel files.

Normally a syscall would check the current privilege level and then
decide to go to _impl_<syscall> directly or go through a
_handler_<syscall>.
__ZEPHYR_SUPERVISOR__ is a compiler optimization flag which will
make all the system calls from the kernel files directly link
to the _impl_<syscall>. Thereby reducing the overhead of checking the
privileges.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
This commit is contained in:
Adithya Baglody 2018-03-28 15:16:48 +05:30 committed by Anas Nashif
commit 8618716c68

View file

@ -23,7 +23,16 @@ add_library(kernel
version.c
work_q.c
smp.c
)
)
# Kernel files has the macro __ZEPHYR_SUPERVISOR__ set so that it
# optimizes the code when userspace is enabled.
set_target_properties(
kernel
PROPERTIES
COMPILE_DEFINITIONS
__ZEPHYR_SUPERVISOR__
)
target_sources_ifdef(CONFIG_INT_LATENCY_BENCHMARK kernel PRIVATE int_latency_bench.c)
target_sources_ifdef(CONFIG_STACK_CANARIES kernel PRIVATE compiler_stack_protect.c)
@ -43,6 +52,7 @@ target_sources_ifdef(
userspace.c
)
add_dependencies(kernel offsets_h)
target_link_libraries(kernel zephyr_interface)