summaryrefslogtreecommitdiff
path: root/AK/Userspace.h
AgeCommit message (Collapse)Author
2020-08-22AK: Prevent confusing silent misuse of Userspace<T>Ben Wiederhake
2020-08-17AK: Add SFINAE fallback for AK C++ concepts use, for Coverity compilerBrian Gianforcaro
The Coverity compiler doesn't support C++2a yet, and thus doesn't even recognize concept keywords. To allow serenity to be built and analyzed on such compilers, add a fallback underdef to perform the same template restriction based on AK::EnableIf<..> meta programming. Note: Coverity does seem to (annoyingly) define __cpp_concepts, even though it doesn't support them, so we need to further check for __COVERITY__ explicitly.
2020-08-07AK: Add static_ptr_cast support for the Userspace<T> pointer typeBrian Gianforcaro
When using Userspace<T> there are certain syscalls where being able to cast between types is needed. You should be able to easily cast away the Userspace<T> wrapper, but it's perfectly safe to be able to cast the internal type that is being wrapped.
2020-08-02AK: Hack Userspace<T> to not break Qt Creator syntax highlightingAndreas Kling
This is a very cheesy patch and I don't like it, but as Qt Creator does not grok C++20 concepts yet, this makes it possible to still use syntax highlighting. We'll remove this hack the moment it stops being a problem. Note that it doesn't actually affect the build since we use GCC, not Clang.
2020-08-01AK: In Userspace.h, #if defined(KERNEL) => #ifdef KERNELEmanuele Torre
2020-08-01AK: Use C++20 concepts to only allow Userspace wrappers of pointersEmanuele Torre
It was a bit odd that you could create a Userspace<int> and that Userspace<int>::ptr() returned an int instead of an int*. Let's use C++20 concepts to only allow creating Userspace objects with pointer types. :^)
2020-07-31Kernel+AK: Add and use Userspace<T>::unsafe_userspace_ptr()Andreas Kling
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.
2020-07-31AK: Add Userspace<T>, a wrapper for userspace pointersAndreas Kling
This will be used in the kernel to wrap pointers into userspace memory without convenient direct access. The idea is to use the compiler to enforce that we don't dereference userspace pointers.