diff options
Diffstat (limited to 'AK/Userspace.h')
-rw-r--r-- | AK/Userspace.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/AK/Userspace.h b/AK/Userspace.h index 8d99a54172..267862424e 100644 --- a/AK/Userspace.h +++ b/AK/Userspace.h @@ -10,6 +10,10 @@ #include <AK/StdLibExtras.h> #include <AK/Types.h> +#ifdef KERNEL +# include <Kernel/VirtualAddress.h> +#endif + namespace AK { template<typename T> @@ -20,8 +24,6 @@ class Userspace { public: Userspace() = default; - operator FlatPtr() const { return (FlatPtr)m_ptr; } - // Disable default implementations that would use surprising integer promotion. bool operator==(const Userspace&) const = delete; bool operator<=(const Userspace&) const = delete; @@ -38,7 +40,8 @@ public: explicit operator bool() const { return m_ptr != 0; } FlatPtr ptr() const { return m_ptr; } - T unsafe_userspace_ptr() const { return (T)m_ptr; } + VirtualAddress vaddr() const { return VirtualAddress(m_ptr); } + T unsafe_userspace_ptr() const { return reinterpret_cast<T>(m_ptr); } #else Userspace(T ptr) : m_ptr(ptr) |