mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
Kernel: Add MemoryManager::set_page_writable_direct()
This helper function goes directly to the page tables and makes a virtual address writable or non-writable.
This commit is contained in:
parent
40f2abf7c3
commit
96fb3d4a11
Notes:
sideshowbarker
2024-07-18 21:31:47 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/96fb3d4a11e
2 changed files with 14 additions and 0 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
Loading…
Reference in a new issue