mirror of
https://github.com/RGBCube/serenity
synced 2025-05-29 06:55:07 +00:00
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:
parent
c4a78633b0
commit
f2d5548d7a
2 changed files with 10 additions and 0 deletions
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue