diff options
Diffstat (limited to 'Kernel/KernelKit/ThreadLocalStorage.hxx')
| -rw-r--r-- | Kernel/KernelKit/ThreadLocalStorage.hxx | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/Kernel/KernelKit/ThreadLocalStorage.hxx b/Kernel/KernelKit/ThreadLocalStorage.hxx index eaae7991..75d29ced 100644 --- a/Kernel/KernelKit/ThreadLocalStorage.hxx +++ b/Kernel/KernelKit/ThreadLocalStorage.hxx @@ -15,19 +15,10 @@ #define kCookieMag1 'C' #define kCookieMag2 'R' -template <typename T> -T* tls_new_ptr(void); - -template <typename T> -bool tls_delete_ptr(T* ptr); - -template <typename T, typename... Args> -T* tls_new_class(Args&&... args); - -#define kTLSCookieLen 3 +#define kTLSCookieLen (3U) /// @brief Thread Information Block for Local Storage. -/// Located in GS on AMD64, Virtual Address 0x10000 (64x0, 32x0, ARM64) +/// Located in GS on AMD64, other architectures have their own stuff. (64x0, 32x0, ARM64) struct PACKED ThreadInformationBlock final { NewOS::Char Cookie[kTLSCookieLen]; @@ -37,14 +28,27 @@ struct PACKED ThreadInformationBlock final NewOS::Int32 ThreadID; // Thread execution ID. }; -/// @brief TLS install TIB and PIB. -EXTERN_C void rt_install_tib(ThreadInformationBlock* TIB, NewOS::VoidPtr PIB); +typedef struct ThreadInformationBlock ProcessInformationBlock; ///! @brief Cookie Sanity check. NewOS::Boolean tls_check_tib(ThreadInformationBlock* Ptr); -/// @brief TLS check system call -EXTERN_C NewOS::Void tls_check_syscall_impl(NewOS::HAL::StackFramePtr StackPtr) noexcept; +///! @brief new ptr syscall. +template <typename T> +T* tls_new_ptr(void); + +///! @brief delete ptr syscall. +template <typename T> +bool tls_delete_ptr(T* ptr); + +template <typename T, typename... Args> +T* tls_new_class(Args&&... args); + +/// @brief TLS install TIB and PIB. (syscall) +EXTERN_C void rt_install_tib(ThreadInformationBlock* TIB, ThreadInformationBlock* PIB); + +/// @brief TLS check (syscall) +EXTERN_C NewOS::Void tls_check_syscall_impl(NewOS::VoidPtr TIB) noexcept; #include <KernelKit/ThreadLocalStorage.inl> |
