From baf2afd8cd672dcb9c13d956dfdd73b61dfee558 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Tue, 19 Mar 2024 10:05:31 +0100 Subject: 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 --- Private/KernelKit/ProcessScheduler.hpp | 1 - Private/KernelKit/ProcessTeam.hpp | 9 --------- Private/KernelKit/SMPManager.hpp | 10 +++++----- Private/KernelKit/ThreadLocalStorage.hxx | 15 ++++----------- 4 files changed, 9 insertions(+), 26 deletions(-) delete mode 100644 Private/KernelKit/ProcessTeam.hpp (limited to 'Private/KernelKit') diff --git a/Private/KernelKit/ProcessScheduler.hpp b/Private/KernelKit/ProcessScheduler.hpp index 733c7c65..fa59be4b 100644 --- a/Private/KernelKit/ProcessScheduler.hpp +++ b/Private/KernelKit/ProcessScheduler.hpp @@ -9,7 +9,6 @@ #include #include -#include #include #include #include diff --git a/Private/KernelKit/ProcessTeam.hpp b/Private/KernelKit/ProcessTeam.hpp deleted file mode 100644 index 9538bbae..00000000 --- a/Private/KernelKit/ProcessTeam.hpp +++ /dev/null @@ -1,9 +0,0 @@ -/* ------------------------------------------- - - Copyright Mahrouss Logic - -------------------------------------------- */ - -#pragma once - -#include diff --git a/Private/KernelKit/SMPManager.hpp b/Private/KernelKit/SMPManager.hpp index 49406f1b..c207be82 100644 --- a/Private/KernelKit/SMPManager.hpp +++ b/Private/KernelKit/SMPManager.hpp @@ -4,8 +4,8 @@ ------------------------------------------- */ -#ifndef _INC_SMP_MANAGER_HPP -#define _INC_SMP_MANAGER_HPP +#ifndef __SMP_MANAGER__ +#define __SMP_MANAGER__ #include #include @@ -112,11 +112,11 @@ class SMPManager final { /// @brief wakes up thread. /// wakes up thread from hang. -void rt_wakeup_thread(HAL::StackFrame* stack); +Void rt_wakeup_thread(HAL::StackFramePtr stack); /// @brief makes thread sleep. /// hooks and hangs thread to prevent code from executing. -void rt_hang_thread(HAL::StackFrame* stack); +Void rt_hang_thread(HAL::StackFramePtr stack); } // namespace HCore -#endif // !_INC_SMP_MANAGER_HPP +#endif // !__SMP_MANAGER__ diff --git a/Private/KernelKit/ThreadLocalStorage.hxx b/Private/KernelKit/ThreadLocalStorage.hxx index 2fab5026..c6be2c2b 100644 --- a/Private/KernelKit/ThreadLocalStorage.hxx +++ b/Private/KernelKit/ThreadLocalStorage.hxx @@ -26,28 +26,21 @@ T *tls_new_class(Args &&...args); #define kTLSCookieLen 3 -typedef HCore::Char* rt_cookie_type; - -#define kTIBNameLen 256 - /// @brief Thread Information Block for Local Storage. /// Located in GS on AMD64, Virtual Address 0x10000 (64x0, 32x0, ARM64) -struct ThreadInformationBlock final { - HCore::Char Name[kTIBNameLen]; // Module Name +struct PACKED ThreadInformationBlock final { + HCore::Char Cookie[kTLSCookieLen]; HCore::UIntPtr StartCode; // Start Address HCore::UIntPtr StartData; // Allocation Heap HCore::UIntPtr StartStack; // Stack Pointer. - HCore::Int32 Arch; // Architecture and/or platform. - HCore::Int32 ID; // Thread execution ID. - rt_cookie_type Cookie; // Not shown in public header, location of the cookie header is store here, this is the way we tell - // something went wrong. + HCore::Int32 ThreadID; // Thread execution ID. }; /// @brief TLS install TIB EXTERN_C void rt_install_tib(ThreadInformationBlock *pTib, HCore::VoidPtr pPib); ///! @brief Cookie Sanity check. -HCore::Boolean tls_check_tib(ThreadInformationBlock *ptr); +HCore::Boolean tls_check_tib(ThreadInformationBlock* ptr); /// @brief TLS check system call EXTERN_C HCore::Void tls_check_syscall_impl(HCore::HAL::StackFramePtr stackPtr) noexcept; -- cgit v1.2.3