From c4261dd2312f8c55dc795f2674a03d6341f821ea Mon Sep 17 00:00:00 2001 From: Fabian Imhof Date: Sat, 10 May 2025 11:45:38 +0000 Subject: continue experimenting with user heap --- .../x86_64/include/arch/memory/heap/user_heap_allocator.hpp | 1 + arch/x86_64/include/arch/memory/paging/kernel_mapper.hpp | 13 ++++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/arch/x86_64/include/arch/memory/heap/user_heap_allocator.hpp b/arch/x86_64/include/arch/memory/heap/user_heap_allocator.hpp index d698888..c50d2f6 100644 --- a/arch/x86_64/include/arch/memory/heap/user_heap_allocator.hpp +++ b/arch/x86_64/include/arch/memory/heap/user_heap_allocator.hpp @@ -18,6 +18,7 @@ namespace teachos::arch::memory::heap * @param heap_start Start of the allocatable heap area * @param heap_end End of the allocatable heap area (Start + Size) */ + [[gnu::section(".user_text")]] user_heap_allocator(std::size_t heap_start, std::size_t heap_end); /** diff --git a/arch/x86_64/include/arch/memory/paging/kernel_mapper.hpp b/arch/x86_64/include/arch/memory/paging/kernel_mapper.hpp index 05fde8b..bc36361 100644 --- a/arch/x86_64/include/arch/memory/paging/kernel_mapper.hpp +++ b/arch/x86_64/include/arch/memory/paging/kernel_mapper.hpp @@ -143,10 +143,11 @@ namespace teachos::arch::memory::paging entry entry{section.flags}; // Required to be accesible in User Mode: - // - .user_text (Contains the actual code executed) - // - .boot_bss (Contains statically allocated variables) // - .boot_rodata (Contains constant data stored in ROM) + // - .boot_bss (Contains statically allocated variables) + // - .user_text (Contains the actual code executed) // - .user_data (Contains static user variables) + // - .stl_text (Contains code for custom std implementations) if (section.physical_address == 0x100000 /* .boot_rodata */ || section.physical_address == 0x102000 /* .boot_bss */ || section.physical_address == 0x218000 /* .stl_text */) @@ -155,8 +156,14 @@ namespace teachos::arch::memory::paging entry.set_global(); } + // TODO: We should be able to remove this somehow + if (section.physical_address == 0x209000 /* .text */) + { + entry.set_user_accesible(); + } + if (section.physical_address == 0x217000 /* .user_text */ || - section.physical_address == 0x21D000 /* .user_data */) + section.physical_address == 0x21E000 /* .user_data */) { entry.set_user_accesible(); } -- cgit v1.2.3