summaryrefslogtreecommitdiffhomepage
path: root/Private/Source
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@el-mahrouss-logic.com>2024-03-19 10:05:31 +0100
committerAmlal El Mahrouss <amlal@el-mahrouss-logic.com>2024-03-19 10:05:31 +0100
commitbaf2afd8cd672dcb9c13d956dfdd73b61dfee558 (patch)
tree0734d2fe6d480e9805121e1c7d5e42f20bf4e8f4 /Private/Source
parent98347089c7e4e2b306d25a0db77e00aa2ea50882 (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')
-rw-r--r--Private/Source/ProcessTeam.cxx2
-rw-r--r--Private/Source/ThreadLocalStorage.cxx15
2 files changed, 9 insertions, 8 deletions
diff --git a/Private/Source/ProcessTeam.cxx b/Private/Source/ProcessTeam.cxx
index 569d417d..9e16c0cd 100644
--- a/Private/Source/ProcessTeam.cxx
+++ b/Private/Source/ProcessTeam.cxx
@@ -9,7 +9,7 @@
/// @brief Process Team API.
/***********************************************************************************/
-#include <KernelKit/ProcessTeam.hpp>
+#include <KernelKit/ProcessScheduler.hpp>
namespace HCore {
MutableArray<Ref<Process>>& ProcessTeam::AsArray() { return mProcessList; }
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();
}