NeKernel dev
Loading...
Searching...
No Matches
ThreadLocalStorage.h
Go to the documentation of this file.
1/* ========================================
2
3 Copyright (C) 2024-2025, Amlal El Mahrouss, licensed under the Apache 2.0 license.
4
5======================================== */
6
7#ifndef KERNELKIT_TLS_H
8#define KERNELKIT_TLS_H
9
10#include <NeKit/Config.h>
11#include <NeKit/ErrorOr.h>
12
14
15#define kCookieMag0Idx (0U)
16#define kCookieMag1Idx (1U)
17#define kCookieMag2Idx (2U)
18
19#define kCookieMag0 'N'
20#define kCookieMag1 'K'
21#define kCookieMag2 'O'
22
23#define kCookieMagLen (3U)
24
26
33
36
38template <typename T>
39T* tls_new_ptr(void);
40
42template <typename T>
44
47template <typename T>
49
52template <typename T>
54
55template <typename T, typename... Args>
56T* tls_new_class(Args&&... args);
57
60
63
65
66// last rev 7/7/24
67
68#endif /* ifndef KERNELKIT_TLS_H */
#define PACKED
#define TIB(X)
#define EXTERN_C
EXTERN_C Kernel::Bool tls_check_syscall_impl(Kernel::VoidPtr TIB)
TLS check (syscall).
Definition ThreadLocalStorage.cc:43
T * tls_new_ptr(void)
!
Definition ThreadLocalStorage.inl:15
EXTERN_C Kernel::Void rt_install_tib(THREAD_INFORMATION_BLOCK *TIB, THREAD_INFORMATION_BLOCK *PIB)
TLS install TIB and PIB. (syscall).
Kernel::Boolean tls_delete_ptr(T *ptr)
!
Definition ThreadLocalStorage.inl:31
Kernel::Boolean tls_check_tib(THREAD_INFORMATION_BLOCK *the_tib)
!
Definition ThreadLocalStorage.cc:30
T * tls_new_class(Args &&... args)
Allocate a C++ class, and then call the constructor of it.
Definition ThreadLocalStorage.inl:64
#define kCookieMagLen
Definition ThreadLocalStorage.h:23
Allocate resources from the process's heap storage.
ErrorOr class for error handling.
Definition ErrorOr.h:22
char Char
Definition Config.h:51
void Void
Definition Config.h:87
void * VoidPtr
Definition Config.h:33
bool Boolean
Definition Config.h:49
bool Bool
Definition Config.h:50
Thread Information Block. Located in GS on AMD64, other architectures have their own stuff....
Definition ThreadLocalStorage.h:29
Kernel::Char Cookie[kCookieMagLen]
Definition ThreadLocalStorage.h:30
Kernel::VoidPtr UserData
Thread Magic Number.
Definition ThreadLocalStorage.h:31