mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 20:37:34 +00:00
UserspaceEmulator: Enable splitting regions at arbitrary points
This is not yet useful in and of itself, but enables the feature in the next commit.
This commit is contained in:
parent
7cc8f20a30
commit
45443f24ec
7 changed files with 66 additions and 2 deletions
|
@ -67,7 +67,18 @@ public:
|
|||
return contains(other.base(), other.size());
|
||||
}
|
||||
|
||||
Vector<Range, 2> carve(const Range&);
|
||||
Vector<Range, 2> carve(const Range&) const;
|
||||
|
||||
Range split_at(VirtualAddress address)
|
||||
{
|
||||
VERIFY(address.is_page_aligned());
|
||||
VERIFY(m_base < address);
|
||||
size_t new_size = (address - m_base).get();
|
||||
VERIFY(new_size < m_size);
|
||||
size_t other_size = m_size - new_size;
|
||||
m_size = new_size;
|
||||
return { address, other_size };
|
||||
}
|
||||
|
||||
private:
|
||||
VirtualAddress m_base;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue