Kernel: Add MemoryManager::copy_physical_page()

This is a handy helper that copies out the full contents of a physical
page into a caller-provided buffer. It uses quickmapping internally
(and takes the MM lock for the duration.)
This commit is contained in:
Andreas Kling 2021-11-17 19:31:30 +01:00
commit f2d5548d7a
Notes: sideshowbarker 2024-07-18 01:03:15 +09:00
2 changed files with 10 additions and 0 deletions

View file

@ -1118,4 +1118,12 @@ void CommittedPhysicalPageSet::uncommit_one()
MM.uncommit_user_physical_pages({}, 1);
}
void MemoryManager::copy_physical_page(PhysicalPage& physical_page, u8 page_buffer[PAGE_SIZE])
{
SpinlockLocker locker(s_mm_lock);
auto* quickmapped_page = quickmap_page(physical_page);
memcpy(page_buffer, quickmapped_page, PAGE_SIZE);
unquickmap_page();
}
}