From 596268586bb4c8248a8ec106b8cdea12b9ab926a Mon Sep 17 00:00:00 2001 From: Amlal EL Mahrouss Date: Tue, 18 Jun 2024 10:39:00 +0200 Subject: IMP: TLS syscall, serial write syscall. FIX: SMP manager writes to stack frame directly, check if we also want to free the stack. Signed-off-by: Amlal EL Mahrouss --- Kernel/KernelKit/ProcessScheduler.hxx | 4 ++-- Kernel/KernelKit/ThreadLocalStorage.hxx | 6 ++++-- Kernel/KernelKit/ThreadLocalStorage.inl | 8 ++++---- 3 files changed, 10 insertions(+), 8 deletions(-) (limited to 'Kernel/KernelKit') diff --git a/Kernel/KernelKit/ProcessScheduler.hxx b/Kernel/KernelKit/ProcessScheduler.hxx index 7c8f99be..8c470bb4 100644 --- a/Kernel/KernelKit/ProcessScheduler.hxx +++ b/Kernel/KernelKit/ProcessScheduler.hxx @@ -249,7 +249,7 @@ namespace NewOS bool Remove(SizeT headerIndex); public: - Ref& GetCurrent(); + Ref& TheCurrent(); SizeT Run() noexcept; public: @@ -268,7 +268,7 @@ namespace NewOS public: static bool Switch(HAL::StackFrame* newStack, const PID& newPid); static bool CanBeScheduled(Ref& process); - static PID& GetCurrentPID(); + static PID& TheCurrentPID(); static SizeT StartScheduling(); }; diff --git a/Kernel/KernelKit/ThreadLocalStorage.hxx b/Kernel/KernelKit/ThreadLocalStorage.hxx index eaae7991..432cc9ac 100644 --- a/Kernel/KernelKit/ThreadLocalStorage.hxx +++ b/Kernel/KernelKit/ThreadLocalStorage.hxx @@ -37,14 +37,16 @@ struct PACKED ThreadInformationBlock final NewOS::Int32 ThreadID; // Thread execution ID. }; +typedef struct ThreadInformationBlock ProcessInformationBlock; + /// @brief TLS install TIB and PIB. -EXTERN_C void rt_install_tib(ThreadInformationBlock* TIB, NewOS::VoidPtr PIB); +EXTERN_C void rt_install_tib(ThreadInformationBlock* TIB, ThreadInformationBlock* PIB); ///! @brief Cookie Sanity check. NewOS::Boolean tls_check_tib(ThreadInformationBlock* Ptr); /// @brief TLS check system call -EXTERN_C NewOS::Void tls_check_syscall_impl(NewOS::HAL::StackFramePtr StackPtr) noexcept; +EXTERN_C NewOS::Void tls_check_syscall_impl(NewOS::VoidPtr TIB) noexcept; #include diff --git a/Kernel/KernelKit/ThreadLocalStorage.inl b/Kernel/KernelKit/ThreadLocalStorage.inl index 1df825a3..6dbff3a1 100644 --- a/Kernel/KernelKit/ThreadLocalStorage.inl +++ b/Kernel/KernelKit/ThreadLocalStorage.inl @@ -15,9 +15,9 @@ inline T* tls_new_ptr(void) { using namespace NewOS; - MUST_PASS(ProcessScheduler::The().Leak().GetCurrent()); + MUST_PASS(ProcessScheduler::The().Leak().TheCurrent()); - auto ref_process = ProcessScheduler::The().Leak().GetCurrent(); + auto ref_process = ProcessScheduler::The().Leak().TheCurrent(); T* pointer = (T*)ref_process.Leak().New(sizeof(T)); return pointer; @@ -32,9 +32,9 @@ inline bool tls_delete_ptr(T* ptr) using namespace NewOS; - MUST_PASS(ProcessScheduler::The().Leak().GetCurrent()); + MUST_PASS(ProcessScheduler::The().Leak().TheCurrent()); - auto ref_process = ProcessScheduler::The().Leak().GetCurrent(); + auto ref_process = ProcessScheduler::The().Leak().TheCurrent(); return ref_process.Leak().Delete(ptr, sizeof(T)); } -- cgit v1.2.3