mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:27:45 +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
|
@ -152,7 +152,7 @@ public:
|
|||
return size() / PAGE_SIZE;
|
||||
}
|
||||
|
||||
PhysicalPage const* physical_page(size_t index) const;
|
||||
RefPtr<PhysicalPage> physical_page(size_t index) const;
|
||||
RefPtr<PhysicalPage>& physical_page_slot(size_t index);
|
||||
|
||||
[[nodiscard]] size_t offset_in_vmobject() const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue