diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-06-03 09:31:01 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-03 09:31:01 +0200 |
| commit | 6511afbf405c31513bc88ab06bca58218610a994 (patch) | |
| tree | e2509b7f9b59643b2a97773604aa383a2fd2e2f3 /dev/kernel/KernelKit | |
| parent | 5c0bb7ee7b1b0fee02cc179fb21f4c57a61d6c2d (diff) | |
| parent | bebcbe04c2b47b3b4fcdc093b1736cc0295109fe (diff) | |
Merge pull request #36 from nekernel-org/dev
0.0.3 — NeKernel
Diffstat (limited to 'dev/kernel/KernelKit')
| -rw-r--r-- | dev/kernel/KernelKit/CoreProcessScheduler.h | 4 | ||||
| -rw-r--r-- | dev/kernel/KernelKit/DebugOutput.h | 12 | ||||
| -rw-r--r-- | dev/kernel/KernelKit/DeviceMgr.h | 24 | ||||
| -rw-r--r-- | dev/kernel/KernelKit/UserMgr.h | 12 | ||||
| -rw-r--r-- | dev/kernel/KernelKit/UserProcessScheduler.h | 17 |
5 files changed, 36 insertions, 33 deletions
diff --git a/dev/kernel/KernelKit/CoreProcessScheduler.h b/dev/kernel/KernelKit/CoreProcessScheduler.h index 5ba29d3a..c06ef92c 100644 --- a/dev/kernel/KernelKit/CoreProcessScheduler.h +++ b/dev/kernel/KernelKit/CoreProcessScheduler.h @@ -130,7 +130,7 @@ enum class ProcessStatusKind : Int32 { //! @brief Affinity is the amount of nano-seconds this process is going to run. /***********************************************************************************/ enum class AffinityKind : Int32 { - kRealTime = 50, + kRealTime = 100, kVeryHigh = 150, kHigh = 200, kStandard = 1000, @@ -208,7 +208,7 @@ struct PROCESS_IMAGE final { Bool HasImage() const { return this->fBlob != nullptr; } - ErrorOr<ImagePtr> Leak() { + ErrorOr<ImagePtr> LeakImage() { if (this->fCode) { return ErrorOr<ImagePtr>{this->fCode}; } diff --git a/dev/kernel/KernelKit/DebugOutput.h b/dev/kernel/KernelKit/DebugOutput.h index 9598f590..de3bc997 100644 --- a/dev/kernel/KernelKit/DebugOutput.h +++ b/dev/kernel/KernelKit/DebugOutput.h @@ -37,9 +37,9 @@ inline TerminalDevice hex_number(const Long& x); // @brief Emulates a VT100 terminal. class TerminalDevice final NE_DEVICE<const Char*> { public: - TerminalDevice(void (*print)(IDeviceObject*, const Char*), - void (*gets)(IDeviceObject*, const Char*)) - : IDeviceObject<const Char*>(print, gets) {} + TerminalDevice(void (*print)(DeviceInterface*, const Char*), + void (*gets)(DeviceInterface*, const Char*)) + : DeviceInterface<const Char*>(print, gets) {} ~TerminalDevice() override; @@ -54,9 +54,9 @@ class TerminalDevice final NE_DEVICE<const Char*> { class Utf8TerminalDevice final NE_DEVICE<const Utf8Char*> { public: - Utf8TerminalDevice(void (*print)(IDeviceObject*, const Utf8Char*), - void (*gets)(IDeviceObject*, const Utf8Char*)) - : IDeviceObject<const Utf8Char*>(print, gets) {} + Utf8TerminalDevice(void (*print)(DeviceInterface*, const Utf8Char*), + void (*gets)(DeviceInterface*, const Utf8Char*)) + : DeviceInterface<const Utf8Char*>(print, gets) {} ~Utf8TerminalDevice() override; diff --git a/dev/kernel/KernelKit/DeviceMgr.h b/dev/kernel/KernelKit/DeviceMgr.h index 7c7b9da3..c6467190 100644 --- a/dev/kernel/KernelKit/DeviceMgr.h +++ b/dev/kernel/KernelKit/DeviceMgr.h @@ -24,13 +24,13 @@ #define kDeviceMgrRootDirPath "/devices/" -#define NE_DEVICE : public ::Kernel::IDeviceObject +#define NE_DEVICE : public ::Kernel::DeviceInterface // Last Rev: Wed, May 27, 2025 6:22 PM namespace Kernel { template <typename T> -class IDeviceObject; +class DeviceInterface; template <typename T> class IOBuf; @@ -39,24 +39,26 @@ class IOBuf; /// @brief Device contract interface, represents an HW device. /***********************************************************************************/ template <typename T> -class IDeviceObject { +class DeviceInterface { public: - explicit IDeviceObject(void (*Out)(IDeviceObject<T>*, T), void (*In)(IDeviceObject<T>*, T)) + DeviceInterface() = default; + + explicit DeviceInterface(void (*Out)(DeviceInterface<T>*, T), void (*In)(DeviceInterface<T>*, T)) : fOut(Out), fIn(In) {} - virtual ~IDeviceObject() = default; + virtual ~DeviceInterface() = default; public: - IDeviceObject& operator=(const IDeviceObject<T>&) = default; - IDeviceObject(const IDeviceObject<T>&) = default; + DeviceInterface& operator=(const DeviceInterface<T>&) = default; + DeviceInterface(const DeviceInterface<T>&) = default; public: - virtual IDeviceObject<T>& operator<<(T Data) { + virtual DeviceInterface<T>& operator<<(T Data) { fOut(this, Data); return *this; } - virtual IDeviceObject<T>& operator>>(T Data) { + virtual DeviceInterface<T>& operator>>(T Data) { fIn(this, Data); return *this; } @@ -68,8 +70,8 @@ class IDeviceObject { Bool operator!() { return !fOut || !fIn; } protected: - Void (*fOut)(IDeviceObject<T>*, T Data) = {nullptr}; - Void (*fIn)(IDeviceObject<T>*, T Data) = {nullptr}; + Void (*fOut)(DeviceInterface<T>*, T Data) = {nullptr}; + Void (*fIn)(DeviceInterface<T>*, T Data) = {nullptr}; }; /// diff --git a/dev/kernel/KernelKit/UserMgr.h b/dev/kernel/KernelKit/UserMgr.h index 82f8ca66..ef1cc659 100644 --- a/dev/kernel/KernelKit/UserMgr.h +++ b/dev/kernel/KernelKit/UserMgr.h @@ -20,8 +20,8 @@ #include <NeKit/Defines.h> #include <NeKit/KString.h> -///! We got the Super, Standard (%s format) and Guest user, -///! all are used to make authorization operations on the OS. +///! We got the MGMT, STD (%s format) and GUEST users, +///! all are used to make authorized operations. #define kSuperUser "OS AUTHORITY/MGMT/%s" #define kGuestUser "OS AUTHORITY/GUEST/%s" #define kStdUser "OS AUTHORITY/STD/%s" @@ -34,11 +34,11 @@ namespace Kernel { class User; -enum class UserRingKind { +enum class UserRingKind : Int32 { kRingInvalid = 0, - kRingStdUser = 1, - kRingSuperUser = 2, - kRingGuestUser = 5, + kRingStdUser = 444, + kRingSuperUser = 666, + kRingGuestUser = 777, kRingCount = 3, }; diff --git a/dev/kernel/KernelKit/UserProcessScheduler.h b/dev/kernel/KernelKit/UserProcessScheduler.h index 14986ab6..7c994726 100644 --- a/dev/kernel/KernelKit/UserProcessScheduler.h +++ b/dev/kernel/KernelKit/UserProcessScheduler.h @@ -125,7 +125,7 @@ class USER_PROCESS final { /***********************************************************************************/ //! @brief Gets the local exit code. /***********************************************************************************/ - const UInt32& GetExitCode() noexcept; + KPCError& GetExitCode() noexcept; /***********************************************************************************/ ///! @brief Get the process's name @@ -137,21 +137,22 @@ class USER_PROCESS final { //! @brief return local error code of process. //! @return Int32 local error code. /***********************************************************************************/ - Int32& GetLocalCode() noexcept; + KPCError& GetLocalCode() noexcept; const User* GetOwner() noexcept; const ProcessStatusKind& GetStatus() noexcept; const AffinityKind& GetAffinity() noexcept; private: - UInt32 fLastExitCode{0}; - Int32 fLocalCode{0}; + KPCError LastExitCode{0}; + KPCError LocalCode{0}; friend UserProcessScheduler; friend UserProcessHelper; }; typedef Array<USER_PROCESS, kSchedProcessLimitPerTeam> USER_PROCESS_ARRAY; +typedef Ref<USER_PROCESS> USER_PROCESS_REF; /// \brief Processs Team (contains multiple processes inside it.) /// Equivalent to a process batch @@ -168,9 +169,9 @@ class UserProcessTeam final { public: USER_PROCESS_ARRAY mProcessList; - Ref<USER_PROCESS> mCurrentProcess; + USER_PROCESS_REF mCurrentProcess; ProcessID mTeamId{0}; - ProcessID mProcessCount{0}; + ProcessID mProcessCur{0}; }; /***********************************************************************************/ @@ -204,8 +205,8 @@ class UserProcessScheduler final : public ISchedulable { Bool HasMP() override; public: - Ref<USER_PROCESS>& TheCurrentProcess(); - SizeT Run() noexcept; + USER_PROCESS_REF& TheCurrentProcess(); + SizeT Run() noexcept; public: STATIC UserProcessScheduler& The(); |
