From d2aa4fbf948a56df5328e0f1b8ec3dfd52b16e13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matteo=20Gm=C3=BCr?= Date: Tue, 26 Nov 2024 09:49:06 +0000 Subject: Make bump allocator atomic and therefore thread safe --- arch/x86_64/src/kernel/main.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'arch/x86_64/src/kernel/main.cpp') diff --git a/arch/x86_64/src/kernel/main.cpp b/arch/x86_64/src/kernel/main.cpp index 13526f4..023327e 100644 --- a/arch/x86_64/src/kernel/main.cpp +++ b/arch/x86_64/src/kernel/main.cpp @@ -20,9 +20,10 @@ namespace teachos::arch::kernel 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) + auto test3 = *test2; + test3.kernel_end = 5000; + auto test4 = test3.kernel_end; + if (test || test2 || test3.kernel_end || test4) { video::vga::text::write("Kernel remapping successfull", video::vga::text::common_attributes::green_on_black); } @@ -31,7 +32,5 @@ namespace teachos::arch::kernel // 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 -- cgit v1.2.3