diff options
Diffstat (limited to 'arch/x86_64/include')
| -rw-r--r-- | arch/x86_64/include/arch/memory/paging/kernel_mapper.hpp | 28 |
1 files changed, 12 insertions, 16 deletions
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 5bf14fb..977b40d 100644 --- a/arch/x86_64/include/arch/memory/paging/kernel_mapper.hpp +++ b/arch/x86_64/include/arch/memory/paging/kernel_mapper.hpp @@ -7,6 +7,9 @@ #include "arch/memory/paging/temporary_page.hpp" #include "arch/video/vga/text.hpp" +#include <algorithm> +#include <array> + namespace teachos::arch::memory::paging { /** @@ -142,24 +145,17 @@ namespace teachos::arch::memory::paging entry entry{section.flags}; // Required to be accessible in User Mode: - // - .boot_bss (Contains statically allocated variables) - // - .user_text (Contains the actual user code executed) - // - .user_data (Contains static user variables) - // - .stl_text (Contains code for custom std implementations and standard library code) - if (section.physical_address == 0x102000 /* .boot_bss */ || - section.physical_address == 0x209000 /* .stl_text */) - { - entry.set_user_accessible(); - } + constexpr std::array<uint64_t, 6> user_section_bases = { + 0x102000, // .boot_bss (Contains statically allocated variables) + 0x209000, // .stl_text (Contains code for custom std implementations and standard library code) + 0x218000, // .user_text (Contains the actual user code executed) + 0x21E000, // .user_data (Contains static user variables) - // TODO: Can be removed once stl has been completly mapped into stl text - if (section.physical_address == 0x20A000 /* .text */) - { - entry.set_user_accessible(); - } + 0x20A000 // .text (Necessary, because symbols for standard library are placed there) + }; - if (section.physical_address == 0x218000 /* .user_text */ || - section.physical_address == 0x21E000 /* .user_data */) + if (std::find(user_section_bases.begin(), user_section_bases.end(), section.physical_address) != + user_section_bases.end()) { entry.set_user_accessible(); } |
