diff options
| -rw-r--r-- | Kernel/KernelKit/MPManager.hpp (renamed from Kernel/KernelKit/SMPManager.hpp) | 24 | ||||
| -rw-r--r-- | Kernel/Sources/MPManager.cxx (renamed from Kernel/Sources/SMPManager.cxx) | 28 | ||||
| -rw-r--r-- | Kernel/Sources/ProcessScheduler.cxx | 20 |
3 files changed, 36 insertions, 36 deletions
diff --git a/Kernel/KernelKit/SMPManager.hpp b/Kernel/KernelKit/MPManager.hpp index a7af05d9..6f23dd66 100644 --- a/Kernel/KernelKit/SMPManager.hpp +++ b/Kernel/KernelKit/MPManager.hpp @@ -4,8 +4,8 @@ ------------------------------------------- */ -#ifndef __INC_SMP_MANAGER_HPP__ -#define __INC_SMP_MANAGER_HPP__ +#ifndef __INC_MP_MANAGER_HPP__ +#define __INC_MP_MANAGER_HPP__ #include <ArchKit/ArchKit.hpp> #include <CompilerKit/CompilerKit.hxx> @@ -65,30 +65,30 @@ namespace Kernel const ThreadID& ID() noexcept; private: - HAL::StackFrame* fStack; + HAL::StackFrame* fStack{nullptr}; ThreadKind fKind; ThreadID fID; + ProcessID fSourcePID; bool fWakeup; bool fBusy; - Int64 fPID; private: - friend class SMPManager; + friend class MPManager; }; /// - /// \name SMPManager + /// \name MPManager /// @brief Multi processor manager to manage other cores and dispatch tasks. /// - class SMPManager final + class MPManager final { private: - explicit SMPManager(); + explicit MPManager(); public: - ~SMPManager(); - NEWOS_COPY_DEFAULT(SMPManager); + ~MPManager(); + NEWOS_COPY_DEFAULT(MPManager); public: bool Switch(HAL::StackFramePtr the); @@ -102,7 +102,7 @@ namespace Kernel public: /// @brief Shared instance of the SMP Manager. /// @return the reference to the smp manager. - static Ref<SMPManager> The(); + static Ref<MPManager> The(); public: /// @brief Returns the amount of threads present in the system. @@ -123,4 +123,4 @@ namespace Kernel Void rt_hang_thread(HAL::StackFramePtr stack); } // namespace Kernel -#endif // !__INC_SMP_MANAGER_HPP__ +#endif // !__INC_MP_MANAGER_HPP__ diff --git a/Kernel/Sources/SMPManager.cxx b/Kernel/Sources/MPManager.cxx index 155a1f86..d8faa983 100644 --- a/Kernel/Sources/SMPManager.cxx +++ b/Kernel/Sources/MPManager.cxx @@ -6,12 +6,12 @@ #include <ArchKit/ArchKit.hpp> #include <KernelKit/ProcessScheduler.hxx> -#include <KernelKit/SMPManager.hpp> +#include <KernelKit/MPManager.hpp> #include <CFKit/Property.hpp> ///! BUGS: 0 -///! @file SMPManager.cxx +///! @file MPManager.cxx ///! @brief This file handles multi processing in Kernel. ///! @brief Multi processing is needed for multi-tasking operations. @@ -120,7 +120,7 @@ namespace Kernel //! @brief Constructor and destructor ///! @brief Default constructor. - SMPManager::SMPManager() + MPManager::MPManager() { StringView strCoreName(512); strCoreName += "\\Properties\\Smp\\SchedulerClass"; @@ -132,28 +132,28 @@ namespace Kernel } ///! @brief Default destructor. - SMPManager::~SMPManager() = default; + MPManager::~MPManager() = default; /// @brief Shared singleton function - Ref<SMPManager> SMPManager::The() + Ref<MPManager> MPManager::The() { - static SMPManager manager; + static MPManager manager; return {manager}; } /// @brief Get Stack Frame of Core - HAL::StackFramePtr SMPManager::Leak() noexcept + HAL::StackFramePtr MPManager::Leak() noexcept { if (fThreadList[fCurrentThread].Leak() && ProcessHelper::TheCurrentPID() == - fThreadList[fCurrentThread].Leak().Leak()->fPID) + fThreadList[fCurrentThread].Leak().Leak()->fSourcePID) return fThreadList[fCurrentThread].Leak().Leak()->fStack; return nullptr; } /// @brief Finds and switch to a free core. - bool SMPManager::Switch(HAL::StackFramePtr stack) + bool MPManager::Switch(HAL::StackFramePtr stack) { if (stack == nullptr) return false; @@ -188,7 +188,7 @@ namespace Kernel fThreadList[idx].Leak().Leak()->Switch(fThreadList[idx].Leak().Leak()->fStack); - fThreadList[idx].Leak().Leak()->fPID = ProcessHelper::TheCurrentPID(); + fThreadList[idx].Leak().Leak()->fSourcePID = ProcessHelper::TheCurrentPID(); fThreadList[idx].Leak().Leak()->Busy(false); @@ -203,7 +203,7 @@ namespace Kernel * @param idx the index * @return the reference to the hardware thread. */ - Ref<HardwareThread*> SMPManager::operator[](const SizeT& idx) + Ref<HardwareThread*> MPManager::operator[](const SizeT& idx) { if (idx == 0) { @@ -233,7 +233,7 @@ namespace Kernel * Check if thread pool isn't empty. * @return */ - SMPManager::operator bool() noexcept + MPManager::operator bool() noexcept { return !fThreadList.Empty(); } @@ -242,14 +242,14 @@ namespace Kernel * Reverse operator bool * @return */ - bool SMPManager::operator!() noexcept + bool MPManager::operator!() noexcept { return fThreadList.Empty(); } /// @brief Returns the amount of core present. /// @return the number of cores. - SizeT SMPManager::Count() noexcept + SizeT MPManager::Count() noexcept { return fThreadList.Count(); } diff --git a/Kernel/Sources/ProcessScheduler.cxx b/Kernel/Sources/ProcessScheduler.cxx index b5be1dd2..cccd8979 100644 --- a/Kernel/Sources/ProcessScheduler.cxx +++ b/Kernel/Sources/ProcessScheduler.cxx @@ -10,7 +10,7 @@ /***********************************************************************************/ #include <KernelKit/ProcessScheduler.hxx> -#include <KernelKit/SMPManager.hpp> +#include <KernelKit/MPManager.hpp> #include <KernelKit/Heap.hxx> #include <NewKit/String.hpp> #include <KernelKit/LPC.hxx> @@ -382,29 +382,29 @@ namespace Kernel if (!the_stack || new_pid < 0) return false; - for (SizeT index = 0UL; index < SMPManager::The().Leak().Count(); ++index) + for (SizeT index = 0UL; index < MPManager::The().Leak().Count(); ++index) { - if (SMPManager::The().Leak()[index].Leak()->Kind() == kInvalidHart) + if (MPManager::The().Leak()[index].Leak()->Kind() == kInvalidHart) continue; - if (SMPManager::The().Leak()[index].Leak()->StackFrame() == the_stack) + if (MPManager::The().Leak()[index].Leak()->StackFrame() == the_stack) { - SMPManager::The().Leak()[index].Leak()->Busy(false); + MPManager::The().Leak()[index].Leak()->Busy(false); continue; } - if (SMPManager::The().Leak()[index].Leak()->IsBusy()) + if (MPManager::The().Leak()[index].Leak()->IsBusy()) continue; - if (SMPManager::The().Leak()[index].Leak()->Kind() != + if (MPManager::The().Leak()[index].Leak()->Kind() != ThreadKind::kHartBoot && - SMPManager::The().Leak()[index].Leak()->Kind() != + MPManager::The().Leak()[index].Leak()->Kind() != ThreadKind::kHartSystemReserved) { - SMPManager::The().Leak()[index].Leak()->Busy(true); + MPManager::The().Leak()[index].Leak()->Busy(true); ProcessHelper::TheCurrentPID() = new_pid; - return SMPManager::The().Leak()[index].Leak()->Switch(the_stack); + return MPManager::The().Leak()[index].Leak()->Switch(the_stack); } } |
