summaryrefslogtreecommitdiffhomepage
path: root/Private/Source/ProcessManager.cxx
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlalelmahrouss@icloud.com>2024-02-05 11:12:42 +0100
committerAmlal El Mahrouss <amlalelmahrouss@icloud.com>2024-02-05 11:12:42 +0100
commit81144dd05a7c01701c3bf7b04e345dccfef2bf82 (patch)
tree163bd79816e97ca31484df86c008af3f9a803ffd /Private/Source/ProcessManager.cxx
parentf8c9b81ff120160af60af6e9d44cba338aceb65a (diff)
HCR-11:
Kernel: Improvements and more. Bootloader: Now works on real hardware (previous commit.) Signed-off-by: Amlal El Mahrouss <amlalelmahrouss@icloud.com>
Diffstat (limited to 'Private/Source/ProcessManager.cxx')
-rw-r--r--Private/Source/ProcessManager.cxx8
1 files changed, 7 insertions, 1 deletions
diff --git a/Private/Source/ProcessManager.cxx b/Private/Source/ProcessManager.cxx
index 0c552b7f..ea9ba1f5 100644
--- a/Private/Source/ProcessManager.cxx
+++ b/Private/Source/ProcessManager.cxx
@@ -241,6 +241,9 @@ bool ProcessHelper::CanBeScheduled(Ref<Process> &process) {
return process.Leak().PTime > static_cast<Int>(kMinMicroTime);
}
+/**
+ * @brief Scheduler spin code.
+ */
bool ProcessHelper::StartScheduling() {
if (ProcessHelper::CanBeScheduled(
ProcessManager::Shared().Leak().GetCurrent())) {
@@ -256,7 +259,7 @@ bool ProcessHelper::StartScheduling() {
SizeT ret = process_ref.Run();
kcout << StringBuilder::FromInt(
- "ProcessHelper::StartScheduling() iterated over: % processes\r\n", ret);
+ "ProcessHelper::StartScheduling() Iterated over: % processes.\r\n", ret);
return true;
}
@@ -265,6 +268,9 @@ bool ProcessHelper::Switch(HAL::StackFrame *the_stack, const PID &new_pid) {
if (!the_stack || new_pid < 0) return false;
for (SizeT index = 0UL; index < kMaxHarts; ++index) {
+ if (SMPManager::Shared().Leak()[index].Leak().Kind() == kInvalidThread)
+ continue;
+
if (SMPManager::Shared().Leak()[index].Leak().StackFrame() == the_stack) {
SMPManager::Shared().Leak()[index].Leak().Busy(false);
continue;