mirror of
https://github.com/RGBCube/serenity
synced 2025-06-30 10:22:13 +00:00
Kernel: Add Region::clear_to_zero
This helper method can be used to quickly and efficiently zero out a region.
This commit is contained in:
parent
5f95a1a7b7
commit
ff6b43734c
2 changed files with 15 additions and 0 deletions
|
@ -293,6 +293,19 @@ void Region::remap()
|
|||
TODO();
|
||||
}
|
||||
|
||||
void Region::clear_to_zero()
|
||||
{
|
||||
VERIFY(vmobject().is_anonymous());
|
||||
SpinlockLocker locker(vmobject().m_lock);
|
||||
for (auto i = 0u; i < page_count(); ++i) {
|
||||
auto page = physical_page_slot(i);
|
||||
VERIFY(page);
|
||||
if (page->is_shared_zero_page())
|
||||
continue;
|
||||
page = MM.shared_zero_page();
|
||||
}
|
||||
}
|
||||
|
||||
PageFaultResponse Region::handle_fault(PageFault const& fault)
|
||||
{
|
||||
auto page_index_in_region = page_index_from_address(fault.vaddr());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue