From 553f3a824511bb8107982b2b2737f5b1dff59855 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matteo=20Gm=C3=BCr?= Date: Sun, 13 Oct 2024 08:28:30 +0000 Subject: Add missing cpp files to cmake and fix elf alignment issues --- arch/x86_64/src/kernel/main.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'arch/x86_64/src/kernel/main.cpp') diff --git a/arch/x86_64/src/kernel/main.cpp b/arch/x86_64/src/kernel/main.cpp index 40b2fe5..01c955b 100644 --- a/arch/x86_64/src/kernel/main.cpp +++ b/arch/x86_64/src/kernel/main.cpp @@ -28,6 +28,7 @@ namespace teachos::arch::kernel auto print_memory_map(arch::memory::memory_map * mminfo) -> void { + // TODO: Probably same issue as elf sections because the values are kind of weird as well auto expected_entry_size = mminfo->entry_size; constexpr auto actual_entry_size = sizeof(arch::memory::memory_area); assert(expected_entry_size == actual_entry_size); @@ -45,23 +46,20 @@ namespace teachos::arch::kernel auto print_elf_sections(arch::memory::elf_symbols_section * symbol) -> void { + // TODO: Check if sectiosn now actually match the elf file 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 expected_total_size = symbol->tag.size; auto actual_total_entry_size = actual_entry_size * symbol->number_of_sections; - constexpr auto actual_total_section_size = - sizeof(arch::memory::elf_symbols_section) - actual_entry_size - sizeof(uint32_t); + constexpr auto actual_total_section_size = sizeof(arch::memory::elf_symbols_section) - sizeof(uint32_t); auto actual_total_size = actual_total_entry_size + actual_total_section_size; assert(expected_total_size == actual_total_size); - auto begin = &symbol->sections; + auto begin = reinterpret_cast(&symbol->end); auto end = begin + symbol->number_of_sections; - // TODO: Last value is completly wrong, should show 0 but shows huge value for size of entries in the table of the - // SHT_NULL elf section entry. Memory around value also make no sense and look even worse? But according to api - // value should be zero :( - // assert(begin->is_null()); + assert(begin->is_null()); std::size_t symbol_table_section_count = 0U; std::size_t dynamic_section_count = 0U; @@ -80,9 +78,8 @@ namespace teachos::arch::kernel video::vga::text::write("Looping Code section", video::vga::text::common_attributes::green_on_black); } - // TODO: Contains two symbol tables and 4 dynamic sections, that is definetly wrong, perhaps same reason as above? assert(symbol_table_section_count == 1U); - assert(dynamic_section_count == 1U); + assert(dynamic_section_count <= 1U); } auto main() -> void -- cgit v1.2.3