diff --git a/AK/Userspace.h b/AK/Userspace.h index 4ac2ef07ed..8c8b778c13 100644 --- a/AK/Userspace.h +++ b/AK/Userspace.h @@ -73,6 +73,18 @@ private: #endif }; +template +inline Userspace static_ptr_cast(const Userspace& ptr) +{ +#ifdef KERNEL + auto casted_ptr = static_cast(ptr.unsafe_userspace_ptr()); +#else + auto casted_ptr = static_cast(ptr.ptr()); +#endif + return Userspace((FlatPtr)casted_ptr); +} + } using AK::Userspace; +using AK::static_ptr_cast;