diff options
author | Liav A <liavalb@gmail.com> | 2022-03-27 17:51:16 +0300 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-05-05 20:55:57 +0200 |
commit | e6ebf9e5c1e82a638ac2a0c40166da36ca1d5bd5 (patch) | |
tree | 8b0405ed20225a0ead5d134f7bbba08e28a47199 /Kernel/Memory | |
parent | 3a3700f95e28177436a5896e5bc37746fb5e67b7 (diff) | |
download | serenity-e6ebf9e5c1e82a638ac2a0c40166da36ca1d5bd5.zip |
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.
Diffstat (limited to 'Kernel/Memory')
-rw-r--r-- | Kernel/Memory/TypedMapping.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/Kernel/Memory/TypedMapping.h b/Kernel/Memory/TypedMapping.h index 10dbd9ecf2..f1dd584aef 100644 --- a/Kernel/Memory/TypedMapping.h +++ b/Kernel/Memory/TypedMapping.h @@ -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(); } |