Skip to content

Commit

Permalink
build: namespace generated syscalls files into zephyr/
Browse files Browse the repository at this point in the history
Namespace the generated syscall files in into the
`zephyr/` folder. Updated in-tree sources that use these
syscall files accordingly.

Signed-off-by: Yong Cong Sin <[email protected]>
  • Loading branch information
ycsin committed Oct 17, 2023
1 parent 464659c commit d0ab838
Show file tree
Hide file tree
Showing 195 changed files with 593 additions and 582 deletions.
17 changes: 14 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,7 @@ add_custom_target(${SYSCALL_LIST_H_TARGET} DEPENDS ${syscall_list_h} ${picolibc_
set_property(TARGET ${SYSCALL_LIST_H_TARGET}
APPEND PROPERTY
ADDITIONAL_CLEAN_FILES
${CMAKE_CURRENT_BINARY_DIR}/include/generated/syscalls
${CMAKE_CURRENT_BINARY_DIR}/include/generated/zephyr/syscalls
)

add_custom_target(${PARSE_SYSCALLS_TARGET}
Expand All @@ -784,18 +784,29 @@ if(CONFIG_TIMEOUT_64BIT)
set(SYSCALL_SPLIT_TIMEOUT_ARG --split-type k_timeout_t --split-type k_ticks_t)
endif()

# percepio/TraceRecorder/kernelports/Zephyr/scripts/tz_parse_syscalls.py hardcodes the path
# to the `syscall_list.h`, make a copy of the generated file so that percepio is able to build
if(CONFIG_LEGACY_GENERATED_INCLUDE_PATH)
set(LEGACY_SYSCALL_LIST_H_ARGS
${CMAKE_COMMAND} -E copy
${syscall_list_h}
${CMAKE_CURRENT_BINARY_DIR}/include/generated/syscall_list.h)
endif()

add_custom_command(OUTPUT include/generated/syscall_dispatch.c ${syscall_list_h}
# Also, some files are written to include/generated/syscalls/
# Also, some files are written to include/generated/zephyr/syscalls/
COMMAND
${PYTHON_EXECUTABLE}
${ZEPHYR_BASE}/scripts/build/gen_syscalls.py
--json-file ${syscalls_json} # Read this file
--base-output include/generated/syscalls # Write to this dir
--base-output include/generated/zephyr/syscalls # Write to this dir
--syscall-dispatch include/generated/syscall_dispatch.c # Write this file
--syscall-list ${syscall_list_h}
$<$<BOOL:${CONFIG_USERSPACE}>:--gen-mrsh-files>
${SYSCALL_LONG_REGISTERS_ARG}
${SYSCALL_SPLIT_TIMEOUT_ARG}
COMMAND
${LEGACY_SYSCALL_LIST_H_ARGS}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS ${PARSE_SYSCALLS_TARGET}
)
Expand Down
2 changes: 1 addition & 1 deletion arch/riscv/core/fatal.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,6 @@ static void z_vrfy_user_fault(unsigned int reason)
z_impl_user_fault(reason);
}

#include <syscalls/user_fault_mrsh.c>
#include <zephyr/syscalls/user_fault_mrsh.c>

#endif /* CONFIG_USERSPACE */
4 changes: 2 additions & 2 deletions doc/kernel/drivers/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ A device-specific API definition typically looks like this:
__syscall int specific_from_user(const struct device *dev, int bar);
/* Only needed when extensions include syscalls */
#include <syscalls/specific.h>
#include <zephyr/syscalls/specific.h>
A driver implementing extensions to the subsystem will define the real
implementation of both the subsystem API and the specific APIs:
Expand Down Expand Up @@ -243,7 +243,7 @@ implementation of both the subsystem API and the specific APIs:
return z_impl_specific_do_that(dev, bar)
}
#include <syscalls/specific_from_user_mrsh.c>
#include <zephyr/syscalls/specific_from_user_mrsh.c>
#endif /* CONFIG_USERSPACE */
Expand Down
6 changes: 3 additions & 3 deletions doc/kernel/usermode/syscalls.rst
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ bottom of ``include/sensor.h``:

.. code-block:: c
#include <syscalls/sensor.h>
#include <zephyr/syscalls/sensor.h>
C prototype functions must be declared in one of the directories
listed in the CMake variable ``SYSCALL_INCLUDE_DIRS``. This list
Expand Down Expand Up @@ -172,7 +172,7 @@ The body of the API is created in the generated system header. Using the
example of :c:func:`k_sem_init()`, this API is declared in
``include/kernel.h``. At the bottom of ``include/kernel.h`` is::

#include <syscalls/kernel.h>
#include <zephyr/syscalls/kernel.h>

Inside this header is the body of :c:func:`k_sem_init()`::

Expand Down Expand Up @@ -360,7 +360,7 @@ For example:
Z_OOPS(Z_SYSCALL_OBJ(sem, K_OBJ_SEM));
return z_impl_k_sem_take(sem, timeout);
}
#include <syscalls/k_sem_take_mrsh.c>
#include <zephyr/syscalls/k_sem_take_mrsh.c>
Verification Memory Access Policies
Expand Down
6 changes: 3 additions & 3 deletions drivers/adc/adc_handlers.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ static inline int z_vrfy_adc_channel_setup(const struct device *dev,
return z_impl_adc_channel_setup((const struct device *)dev,
&channel_cfg);
}
#include <syscalls/adc_channel_setup_mrsh.c>
#include <zephyr/syscalls/adc_channel_setup_mrsh.c>

