diff options
| author | Amlal <amlalelmahrouss@icloud.com> | 2024-05-11 06:43:54 +0000 |
|---|---|---|
| committer | Amlal <amlalelmahrouss@icloud.com> | 2024-05-11 06:43:54 +0000 |
| commit | ca675beb41dba8d7d16c5793b55d1672f38be3b4 (patch) | |
| tree | c995ada42729ac2059a0ed87a4539d1a7e10b14a /Private/Source/ThreadLocalStorage.cxx | |
| parent | 2b4a4792abf51487ab4a16106f9376f43acf381a (diff) | |
| parent | bc57a29a24b98b00ba17710ba84ec2188ab73504 (diff) | |
Merged in MHR-23 (pull request #12)
MHR-23: Merge work.
Diffstat (limited to 'Private/Source/ThreadLocalStorage.cxx')
| -rw-r--r-- | Private/Source/ThreadLocalStorage.cxx | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/Private/Source/ThreadLocalStorage.cxx b/Private/Source/ThreadLocalStorage.cxx deleted file mode 100644 index 05e0dbe9..00000000 --- a/Private/Source/ThreadLocalStorage.cxx +++ /dev/null @@ -1,54 +0,0 @@ -/* - * ======================================================== - * - * NewOS - * Copyright Mahrouss Logic, all rights reserved. - * - * ======================================================== - */ - -#include <KernelKit/ProcessScheduler.hpp> -#include <KernelKit/ThreadLocalStorage.hxx> - -///! BUGS: 0 - -/***********************************************************************************/ -/// @file ThreadLocalStorage.cxx -/// @brief TLS implementation in kernel. -/***********************************************************************************/ - -using namespace NewOS; - -/** - * @brief Check for cookie inside TIB. - * @param tib the TIB to check. - * @return if the cookie is enabled. - */ - -Boolean tls_check_tib(ThreadInformationBlock* tib) { - if (!tib) return false; - - Encoder encoder; - const char* tibAsBytes = encoder.AsBytes(tib); - - kcout << "New OS: Checking for a valid cookie...\r"; - - return tibAsBytes[0] == kCookieMag0 && tibAsBytes[1] == kCookieMag1 && - tibAsBytes[2] == kCookieMag2; -} - -/** - * @brief System call implementation of the TLS check. - * @param stackPtr The call frame. - * @return - */ -EXTERN_C Void tls_check_syscall_impl(NewOS::HAL::StackFramePtr stackPtr) noexcept { - ThreadInformationBlock* tib = (ThreadInformationBlock*)stackPtr->Gs; - - if (!tls_check_tib(tib)) { - kcout << "New OS: Verification failed, Crashing...\r"; - ProcessScheduler::Shared().Leak().GetCurrent().Leak().Crash(); - } - - kcout << "New OS: Verification succeeded! Keeping on...\r"; -} |
