llext: export some symbols
Export some symbols for loadable modules. Also add an EXPORT_SYSCALL() helper macro for exporting system calls by their official names. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
This commit is contained in:
parent
f98b8bb48f
commit
69cdc32892
|
@ -78,6 +78,16 @@ struct llext_symtable {
|
|||
.name = STRINGIFY(x), .addr = &x, \
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Export a system call to a table of symbols
|
||||
*
|
||||
* Takes a system call name and uses @a EXPORT_SYMBOL() to export the respective
|
||||
* function.
|
||||
*
|
||||
* @param x System call to export
|
||||
*/
|
||||
#define EXPORT_SYSCALL(x) EXPORT_SYMBOL(z_impl_ ## x)
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include <zephyr/tracing/tracing.h>
|
||||
#include <zephyr/sys/check.h>
|
||||
#include <zephyr/logging/log.h>
|
||||
#include <zephyr/llext/symbol.h>
|
||||
LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL);
|
||||
|
||||
/* We use a global spinlock here because some of the synchronization
|
||||
|
@ -195,6 +196,7 @@ int z_impl_k_mutex_lock(struct k_mutex *mutex, k_timeout_t timeout)
|
|||
|
||||
return -EAGAIN;
|
||||
}
|
||||
EXPORT_SYSCALL(k_mutex_lock);
|
||||
|
||||
#ifdef CONFIG_USERSPACE
|
||||
static inline int z_vrfy_k_mutex_lock(struct k_mutex *mutex,
|
||||
|
@ -280,6 +282,7 @@ k_mutex_unlock_return:
|
|||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYSCALL(k_mutex_unlock);
|
||||
|
||||
#ifdef CONFIG_USERSPACE
|
||||
static inline int z_vrfy_k_mutex_unlock(struct k_mutex *mutex)
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include <zephyr/random/random.h>
|
||||
#include <zephyr/sys/atomic.h>
|
||||
#include <zephyr/logging/log.h>
|
||||
#include <zephyr/llext/symbol.h>
|
||||
#include <zephyr/sys/iterable_sections.h>
|
||||
|
||||
LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL);
|
||||
|
@ -141,6 +142,7 @@ bool k_is_in_isr(void)
|
|||
{
|
||||
return arch_is_in_isr();
|
||||
}
|
||||
EXPORT_SYMBOL(k_is_in_isr);
|
||||
|
||||
/*
|
||||
* This function tags the current thread as essential to system operation.
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include <zephyr/sys/__assert.h>
|
||||
#include <zephyr/sys/printk.h>
|
||||
#include <zephyr/kernel.h>
|
||||
|
||||
#include <zephyr/llext/symbol.h>
|
||||
|
||||
/**
|
||||
* @brief Assert Action Handler
|
||||
|
@ -42,6 +42,7 @@ __weak void assert_post_action(const char *file, unsigned int line)
|
|||
|
||||
k_panic();
|
||||
}
|
||||
EXPORT_SYMBOL(assert_post_action);
|
||||
|
||||
void assert_print(const char *fmt, ...)
|
||||
{
|
||||
|
@ -53,3 +54,4 @@ void assert_print(const char *fmt, ...)
|
|||
|
||||
va_end(ap);
|
||||
}
|
||||
EXPORT_SYMBOL(assert_print);
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
if(CONFIG_LLEXT)
|
||||
zephyr_library()
|
||||
zephyr_library_sources(llext.c)
|
||||
zephyr_library_sources(buf_loader.c)
|
||||
zephyr_library_sources(llext.c llext_export.c buf_loader.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_LLEXT_SHELL shell.c)
|
||||
endif()
|
||||
|
|
17
subsys/llext/llext_export.c
Normal file
17
subsys/llext/llext_export.c
Normal file
|
@ -0,0 +1,17 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <zephyr/llext/symbol.h>
|
||||
|
||||
EXPORT_SYMBOL(strcpy);
|
||||
EXPORT_SYMBOL(strncpy);
|
||||
EXPORT_SYMBOL(strlen);
|
||||
EXPORT_SYMBOL(strcmp);
|
||||
EXPORT_SYMBOL(strncmp);
|
||||
EXPORT_SYMBOL(memcmp);
|
||||
EXPORT_SYMBOL(memcpy);
|
||||
EXPORT_SYMBOL(memset);
|
|
@ -10,6 +10,7 @@
|
|||
#include <zephyr/logging/log_frontend.h>
|
||||
#include <zephyr/logging/log_backend.h>
|
||||
#include <zephyr/logging/log.h>
|
||||
#include <zephyr/llext/symbol.h>
|
||||
LOG_MODULE_DECLARE(log);
|
||||
|
||||
BUILD_ASSERT(sizeof(struct log_msg_desc) == sizeof(uint32_t),
|
||||
|
@ -270,6 +271,7 @@ void z_impl_z_log_msg_static_create(const void *source,
|
|||
|
||||
z_log_msg_finalize(msg, source, out_desc, data);
|
||||
}
|
||||
EXPORT_SYSCALL(z_log_msg_static_create);
|
||||
|
||||
#ifdef CONFIG_USERSPACE
|
||||
static inline void z_vrfy_z_log_msg_static_create(const void *source,
|
||||
|
|
Loading…
Reference in a new issue