mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-31 05:39:55 +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:
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user