diff options
Diffstat (limited to 'Kernel')
-rw-r--r-- | Kernel/VM/MemoryManager.cpp | 12 | ||||
-rw-r--r-- | Kernel/VM/MemoryManager.h | 2 |
2 files changed, 14 insertions, 0 deletions
diff --git a/Kernel/VM/MemoryManager.cpp b/Kernel/VM/MemoryManager.cpp index 0e7f49c4bc..73ee9d2389 100644 --- a/Kernel/VM/MemoryManager.cpp +++ b/Kernel/VM/MemoryManager.cpp @@ -915,4 +915,16 @@ void MemoryManager::dump_kernel_regions() } } +void MemoryManager::set_page_writable_direct(VirtualAddress vaddr, bool writable) +{ + ScopedSpinLock lock(s_mm_lock); + ScopedSpinLock page_lock(kernel_page_directory().get_lock()); + auto* pte = ensure_pte(kernel_page_directory(), vaddr); + VERIFY(pte); + if (pte->is_writable() == writable) + return; + pte->set_writable(writable); + flush_tlb(&kernel_page_directory(), vaddr); +} + } diff --git a/Kernel/VM/MemoryManager.h b/Kernel/VM/MemoryManager.h index 4f505524a7..15ba26888f 100644 --- a/Kernel/VM/MemoryManager.h +++ b/Kernel/VM/MemoryManager.h @@ -139,6 +139,8 @@ public: PageFaultResponse handle_page_fault(const PageFault&); + void set_page_writable_direct(VirtualAddress, bool); + void protect_readonly_after_init_memory(); void unmap_memory_after_init(); |