From 6ed8a39c1bd3083297b41e981a2bf4bdbe2abd1f Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Thu, 21 Nov 2024 08:50:57 +0100 Subject: 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 --- dev/ZKAKit/KernelKit/UserProcessScheduler.h | 37 +++++++++++++++++++---------- 1 file changed, 25 insertions(+), 12 deletions(-) (limited to 'dev/ZKAKit/KernelKit/UserProcessScheduler.h') 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 TheCurrentPID(); STATIC SizeT StartScheduling(); - STATIC Void InitScheduler(); }; const UInt32& sched_get_exit_code(void) noexcept; -- cgit v1.2.3