Zephyr API Documentation  3.5.0
A Scalable Open Source RTOS
3.5.0
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
llext.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2023 Intel Corporation
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#ifndef ZEPHYR_LLEXT_H
8#define ZEPHYR_LLEXT_H
9
10#include <zephyr/sys/slist.h>
11#include <zephyr/llext/elf.h>
12#include <zephyr/llext/symbol.h>
13#include <zephyr/llext/loader.h>
14#include <sys/types.h>
15
16#ifdef __cplusplus
17extern "C" {
18#endif
19
35
37};
38
42struct llext {
44 sys_snode_t _llext_list;
48 char name[16];
49
52
54 size_t mem_size;
55
58};
59
64
72struct llext *llext_by_name(const char *name);
73
89int llext_load(struct llext_loader *loader, const char *name, struct llext **ext);
90
96void llext_unload(struct llext *ext);
97
107const void * const llext_find_sym(const struct llext_symtable *sym_table, const char *sym_name);
108
121int llext_call_fn(struct llext *ext, const char *sym_name);
122
137
142#ifdef __cplusplus
143}
144#endif
145
146#endif /* ZEPHYR_LLEXT_H */
struct elf64_rela elf_rel_t
Machine sized relocation struct.
Definition: elf.h:438
sys_slist_t * llext_list(void)
List head of loaded extensions.
const void *const llext_find_sym(const struct llext_symtable *sym_table, const char *sym_name)
Find the address for an arbitrary symbol name.
void arch_elf_relocate(elf_rel_t *rel, uintptr_t opaddr, uintptr_t opval)
Architecture specific function for updating op codes given a relocation.
void llext_unload(struct llext *ext)
Unload an extension.
llext_mem
Enum of memory regions for lookup tables.
Definition: llext.h:30
int llext_load(struct llext_loader *loader, const char *name, struct llext **ext)
Load and link an extension.
struct llext * llext_by_name(const char *name)
Find an llext by name.
int llext_call_fn(struct llext *ext, const char *sym_name)
Call a function by name.
@ LLEXT_MEM_TEXT
Definition: llext.h:31
@ LLEXT_MEM_DATA
Definition: llext.h:32
@ LLEXT_MEM_BSS
Definition: llext.h:34
@ LLEXT_MEM_RODATA
Definition: llext.h:33
@ LLEXT_MEM_COUNT
Definition: llext.h:36
struct _slist sys_slist_t
Single-linked list structure.
Definition: slist.h:49
struct _snode sys_snode_t
Single-linked list node structure.
Definition: slist.h:39
__UINTPTR_TYPE__ uintptr_t
Definition: stdint.h:105
Linkable loadable extension loader context.
Definition: loader.h:48
A symbol table.
Definition: symbol.h:59
Linkable loadable extension.
Definition: llext.h:42
struct llext_symtable sym_tab
Exported symbols from the llext, may be linked against by other llext.
Definition: llext.h:57
char name[16]
Name of the llext.
Definition: llext.h:48
size_t mem_size
Total size of the llext memory usage.
Definition: llext.h:54
void * mem[LLEXT_MEM_COUNT]
Lookup table of llext memory regions.
Definition: llext.h:51