#include "arch/kernel/main.hpp" #include "arch/memory/heap/bump_allocator.hpp" #include "arch/memory/heap/concept.hpp" #include "arch/memory/heap/linked_list_allocator.hpp" #include "arch/memory/main.hpp" #include "arch/memory/multiboot/reader.hpp" #include "arch/video/vga/text.hpp" namespace teachos::arch::kernel { auto stack_overflow_test(int count) -> int { int test[5000] = {}; if (test[0] == 0xFFFF) { return count; } count = stack_overflow_test(count); return count++; } auto heap_test() -> void { memory::heap::linked_list_allocator kernel_heap(memory::heap::HEAP_START, memory::heap::HEAP_START + memory::heap::HEAP_SIZE); auto test2 = new memory::multiboot::memory_information{}; auto test4 = *test2; test4.kernel_end = 5000; auto test6 = test4.kernel_end; auto test8 = memory::multiboot::read_multiboot2(); if (test6 && test8.kernel_end) { video::vga::text::write("Heap test successful", video::vga::text::common_attributes::green_on_black); } test2->kernel_end = 2000; test2->kernel_start = 1000; test2->multiboot_start = 2000; delete test2; // auto test9 = heap_allocator.allocate(1024); // auto test10 = heap_allocator.allocate(1024); // auto test11 = heap_allocator.allocate(1024); // heap_allocator.deallocate(test9, 1024); // auto test12 = heap_allocator.allocate(1024); // auto test13 = heap_allocator.allocate(1024); // heap_allocator.deallocate(test11, 1024); // heap_allocator.deallocate(test10, 1024); // heap_allocator.deallocate(test13, 1024); // heap_allocator.deallocate(test12, 1024); } 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); video::vga::text::newline(); memory::initialize_memory_management(); // stack_overflow_test(0); heap_test(); } } // namespace teachos::arch::kernel