summaryrefslogtreecommitdiffhomepage
path: root/dev/ZKA
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-09-05 10:50:15 +0200
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-09-05 10:50:15 +0200
commit270223aea3a48f2d250525869c30fff418356ef3 (patch)
tree22a101c274e839f1711cddaa596800d1edbbcfce /dev/ZKA
parent518e2ce29513b8d49adf73e76aaf94c4f722dfae (diff)
[ IMP ] Use Busy flag for MP scheduler.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'dev/ZKA')
-rw-r--r--dev/ZKA/Sources/MP.cxx8
-rw-r--r--dev/ZKA/Sources/UserProcessScheduler.cxx24
2 files changed, 13 insertions, 19 deletions
diff --git a/dev/ZKA/Sources/MP.cxx b/dev/ZKA/Sources/MP.cxx
index c5cab5dc..0e109b66 100644
--- a/dev/ZKA/Sources/MP.cxx
+++ b/dev/ZKA/Sources/MP.cxx
@@ -94,14 +94,18 @@ namespace Kernel
if (kHandoverHeader->f_HardwareTables.f_MultiProcessingEnabled)
{
- return mp_register_process(fStack);
+ this->Busy(true);
+ Bool ret = mp_register_process(fStack);
+ this->Busy(true);
+
+ return ret;
}
else
{
mp_do_context_switch_pre();
mp_do_context_switch(image, stack_ptr, fStack);
- return false;
+ return true;
}
}
diff --git a/dev/ZKA/Sources/UserProcessScheduler.cxx b/dev/ZKA/Sources/UserProcessScheduler.cxx
index 4d74a5b3..733e19ed 100644
--- a/dev/ZKA/Sources/UserProcessScheduler.cxx
+++ b/dev/ZKA/Sources/UserProcessScheduler.cxx
@@ -19,7 +19,7 @@
///! BUGS: 0
/***********************************************************************************/
-/* TODO: Document the Kernel, SDK and kits. */
+/** TODO: Document the Kernel, SDK and kits. */
/***********************************************************************************/
namespace Kernel
@@ -31,7 +31,7 @@ namespace Kernel
STATIC UInt32 cLastExitCode = 0U;
/***********************************************************************************/
- /// @brief UserProcess scheduler instance.
+ /// @brief User Process scheduler global object.
/***********************************************************************************/
STATIC UserProcessScheduler* cProcessScheduler = nullptr;
@@ -289,18 +289,16 @@ namespace Kernel
/***********************************************************************************/
/// @brief Remove process from list.
- /// @param processSlot process slot inside team.
+ /// @param process_id process slot inside team.
/// @retval true process was removed.
/// @retval false process doesn't exist in team.
- Bool UserProcessScheduler::Remove(ProcessID processSlot)
+ Bool UserProcessScheduler::Remove(ProcessID process_id)
{
// check if process is within range.
- if (processSlot > mTeam.AsArray().Count())
+ if (process_id > mTeam.AsArray().Count())
return false;
-
- kcout << "UserProcessScheduler: Removing process...\r";
-
- mTeam.AsArray()[processSlot].Status = ProcessStatusKind::kDead;
+
+ mTeam.AsArray()[process_id].Status = ProcessStatusKind::kDead;
--mTeam.mProcessAmount;
return true;
@@ -424,8 +422,6 @@ namespace Kernel
if (!stack || !frame_ptr || !image_ptr || new_pid < 0)
return false;
- kcout << "Finding hardware thread...\r";
-
for (SizeT index = 0UL; index < HardwareThreadScheduler::The().Count(); ++index)
{
if (HardwareThreadScheduler::The()[index].Leak()->Kind() == kInvalidHart)
@@ -439,16 +435,10 @@ namespace Kernel
HardwareThreadScheduler::The()[index].Leak()->Kind() !=
ThreadKind::kHartSystemReserved)
{
- HardwareThreadScheduler::The()[index].Leak()->Busy(true);
-
UserProcessHelper::TheCurrentPID() = new_pid;
- kcout << "Found hardware thread...\r";
-
bool ret = HardwareThreadScheduler::The()[index].Leak()->Switch(image_ptr, stack, frame_ptr);
- HardwareThreadScheduler::The()[index].Leak()->Busy(false);
-
return ret;
}
}