mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 05:27:46 +00:00
Kernel: Add safe atomic functions
This allows us to perform atomic operations on potentially unsafe user space pointers.
This commit is contained in:
parent
992f513ad2
commit
b17a889320
10 changed files with 573 additions and 166 deletions
|
@ -37,6 +37,16 @@ struct StringArgument;
|
|||
String copy_string_from_user(const char*, size_t);
|
||||
String copy_string_from_user(Userspace<const char*>, size_t);
|
||||
|
||||
[[nodiscard]] Optional<u32> user_atomic_fetch_add_relaxed(volatile u32* var, u32 val);
|
||||
[[nodiscard]] Optional<u32> user_atomic_exchange_relaxed(volatile u32* var, u32 val);
|
||||
[[nodiscard]] Optional<u32> user_atomic_load_relaxed(volatile u32* var);
|
||||
[[nodiscard]] bool user_atomic_store_relaxed(volatile u32* var, u32 val);
|
||||
[[nodiscard]] Optional<bool> user_atomic_compare_exchange_relaxed(volatile u32* var, u32& expected, u32 val);
|
||||
[[nodiscard]] Optional<u32> user_atomic_fetch_and_relaxed(volatile u32* var, u32 val);
|
||||
[[nodiscard]] Optional<u32> user_atomic_fetch_and_not_relaxed(volatile u32* var, u32 val);
|
||||
[[nodiscard]] Optional<u32> user_atomic_fetch_or_relaxed(volatile u32* var, u32 val);
|
||||
[[nodiscard]] Optional<u32> user_atomic_fetch_xor_relaxed(volatile u32* var, u32 val);
|
||||
|
||||
extern "C" {
|
||||
|
||||
[[nodiscard]] bool copy_to_user(void*, const void*, size_t);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue