summaryrefslogtreecommitdiffhomepage
path: root/Private/Source/ThreadLocalStorage.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Private/Source/ThreadLocalStorage.cxx')
-rw-r--r--Private/Source/ThreadLocalStorage.cxx15
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();
}