Zephyr API Documentation  3.6.0
A Scalable Open Source RTOS
3.6.0
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
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
72 elf_ehdr_t hdr;
74 enum llext_mem *sect_map;
75 uint32_t sect_cnt;
77};
78
79static inline int llext_read(struct llext_loader *l, void *buf, size_t len)
80{
81 return l->read(l, buf, len);
82}
83
84static inline int llext_seek(struct llext_loader *l, size_t pos)
85{
86 return l->seek(l, pos);
87}
88
89static inline void *llext_peek(struct llext_loader *l, size_t pos)
90{
91 if (l->peek) {
92 return l->peek(l, pos);
93 }
94
95 return NULL;
96}
97
102#ifdef __cplusplus
103}
104#endif
105
106#endif /* ZEPHYR_LLEXT_LOADER_H */
static void * llext_peek(struct llext_loader *l, size_t pos)
Definition: loader.h:89
static int llext_seek(struct llext_loader *l, size_t pos)
Definition: loader.h:84
static int llext_read(struct llext_loader *l, void *buf, size_t len)
Definition: loader.h:79
llext_mem
List of ELF regions that are stored or referenced in the llext.
Definition: llext.h:31
@ LLEXT_MEM_COUNT
Definition: llext.h:41
__UINT32_TYPE__ uint32_t
Definition: stdint.h:90
ELF Header(64-bit)
Definition: elf.h:103
Section Header(64-bit)
Definition: elf.h:175
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
void *(* peek)(struct llext_loader *ldr, size_t pos)
Peek at an absolute location.
Definition: loader.h:69