diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-11-21 08:50:57 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-11-21 08:51:40 +0100 |
| commit | 6ed8a39c1bd3083297b41e981a2bf4bdbe2abd1f (patch) | |
| tree | 183713eb331a92e4e1ce061263cf91a208c7c400 /dev/ZKAKit/KernelKit/UserProcessScheduler.h | |
| parent | 50439432a85976605dbb18e3cd2161f888d2e17d (diff) | |
IMP: Add UserProcessImage structure to hold the code/entrypoint of the process.
IMP: Use IDLLObject instead of IPEFDLLObject.
IMP: Refactor DeviceInterface to IDeviceObject.
ADD: rt_jump_to_address when you want to use a custom stack.
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 | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/dev/ZKAKit/KernelKit/UserProcessScheduler.h b/dev/ZKAKit/KernelKit/UserProcessScheduler.h index 1c9f4a94..808a8457 100644 --- a/dev/ZKAKit/KernelKit/UserProcessScheduler.h +++ b/dev/ZKAKit/KernelKit/UserProcessScheduler.h @@ -27,10 +27,10 @@ namespace Kernel { - //! @note Forward declarations. + //! @note Forward class declarations. class UserProcess; - class IPEFDLLObject; + class IDLLObject; class UserProcessTeam; class UserProcessScheduler; class UserProcessHelper; @@ -39,7 +39,8 @@ namespace Kernel typedef Int64 ProcessID; //! @brief Local Process name length. - inline constexpr SizeT kProcessNameLen = 129U; + inline constexpr SizeT kProcessNameLen = 128U; + inline constexpr ProcessID kProcessInvalidID = -1; //! @brief Local Process status enum. enum class ProcessStatusKind : Int32 @@ -123,18 +124,32 @@ namespace Kernel kRingCount = 5, }; - // Helper types. + /// @brief Helper type to describe a code image. using ImagePtr = VoidPtr; + struct UserProcessImage + { + ImagePtr fCode; + ImagePtr fBlob; + + operator bool() + { + return this->fCode; + } + + Bool HasImage() + { + return this->fBlob != nullptr; + } + }; + /// @name UserProcess - /// @brief User process header. + /// @brief User process class. /// Holds information about the running process/thread. class UserProcess final { public: - explicit UserProcess(VoidPtr start_image); - explicit UserProcess() = default; - + explicit UserProcess(); ~UserProcess(); public: @@ -148,10 +163,9 @@ namespace Kernel AffinityKind Affinity{AffinityKind::kStandard}; ProcessStatusKind Status{ProcessStatusKind::kDead}; UInt8* StackReserve{nullptr}; - ImagePtr Code{nullptr}; - ImagePtr ExecImg{nullptr}; + UserProcessImage Image; SizeT StackSize{kSchedMaxStackSz}; - IPEFDLLObject* PefDLLDelegate{nullptr}; + IDLLObject* PefDLLDelegate{nullptr}; SizeT MemoryCursor{0}; SizeT MemoryLimit{kSchedMaxMemoryLimit}; @@ -306,7 +320,6 @@ namespace Kernel STATIC Bool CanBeScheduled(const UserProcess& process); STATIC ErrorOr<PID> TheCurrentPID(); STATIC SizeT StartScheduling(); - STATIC Void InitScheduler(); }; const UInt32& sched_get_exit_code(void) noexcept; |
