blob: 13526f40cbdf2b2cea5f981c87e141d75a2b460b (
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
|
#include "arch/kernel/main.hpp"
#include "arch/memory/heap/bump_allocator.hpp"
#include "arch/memory/heap/concept.hpp"
#include "arch/memory/main.hpp"
#include "arch/memory/multiboot/reader.hpp"
#include "arch/video/vga/text.hpp"
namespace teachos::arch::kernel
{
auto main() -> void
{
video::vga::text::clear();
video::vga::text::cursor(false);
video::vga::text::write("TeachOS is starting up...", video::vga::text::common_attributes::green_on_black);
memory::initialize_memory_management();
memory::heap::bump_allocator heap_allocator{memory::heap::HEAP_START,
memory::heap::HEAP_START + memory::heap::HEAP_SIZE};
auto test = heap_allocator.allocate(1024);
auto test2 = new (test) memory::multiboot::memory_information{};
test2->kernel_end = 5000;
auto test3 = test2->kernel_end;
if (test || test2 || test3)
{
video::vga::text::write("Kernel remapping successfull", video::vga::text::common_attributes::green_on_black);
}
// TODO: Why is identity mapping multiboot2 information structure with new kernel not required and
// allocator.allocate_frame still works?
// TODO: Fix unmapping old level 4 page table and turn it into guard page, use Stack Probes for stack allocation if
// possible.
// TODO: Align up and down for the bump allocator. https://os.phil-opp.com/kernel-heap/#a-bump-allocator
}
} // namespace teachos::arch::kernel
|