From e0024d9ea688ee91a77abc0e28c5ea24b13ca67d Mon Sep 17 00:00:00 2001 From: Amlal Date: Mon, 28 Oct 2024 07:01:58 +0100 Subject: IMP: Refactor whole source code to make it even. - That is because previously the source was both in lowercase and lettercase. Signed-off-by: Amlal --- dev/ZKAKit/KernelKit/ThreadLocalStorage.h | 54 +++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 dev/ZKAKit/KernelKit/ThreadLocalStorage.h (limited to 'dev/ZKAKit/KernelKit/ThreadLocalStorage.h') diff --git a/dev/ZKAKit/KernelKit/ThreadLocalStorage.h b/dev/ZKAKit/KernelKit/ThreadLocalStorage.h new file mode 100644 index 00000000..1e6df991 --- /dev/null +++ b/dev/ZKAKit/KernelKit/ThreadLocalStorage.h @@ -0,0 +1,54 @@ +/* ------------------------------------------- + + Copyright ZKA Web Services Co. + +------------------------------------------- */ + +#ifndef _KERNELKIT_TLS_HPP +#define _KERNELKIT_TLS_HPP + +#include + +///! @brief Thread Local Storage for minoskrnl. + +#define kCookieMag0 'Z' +#define kCookieMag1 'K' +#define kCookieMag2 'A' + +#define kTLSCookieLen (3U) + +struct THREAD_INFORMATION_BLOCK; + +/// @brief Thread Information Block. +/// Located in GS on AMD64, other architectures have their own stuff. (64x0, 32x0, ARM64) +struct PACKED THREAD_INFORMATION_BLOCK final +{ + Kernel::Char f_Cookie[kTLSCookieLen]{0}; //! Thread magic number. + Kernel::VoidPtr f_ThreadRecord{nullptr}; //! Thread information record. +}; + +///! @brief Cookie Sanity check. +Kernel::Boolean tls_check_tib(THREAD_INFORMATION_BLOCK* the_tib); + +///! @brief new ptr syscall. +template +T* tls_new_ptr(void) noexcept; + +///! @brief delete ptr syscall. +template +Kernel::Boolean tls_delete_ptr(T* ptr) noexcept; + +template +T* tls_new_class(Args&&... args); + +/// @brief TLS install TIB and PIB. (syscall) +EXTERN_C Kernel::Void rt_install_tib(THREAD_INFORMATION_BLOCK* TIB, THREAD_INFORMATION_BLOCK* PIB); + +/// @brief TLS check (syscall) +EXTERN_C Kernel::Bool tls_check_syscall_impl(Kernel::VoidPtr TIB) noexcept; + +#include + +// last rev 7/7/24 + +#endif /* ifndef _KERNELKIT_TLS_HPP */ -- cgit v1.2.3