mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 18:02:05 -05:00
Kernel: Add some convenient getters to Region
Add getters for the underlying Range, the access bits, and also add contains(Range) which just wraps m_range.contains().
This commit is contained in:
parent
10e0e13bf3
commit
0e53b1d1ad
1 changed files with 7 additions and 0 deletions
|
@ -27,12 +27,14 @@ public:
|
|||
|
||||
~Region();
|
||||
|
||||
const Range& range() const { return m_range; }
|
||||
VirtualAddress vaddr() const { return m_range.base(); }
|
||||
size_t size() const { return m_range.size(); }
|
||||
bool is_readable() const { return m_access & Access::Read; }
|
||||
bool is_writable() const { return m_access & Access::Write; }
|
||||
bool is_executable() const { return m_access & Access::Execute; }
|
||||
const String& name() const { return m_name; }
|
||||
unsigned access() const { return m_access; }
|
||||
|
||||
void set_name(const String& name) { m_name = name; }
|
||||
|
||||
|
@ -51,6 +53,11 @@ public:
|
|||
return m_range.contains(vaddr);
|
||||
}
|
||||
|
||||
bool contains(const Range& range) const
|
||||
{
|
||||
return m_range.contains(range);
|
||||
}
|
||||
|
||||
unsigned page_index_from_address(VirtualAddress vaddr) const
|
||||
{
|
||||
return (vaddr - m_range.base()).get() / PAGE_SIZE;
|
||||
|
|
Loading…
Add table
Reference in a new issue