From c7f1dd153ef439c94d04c99019038375468fc79a Mon Sep 17 00:00:00 2001 From: Xander Date: Sat, 15 Jul 2023 19:27:19 +0200 Subject: Elf section headers implementation --- kernel/bootinfo/multiboot.sats | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) (limited to 'kernel/bootinfo/multiboot.sats') diff --git a/kernel/bootinfo/multiboot.sats b/kernel/bootinfo/multiboot.sats index 0507241..0d89040 100644 --- a/kernel/bootinfo/multiboot.sats +++ b/kernel/bootinfo/multiboot.sats @@ -7,7 +7,7 @@ typedef tag_t = @{ typedef memory_entry_t = @{ base_addr = Ptr1, // Start of physical address length = uint64, // Size of memory region in bytes - type = uint, // Variety of address range represented. 1: available RAM, 3: usable memory holding ACPI information, + type = uint, // Variety of address range represented. 1: available RAM, 3: usable memory holding ACPI information, // 4: reserved memory (preserved on hibernation), Other: reserved area reserved = uint 0 } @@ -19,10 +19,31 @@ typedef memory_map_t = @{ entries = ptr // Pointer to entries } +typedef elf_tag_t = @{ + tag = tag_t, + num = uint, // Number of elf entries + entsize = uint 64, // Size of entry + shndx = uint, // Index of the section containing the string table + headers = ptr // Pointer to entries +} + +typedef elf64_shdr_t = @{ + name = uint, // Index into seaction header string table + type = uint, // Type of section (code,data,symbol,...) + flags = uint64, // Attributes and flags of section + addr = Ptr1, // (virtual) address of section in memory + offset = Ptr1, // Offset of seaction in ELF executable file + size = size_t, // Size of section in bytes + link = uint, // Extra informaion + info = uint, // Additional information + addralign = uint64, // Alignment requirements of section's address + entsize = size_t 64 // Size of each entry in section +} typedef boot_info_t = @{ - total_size = uint, // total size of boot information - memory_map = memory_map_t + total_size = uint, // total size of boot information + memory_map = memory_map_t, + elf_tag = elf_tag_t } vtypedef bootptr = [l : agz] (boot_info_t@l , boot_info_t@l - void | ptr l) @@ -32,3 +53,7 @@ fun boot_info_init(p : Ptr1) : bootptr fn get_memory_mappings_n (p : !bootptr) : [n:nat] size_t n fn get_memory_mapping (p : !bootptr, n : size_t) : memory_entry_t fn print_memory_mappings (p : !bootptr) : void + +fn get_elf_headers_n (p : !bootptr) : [n:nat] size_t n +fn get_elf_header (p : !bootptr, n : size_t) : elf64_shdr_t +fn print_elf_headers (p : !bootptr) : void -- cgit v1.2.3