aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64/src/memory/multiboot
diff options
context:
space:
mode:
authorMatteo Gmür <matteo.gmuer1@ost.ch>2024-11-04 12:13:44 +0000
committerMatteo Gmür <matteo.gmuer1@ost.ch>2024-11-04 12:13:44 +0000
commit162bea11c7a4f1854cde53920b4c14b4eadf539d (patch)
tree602177115d3e88991882edf39564e844a20bb19a /arch/x86_64/src/memory/multiboot
parent95d8c279bf945c99ef207c12de3ab6a2bc14f380 (diff)
downloadteachos-162bea11c7a4f1854cde53920b4c14b4eadf539d.tar.xz
teachos-162bea11c7a4f1854cde53920b4c14b4eadf539d.zip
WIP attempt to fix crashes
Diffstat (limited to 'arch/x86_64/src/memory/multiboot')
-rw-r--r--arch/x86_64/src/memory/multiboot/reader.cpp25
1 files changed, 12 insertions, 13 deletions
diff --git a/arch/x86_64/src/memory/multiboot/reader.cpp b/arch/x86_64/src/memory/multiboot/reader.cpp
index 4576085..178cc45 100644
--- a/arch/x86_64/src/memory/multiboot/reader.cpp
+++ b/arch/x86_64/src/memory/multiboot/reader.cpp
@@ -51,28 +51,27 @@ namespace teachos::arch::memory::multiboot
auto const begin = elf_section_header_container::iterator{reinterpret_cast<elf_section_header *>(&symbol->end)};
auto const end = begin + symbol->number_of_sections;
- exception_handling::assert(begin->is_null(),
+ exception_handling::assert((*begin)->is_null(),
"[Multiboot Reader] Elf symbols section not starting with SHT_NULL section");
elf_section_header_container sections{begin, end};
- auto const elf_section_with_lowest_physical_address =
- std::ranges::min_element(sections, [](elf_section_header const & a, elf_section_header const & b) {
- return a.physical_address < b.physical_address;
- });
+ auto const elf_section_with_lowest_physical_address = std::ranges::min_element(
+ sections, [](auto const & a, auto const & b) { return a->physical_address < b->physical_address; });
auto const elf_section_with_highest_physical_address =
- std::ranges::max_element(sections, [](elf_section_header const & a, elf_section_header const & b) {
- auto a_physical_address_end = a.physical_address + a.section_size;
- auto b_physical_address_end = b.physical_address + b.section_size;
+ std::ranges::max_element(sections, [](auto const & a, auto const & b) {
+ auto a_physical_address_end = a->physical_address + a->section_size;
+ auto b_physical_address_end = b->physical_address + b->section_size;
return a_physical_address_end < b_physical_address_end;
});
- auto const symbol_table_section_count = std::ranges::count_if(sections, [](elf_section_header const & section) {
- return section.type == elf_section_type::DYNAMIC_SYMBOL_TABLE || section.type == elf_section_type::SYMBOL_TABLE;
+ auto const symbol_table_section_count = std::ranges::count_if(sections, [](auto const & section) {
+ return section->type == elf_section_type::DYNAMIC_SYMBOL_TABLE ||
+ section->type == elf_section_type::SYMBOL_TABLE;
});
auto const dynamic_section_count = std::ranges::count_if(
- sections, [](elf_section_header const & section) { return section.type == elf_section_type::DYNAMIC; });
+ sections, [](auto const & section) { return section->type == elf_section_type::DYNAMIC; });
exception_handling::assert(
symbol_table_section_count == 1U,
@@ -82,10 +81,10 @@ namespace teachos::arch::memory::multiboot
"[Multiboot Reader] ELF Specifications allows only (1) or less dynamic sections, but got more");
auto const lowest_elf_section = *elf_section_with_lowest_physical_address;
- kernel_start = lowest_elf_section.physical_address;
+ kernel_start = lowest_elf_section->physical_address;
auto const highest_elf_section = *elf_section_with_highest_physical_address;
- kernel_end = highest_elf_section.physical_address + highest_elf_section.section_size;
+ kernel_end = highest_elf_section->physical_address + highest_elf_section->section_size;
return sections;
}