1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 13:57:35 +00:00

Kernel+AK: Add and use Userspace<T>::unsafe_userspace_ptr()

Since we already have the type information in the Userspace template,
it was a bit silly to cast manually everywhere. Just add a sufficiently
scary-sounding getter for a typed pointer.

Thanks @alimpfard for pointing out that I was being silly with tossing
out the type.

In the future we may want to make this API non-public as well.
This commit is contained in:
Andreas Kling 2020-07-31 18:46:55 +02:00
parent 5cd7159629
commit 628b3badfb
4 changed files with 13 additions and 12 deletions

View file

@ -45,6 +45,7 @@ public:
}
FlatPtr ptr() const { return m_ptr; }
T unsafe_userspace_ptr() const { return (T)m_ptr; }
#else
Userspace(T ptr)
: m_ptr(ptr)