summaryrefslogtreecommitdiff
path: root/api/lib
diff options
context:
space:
mode:
authorAda Christine <adachristine18@gmail.com>2025-01-23 00:24:57 +0000
committerAda Christine <adachristine18@gmail.com>2025-01-23 00:24:57 +0000
commitd855c0a219a180497c2e50f9bc19bfce69b937a6 (patch)
tree1ff8523d41b222fb356fb3404d2a53c26a7d6a3d /api/lib
parentedd52bd1464ee9ae4f0cdf7ff90a20ca175580fe (diff)
it printfs with the efi interface
Diffstat (limited to 'api/lib')
-rw-r--r--api/lib/elf.h30
1 files changed, 27 insertions, 3 deletions
diff --git a/api/lib/elf.h b/api/lib/elf.h
index 951fc25..ea0d6cc 100644
--- a/api/lib/elf.h
+++ b/api/lib/elf.h
@@ -5,13 +5,37 @@
#include <stdbool.h>
#include <stddef.h>
+#include <posix/sys/types.h>
+
#ifdef __x86_64__
# define elf_validate elf64_validate
# define elf_size elf64_size
#endif
-bool elf64_validate(Elf64_Ehdr *ehdr, unsigned type, unsigned machine);
-size_t elf64_size(Elf64_Ehdr *ehdr, Elf64_Phdr *phdr);
-void *elf64_dt_ptr(void *base, Elf64_Dyn *dyntab, unsigned long dt_type);
+struct linear_buffer
+{
+ char *base;
+ size_t length;
+};
+
+struct elf64_image
+{
+ struct linear_buffer buffer;
+ struct
+ {
+ Elf64_Ehdr *file;
+ Elf64_Phdr *segments;
+ Elf64_Shdr *sections;
+ }
+ headers;
+};
+
+bool elf64_validate(Elf64_Ehdr const *ehdr, unsigned type, unsigned machine);
+bool elf64_validate_fd(int fd, unsigned type, unsigned machine);
+size_t elf64_size(Elf64_Ehdr const *ehdr, Elf64_Phdr *phdr);
+size_t elf64_size_fd(int fd);
+ssize_t elf64_load_segments(int fd, size_t buffer_size, char buffer[buffer_size]);
+void *elf64_dt_ptr(char *base, Elf64_Dyn *dyntab, unsigned long dt_type);
uintptr_t elf64_dt_val(Elf64_Dyn *dyntab, unsigned long dt_type);
+struct elf64_image elf64_open(const char *path);