aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Imhof <fabian.imhof@ost.ch>2025-05-10 11:45:38 +0000
committerFabian Imhof <fabian.imhof@ost.ch>2025-05-10 11:45:38 +0000
commitc4261dd2312f8c55dc795f2674a03d6341f821ea (patch)
treeba5a3c862e5e1ae69026bd7606ebdea0875a6ad8
parentf3a976be198d97573b630242c0f833c290c62d81 (diff)
downloadteachos-c4261dd2312f8c55dc795f2674a03d6341f821ea.tar.xz
teachos-c4261dd2312f8c55dc795f2674a03d6341f821ea.zip
continue experimenting with user heap
-rw-r--r--arch/x86_64/include/arch/memory/heap/user_heap_allocator.hpp1
-rw-r--r--arch/x86_64/include/arch/memory/paging/kernel_mapper.hpp13
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();
}