Zephyr API Documentation  3.6.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
loader.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_LOADER_H
8#define ZEPHYR_LLEXT_LOADER_H
9
10#include <zephyr/llext/elf.h>
11#include <stddef.h>
12
13#ifdef __cplusplus
14extern "C" {
15#endif
16
24#include <zephyr/llext/llext.h>
25
43 int (*read)(struct llext_loader *ldr, void *out, size_t len);
44
57 int (*seek)(struct llext_loader *ldr, size_t pos);
58
69 void *(*peek)(struct llext_loader *ldr, size_t pos);
70
73
75 elf_ehdr_t hdr;
77 enum llext_mem *sect_map;
78 uint32_t sect_cnt;
80};
81
82static inline int llext_read(struct llext_loader *l, void *buf, size_t len)
83{
84 return l->read(l, buf, len);
85}
86
87static inline int llext_seek(struct llext_loader *l, size_t pos)
88{
89 return l->seek(l, pos);
90}
91
92static inline void *llext_peek(struct llext_loader *l, size_t pos)
93{
94 if (l->peek) {
95 return l->peek(l, pos);
96 }
97
98 return NULL;
99}
100
105#ifdef __cplusplus
106}
107#endif
108
109#endif /* ZEPHYR_LLEXT_LOADER_H */
static void * llext_peek(struct llext_loader *l, size_t pos)
Definition: loader.h:92
static int llext_seek(struct llext_loader *l, size_t pos)
Definition: loader.h:87
static int llext_read(struct llext_loader *l, void *buf, size_t len)
Definition: loader.h:82
llext_mem
List of ELF regions that are stored or referenced in the llext.
Definition: llext.h:34
@ LLEXT_MEM_COUNT
Definition: llext.h:44
__UINT32_TYPE__ uint32_t
Definition: stdint.h:90
ELF Header(64-bit)
Definition: elf.h:104
Section Header(64-bit)
Definition: elf.h:176
Linkable loadable extension loader context.
Definition: loader.h:29
int(* seek)(struct llext_loader *ldr, size_t pos)
Seek to a new absolute location.
Definition: loader.h:57
int(* read)(struct llext_loader *ldr, void *out, size_t len)
Read (copy) from the loader.
Definition: loader.h:43
size_t prog_data_size
Total calculated .data size for relocatable extensions.
Definition: loader.h:72
void *(* peek)(struct llext_loader *ldr, size_t pos)
Peek at an absolute location.
Definition: loader.h:69