aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64/src/kernel/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86_64/src/kernel/main.cpp')
-rw-r--r--arch/x86_64/src/kernel/main.cpp26
1 files changed, 12 insertions, 14 deletions
diff --git a/arch/x86_64/src/kernel/main.cpp b/arch/x86_64/src/kernel/main.cpp
index bdf530c..7e4a336 100644
--- a/arch/x86_64/src/kernel/main.cpp
+++ b/arch/x86_64/src/kernel/main.cpp
@@ -5,6 +5,8 @@
#include "arch/memory/multiboot.hpp"
#include "arch/video/vga/text.hpp"
+#include <algorithm>
+
namespace teachos::arch::kernel
{
auto assert(bool condition) -> void
@@ -63,7 +65,7 @@ namespace teachos::arch::kernel
for (auto section = begin; section != end; ++section)
{
- bool const writeable = section->flags.writeable();
+ bool const writable = section->flags.writable();
bool const occupies_memory = section->flags.occupies_memory();
bool const is_executable = section->flags.is_executable();
bool const contains_duplicate_data = section->flags.contains_duplicate_data();
@@ -79,7 +81,7 @@ namespace teachos::arch::kernel
bool const is_excluded_unless_referenced_or_allocated =
section->flags.is_excluded_unless_referenced_or_allocated();
- if (writeable && occupies_memory && is_executable && contains_duplicate_data && contains_strings &&
+ if (writable && occupies_memory && is_executable && contains_duplicate_data && contains_strings &&
section_header_info_is_section_header_table_index && preserve_ordering_after_combination &&
requires_special_os_processing && is_section_group_member && holds_thread_local_data && is_compressed &&
has_special_ordering_requirements && is_excluded_unless_referenced_or_allocated)
@@ -182,20 +184,16 @@ namespace teachos::arch::kernel
// Address of Frame: 0x203F00
auto allocator = arch::memory::area_frame_allocator(kernel_start, kernel_end, multiboot_start, multiboot_end,
memory_areas, area_count);
- auto allocated = allocator.allocate_frame();
// WATCH OUT: using optional::value() crashes the build... I think its because of missing exception handling
- if (allocated.has_value())
- {
- video::vga::text::write("Allocated Frame address: ", video::vga::text::common_attributes::green_on_black);
- video::vga::text::write_number(reinterpret_cast<uint64_t>(&allocated->frame_number),
- video::vga::text::common_attributes::green_on_black);
- video::vga::text::write("Allocated Frame number: ", video::vga::text::common_attributes::green_on_black);
- video::vga::text::write_number(allocated->frame_number, video::vga::text::common_attributes::green_on_black);
- }
- else
+ auto last_allocated = allocator.allocate_frame();
+ auto allocated = last_allocated;
+ do
{
- video::vga::text::write("NO VALUE", video::vga::text::common_attributes::green_on_black);
- }
+ last_allocated = allocated;
+ allocated = allocator.allocate_frame();
+ } while (allocated.has_value());
+ video::vga::text::write("Allocated Frames", video::vga::text::common_attributes::green_on_black);
+ video::vga::text::write_number(allocated->frame_number, video::vga::text::common_attributes::green_on_black);
}
} // namespace teachos::arch::kernel