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.cpp34
1 files changed, 26 insertions, 8 deletions
diff --git a/arch/x86_64/src/kernel/main.cpp b/arch/x86_64/src/kernel/main.cpp
index e77818e..8ca577a 100644
--- a/arch/x86_64/src/kernel/main.cpp
+++ b/arch/x86_64/src/kernel/main.cpp
@@ -10,16 +10,34 @@ namespace teachos::arch::kernel
{
using namespace video::vga;
- auto t = arch::boot::multiboot_information_pointer;
- // auto multiboot_tag = (struct multiboot_tag *) ((uint8_t) t + 8);
- // for (auto tag = multiboot_tag; tag->type != )
-
- if (t == 300)
- {
- }
-
text::clear();
text::cursor(false);
text::write("TeachOS is starting up...", text::common_attributes::green_on_black);
+
+ auto mip = arch::boot::multiboot_information_pointer;
+
+ // Address of the first multiboot tag
+ auto multiboot_tag = (struct multiboot_tag *)((uint8_t *)mip + 8);
+
+ /*
+ * Loop over the multiboot2 tags to access the information needed.
+ * Tags are defined in the header.
+ */
+ for (auto tag = multiboot_tag; tag->type != MULTIBOOT_TAG_TYPE_END;
+ tag = (struct multiboot_tag *)((uint8_t *)tag + ((tag->size + 7) & ~7)))
+ {
+ switch (tag->type)
+ {
+ case MULTIBOOT_TAG_TYPE_BASIC_MEMINFO:
+ uint32_t size = tag->size;
+ uint32_t mem_lower = *(uint32_t *)(&size + 32);
+ uint32_t mem_upper = *(uint32_t *)(&size + 64);
+ if (mem_lower > mem_upper)
+ {
+ }
+ text::write("BUFFER IS HERE", text::common_attributes::green_on_black);
+ break;
+ }
+ }
}
} // namespace teachos::arch::kernel