diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2026-01-11 17:48:17 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2026-01-11 17:48:17 +0100 |
| commit | e3b0df6ae2a5cd1f98400f671c374b5955bd0bcc (patch) | |
| tree | 1aa8346d564da8d08097dd4eec3b5216877b036c | |
| parent | 878919d80864301328f3e9c471fe2dce2a8ea61d (diff) | |
chore: kernel: specs fixes and kernel API impl improvements.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
| -rw-r--r-- | doc/specs/SPECIFICATION_FWRK.md | 2 | ||||
| -rw-r--r-- | doc/specs/SPECIFICATION_MACROS.md (renamed from doc/specs/SPECFICATION_MACROS.md) | 18 | ||||
| -rw-r--r-- | src/kernel/KernelKit/TraceSrv.h | 4 | ||||
| -rw-r--r-- | src/kernel/NeKit/Atom.h | 9 | ||||
| -rw-r--r-- | src/kernel/NeKit/Function.h | 17 |
5 files changed, 35 insertions, 15 deletions
diff --git a/doc/specs/SPECIFICATION_FWRK.md b/doc/specs/SPECIFICATION_FWRK.md index e7366987..6d965ef5 100644 --- a/doc/specs/SPECIFICATION_FWRK.md +++ b/doc/specs/SPECIFICATION_FWRK.md @@ -9,7 +9,7 @@ =================================== -# 1: The specification: +# 1: Specification: =================================== diff --git a/doc/specs/SPECFICATION_MACROS.md b/doc/specs/SPECIFICATION_MACROS.md index 08c57447..3b5cdf2d 100644 --- a/doc/specs/SPECFICATION_MACROS.md +++ b/doc/specs/SPECIFICATION_MACROS.md @@ -1,12 +1,24 @@ -# Configuration Macros of NeKernel. +=================================== -## NeKernel +# 0: General Information: + +=================================== + +=================================== + +# NeKernel + +=================================== - `__nekernel_max_cores` -> Max SMP cores usable by NeKernel's scheduler. - `__nekernel_boot_core_index` -> Index of the boot core (0, 1, or 3). - `__nekernel_allow_non_nekernel_pe` -> Allow non-subsystem 17 to run on NeKernel. -## KernelTest: +=================================== + +# KernelTest + +=================================== - `__KT_TEST_MAIN` -> KernelTest entrypoint symbol. - `KT_TESTING_ENABLED` -> Program is running under testing constraints. diff --git a/src/kernel/KernelKit/TraceSrv.h b/src/kernel/KernelKit/TraceSrv.h index 5a9d365c..1118e0d9 100644 --- a/src/kernel/KernelKit/TraceSrv.h +++ b/src/kernel/KernelKit/TraceSrv.h @@ -9,7 +9,8 @@ namespace Kernel { -namespace Detail { +namespace TraceSrv { + inline constexpr auto kDebugCmdLen = 256U; inline constexpr auto kDebugPort = 51820; /// \brief Debug Magic Value @@ -17,6 +18,7 @@ namespace Detail { inline constexpr auto kDebugVersion = 0x0100; inline constexpr auto kDebugDelim = ';'; inline constexpr auto kDebugEnd = '\r'; + } // namespace Detail } // namespace Kernel diff --git a/src/kernel/NeKit/Atom.h b/src/kernel/NeKit/Atom.h index 9d6e9f24..3dedea32 100644 --- a/src/kernel/NeKit/Atom.h +++ b/src/kernel/NeKit/Atom.h @@ -1,13 +1,14 @@ -// Copyright 2024-2025, Amlal El Mahrouss (amlal@nekernel.org) +// Copyright 2024-2026, Amlal El Mahrouss (amlal@nekernel.org) // Licensed under the Apache License, Version 2.0 (see LICENSE file) // Official repository: https://github.com/nekernel-org/nekernel -#ifndef __NE_KIT_ATOM_H__ -#define __NE_KIT_ATOM_H__ +#ifndef NEKIT_ATOM_H +#define NEKIT_ATOM_H #include <NeKit/Config.h> namespace Kernel { + template <class TypeAtomic> class Atom final { public: @@ -24,6 +25,7 @@ class Atom final { const TypeAtomic& operator[](const SizeT& bit) { return (fArrayOfAtoms & (1 << bit)); } void operator|(const SizeT& bit) { fArrayOfAtoms |= (1 << bit); } + Atom& operator|=(const SizeT& bit) { this->operator|(bit); return *this; @@ -39,6 +41,7 @@ class Atom final { private: TypeAtomic fArrayOfAtoms; }; + } // namespace Kernel #endif diff --git a/src/kernel/NeKit/Function.h b/src/kernel/NeKit/Function.h index d32c0f46..77d9aa23 100644 --- a/src/kernel/NeKit/Function.h +++ b/src/kernel/NeKit/Function.h @@ -1,4 +1,4 @@ -// Copyright 2024-2025, Amlal El Mahrouss (amlal@nekernel.org) +// Copyright 2024-2026, Amlal El Mahrouss (amlal@nekernel.org) // Licensed under the Apache License, Version 2.0 (see LICENSE file) // Official repository: https://github.com/nekernel-org/nekernel @@ -9,22 +9,21 @@ #include <NeKit/ErrorOr.h> namespace Kernel { -/// ================================================================================ -/// @brief Function wrapper class. -/// ================================================================================ + +/// @brief Function Pointer Container. template <typename T, typename... Args> class Function final { public: Function() = delete; Function(nullPtr) = delete; - ~Function() = default; - explicit Function(T (*Fn)(Args... args)) : fFn(Fn) { MUST_PASS(fFn); } + ~Function() = default; + Function(T (*Fn)(Args... args)) : fFn(Fn) { MUST_PASS(fFn); } Function& operator=(const Function&) = delete; Function(const Function&) = delete; - T operator()(Args&&... args) { return fFn(args...); } + T operator()(Args&&... args) { return fFn(forward<Args...>(args)...); } explicit operator bool() { return fFn; } bool operator!() { return !fFn; } @@ -35,6 +34,10 @@ class Function final { template <typename T, typename... Args> using FunctionOr = ErrorOr<Function<T, Args...>>; + +template <typename T, typename... Args> +using FunctionRef = Ref<Function<T, Args...>>; + } // namespace Kernel #endif |
