aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64/src/memory/multiboot/reader.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86_64/src/memory/multiboot/reader.cpp')
-rw-r--r--arch/x86_64/src/memory/multiboot/reader.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/arch/x86_64/src/memory/multiboot/reader.cpp b/arch/x86_64/src/memory/multiboot/reader.cpp
index 7bdf48f..4576085 100644
--- a/arch/x86_64/src/memory/multiboot/reader.cpp
+++ b/arch/x86_64/src/memory/multiboot/reader.cpp
@@ -56,16 +56,16 @@ namespace teachos::arch::memory::multiboot
elf_section_header_container sections{begin, end};
- auto const elf_section_with_lowest_virtual_address =
+ 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.virtual_address < b.virtual_address;
+ return a.physical_address < b.physical_address;
});
- auto const elf_section_with_highest_virtual_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_virtual_address_end = a.virtual_address + a.section_size;
- auto b_virtual_address_end = b.virtual_address + b.section_size;
- return a_virtual_address_end < b_virtual_address_end;
+ 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) {
@@ -81,11 +81,11 @@ namespace teachos::arch::memory::multiboot
dynamic_section_count <= 1U,
"[Multiboot Reader] ELF Specifications allows only (1) or less dynamic sections, but got more");
- auto const lowest_elf_section = *elf_section_with_lowest_virtual_address;
- kernel_start = lowest_elf_section.virtual_address;
+ auto const lowest_elf_section = *elf_section_with_lowest_physical_address;
+ kernel_start = lowest_elf_section.physical_address;
- auto const highest_elf_section = *elf_section_with_highest_virtual_address;
- kernel_end = highest_elf_section.virtual_address + highest_elf_section.section_size;
+ auto const highest_elf_section = *elf_section_with_highest_physical_address;
+ kernel_end = highest_elf_section.physical_address + highest_elf_section.section_size;
return sections;
}