summaryrefslogtreecommitdiffhomepage
path: root/Kernel/KernelKit
diff options
context:
space:
mode:
authorAmlal EL Mahrouss <amlalelmahrouss@icloud.com>2024-06-18 10:39:00 +0200
committerAmlal EL Mahrouss <amlalelmahrouss@icloud.com>2024-06-18 10:43:43 +0200
commit596268586bb4c8248a8ec106b8cdea12b9ab926a (patch)
tree5fdad88c44af284271ffac1ad3fefcbfe0dac4a6 /Kernel/KernelKit
parent8051ad2bd4af1f226a9751288957ee6af7e787d7 (diff)
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 <amlalelmahrouss@icloud.com>
Diffstat (limited to 'Kernel/KernelKit')
-rw-r--r--Kernel/KernelKit/ProcessScheduler.hxx4
-rw-r--r--Kernel/KernelKit/ThreadLocalStorage.hxx6
-rw-r--r--Kernel/KernelKit/ThreadLocalStorage.inl8
3 files changed, 10 insertions, 8 deletions
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<ProcessHeader>& GetCurrent();
+ Ref<ProcessHeader>& 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<ProcessHeader>& 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 <KernelKit/ThreadLocalStorage.inl>
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));
}