From be11411ae7c2f6a2eda84abf56521d38a8b80b7e Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Thu, 4 Sep 2025 10:15:05 +0200 Subject: feat&fix: Kernel improvements and fixes, introduced `special` trees. fix: Protective measures against affinity `zero` processes. wip: WIP introduce `CFDictionary` object inside CF. fix: public tooling fixes. Signed-off-by: Amlal El Mahrouss --- dev/kernel/KernelKit/CoreProcessScheduler.h | 39 +++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) (limited to 'dev/kernel/KernelKit/CoreProcessScheduler.h') diff --git a/dev/kernel/KernelKit/CoreProcessScheduler.h b/dev/kernel/KernelKit/CoreProcessScheduler.h index 56c2bce0..9ed2dada 100644 --- a/dev/kernel/KernelKit/CoreProcessScheduler.h +++ b/dev/kernel/KernelKit/CoreProcessScheduler.h @@ -104,6 +104,40 @@ struct PROCESS_FILE_TREE { }; }; +using ProcessCtx = UInt32; + +template +struct PROCESS_SPECIAL_TREE { + static constexpr auto kHeap = false; + static constexpr auto kFile = false; + static constexpr auto kSpecial = true; + + T Entry{nullptr}; + SizeT EntrySize{0UL}; + SizeT EntryPad{0UL}; + + /// @brief a context is where the resource comes from. + ProcessCtx EntryContext{0UL}; // could be a socket, printer, device... + + UInt32 Color{kBlackTreeKind}; + + struct PROCESS_SPECIAL_TREE* Parent { + nullptr + }; + + struct PROCESS_SPECIAL_TREE* Child { + nullptr + }; + + struct PROCESS_SPECIAL_TREE* Prev { + nullptr + }; + + struct PROCESS_SPECIAL_TREE* Next { + nullptr + }; +}; + /***********************************************************************************/ /// @brief Subsystem enum type. /***********************************************************************************/ @@ -113,8 +147,8 @@ enum class ProcessSubsystem : Int32 { kProcessSubsystemUser, kProcessSubsystemService, kProcessSubsystemDriver, + kProcessSubsystemCount = kProcessSubsystemDriver - kProcessSubsystemSecurity + 1, kProcessSubsystemInvalid = 0xFFFFFFF, - kProcessSubsystemCount = 4, }; /***********************************************************************************/ @@ -127,13 +161,14 @@ enum class ProcessStatusKind : Int32 { kKilled, kFrozen, kFinished, - kCount = 6, + kCount = kFinished - kStarting + 1, }; /***********************************************************************************/ //! @brief Affinity is the amount of nano-seconds this process is going to run. /***********************************************************************************/ enum class AffinityKind : Int32 { + kInvalid = 0, kRealTime = 100, kVeryHigh = 150, kHigh = 200, -- cgit v1.2.3