aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64/src/kernel
diff options
context:
space:
mode:
authorMatteo Gmür <matteo.gmuer1@ost.ch>2024-10-02 13:32:28 +0000
committerMatteo Gmür <matteo.gmuer1@ost.ch>2024-10-02 13:32:28 +0000
commitc2c7ad21fdd42111180d317ef50b15b7404769d1 (patch)
tree315bb0cef4ab930532ceae28d1d4edf253b9dccc /arch/x86_64/src/kernel
parent32add45849744dc976c7af6ec24f985bbace47d3 (diff)
downloadteachos-c2c7ad21fdd42111180d317ef50b15b7404769d1.tar.xz
teachos-c2c7ad21fdd42111180d317ef50b15b7404769d1.zip
Improve naming, add enums and move into namespace
Diffstat (limited to 'arch/x86_64/src/kernel')
-rw-r--r--arch/x86_64/src/kernel/main.cpp33
1 files changed, 19 insertions, 14 deletions
diff --git a/arch/x86_64/src/kernel/main.cpp b/arch/x86_64/src/kernel/main.cpp
index da496a6..cffbfb8 100644
--- a/arch/x86_64/src/kernel/main.cpp
+++ b/arch/x86_64/src/kernel/main.cpp
@@ -1,12 +1,12 @@
#include "arch/kernel/main.hpp"
-#include "arch/boot/multiboot.hpp"
#include "arch/boot/pointers.hpp"
+#include "arch/memory/multiboot.hpp"
#include "arch/video/vga/text.hpp"
namespace teachos::arch::kernel
{
- auto print_mem_info(basic_memory_info * mem_info) -> void
+ auto print_mem_info(arch::memory::MemoryInfo * mem_info) -> void
{
using namespace video::vga;
@@ -19,7 +19,7 @@ namespace teachos::arch::kernel
text::write_number(mem_upper, text::common_attributes::green_on_black);
}
- auto print_memory_map(memory_map_info * mminfo) -> void
+ auto print_memory_map(arch::memory::MemoryMap * mminfo) -> void
{
using namespace video::vga;
@@ -45,14 +45,15 @@ namespace teachos::arch::kernel
text::write_number(entry->length, text::common_attributes::green_on_black);
text::write("Type: ", text::common_attributes::green_on_black);
- text::write_number(entry->type, text::common_attributes::green_on_black);
+ text::write_number(static_cast<std::underlying_type<arch::memory::MemoryAreaType>::type>(entry->type),
+ text::common_attributes::green_on_black);
text::write("Reserved: ", text::common_attributes::green_on_black);
text::write_number(entry->reserved, text::common_attributes::green_on_black);
}
}
- auto print_elf_sections(elf_symbols_section * symbol) -> void
+ auto print_elf_sections(arch::memory::elf_symbols_section * symbol) -> void
{
using namespace video::vga;
@@ -122,7 +123,8 @@ namespace teachos::arch::kernel
text::cursor(false);
text::write("TeachOS is starting up...", text::common_attributes::green_on_black);
- multiboot_info * multiboot_information_pointer = (multiboot_info *)arch::boot::multiboot_information_pointer;
+ arch::memory::MultibootInfo * multiboot_information_pointer =
+ (arch::memory::MultibootInfo *)arch::boot::multiboot_information_pointer;
auto multiboot_tag = &(multiboot_information_pointer->tags);
text::write("Multiboot Start: ", text::common_attributes::green_on_black);
@@ -138,19 +140,22 @@ namespace teachos::arch::kernel
*
* The increment part aligns the size to an 8-byte address.
*/
- for (auto tag = multiboot_tag; tag->type != MULTIBOOT_TAG_TYPE_END;
- tag = (struct multiboot_tag *)(((uint8_t *)tag) + ((tag->size + 7) & ~7)))
+ for (auto tag = multiboot_tag; tag->type != arch::memory::MultibootTagType::END;
+ tag = (arch::memory::MultibootTag *)(((uint8_t *)tag) + ((tag->size + 7) & ~7)))
{
switch (tag->type)
{
- case MULTIBOOT_TAG_TYPE_BASIC_MEMINFO:
- print_mem_info((struct basic_memory_info *)tag);
+ case arch::memory::MultibootTagType::BASIC_MEMORY_INFO:
+ print_mem_info((arch::memory::MemoryInfo *)tag);
break;
- case MULTIBOOT_TAG_TYPE_ELF_SECTIONS:
- print_elf_sections((struct elf_symbols_section *)tag);
+ case arch::memory::MultibootTagType::ELF_SECTIONS:
+ print_elf_sections((arch::memory::elf_symbols_section *)tag);
break;
- case MULTIBOOT_TAG_TYPE_MMAP:
- print_memory_map((struct memory_map_info *)tag);
+ case arch::memory::MultibootTagType::MEMORY_MAP:
+ print_memory_map((arch::memory::MemoryMap *)tag);
+ break;
+ default:
+ // All other cases are not important and can be ignored
break;
}
}