mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:17:44 +00:00
Kernel: Make Region's physical page accessors safer to use
Region::physical_page() now takes the VMObject lock while accessing the physical pages array, and returns a RefPtr<PhysicalPage>. This ensures that the array access is safe. Region::physical_page_slot() now VERIFY()'s that the VMObject lock is held by the caller. Since we're returning a reference to the physical page slot in the VMObject's physical page array, this is the best we can do here.
This commit is contained in:
parent
c3ad4ffcec
commit
4bc3745ce6
4 changed files with 12 additions and 9 deletions
|
@ -200,7 +200,7 @@ ErrorOr<void> Coredump::write_regions()
|
|||
region.remap();
|
||||
|
||||
for (size_t i = 0; i < region.page_count(); i++) {
|
||||
auto const* page = region.physical_page(i);
|
||||
auto page = region.physical_page(i);
|
||||
auto src_buffer = [&]() -> ErrorOr<UserOrKernelBuffer> {
|
||||
if (page)
|
||||
return UserOrKernelBuffer::for_user_buffer(reinterpret_cast<uint8_t*>((region.vaddr().as_ptr() + (i * PAGE_SIZE))), PAGE_SIZE);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue