mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-01 07:07:49 +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
Notes:
sideshowbarker
2024-07-18 23:08:18 +09:00
Author: https://github.com/tomuta
Commit: b17a889320
Pull-request: https://github.com/SerenityOS/serenity/pull/4467
Reviewed-by: https://github.com/awesomekling
Reviewed-by: https://github.com/bgianfo
Reviewed-by: https://github.com/bugaevc
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