diff options
| author | Matteo Gmür <matteo.gmuer1@ost.ch> | 2024-10-06 13:40:24 +0000 |
|---|---|---|
| committer | Matteo Gmür <matteo.gmuer1@ost.ch> | 2024-10-06 13:40:24 +0000 |
| commit | 78153377d8a964d6b7290d966e5c1d30369abc2c (patch) | |
| tree | ee7c4ba6103e75c832a61eb064203ade7ae574de | |
| parent | 951b314b655781dc59aee24cf952d03bf3b3ee83 (diff) | |
| download | teachos-78153377d8a964d6b7290d966e5c1d30369abc2c.tar.xz teachos-78153377d8a964d6b7290d966e5c1d30369abc2c.zip | |
Improve naming
| -rw-r--r-- | arch/x86_64/include/arch/memory/multiboot.hpp | 48 | ||||
| -rw-r--r-- | arch/x86_64/src/kernel/main.cpp | 4 |
2 files changed, 27 insertions, 25 deletions
diff --git a/arch/x86_64/include/arch/memory/multiboot.hpp b/arch/x86_64/include/arch/memory/multiboot.hpp index f1f0613..37b10f0 100644 --- a/arch/x86_64/include/arch/memory/multiboot.hpp +++ b/arch/x86_64/include/arch/memory/multiboot.hpp @@ -43,14 +43,6 @@ namespace teachos::arch::memory uint32_t size; }; - struct memory_info - { - uint32_t type; - uint32_t size; - uint32_t mem_lower; - uint32_t mem_upper; - }; - struct multi_boot_info { uint32_t total_size; @@ -62,6 +54,13 @@ namespace teachos::arch::memory alignas(8) struct multi_boot_tag tags; }; + struct memory_info + { + multi_boot_tag tag; + uint32_t mem_lower; + uint32_t mem_upper; + }; + enum class memory_area_type : uint32_t { AVAILABLE = 1, @@ -73,8 +72,8 @@ namespace teachos::arch::memory struct memory_area { - uint64_t base_addr; - uint64_t length; + uint64_t base_address; + uint64_t area_length; alignas(8) memory_area_type type; }; @@ -157,18 +156,21 @@ namespace teachos::arch::memory std::bitset<64U> flags; }; + /** + * https://docs.oracle.com/cd/E19455-01/806-3773/elf-2/index.html + */ struct elf_section_header { - uint32_t sh_name; /* Section name (string tbl index) */ - elf_section_type sh_type; /* Section type */ - elf_section_flags sh_flags; /* Section flags */ - uint64_t sh_addr; /* Section virtual addr at execution */ - uint64_t sh_offset; /* Section file offset */ - uint64_t sh_size; /* Section size in bytes */ - uint32_t sh_link; /* Link to another section */ - uint32_t sh_info; /* Additional section information */ - uint64_t sh_addralign; /* Section alignment */ - uint64_t sh_entsize; /* Entry size if section holds table */ + uint32_t name_table_index; + elf_section_type type; + elf_section_flags flags; + uint64_t virtual_address; + uint64_t file_offset; + uint64_t section_size; + uint32_t other_section; + uint32_t additional_information; + uint64_t address_alignment; + uint64_t fixed_table_entry_size; }; /** @@ -177,9 +179,9 @@ namespace teachos::arch::memory struct elf_symbols_section { multi_boot_tag tag; - uint32_t num; - uint32_t entsize; - uint32_t shndx; + uint32_t number_of_sections; + uint32_t entry_size; + uint32_t section_index; alignas(8) struct elf_section_header sections; }; } // namespace teachos::arch::memory diff --git a/arch/x86_64/src/kernel/main.cpp b/arch/x86_64/src/kernel/main.cpp index 481264c..636ddf2 100644 --- a/arch/x86_64/src/kernel/main.cpp +++ b/arch/x86_64/src/kernel/main.cpp @@ -40,12 +40,12 @@ namespace teachos::arch::kernel auto print_elf_sections(arch::memory::elf_symbols_section * symbol) -> void { - auto expected_entry_size = symbol->entsize; + auto expected_entry_size = symbol->entry_size; constexpr auto actual_entry_size = sizeof(arch::memory::elf_section_header); assert(expected_entry_size == actual_entry_size); auto begin = &symbol->sections; - auto end = begin + symbol->num; + auto end = begin + symbol->number_of_sections; for (auto section = begin; section != end; ++section) { video::vga::text::write("Looping Code section", video::vga::text::common_attributes::green_on_black); |
