summaryrefslogtreecommitdiffhomepage
path: root/dev/ZKA/Sources/MP.cxx
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-08-31 10:47:14 +0200
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-08-31 10:47:14 +0200
commit2c4b02249ec4355a73b826909ab1889e45871faf (patch)
treea904b374c7a738dd3dcb0a580e5667714b72682a /dev/ZKA/Sources/MP.cxx
parentd65e85588388bf8c2e0dc8f6b106947110c0e815 (diff)
Saving progress on User scheduler implementation.
+ Working on RISC-V, ARM64, POWER64 HALs, to be able to distribute mulitple versions of the product. Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'dev/ZKA/Sources/MP.cxx')
-rw-r--r--dev/ZKA/Sources/MP.cxx51
1 files changed, 19 insertions, 32 deletions
diff --git a/dev/ZKA/Sources/MP.cxx b/dev/ZKA/Sources/MP.cxx
index 89b5f01d..381f266d 100644
--- a/dev/ZKA/Sources/MP.cxx
+++ b/dev/ZKA/Sources/MP.cxx
@@ -5,19 +5,23 @@
------------------------------------------- */
#include <ArchKit/ArchKit.hxx>
-#include <KernelKit/ProcessScheduler.hxx>
+#include <KernelKit/UserProcessScheduler.hxx>
#include <KernelKit/MP.hxx>
#include <CFKit/Property.hxx>
///! BUGS: 0
///! @file MP.cxx
-///! @brief This file handles multi processing in the kernel.
+///! @brief This file handles multi processing in the Kernel.
///! @brief Multi processing is needed for multi-tasking operations.
namespace Kernel
{
- STATIC Property cSMPCoreName;
+ /***********************************************************************************/
+ /// @brief MP object container property.
+ /***********************************************************************************/
+
+ Property cSMPCoreName;
///! A HardwareThread class takes care of it's owned hardware thread.
///! It has a stack for it's core.
@@ -87,29 +91,10 @@ namespace Kernel
/// @retval false stack is invalid, previous code is running.
Bool HardwareThread::Switch(HAL::StackFramePtr stack)
{
- /// provide 'nullptr' to free the stack frame.
- if (stack == nullptr)
- {
- delete fStack;
- fStack = nullptr;
-
- return true;
- }
-
- if (!hal_check_stack(stack))
- {
- return false;
- }
-
- if (fStack)
- {
- delete fStack;
- fStack = nullptr;
- }
-
fStack = stack;
hal_switch_context(fStack);
+ mp_do_context_switch(fStack);
return true;
}
@@ -120,28 +105,30 @@ namespace Kernel
return fWakeup;
}
- //! @brief Constructor and destructor
+ ///! @brief Internal Hardware Thread list.
+ STATIC HardwareThread cThreadList[cMaxHWThreads];
+
+ ///! @brief Constructor and destructors.
///! @brief Default constructor.
HardwareThreadScheduler::HardwareThreadScheduler()
{
- StringView strCoreName(512);
- strCoreName += "\\Class\\Smp\\MPClass";
+ kcout << "newoskrnl: initializing HardwareThreadScheduler." << endl;
- cSMPCoreName.GetKey() = strCoreName;
- cSMPCoreName.GetValue() = (UIntPtr)this;
+ cSMPCoreName.GetKey() += "Property\\MPClass";
+ cSMPCoreName.GetValue() = (PropertyId)this;
- kcout << "newoskrnl: initializing " << strCoreName.CData() << endl;
+ kcout << "newoskrnl: initialized HardwareThreadScheduler." << endl;
}
///! @brief Default destructor.
HardwareThreadScheduler::~HardwareThreadScheduler() = default;
/// @brief Shared singleton function
- Ref<HardwareThreadScheduler> HardwareThreadScheduler::The()
+ HardwareThreadScheduler& HardwareThreadScheduler::The()
{
- static HardwareThreadScheduler manager;
- return {manager};
+ STATIC HardwareThreadScheduler sched;
+ return sched;
}
/// @brief Get Stack Frame of Core