diff options
Diffstat (limited to 'src/kernel/KernelKit')
| -rw-r--r-- | src/kernel/KernelKit/BinaryMutex.h | 5 | ||||
| -rw-r--r-- | src/kernel/KernelKit/CoreProcessScheduler.h | 2 | ||||
| -rw-r--r-- | src/kernel/KernelKit/DebugOutput.h | 4 | ||||
| -rw-r--r-- | src/kernel/KernelKit/DriveMgr.h | 6 | ||||
| -rw-r--r-- | src/kernel/KernelKit/FileMgr.h | 21 | ||||
| -rw-r--r-- | src/kernel/KernelKit/HardwareThreadScheduler.h | 1 | ||||
| -rw-r--r-- | src/kernel/KernelKit/User.h (renamed from src/kernel/KernelKit/UserMgr+User.h) | 0 | ||||
| -rw-r--r-- | src/kernel/KernelKit/UserMgr.h | 2 | ||||
| -rw-r--r-- | src/kernel/KernelKit/UserProcessScheduler.h | 7 |
9 files changed, 27 insertions, 21 deletions
diff --git a/src/kernel/KernelKit/BinaryMutex.h b/src/kernel/KernelKit/BinaryMutex.h index 2fb390d3..2388c50a 100644 --- a/src/kernel/KernelKit/BinaryMutex.h +++ b/src/kernel/KernelKit/BinaryMutex.h @@ -7,6 +7,7 @@ #define KERNELKIT_BINARYMUTEX_H #include <CompilerKit/CompilerKit.h> +#include <KernelKit/CoreProcessScheduler.h> #include <KernelKit/Timer.h> #include <NeKit/Config.h> @@ -14,6 +15,7 @@ namespace Kernel { class UserProcess; /// @brief Access control class, which locks a task until one is done. +/// Implements priority inheritance to prevent priority inversion. class BinaryMutex final { public: using LockedPtr = UserProcess*; @@ -36,7 +38,8 @@ class BinaryMutex final { NE_COPY_DEFAULT(BinaryMutex) private: - LockedPtr fLockingProcess{nullptr}; + LockedPtr fLockingProcess{nullptr}; + AffinityKind fOwnerOriginalAffinity{AffinityKind::kInvalid}; // for priority inheritance }; } // namespace Kernel diff --git a/src/kernel/KernelKit/CoreProcessScheduler.h b/src/kernel/KernelKit/CoreProcessScheduler.h index 71a75e1a..5d6dc9b3 100644 --- a/src/kernel/KernelKit/CoreProcessScheduler.h +++ b/src/kernel/KernelKit/CoreProcessScheduler.h @@ -146,7 +146,7 @@ enum struct ProcessStatusKind : Int32 { /***********************************************************************************/ enum struct AffinityKind : Int32 { kInvalid = 0, - kRealTime = 100, + kUltraHigh = 100, kVeryHigh = 150, kHigh = 200, kStandard = 1000, diff --git a/src/kernel/KernelKit/DebugOutput.h b/src/kernel/KernelKit/DebugOutput.h index 3695602e..4a705804 100644 --- a/src/kernel/KernelKit/DebugOutput.h +++ b/src/kernel/KernelKit/DebugOutput.h @@ -185,7 +185,7 @@ inline TerminalDevice& operator<<(TerminalDevice& src, const Long& num) { #undef kout #endif // ifdef kout -#define kout TerminalDevice::The() +#define kout TerminalDevice::The() << __FILE__ << ": " #ifdef kendl #undef kendl @@ -197,7 +197,7 @@ inline TerminalDevice& operator<<(TerminalDevice& src, const Long& num) { #undef kout8 #endif // ifdef kout8 -#define kout8 Utf8TerminalDevice::The() +#define kout8 Utf8TerminalDevice::The() << __FILE__ << ": " #ifdef kendl8 #undef kendl8 diff --git a/src/kernel/KernelKit/DriveMgr.h b/src/kernel/KernelKit/DriveMgr.h index 76ee5dcf..8b095f05 100644 --- a/src/kernel/KernelKit/DriveMgr.h +++ b/src/kernel/KernelKit/DriveMgr.h @@ -3,8 +3,8 @@ // Licensed under the Apache License, Version 2.0 (see LICENSE file) // Official repository: https://github.com/ne-foss-org/nekernel -#ifndef INC_DRIVE_MANAGER_H -#define INC_DRIVE_MANAGER_H +#ifndef KERNELKIT_DRIVEMGR_H +#define KERNELKIT_DRIVEMGR_H /// @file DriveMgr.h /// @brief NeKernel's drive manager. @@ -166,4 +166,4 @@ Void io_drv_input(DriveTrait::DrivePacket pckt); Void io_drv_output(DriveTrait::DrivePacket pckt); } // namespace Kernel -#endif /* ifndef INC_DRIVE_MANAGER_H */ +#endif /* ifndef KERNELKIT_DRIVEMGR_H */ diff --git a/src/kernel/KernelKit/FileMgr.h b/src/kernel/KernelKit/FileMgr.h index 87644e68..06af3c2d 100644 --- a/src/kernel/KernelKit/FileMgr.h +++ b/src/kernel/KernelKit/FileMgr.h @@ -3,14 +3,14 @@ // Licensed under the Apache License, Version 2.0 (see LICENSE file) // Official repository: https://github.com/ne-foss-org/nekernel -#ifndef INC_FILEMGR_H -#define INC_FILEMGR_H +#ifndef KERNELKIT_FILEMGR_H +#define KERNELKIT_FILEMGR_H /// @file FileMgr.h /// @brief File Manager Subsystem. /// @author Amlal El Mahrouss (amlal@nekernel.org) -//! Include filesystems that NeKernel supports. +//! Include filesystems that the hybrid kernel supports. #include <FSKit/Ext2+IFS.h> #include <FSKit/NeFS.h> #include <FSKit/OpenHeFS.h> @@ -352,7 +352,7 @@ class FileStream final { /// @brief Leak MIME. /// @return The MIME. - Char* MIME() { return const_cast<Char*>(fMime); } + Char* MIME() { return fMime; } enum { kFileMgrRestrictRead = 100, @@ -364,14 +364,15 @@ class FileStream final { }; private: - NodePtr fFile{nullptr}; - Int32 fFileRestrict{kFileMgrRestrictReadBinary}; - const Char* fMime{kFileMimeGeneric}; + NodePtr fFile{nullptr}; + Int32 fFileRestrict{kFileMgrRestrictReadBinary}; + Char* fMime{const_cast<Char*>(kFileMimeGeneric)}; }; using FileStreamASCII = FileStream<Char>; using FileStreamUTF8 = FileStream<Utf8Char>; -using FileStreamUTF16 = FileStream<WideChar>; +using FileStreamUTF16 = FileStream<Utf16Char>; +using FileStreamWide = FileStream<WideChar>; typedef UInt64 CursorType; @@ -423,9 +424,9 @@ inline FileStream<Encoding, Class>::FileStream(const Encoding* path, const Encod /// @brief destructor of the file stream. template <typename Encoding, typename Class> inline FileStream<Encoding, Class>::~FileStream() { - mm_free_ptr(fFile); + if (fFile) mm_free_ptr(fFile); fFile = nullptr; } } // namespace Kernel -#endif // ifndef INC_FILEMGR_H +#endif // ifndef KERNELKIT_FILEMGR_H diff --git a/src/kernel/KernelKit/HardwareThreadScheduler.h b/src/kernel/KernelKit/HardwareThreadScheduler.h index a9183cd2..43a906d6 100644 --- a/src/kernel/KernelKit/HardwareThreadScheduler.h +++ b/src/kernel/KernelKit/HardwareThreadScheduler.h @@ -12,6 +12,7 @@ /// @note Last Rev Sun 28 Jul CET 2024 /// @note Last Rev Thu, Aug 1, 2024 9:07:38 AM +/// @note Last Rev Sun, March 22, 2026 5:16 PM #if defined(__nekernel_max_cores) /// \note This can be edited at compile-time to specify how many cores can be used by NeKernel. diff --git a/src/kernel/KernelKit/UserMgr+User.h b/src/kernel/KernelKit/User.h index bae51180..bae51180 100644 --- a/src/kernel/KernelKit/UserMgr+User.h +++ b/src/kernel/KernelKit/User.h diff --git a/src/kernel/KernelKit/UserMgr.h b/src/kernel/KernelKit/UserMgr.h index 16ca79b6..7fc2b635 100644 --- a/src/kernel/KernelKit/UserMgr.h +++ b/src/kernel/KernelKit/UserMgr.h @@ -6,6 +6,6 @@ #ifndef KERNELKIT_USERMGR_H #define KERNELKIT_USERMGR_H -#include <KernelKit/UserMgr+User.h> +#include <KernelKit/User.h> #endif
\ No newline at end of file diff --git a/src/kernel/KernelKit/UserProcessScheduler.h b/src/kernel/KernelKit/UserProcessScheduler.h index 5018f1f6..1318c7f6 100644 --- a/src/kernel/KernelKit/UserProcessScheduler.h +++ b/src/kernel/KernelKit/UserProcessScheduler.h @@ -13,7 +13,7 @@ #include <ArchKit/ArchKit.h> #include <KernelKit/CoreProcessScheduler.h> #include <KernelKit/LockDelegate.h> -#include <KernelKit/UserMgr+User.h> +#include <KernelKit/User.h> #include <NeKit/MutableArray.h> //////////////////////////////////////////////////// @@ -83,9 +83,10 @@ class UserProcess final { kExecutableKindCount, }; - ProcessTime PTime{0}; //! @brief Process allocated tine. + ProcessTime PTime{0}; //! @brief Process allocated time. ProcessTime RTime{0}; //! @brief Process run time. - ProcessTime UTime{0}; //! #brief Process used time. + ProcessTime UTime{0}; //! @brief Process used time. + ProcessTime STime{0}; //! @brief Process sleep time (for dynamic priority boost). ProcessID ProcessId{kCPSInvalidPID}; ExecutableKind Kind{ExecutableKind::kExecutableKind}; |
