diff options
author | Andreas Kling <kling@serenityos.org> | 2021-02-19 18:41:50 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-02-19 20:23:05 +0100 |
commit | fdf03852c968f11b942376aa225248cdc26bd904 (patch) | |
tree | 239d742b2622553f00a6039b8fe41843ada53e0b /Kernel/VM/MemoryManager.cpp | |
parent | 32e93c88081d88640d1a4cdca4019c0ef7ece0a3 (diff) | |
download | serenity-fdf03852c968f11b942376aa225248cdc26bd904.zip |
Kernel: Slap UNMAP_AFTER_INIT on a whole bunch of functions
There's no real system here, I just added it to various functions
that I don't believe we ever want to call after initialization
has finished.
With these changes, we're able to unmap 60 KiB of kernel text
after init. :^)
Diffstat (limited to 'Kernel/VM/MemoryManager.cpp')
-rw-r--r-- | Kernel/VM/MemoryManager.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/Kernel/VM/MemoryManager.cpp b/Kernel/VM/MemoryManager.cpp index b780f82655..90e764575d 100644 --- a/Kernel/VM/MemoryManager.cpp +++ b/Kernel/VM/MemoryManager.cpp @@ -81,7 +81,7 @@ bool MemoryManager::is_initialized() return s_the != nullptr; } -MemoryManager::MemoryManager() +UNMAP_AFTER_INIT MemoryManager::MemoryManager() { ScopedSpinLock lock(s_mm_lock); m_kernel_page_directory = PageDirectory::create_kernel_page_directory(); @@ -104,11 +104,11 @@ MemoryManager::MemoryManager() m_lazy_committed_page = allocate_committed_user_physical_page(); } -MemoryManager::~MemoryManager() +UNMAP_AFTER_INIT MemoryManager::~MemoryManager() { } -void MemoryManager::protect_kernel_image() +UNMAP_AFTER_INIT void MemoryManager::protect_kernel_image() { ScopedSpinLock page_lock(kernel_page_directory().get_lock()); // Disable writing to the kernel text and rodata segments. @@ -125,7 +125,7 @@ void MemoryManager::protect_kernel_image() } } -void MemoryManager::protect_readonly_after_init_memory() +UNMAP_AFTER_INIT void MemoryManager::protect_readonly_after_init_memory() { ScopedSpinLock mm_lock(s_mm_lock); ScopedSpinLock page_lock(kernel_page_directory().get_lock()); @@ -153,9 +153,10 @@ void MemoryManager::unmap_memory_after_init() } dmesgln("Unmapped {} KiB of kernel text after init! :^)", (end - start) / KiB); + //Processor::halt(); } -void MemoryManager::register_reserved_ranges() +UNMAP_AFTER_INIT void MemoryManager::register_reserved_ranges() { ASSERT(!m_physical_memory_ranges.is_empty()); ContiguousReservedMemoryRange range; @@ -194,7 +195,7 @@ bool MemoryManager::is_allowed_to_mmap_to_userspace(PhysicalAddress start_addres return false; } -void MemoryManager::parse_memory_map() +UNMAP_AFTER_INIT void MemoryManager::parse_memory_map() { RefPtr<PhysicalRegion> physical_region; @@ -414,7 +415,7 @@ void MemoryManager::release_pte(PageDirectory& page_directory, VirtualAddress va } } -void MemoryManager::initialize(u32 cpu) +UNMAP_AFTER_INIT void MemoryManager::initialize(u32 cpu) { auto mm_data = new MemoryManagerData; Processor::current().set_mm_data(*mm_data); |