Files

39 lines
799 B
C
Raw Permalink Normal View History

2026-06-16 18:44:31 -05:00
#ifndef KELF_H
#define KELF_H
#include <stdint.h>
#define ELF_MAGIC 0x464C457F
#define PT_LOAD 1
typedef struct {
uint8_t e_ident[16];
uint16_t e_type;
uint16_t e_machine;
uint32_t e_version;
uint32_t e_entry;
uint32_t e_phoff;
uint32_t e_shoff;
uint32_t e_flags;
uint16_t e_ehsize;
uint16_t e_phentsize;
uint16_t e_phnum;
uint16_t e_shentsize;
uint16_t e_shnum;
uint16_t e_shstrndx;
} __attribute__((packed)) elf_header_t;
typedef struct {
uint32_t p_type;
uint32_t p_offset;
uint32_t p_vaddr;
uint32_t p_paddr;
uint32_t p_filesz;
uint32_t p_memsz;
uint32_t p_flags;
uint32_t p_align;
} __attribute__((packed)) elf_program_header_t;
uint32_t load_elf_program(const char* prgm);
2026-06-16 18:44:31 -05:00
#endif