diff options
| author | Amlal El Mahrouss <amlal@el-mahrouss-logic.com> | 2024-03-19 10:05:31 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@el-mahrouss-logic.com> | 2024-03-19 10:05:31 +0100 |
| commit | baf2afd8cd672dcb9c13d956dfdd73b61dfee558 (patch) | |
| tree | 0734d2fe6d480e9805121e1c7d5e42f20bf4e8f4 /Private/Source/ThreadLocalStorage.cxx | |
| parent | 98347089c7e4e2b306d25a0db77e00aa2ea50882 (diff) | |
unstable, secret: See below.
System.Core:
- Add RunTime init function.
- Add ReadMe.md
Kernel:
- Improve TLS code, use Encoder class instead of casting directly.
- Refactor process team to include processscheduler.hpp instead.
ObjectKit:
- Rename Object.hxx to ObjectKit.hxx
Builtins/AHCI:
- Rename API.hxx to Interface.hxx
Signed-off-by: Amlal El Mahrouss <amlal@el-mahrouss-logic.com>
Diffstat (limited to 'Private/Source/ThreadLocalStorage.cxx')
| -rw-r--r-- | Private/Source/ThreadLocalStorage.cxx | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/Private/Source/ThreadLocalStorage.cxx b/Private/Source/ThreadLocalStorage.cxx index 8fd61d5e..30a241ea 100644 --- a/Private/Source/ThreadLocalStorage.cxx +++ b/Private/Source/ThreadLocalStorage.cxx @@ -25,26 +25,27 @@ using namespace HCore; * @return if the cookie is enabled. */ -Boolean tls_check_tib(VoidPtr ptr) { - if (!ptr) return false; +Boolean tls_check_tib(ThreadInformationBlock* tib) { + if (!tib) return false; - const char* _ptr = (const char*)ptr; + HCore::Encoder encoder; + const char* tibAsBytes = encoder.AsBytes(tib); kcout << "HCoreKrnl\\TLS: Checking for a valid cookie...\n"; - return _ptr[0] == kCookieMag0 && _ptr[1] == kCookieMag1 && - _ptr[2] == kCookieMag2; + return tibAsBytes[0] == kCookieMag0 && tibAsBytes[1] == kCookieMag1 && + tibAsBytes[2] == kCookieMag2; } /** - * System call implementation in HCore + * System call implementation of the TLS check. * @param ptr * @return */ EXTERN_C Void tls_check_syscall_impl(HCore::HAL::StackFramePtr stackPtr) noexcept { ThreadInformationBlock* tib = (ThreadInformationBlock*)stackPtr->Gs; - if (!tls_check_tib(tib->Cookie)) { + if (!tls_check_tib(tib)) { kcout << "HCoreKrnl\\TLS: Verification failed, Crashing...\n"; ProcessManager::Shared().Leak().GetCurrent().Leak().Crash(); } |