static bool copy_sequence(struct adc_sequence *dst,
struct adc_sequence_options *options,
Expand Down Expand Up @@ -66,7 +66,7 @@ static inline int z_vrfy_adc_read(const struct device *dev,

return z_impl_adc_read((const struct device *)dev, &sequence);
}
#include <syscalls/adc_read_mrsh.c>
#include <zephyr/syscalls/adc_read_mrsh.c>

#ifdef CONFIG_ADC_ASYNC
static inline int z_vrfy_adc_read_async(const struct device *dev,
Expand All @@ -89,5 +89,5 @@ static inline int z_vrfy_adc_read_async(const struct device *dev,
return z_impl_adc_read_async((const struct device *)dev, &sequence,
(struct k_poll_signal *)async);
}
#include <syscalls/adc_read_async_mrsh.c>
#include <zephyr/syscalls/adc_read_async_mrsh.c>
#endif /* CONFIG_ADC_ASYNC */
38 changes: 19 additions & 19 deletions drivers/auxdisplay/auxdisplay_handlers.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,37 +12,37 @@ static inline int z_vrfy_auxdisplay_display_on(const struct device *dev)
Z_OOPS(Z_SYSCALL_OBJ(dev, K_OBJ_DRIVER_AUXDISPLAY));
return z_impl_auxdisplay_display_on(dev);
}
#include <syscalls/auxdisplay_display_on_mrsh.c>
#include <zephyr/syscalls/auxdisplay_display_on_mrsh.c>

static inline int z_vrfy_auxdisplay_display_off(const struct device *dev)
{
Z_OOPS(Z_SYSCALL_OBJ(dev, K_OBJ_DRIVER_AUXDISPLAY));
return z_impl_auxdisplay_display_off(dev);
}
#include <syscalls/auxdisplay_display_off_mrsh.c>
#include <zephyr/syscalls/auxdisplay_display_off_mrsh.c>

static inline int z_vrfy_auxdisplay_cursor_set_enabled(const struct device *dev, bool enabled)
{
Z_OOPS(Z_SYSCALL_OBJ(dev, K_OBJ_DRIVER_AUXDISPLAY));
return z_impl_auxdisplay_cursor_set_enabled(dev, enabled);
}
#include <syscalls/auxdisplay_cursor_set_enabled_mrsh.c>
#include <zephyr/syscalls/auxdisplay_cursor_set_enabled_mrsh.c>

static inline int z_vrfy_auxdisplay_position_blinking_set_enabled(const struct device *dev,
bool enabled)
{
Z_OOPS(Z_SYSCALL_OBJ(dev, K_OBJ_DRIVER_AUXDISPLAY));
return z_impl_auxdisplay_position_blinking_set_enabled(dev, enabled);
}
#include <syscalls/auxdisplay_position_blinking_set_enabled_mrsh.c>
#include <zephyr/syscalls/auxdisplay_position_blinking_set_enabled_mrsh.c>

static inline int z_vrfy_auxdisplay_cursor_shift_set(const struct device *dev, uint8_t direction,
bool display_shift)
{
Z_OOPS(Z_SYSCALL_OBJ(dev, K_OBJ_DRIVER_AUXDISPLAY));
return z_impl_auxdisplay_cursor_shift_set(dev, direction, display_shift);
}
#include <syscalls/auxdisplay_cursor_shift_set_mrsh.c>
#include <zephyr/syscalls/auxdisplay_cursor_shift_set_mrsh.c>

static inline int z_vrfy_auxdisplay_cursor_position_set(const struct device *dev,
enum auxdisplay_position type,
Expand All @@ -51,15 +51,15 @@ static inline int z_vrfy_auxdisplay_cursor_position_set(const struct device *dev
Z_OOPS(Z_SYSCALL_OBJ(dev, K_OBJ_DRIVER_AUXDISPLAY));
return z_impl_auxdisplay_cursor_position_set(dev, type, x, y);
}
#include <syscalls/auxdisplay_cursor_position_set_mrsh.c>
#include <zephyr/syscalls/auxdisplay_cursor_position_set_mrsh.c>

static inline int z_vrfy_auxdisplay_cursor_position_get(const struct device *dev, int16_t *x,
int16_t *y)
{
Z_OOPS(Z_SYSCALL_OBJ(dev, K_OBJ_DRIVER_AUXDISPLAY));
return z_impl_auxdisplay_cursor_position_get(dev, x, y);
}
#include <syscalls/auxdisplay_cursor_position_get_mrsh.c>
#include <zephyr/syscalls/auxdisplay_cursor_position_get_mrsh.c>

static inline int z_vrfy_auxdisplay_display_position_set(const struct device *dev,
enum auxdisplay_position type,
Expand All @@ -68,90 +68,90 @@ static inline int z_vrfy_auxdisplay_display_position_set(const struct device *de
Z_OOPS(Z_SYSCALL_OBJ(dev, K_OBJ_DRIVER_AUXDISPLAY));
return z_impl_auxdisplay_display_position_set(dev, type, x, y);
}
#include <syscalls/auxdisplay_display_position_set_mrsh.c>
#include <zephyr/syscalls/auxdisplay_display_position_set_mrsh.c>

static inline int z_vrfy_auxdisplay_display_position_get(const struct device *dev, int16_t *x,
int16_t *y)
{
Z_OOPS(Z_SYSCALL_OBJ(dev, K_OBJ_DRIVER_AUXDISPLAY));
return z_impl_auxdisplay_display_position_get(dev, x, y);
}
#include <syscalls/auxdisplay_display_position_get_mrsh.c>
#include <zephyr/syscalls/auxdisplay_display_position_get_mrsh.c>

static inline int z_vrfy_auxdisplay_capabilities_get(const struct device *dev,
struct auxdisplay_capabilities *capabilities)
{
Z_OOPS(Z_SYSCALL_OBJ(dev, K_OBJ_DRIVER_AUXDISPLAY));
return z_impl_auxdisplay_capabilities_get(dev, capabilities);
}
#include <syscalls/auxdisplay_capabilities_get_mrsh.c>
#include <zephyr/syscalls/auxdisplay_capabilities_get_mrsh.c>

static inline int z_vrfy_auxdisplay_clear(const struct device *dev)
{
Z_OOPS(Z_SYSCALL_OBJ(dev, K_OBJ_DRIVER_AUXDISPLAY));
return z_impl_auxdisplay_clear(dev);
}
#include <syscalls/auxdisplay_clear_mrsh.c>
#include <zephyr/syscalls/auxdisplay_clear_mrsh.c>

static inline int z_vrfy_auxdisplay_brightness_get(const struct device *dev,
uint8_t *brightness)
{
Z_OOPS(Z_SYSCALL_OBJ(dev, K_OBJ_DRIVER_AUXDISPLAY));
return z_impl_auxdisplay_brightness_get(dev, brightness);
}
#include <syscalls/auxdisplay_brightness_get_mrsh.c>
#include <zephyr/syscalls/auxdisplay_brightness_get_mrsh.c>

static inline int z_vrfy_auxdisplay_brightness_set(const struct device *dev,
uint8_t brightness)
{
Z_OOPS(Z_SYSCALL_OBJ(dev, K_OBJ_DRIVER_AUXDISPLAY));
return z_impl_auxdisplay_brightness_set(dev, brightness);
}
#include <syscalls/auxdisplay_brightness_set_mrsh.c>
#include <zephyr/syscalls/auxdisplay_brightness_set_mrsh.c>

static inline int z_vrfy_auxdisplay_backlight_get(const struct device *dev,
uint8_t *backlight)
{
Z_OOPS(Z_SYSCALL_OBJ(dev, K_OBJ_DRIVER_AUXDISPLAY));
return z_impl_auxdisplay_backlight_get(dev, backlight);
}
#include <syscalls/auxdisplay_backlight_get_mrsh.c>
#include <zephyr/syscalls/auxdisplay_backlight_get_mrsh.c>

static inline int z_vrfy_auxdisplay_backlight_set(const struct device *dev,
uint8_t backlight)
{
Z_OOPS(Z_SYSCALL_OBJ(dev, K_OBJ_DRIVER_AUXDISPLAY));
return z_impl_auxdisplay_backlight_set(dev, backlight);
}
#include <syscalls/auxdisplay_backlight_set_mrsh.c>
#include <zephyr/syscalls/auxdisplay_backlight_set_mrsh.c>

static inline int z_vrfy_auxdisplay_is_busy(const struct device *dev)
{
Z_OOPS(Z_SYSCALL_OBJ(dev, K_OBJ_DRIVER_AUXDISPLAY));
return z_impl_auxdisplay_is_busy(dev);
}
#include <syscalls/auxdisplay_is_busy_mrsh.c>
#include <zephyr/syscalls/auxdisplay_is_busy_mrsh.c>

static inline int z_vrfy_auxdisplay_custom_character_set(const struct device *dev,
struct auxdisplay_character *character)
{
Z_OOPS(Z_SYSCALL_OBJ(dev, K_OBJ_DRIVER_AUXDISPLAY));
return z_impl_auxdisplay_custom_character_set(dev, character);
}
#include <syscalls/auxdisplay_custom_character_set_mrsh.c>
#include <zephyr/syscalls/auxdisplay_custom_character_set_mrsh.c>

static inline int z_vrfy_auxdisplay_write(const struct device *dev, const uint8_t *data,
uint16_t len)
{
Z_OOPS(Z_SYSCALL_OBJ(dev, K_OBJ_DRIVER_AUXDISPLAY));
return z_impl_auxdisplay_write(dev, data, len);
}
#include <syscalls/auxdisplay_write_mrsh.c>
#include <zephyr/syscalls/auxdisplay_write_mrsh.c>

static inline int z_vrfy_auxdisplay_custom_command(const struct device *dev,
struct auxdisplay_custom_data *data)
{
Z_OOPS(Z_SYSCALL_OBJ(dev, K_OBJ_DRIVER_AUXDISPLAY));
return z_impl_auxdisplay_custom_command(dev, data);
}
#include <syscalls/auxdisplay_custom_command_mrsh.c>
#include <zephyr/syscalls/auxdisplay_custom_command_mrsh.c>
12 changes: 6 additions & 6 deletions drivers/bbram/bbram_handlers.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,29 @@ static inline int z_vrfy_bbram_check_invalid(const struct device *dev)
Z_OOPS(Z_SYSCALL_OBJ(dev, K_OBJ_DRIVER_BBRAM));
return z_impl_bbram_check_invalid(dev);
}
#include <syscalls/bbram_check_invalid_mrsh.c>
#include <zephyr/syscalls/bbram_check_invalid_mrsh.c>

static inline int z_vrfy_bbram_check_standby_power(const struct device *dev)
{
Z_OOPS(Z_SYSCALL_OBJ(dev, K_OBJ_DRIVER_BBRAM));
return z_impl_bbram_check_standby_power(dev);
}
#include <syscalls/bbram_check_standby_power_mrsh.c>
#include <zephyr/syscalls/bbram_check_standby_power_mrsh.c>

static inline int z_vrfy_bbram_check_power(const struct device *dev)
{
Z_OOPS(Z_SYSCALL_OBJ(dev, K_OBJ_DRIVER_BBRAM));
return z_impl_bbram_check_power(dev);
}
#include <syscalls/bbram_check_power_mrsh.c>
#include <zephyr/syscalls/bbram_check_power_mrsh.c>

static inline int z_vrfy_bbram_get_size(const struct device *dev, size_t *size)
{
Z_OOPS(Z_SYSCALL_OBJ(dev, K_OBJ_DRIVER_BBRAM));
Z_OOPS(Z_SYSCALL_MEMORY_WRITE(size, sizeof(size_t)));
return z_impl_bbram_get_size(dev, size);
}
#include <syscalls/bbram_get_size_mrsh.c>
#include <zephyr/syscalls/bbram_get_size_mrsh.c>

static inline int z_vrfy_bbram_read(const struct device *dev, size_t offset,
size_t size, uint8_t *data)
Expand All @@ -43,7 +43,7 @@ static inline int z_vrfy_bbram_read(const struct device *dev, size_t offset,
Z_OOPS(Z_SYSCALL_MEMORY_WRITE(data, size));
return z_impl_bbram_read(dev, offset, size, data);
}
#include <syscalls/bbram_read_mrsh.c>
#include <zephyr/syscalls/bbram_read_mrsh.c>

static inline int z_vrfy_bbram_write(const struct device *dev, size_t offset,
size_t size, const uint8_t *data)
Expand All @@ -52,4 +52,4 @@ static inline int z_vrfy_bbram_write(const struct device *dev, size_t offset,
Z_OOPS(Z_SYSCALL_MEMORY_READ(data, size));
return z_impl_bbram_write(dev, offset, size, data);
}
#include <syscalls/bbram_write_mrsh.c>
#include <zephyr/syscalls/bbram_write_mrsh.c>
6 changes: 3 additions & 3 deletions drivers/cache/cache_handlers.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@ static inline int z_vrfy_sys_cache_data_flush_range(void *addr, size_t size)

return z_impl_sys_cache_data_flush_range(addr, size);
}
#include <syscalls/sys_cache_data_flush_range_mrsh.c>
#include <zephyr/syscalls/sys_cache_data_flush_range_mrsh.c>

static inline int z_vrfy_sys_cache_data_invd_range(void *addr, size_t size)
{
Z_OOPS(Z_SYSCALL_MEMORY_WRITE(addr, size));

return z_impl_sys_cache_data_invd_range(addr, size);
}
#include <syscalls/sys_cache_data_invd_range_mrsh.c>
#include <zephyr/syscalls/sys_cache_data_invd_range_mrsh.c>

static inline int z_vrfy_sys_cache_data_flush_and_invd_range(void *addr, size_t size)
{
Z_OOPS(Z_SYSCALL_MEMORY_WRITE(addr, size));

return z_impl_sys_cache_data_flush_and_invd_range(addr, size);
}
#include <syscalls/sys_cache_data_flush_and_invd_range_mrsh.c>
#include <zephyr/syscalls/sys_cache_data_flush_and_invd_range_mrsh.c>
Loading

0 comments on commit d0ab838

Please sign in to comment.