summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-09-04 11:54:55 +0200
committerGitHub <noreply@github.com>2025-09-04 11:54:55 +0200
commit0f88e96c0cf7ffaccecae94794024164c510f735 (patch)
tree66ebc7e2cb99a0e54ca7b2da4b617ceed6e98a3d
parentaead694f3cada63e4dc2d79653a5b0efe0d9f49f (diff)
parent77dc0a650819b460480e1c0be5409fc322a6d2a4 (diff)
Merge pull request #61 from nekernel-org/devv0.0.5
NeKernel: v0.0.5 (Arlington)
-rw-r--r--.gitignore3
-rw-r--r--dev/kernel/HALKit/ARM64/HalHandoverStub.s6
-rw-r--r--dev/kernel/KernelKit/CoreProcessScheduler.h55
-rw-r--r--dev/kernel/KernelKit/ZXD.h9
-rw-r--r--dev/kernel/src/FS/HeFS+FileSystemParser.cc5
-rw-r--r--dev/kernel/src/UserProcessScheduler.cc1
-rw-r--r--public/frameworks/CoreFoundation.fwrk/headers/Array.h2
-rw-r--r--public/frameworks/CoreFoundation.fwrk/headers/Dictionary.h40
-rw-r--r--public/tools/diutil/dist/.touch0
-rw-r--r--public/tools/ld.dyn/dist/.touch0
-rw-r--r--public/tools/ld.fwrk/dist/.touch0
-rw-r--r--public/tools/mgmt.oe/dist/.keep0
-rw-r--r--public/tools/mk.fwrk/dist/.touch0
-rw-r--r--public/tools/mk.hefs/dist/.touch0
-rw-r--r--public/tools/mk.nefs/dist/.touch0
-rw-r--r--public/tools/ping/dist/.touch0
16 files changed, 104 insertions, 17 deletions
diff --git a/.gitignore b/.gitignore
index 781e9544..1058abb8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -14,9 +14,6 @@ xcuserdata/
*/xcuserdata/*
*.xcworkspacedata
-public/tools/*/dist/*
-public/frameworks/*/dist/*
-
*.pdf
*.aux
diff --git a/dev/kernel/HALKit/ARM64/HalHandoverStub.s b/dev/kernel/HALKit/ARM64/HalHandoverStub.s
index 0f73cf7b..7c70ebfd 100644
--- a/dev/kernel/HALKit/ARM64/HalHandoverStub.s
+++ b/dev/kernel/HALKit/ARM64/HalHandoverStub.s
@@ -9,7 +9,11 @@
.section .ldr
+ ;; MAGIC
.quad 0xDAB4
+ ;; VERSION (1.0.0)
.word 100
+ ;; CPU (ARM64)
.word 0
-.word 122 \ No newline at end of file
+ ;; TYPE (KERNEL)
+.word 122
diff --git a/dev/kernel/KernelKit/CoreProcessScheduler.h b/dev/kernel/KernelKit/CoreProcessScheduler.h
index 56c2bce0..f40ffc81 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,
@@ -147,29 +182,29 @@ enum class AffinityKind : Int32 {
/***********************************************************************************/
inline bool operator<(AffinityKind lhs, AffinityKind rhs) {
- Int32 lhs_int = static_cast<Int>(lhs);
- Int32 rhs_int = static_cast<Int>(rhs);
+ Int32 lhs_int = static_cast<Int32>(lhs);
+ Int32 rhs_int = static_cast<Int32>(rhs);
return lhs_int < rhs_int;
}
inline bool operator>(AffinityKind lhs, AffinityKind rhs) {
- Int32 lhs_int = static_cast<Int>(lhs);
- Int32 rhs_int = static_cast<Int>(rhs);
+ Int32 lhs_int = static_cast<Int32>(lhs);
+ Int32 rhs_int = static_cast<Int32>(rhs);
return lhs_int > rhs_int;
}
inline bool operator<=(AffinityKind lhs, AffinityKind rhs) {
Int32 lhs_int = static_cast<Int>(lhs);
- Int32 rhs_int = static_cast<Int>(rhs);
+ Int32 rhs_int = static_cast<Int32>(rhs);
return lhs_int <= rhs_int;
}
inline bool operator>=(AffinityKind lhs, AffinityKind rhs) {
- Int32 lhs_int = static_cast<Int>(lhs);
- Int32 rhs_int = static_cast<Int>(rhs);
+ Int32 lhs_int = static_cast<Int32>(lhs);
+ Int32 rhs_int = static_cast<Int32>(rhs);
return lhs_int >= rhs_int;
}
@@ -178,7 +213,7 @@ using PTime = UInt64;
using ProcessTime = PTime;
/***********************************************************************************/
-//! @brief Local Process identifier.
+//! @brief Local Process Identifier type.
/***********************************************************************************/
using ProcessID = Int64;
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
diff --git a/dev/kernel/src/FS/HeFS+FileSystemParser.cc b/dev/kernel/src/FS/HeFS+FileSystemParser.cc
index f1531b4c..86f929c0 100644
--- a/dev/kernel/src/FS/HeFS+FileSystemParser.cc
+++ b/dev/kernel/src/FS/HeFS+FileSystemParser.cc
@@ -88,7 +88,8 @@ namespace Detail {
/// @brief Simple algorithm to hash directory entries for INDs.
/// @param path the directory path.
/// @return The hashed path.
- STATIC UInt64 hefsi_hash_64(const Utf8Char* path) {
+ template <typename CharT = Utf8Char>
+ STATIC UInt64 hefsi_hash_64(const CharT* path) {
if (!path || *path == 0) return 0;
const UInt64 kFnvBaseOffset = 0xcbf29ce484222325ULL;
@@ -97,7 +98,7 @@ namespace Detail {
UInt64 hash = kFnvBaseOffset;
while (*path) {
- hash ^= (Utf8Char) (*path++);
+ hash ^= (CharT) (*path++);
hash *= kFnvPrimeNumber;
}
diff --git a/dev/kernel/src/UserProcessScheduler.cc b/dev/kernel/src/UserProcessScheduler.cc
index 15da4431..174862a4 100644
--- a/dev/kernel/src/UserProcessScheduler.cc
+++ b/dev/kernel/src/UserProcessScheduler.cc
@@ -587,6 +587,7 @@ ErrorOr<ProcessID> UserProcessHelper::TheCurrentPID() {
/// @retval false cannot be schedulded.
Bool UserProcessHelper::CanBeScheduled(const USER_PROCESS& process) {
if (process.Status != ProcessStatusKind::kRunning) return No;
+ if (process.Affinity == AffinityKind::kInvalid) return No;
if (process.StackSize > kSchedMaxStackSz) return No;
if (!process.Name[0]) return No;
diff --git a/public/frameworks/CoreFoundation.fwrk/headers/Array.h b/public/frameworks/CoreFoundation.fwrk/headers/Array.h
index d9c528d9..81f5f064 100644
--- a/public/frameworks/CoreFoundation.fwrk/headers/Array.h
+++ b/public/frameworks/CoreFoundation.fwrk/headers/Array.h
@@ -46,7 +46,7 @@ class CFArray final {
};
template <typename ValueType>
-auto make_array(ValueType val) {
+inline auto make_array(ValueType val) {
return CFArray<ValueType, ARRAY_SIZE(val)>{val};
}
} // namespace CF
diff --git a/public/frameworks/CoreFoundation.fwrk/headers/Dictionary.h b/public/frameworks/CoreFoundation.fwrk/headers/Dictionary.h
new file mode 100644
index 00000000..87496c73
--- /dev/null
+++ b/public/frameworks/CoreFoundation.fwrk/headers/Dictionary.h
@@ -0,0 +1,40 @@
+/* -------------------------------------------
+
+ Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved.
+
+------------------------------------------- */
+
+#pragma once
+
+#include <libSystem/SystemKit/System.h>
+
+namespace CF {
+template <typename Key, typename Value>
+class CFDictionary final {
+ public:
+ explicit CFDictionary() = default;
+ ~CFDictionary() = default;
+
+ CFDictionary& operator=(const CFDictionary&) = default;
+ CFDictionary(const CFDictionary&) = default;
+
+ Value& operator[](Key& at) {
+ MUST_PASS(this->Find(at));
+ return fArray[at];
+ }
+
+ Bool Empty() { return this->fCount > 0; }
+
+ Bool Find(Key& key) { return No; }
+
+ operator bool() { return !this->Empty(); }
+
+ private:
+ SizeT fCount{0UL};
+};
+
+template <typename KeyType, typename ValueType>
+inline auto make_dict() {
+ return CFDictionary<KeyType, ValueType>{};
+}
+} // namespace CF
diff --git a/public/tools/diutil/dist/.touch b/public/tools/diutil/dist/.touch
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/public/tools/diutil/dist/.touch
diff --git a/public/tools/ld.dyn/dist/.touch b/public/tools/ld.dyn/dist/.touch
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/public/tools/ld.dyn/dist/.touch
diff --git a/public/tools/ld.fwrk/dist/.touch b/public/tools/ld.fwrk/dist/.touch
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/public/tools/ld.fwrk/dist/.touch
diff --git a/public/tools/mgmt.oe/dist/.keep b/public/tools/mgmt.oe/dist/.keep
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/public/tools/mgmt.oe/dist/.keep
diff --git a/public/tools/mk.fwrk/dist/.touch b/public/tools/mk.fwrk/dist/.touch
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/public/tools/mk.fwrk/dist/.touch
diff --git a/public/tools/mk.hefs/dist/.touch b/public/tools/mk.hefs/dist/.touch
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/public/tools/mk.hefs/dist/.touch
diff --git a/public/tools/mk.nefs/dist/.touch b/public/tools/mk.nefs/dist/.touch
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/public/tools/mk.nefs/dist/.touch
diff --git a/public/tools/ping/dist/.touch b/public/tools/ping/dist/.touch
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/public/tools/ping/dist/.touch