From 650fee520f526d9cd5ffa75735bd94d5140dd247 Mon Sep 17 00:00:00 2001 From: Amlal Date: Sat, 20 Jul 2024 08:43:16 +0200 Subject: [IMP] See below. - Revoke OTA flag for now inside bootloader (newosldr #4) - Rework Comm as SCI (System Call Interface) (newoskrnl #3) - Rework and fix some parts of the scheduler (newoskrnl #2) - Return from thread when region is zero (newosldr #1) - Separate allocation functions and c++ runtime from each other. (DDK #5) - Rename kHartStandard to kStandard (newoskrnl #6) Signed-off-by: Amlal --- Kernel/Sources/ProcessScheduler.cxx | 20 ++++++++++---------- Kernel/Sources/SMPManager.cxx | 14 +++++++++++++- 2 files changed, 23 insertions(+), 11 deletions(-) (limited to 'Kernel/Sources') diff --git a/Kernel/Sources/ProcessScheduler.cxx b/Kernel/Sources/ProcessScheduler.cxx index a536bf52..34bc321d 100644 --- a/Kernel/Sources/ProcessScheduler.cxx +++ b/Kernel/Sources/ProcessScheduler.cxx @@ -138,7 +138,7 @@ namespace Kernel } /// @brief process name getter. - const Char* ProcessHeader::GetName() noexcept + const Char* ProcessHeader::GetProcessName() noexcept { return this->Name; } @@ -273,21 +273,21 @@ namespace Kernel { auto unwrapped_process = *process.Leak(); - unwrapped_process.PTime = 0; - // set the current process. mTeam.AsRef() = unwrapped_process; // tell helper to find a core to schedule on. - ProcessHelper::Switch(mTeam.AsRef().Leak().StackFrame, - mTeam.AsRef().Leak().ProcessId); + ProcessHelper::Switch(unwrapped_process.StackFrame, + unwrapped_process.ProcessId); + + unwrapped_process.PTime = static_cast(unwrapped_process.Affinity); - kcout << unwrapped_process.Name << ": process switched.\r"; + kcout << unwrapped_process.Name << ": has been switched to process core.\r"; } else { // otherwise increment the P-time. - ++mTeam.AsRef().Leak().PTime; + --mTeam.AsRef().Leak().PTime; } } @@ -336,10 +336,10 @@ namespace Kernel if (process.Leak().GetStatus() == ProcessStatus::kStarting) { - if (process.Leak().PTime < static_cast(kSchedMinMicroTime)) + if (process.Leak().PTime <= 0) { process.Leak().Status = ProcessStatus::kRunning; - process.Leak().Affinity = AffinityKind::kHartStandard; + process.Leak().Affinity = AffinityKind::kStandard; return true; } @@ -347,7 +347,7 @@ namespace Kernel ++process.Leak().PTime; } - return process.Leak().PTime > static_cast(kSchedMinMicroTime); + return process.Leak().PTime > 0; } /** diff --git a/Kernel/Sources/SMPManager.cxx b/Kernel/Sources/SMPManager.cxx index e32f8be7..f5424525 100644 --- a/Kernel/Sources/SMPManager.cxx +++ b/Kernel/Sources/SMPManager.cxx @@ -7,6 +7,7 @@ #include #include #include +#include ///! BUGS: 0 @@ -16,6 +17,8 @@ namespace Kernel { + STATIC Property cSMPCoreName; + ///! A HardwareThread class takes care of it's owned hardware thread. ///! It has a stack for it's core. @@ -120,7 +123,16 @@ namespace Kernel //! @brief Constructor and destructor ///! @brief Default constructor. - SMPManager::SMPManager() = default; + SMPManager::SMPManager() + { + StringView strCoreName(512); + strCoreName += "\\Properties\\Smp\\SchedulerClass"; + + cSMPCoreName.GetKey() = strCoreName; + cSMPCoreName.GetValue() = (UIntPtr)this; + + kcout << "newoskrnl: initializing " << strCoreName.CData() << endl; + } ///! @brief Default destructor. SMPManager::~SMPManager() = default; -- cgit v1.2.3