diff options
| author | TheSoeren <imhofabian@gmail.com> | 2024-09-29 09:26:17 +0000 |
|---|---|---|
| committer | TheSoeren <imhofabian@gmail.com> | 2024-09-29 09:26:17 +0000 |
| commit | 8f91d0ef50e01440f7e6e9f4afa5887f6afefea1 (patch) | |
| tree | 179cd8a2809cde6d2add5d7f9f940686a575a527 /arch/x86_64/src/kernel/main.cpp | |
| parent | eeee7967c17704fee443a3b5b02d53a580f18b73 (diff) | |
| download | teachos-8f91d0ef50e01440f7e6e9f4afa5887f6afefea1.tar.xz teachos-8f91d0ef50e01440f7e6e9f4afa5887f6afefea1.zip | |
read basic mem info
Diffstat (limited to 'arch/x86_64/src/kernel/main.cpp')
| -rw-r--r-- | arch/x86_64/src/kernel/main.cpp | 34 |
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 |
