diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-11-05 09:34:00 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-11-05 09:34:00 +0100 |
| commit | b636137088923d092c3f0fa4221907fd43c34923 (patch) | |
| tree | 2d21e43349204866d17091cfb395cd2dd1b28a90 /dev/ZKAKit/KernelKit/UserProcessScheduler.h | |
| parent | 4e7ea02ed492a1fc0b167392361673244f957cce (diff) | |
IMP: Scheduler improvements, fixing stack issue of kernel now.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'dev/ZKAKit/KernelKit/UserProcessScheduler.h')
| -rw-r--r-- | dev/ZKAKit/KernelKit/UserProcessScheduler.h | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/dev/ZKAKit/KernelKit/UserProcessScheduler.h b/dev/ZKAKit/KernelKit/UserProcessScheduler.h index 9880b565..4f9b04e8 100644 --- a/dev/ZKAKit/KernelKit/UserProcessScheduler.h +++ b/dev/ZKAKit/KernelKit/UserProcessScheduler.h @@ -39,16 +39,18 @@ namespace Kernel typedef Int64 ProcessID; //! @brief Local Process name length. - inline constexpr SizeT kProcessLen = 4096U; + inline constexpr SizeT kProcessNameLen = 4096U; //! @brief Local Process status enum. enum class ProcessStatusKind : Int32 { + kInvalid, kStarting, kRunning, kKilled, kFrozen, - kDead + kDead, + kCount, }; //! @brief Affinity is the amount of nano-seconds this process is going @@ -134,17 +136,18 @@ namespace Kernel ~UserProcess(); public: - ZKA_COPY_DEFAULT(UserProcess) + ZKA_COPY_DEFAULT(UserProcess); public: - Char Name[kProcessLen] = {"Application Process (Unnamed)"}; + Char Name[kProcessNameLen] = {"Application Process (Unnamed)"}; ProcessSubsystem SubSystem{ProcessSubsystem::kProcessSubsystemInvalid}; User* Owner{nullptr}; HAL::StackFramePtr StackFrame{nullptr}; AffinityKind Affinity{AffinityKind::kStandard}; ProcessStatusKind Status{ProcessStatusKind::kDead}; UInt8* StackReserve{nullptr}; - ImagePtr Image{nullptr}; + ImagePtr Code{nullptr}; + ImagePtr ExecImg{nullptr}; SizeT StackSize{kSchedMaxStackSz}; IPEFDLLObject* PefDLLDelegate{nullptr}; SizeT MemoryCursor{0}; @@ -264,7 +267,7 @@ namespace Kernel UserProcessTeam& CurrentTeam(); public: - SizeT Add(UserProcess process); + ProcessID Add(UserProcess* process); const Bool Remove(ProcessID process_id); const Bool IsUser() override; @@ -289,10 +292,10 @@ namespace Kernel class UserProcessHelper final { public: - STATIC bool Switch(VoidPtr image_ptr, UInt8* stack_ptr, HAL::StackFramePtr frame_ptr, const PID& new_pid); - STATIC bool CanBeScheduled(const UserProcess& process); - STATIC PID& TheCurrentPID(); - STATIC SizeT StartScheduling(); + STATIC Bool Switch(VoidPtr image_ptr, UInt8* stack_ptr, HAL::StackFramePtr frame_ptr, const PID& new_pid); + STATIC Bool CanBeScheduled(const UserProcess& process); + STATIC ErrorOr<PID> TheCurrentPID(); + STATIC SizeT StartScheduling(); }; const UInt32& sched_get_exit_code(void) noexcept; |
