mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 01:41:59 -05:00
Kernel/Memory: Add TypedMapping base_address method
This method will be used to ease usage with the structure when we need to do virtual pointer arithmetics.
This commit is contained in:
parent
3a3700f95e
commit
e6ebf9e5c1
1 changed files with 1 additions and 0 deletions
|
@ -15,6 +15,7 @@ template<typename T>
|
|||
struct TypedMapping {
|
||||
const T* ptr() const { return reinterpret_cast<const T*>(region->vaddr().offset(offset).as_ptr()); }
|
||||
T* ptr() { return reinterpret_cast<T*>(region->vaddr().offset(offset).as_ptr()); }
|
||||
VirtualAddress base_address() const { return region->vaddr().offset(offset); }
|
||||
const T* operator->() const { return ptr(); }
|
||||
T* operator->() { return ptr(); }
|
||||
const T& operator*() const { return *ptr(); }
|
||||
|
|
Loading…
Reference in a new issue