mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 12:57:35 +00:00
Refactor the virtual memory object model a bit:
Process now has a number of Regions. Each Region is backed by a VMObject. A VMObject can be file-backed or anonymous. These can be shared.
This commit is contained in:
parent
3c8064a787
commit
862f108cb5
6 changed files with 165 additions and 31 deletions
|
@ -100,8 +100,8 @@ Region* Process::allocate_region(LinearAddress laddr, size_t size, String&& name
|
|||
unsigned page_count = ceilDiv(size, PAGE_SIZE);
|
||||
auto physical_pages = MM.allocate_physical_pages(page_count);
|
||||
ASSERT(physical_pages.size() == page_count);
|
||||
|
||||
m_regions.append(adopt(*new Region(laddr, size, move(physical_pages), move(name), is_readable, is_writable)));
|
||||
m_regions.append(adopt(*new Region(laddr, size, move(name), is_readable, is_writable)));
|
||||
m_regions.last()->commit(*this);
|
||||
MM.mapRegion(*this, *m_regions.last());
|
||||
return m_regions.last().ptr();
|
||||
}
|
||||
|
@ -122,8 +122,7 @@ Region* Process::allocate_file_backed_region(LinearAddress laddr, size_t size, R
|
|||
Vector<RetainPtr<PhysicalPage>> physical_pages;
|
||||
physical_pages.resize(page_count); // Start out with no physical pages!
|
||||
|
||||
m_regions.append(adopt(*new Region(laddr, size, move(physical_pages), move(name), is_readable, is_writable)));
|
||||
m_regions.last()->m_vnode = move(vnode);
|
||||
m_regions.append(adopt(*new Region(laddr, size, move(vnode), move(name), is_readable, is_writable)));
|
||||
MM.mapRegion(*this, *m_regions.last());
|
||||
return m_regions.last().ptr();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue