mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-07 09:04:30 +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:
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user