zephyr/drivers/cache/cache_handlers.c
Carlo Caione 4806e1087e cache: Fix cache API calling from userspace
When a cache API function is called from userspace, this results on
ARM64 in an OOPS (bad syscall error). This is due to at least two
different factors:

- the location of the cache handlers is preventing the linker to
  actually find the handlers
- specifically for ARM64 and ARC some cache handling functions are not
  implemented (when userspace is not used the compiler simply optimizes
  out these calls)

Fix the problem by:

- moving the userspace cache handlers to a their logical and proper
  location (in the drivers directory)
- adding the missing handlers for ARM64 and ARC

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2022-08-23 10:14:17 +02:00

37 lines
904 B
C

/*
* Copyright (c) 2020 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/cache.h>
#include <zephyr/syscall_handler.h>
static inline int z_vrfy_sys_cache_data_all(int op)
{
return z_impl_sys_cache_data_all(op);
}
#include <syscalls/sys_cache_data_all_mrsh.c>
static inline int z_vrfy_sys_cache_data_range(void *addr, size_t size, int op)
{
Z_OOPS(Z_SYSCALL_MEMORY_WRITE(addr, size));
return z_impl_sys_cache_data_range(addr, size, op);
}
#include <syscalls/sys_cache_data_range_mrsh.c>
static inline int z_vrfy_sys_cache_instr_all(int op)
{
return z_impl_sys_cache_instr_all(op);
}
#include <syscalls/sys_cache_instr_all_mrsh.c>
static inline int z_vrfy_sys_cache_instr_range(void *addr, size_t size, int op)
{
Z_OOPS(Z_SYSCALL_MEMORY_WRITE(addr, size));
return z_impl_sys_cache_instr_range(addr, size, op);
}
#include <syscalls/sys_cache_instr_range_mrsh.c>