summaryrefslogtreecommitdiffhomepage
path: root/dev/kernel/KernelKit
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-09-04 10:15:05 +0200
committerAmlal El Mahrouss <amlal@nekernel.org>2025-09-04 10:15:05 +0200
commitbe11411ae7c2f6a2eda84abf56521d38a8b80b7e (patch)
treee42a87f76dee6a123ba02f2014f563464af93ba9 /dev/kernel/KernelKit
parentce27bc968ba425eaa7f27091b704b6519b4b978b (diff)
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 <amlal@nekernel.org>
Diffstat (limited to 'dev/kernel/KernelKit')
-rw-r--r--dev/kernel/KernelKit/CoreProcessScheduler.h39
-rw-r--r--dev/kernel/KernelKit/ZXD.h9
2 files changed, 46 insertions, 2 deletions
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 <typename T>
+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<T>* Parent {
+ nullptr
+ };
+
+ struct PROCESS_SPECIAL_TREE<T>* Child {
+ nullptr
+ };
+
+ struct PROCESS_SPECIAL_TREE<T>* Prev {
+ nullptr
+ };
+
+ struct PROCESS_SPECIAL_TREE<T>* 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,
diff --git a/dev/kernel/KernelKit/ZXD.h b/dev/kernel/KernelKit/ZXD.h
index f1c99a21..966c54c7 100644
--- a/dev/kernel/KernelKit/ZXD.h
+++ b/dev/kernel/KernelKit/ZXD.h
@@ -15,6 +15,12 @@ namespace Kernel {
struct ZXD_EXEC_HEADER;
struct ZXD_STUB_HEADER;
+enum ZXD_FLAGS {
+ kZXDFlagsInvalid,
+ kZXDFlagsDriver,
+ kZXDFlagsCount,
+};
+
/// @brief ZXD executable header
/// @details This header is used to identify ZXD executable files.
struct PACKED ZXD_EXEC_HEADER {
@@ -41,4 +47,7 @@ struct PACKED ZXD_STUB_HEADER {
UInt32 fStubOffset;
UInt32 fStubCRC32;
};
+
+using ZXD_EXEC_HEADER_PTR = ZXD_EXEC_HEADER*;
+using ZXD_STUB_HEADER_PTR = ZXD_STUB_HEADER*;
} // namespace Kernel