diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-09-03 16:59:52 +0200 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-09-03 17:00:50 +0200 |
| commit | 74687def5fa5f8eb69a59608a14f9f0a4bf5602e (patch) | |
| tree | b3af8c110033c587f1881df58e5aeb8097bb5f2c /dev/ZKA | |
| parent | 441c1460b29f5003a5478032f17a6c5f486dd1fd (diff) | |
[ UPD ] Refactor kernel.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'dev/ZKA')
| -rw-r--r-- | dev/ZKA/KernelKit/UserProcessScheduler.hxx | 10 | ||||
| -rw-r--r-- | dev/ZKA/Sources/Semaphore.cxx | 2 | ||||
| -rw-r--r-- | dev/ZKA/Sources/ThreadLocalStorage.cxx | 4 | ||||
| -rw-r--r-- | dev/ZKA/Sources/UserProcessScheduler.cxx | 14 |
4 files changed, 15 insertions, 15 deletions
diff --git a/dev/ZKA/KernelKit/UserProcessScheduler.hxx b/dev/ZKA/KernelKit/UserProcessScheduler.hxx index c779a8c6..6ea99987 100644 --- a/dev/ZKA/KernelKit/UserProcessScheduler.hxx +++ b/dev/ZKA/KernelKit/UserProcessScheduler.hxx @@ -40,7 +40,7 @@ namespace Kernel inline constexpr SizeT kProcessLen = 256U; //! @brief UserProcess status enum. - enum class ProcessStatus : Int32 + enum class ProcessStatusKind : Int32 { kStarting, kRunning, @@ -138,7 +138,7 @@ namespace Kernel ZKA_COPY_DEFAULT(UserProcess) public: - void SetImageStart(VoidPtr imageStart) noexcept; + Void SetImageStart(VoidPtr imageStart) noexcept; const UInt32& GetExitCode() noexcept; public: @@ -147,7 +147,7 @@ namespace Kernel User* Owner{nullptr}; HAL::StackFramePtr StackFrame{nullptr}; AffinityKind Affinity{AffinityKind::kStandard}; - ProcessStatus Status{ProcessStatus::kDead}; + ProcessStatusKind Status{ProcessStatusKind::kDead}; UInt8* StackReserve{nullptr}; // Memory, images pointers. @@ -181,7 +181,7 @@ namespace Kernel //! @brief boolean operator, check status. operator bool() { - return Status != ProcessStatus::kDead; + return Status != ProcessStatusKind::kDead; } ///! @brief Crashes the app, exits with code ~0. @@ -213,7 +213,7 @@ namespace Kernel Int32& GetLocalCode() noexcept; const User* GetOwner() noexcept; - const ProcessStatus& GetStatus() noexcept; + const ProcessStatusKind& GetStatus() noexcept; const AffinityKind& GetAffinity() noexcept; private: diff --git a/dev/ZKA/Sources/Semaphore.cxx b/dev/ZKA/Sources/Semaphore.cxx index 9181443e..3e30cc31 100644 --- a/dev/ZKA/Sources/Semaphore.cxx +++ b/dev/ZKA/Sources/Semaphore.cxx @@ -52,7 +52,7 @@ namespace Kernel { while (fLockingProcess) { - if (fLockingProcess->GetStatus() != ProcessStatus::kRunning) + if (fLockingProcess->GetStatus() != ProcessStatusKind::kRunning) { this->Unlock(); break; diff --git a/dev/ZKA/Sources/ThreadLocalStorage.cxx b/dev/ZKA/Sources/ThreadLocalStorage.cxx index 3a60f36c..f4794bdd 100644 --- a/dev/ZKA/Sources/ThreadLocalStorage.cxx +++ b/dev/ZKA/Sources/ThreadLocalStorage.cxx @@ -29,7 +29,7 @@ namespace Detail STATIC constexpr SizeT cMaxLen = 256; Char fName[cMaxLen] = {"THREAD #0 (PROCESS 0)"}; - ProcessStatus fThreadStatus; + ProcessStatusKind fThreadStatus; Int64 fThreadID; UIntPtr fCode{0}; UIntPtr fStack{0}; @@ -37,7 +37,7 @@ namespace Detail Void Exit() noexcept { - this->fThreadStatus = ProcessStatus::kKilled; + this->fThreadStatus = ProcessStatusKind::kKilled; } UIntPtr GetStack() noexcept diff --git a/dev/ZKA/Sources/UserProcessScheduler.cxx b/dev/ZKA/Sources/UserProcessScheduler.cxx index cd8ec150..1d49ff5c 100644 --- a/dev/ZKA/Sources/UserProcessScheduler.cxx +++ b/dev/ZKA/Sources/UserProcessScheduler.cxx @@ -80,7 +80,7 @@ namespace Kernel void UserProcess::Wake(const bool should_wakeup) { this->Status = - should_wakeup ? ProcessStatus::kRunning : ProcessStatus::kFrozen; + should_wakeup ? ProcessStatusKind::kRunning : ProcessStatusKind::kFrozen; } /***********************************************************************************/ @@ -164,7 +164,7 @@ namespace Kernel } /// @brief UserProcess status getter. - const ProcessStatus& UserProcess::GetStatus() noexcept + const ProcessStatusKind& UserProcess::GetStatus() noexcept { return this->Status; } @@ -184,7 +184,7 @@ namespace Kernel */ void UserProcess::Exit(const Int32& exit_code) { - this->Status = ProcessStatus::kDead; + this->Status = ProcessStatusKind::kDead; fLastExitCode = exit_code; cLastExitCode = exit_code; @@ -272,7 +272,7 @@ namespace Kernel } } - process.Status = ProcessStatus::kStarting; + process.Status = ProcessStatusKind::kStarting; process.ProcessId = mTeam.mProcessAmount; @@ -313,7 +313,7 @@ namespace Kernel kcout << "UserProcessScheduler: Removing process...\r"; - mTeam.AsArray()[processSlot].Status = ProcessStatus::kDead; + mTeam.AsArray()[processSlot].Status = ProcessStatusKind::kDead; --mTeam.mProcessAmount; return true; @@ -391,8 +391,8 @@ namespace Kernel /// @retval false cannot be schedulded. bool UserProcessHelper::CanBeScheduled(UserProcess& process) { - if (process.Status == ProcessStatus::kFrozen || - process.Status == ProcessStatus::kDead) + if (process.Status == ProcessStatusKind::kFrozen || + process.Status == ProcessStatusKind::kDead) return false; if (process.Kind == UserProcess::kDLLKind) |
