blob: 8ca577a5236b9855264a9fb0cf2f0c946769d183 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
#include "arch/kernel/main.hpp"
#include "arch/boot/multiboot.hpp"
#include "arch/boot/pointers.hpp"
#include "arch/video/vga/text.hpp"
namespace teachos::arch::kernel
{
auto main() -> void
{
using namespace video::vga;
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
|