From b55d3ac738b40677c579221b4f0dbf294dc3b017 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Wed, 23 Apr 2025 22:27:47 +0200 Subject: dev, kernel: necessary refactors regarding future changes. Signed-off-by: Amlal El Mahrouss --- dev/kernel/FSKit/Ext2.h | 2 + dev/kernel/FSKit/HeFS.h | 63 +++++----- dev/kernel/FSKit/IndexableProperty.h | 5 +- dev/kernel/HALKit/AMD64/HalKernelMain.cc | 2 +- dev/kernel/KernelKit/CoreProcessScheduler.h | 161 +++++++++++++++++++++++++ dev/kernel/KernelKit/HardwareThreadScheduler.h | 8 +- dev/kernel/KernelKit/IPEFDylibObject.h | 4 +- dev/kernel/KernelKit/PE.h | 13 +- dev/kernel/KernelKit/PECodeMgr.h | 55 +++++++++ dev/kernel/KernelKit/PEFCodeMgr.h | 4 +- dev/kernel/KernelKit/ProcessSchedulerCore.h | 161 ------------------------- dev/kernel/KernelKit/UserProcessScheduler.h | 2 +- dev/kernel/KernelKit/UserProcessScheduler.inl | 6 +- dev/kernel/src/IPEFDylibObject.cc | 10 +- dev/kernel/src/UserProcessScheduler.cc | 6 +- 15 files changed, 280 insertions(+), 222 deletions(-) create mode 100644 dev/kernel/KernelKit/CoreProcessScheduler.h delete mode 100644 dev/kernel/KernelKit/ProcessSchedulerCore.h (limited to 'dev/kernel') diff --git a/dev/kernel/FSKit/Ext2.h b/dev/kernel/FSKit/Ext2.h index 856654d6..c27eb5f9 100644 --- a/dev/kernel/FSKit/Ext2.h +++ b/dev/kernel/FSKit/Ext2.h @@ -26,6 +26,7 @@ #define kExt2FSRev0 (0) #define kExt2FSRev1 (1) +/// @brief EXT2's file types. enum { kExt2FileTypeUnknown = 0, @@ -38,6 +39,7 @@ enum kExt2FileTypeSymbolicLink = 7 }; +/// @brief The super block structure, located at LBA 1024. struct PACKED EXT2_SUPER_BLOCK final { Kernel::UInt32 fInodeCount; diff --git a/dev/kernel/FSKit/HeFS.h b/dev/kernel/FSKit/HeFS.h index 60f1342a..2d4562c4 100644 --- a/dev/kernel/FSKit/HeFS.h +++ b/dev/kernel/FSKit/HeFS.h @@ -81,6 +81,13 @@ inline constexpr UInt16 kHeFSBlockCount = 0x10; inline constexpr UInt16 kHeFSInvalidVID = 0xFFFF; +namespace Kernel +{ + /// @brief Access time type. + /// @details Used to keep track of the INode, INodeDir allocation status. + typedef UInt64 ATime; +} // namespace Kernel + /// @brief HeFS Boot node. /// @details Acts like a superblock, it contains the information about the filesystem. /// @note The boot node is the first block of the filesystem. @@ -108,12 +115,8 @@ struct PACKED HEFS_BOOT_NODE final Kernel::UInt64 fReserved4; /// @brief Reserved for future use. }; -/// @brief Access time type. -/// @details Used to keep track of the INode, INodeDir allocation status. -typedef Kernel::UInt64 ATime; - -inline constexpr ATime kHeFSTimeInvalid = 0x0000000000000000; -inline constexpr ATime kHeFSTimeMax = 0xFFFFFFFFFFFFFFFF; +inline constexpr Kernel::ATime kHeFSTimeInvalid = 0x0000000000000000; +inline constexpr Kernel::ATime kHeFSTimeMax = 0xFFFFFFFFFFFFFFFF; /// @brief HeFS index node. /// @details This structure is used to store the file information of a file. @@ -127,7 +130,7 @@ struct PACKED ALIGN(8) HEFS_INDEX_NODE final Kernel::UInt32 fSize; /// @brief File size. Kernel::UInt32 fChecksum, fRecoverChecksum, fBlockChecksum, fLinkChecksum; /// @brief Checksum of the file, recovery checksum, block checksum, link checksum. - ATime fCreated, fAccessed, fModified, fDeleted; /// @brief File timestamps. + Kernel::ATime fCreated, fAccessed, fModified, fDeleted; /// @brief File timestamps. Kernel::UInt32 fUID, fGID; /// @brief User ID and Group ID of the file. Kernel::UInt32 fMode; /// @brief File mode. (read, write, execute, etc). @@ -160,7 +163,7 @@ struct PACKED ALIGN(8) HEFS_INDEX_NODE_DIRECTORY final Kernel::UInt32 fSize; /// @brief Size of the directory. Kernel::UInt32 fChecksum, fIndexNodeChecksum; /// @brief Checksum of the file, index node checksum. - ATime fCreated, fAccessed, fModified, fDeleted; /// @brief File timestamps. + Kernel::ATime fCreated, fAccessed, fModified, fDeleted; /// @brief File timestamps. Kernel::UInt32 fUID, fGID; /// @brief User ID and Group ID of the file. Kernel::UInt32 fMode; /// @brief File mode. (read, write, execute, etc). @@ -177,47 +180,47 @@ struct PACKED ALIGN(8) HEFS_INDEX_NODE_DIRECTORY final namespace Kernel::Detail { - /// @brief HeFS get year from ATime. - /// @param raw_atime the raw ATime value. + /// @brief HeFS get year from Kernel::ATime. + /// @param raw_atime the raw Kernel::ATime value. /// @return the year value. - /// @note The year is stored in the upper 32 bits of the ATime value. - inline UInt32 hefs_year_get(ATime raw_atime) noexcept + /// @note The year is stored in the upper 32 bits of the Kernel::ATime value. + inline UInt32 hefs_year_get(Kernel::ATime raw_atime) noexcept { return (raw_atime) >> 32; } - /// @brief HeFS get month from ATime. - /// @param raw_atime the raw ATime value. + /// @brief HeFS get month from Kernel::ATime. + /// @param raw_atime the raw Kernel::ATime value. /// @return the month value. - /// @note The month is stored in the upper 24 bits of the ATime value. - inline UInt32 hefs_month_get(ATime raw_atime) noexcept + /// @note The month is stored in the upper 24 bits of the Kernel::ATime value. + inline UInt32 hefs_month_get(Kernel::ATime raw_atime) noexcept { return (raw_atime) >> 24; } - /// @brief HeFS get day from ATime. - /// @param raw_atime the raw ATime value. + /// @brief HeFS get day from Kernel::ATime. + /// @param raw_atime the raw Kernel::ATime value. /// @return the day value. - /// @note The day is stored in the upper 16 bits of the ATime value. - inline UInt32 hefs_day_get(ATime raw_atime) noexcept + /// @note The day is stored in the upper 16 bits of the Kernel::ATime value. + inline UInt32 hefs_day_get(Kernel::ATime raw_atime) noexcept { return (raw_atime) >> 16; } - /// @brief HeFS get hour from ATime. - /// @param raw_atime the raw ATime value. + /// @brief HeFS get hour from Kernel::ATime. + /// @param raw_atime the raw Kernel::ATime value. /// @return the hour value. - /// @note The hour is stored in the upper 8 bits of the ATime value. - inline UInt32 hefs_hour_get(ATime raw_atime) noexcept + /// @note The hour is stored in the upper 8 bits of the Kernel::ATime value. + inline UInt32 hefs_hour_get(Kernel::ATime raw_atime) noexcept { return (raw_atime) >> 8; } - /// @brief HeFS get minute from ATime. - /// @param raw_atime the raw ATime value. + /// @brief HeFS get minute from Kernel::ATime. + /// @param raw_atime the raw Kernel::ATime value. /// @return the minute value. - /// @note The minute is stored in the lower 8 bits of the ATime value. - inline UInt32 hefs_minute_get(ATime raw_atime) noexcept + /// @note The minute is stored in the lower 8 bits of the Kernel::ATime value. + inline UInt32 hefs_minute_get(Kernel::ATime raw_atime) noexcept { return (raw_atime)&0xFF; } @@ -262,7 +265,6 @@ namespace Kernel::Detail case kHeFSFlashDrive: return "Flash Drive"; case kHeFSUnknown: - return "Unknown"; default: return "Unknown"; } @@ -314,7 +316,6 @@ namespace Kernel::Detail case kHeFSFileKindSymbolicLink: return "Symbolic Link"; case kHeFSFileKindUnknown: - return "Unknown"; default: return "Unknown"; } @@ -376,6 +377,6 @@ namespace Kernel _Output Bool FormatGPT(_Input _Output DriveTrait* drive, _Input const Lba end_lba, _Input const Int32 flags, const Char* part_name); public: - UInt32 mDriveIndex{MountpointInterface::kDriveIndexA}; /// @brief Drive index. + UInt32 mDriveIndex{MountpointInterface::kDriveIndexA}; /// @brief The drive index which this filesystem is mounted on. }; } // namespace Kernel \ No newline at end of file diff --git a/dev/kernel/FSKit/IndexableProperty.h b/dev/kernel/FSKit/IndexableProperty.h index 4dbeb9f4..96853fbc 100644 --- a/dev/kernel/FSKit/IndexableProperty.h +++ b/dev/kernel/FSKit/IndexableProperty.h @@ -10,8 +10,9 @@ #include #include -#define kIndexerCatalogNameLength 256U -#define kIndexerClaimed 0xCF +#define kIndexerCatalogNameLength (256U) +#define kIndexerClaimed (0xCF) +#define kIndexerUnclaimed (0xCA) namespace Kernel { diff --git a/dev/kernel/HALKit/AMD64/HalKernelMain.cc b/dev/kernel/HALKit/AMD64/HalKernelMain.cc index 833788fe..3686a48f 100644 --- a/dev/kernel/HALKit/AMD64/HalKernelMain.cc +++ b/dev/kernel/HALKit/AMD64/HalKernelMain.cc @@ -25,7 +25,7 @@ STATIC Kernel::Void hal_pre_init_scheduler() noexcept { for (Kernel::SizeT i = 0U; i < Kernel::UserProcessScheduler::The().CurrentTeam().AsArray().Count(); ++i) { - Kernel::UserProcessScheduler::The().CurrentTeam().AsArray()[i] = Kernel::USER_PROCESS(); + Kernel::UserProcessScheduler::The().CurrentTeam().AsArray()[i] = Kernel::USER_PROCESS(); } } diff --git a/dev/kernel/KernelKit/CoreProcessScheduler.h b/dev/kernel/KernelKit/CoreProcessScheduler.h new file mode 100644 index 00000000..bd493140 --- /dev/null +++ b/dev/kernel/KernelKit/CoreProcessScheduler.h @@ -0,0 +1,161 @@ +/* ------------------------------------------- + + Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved. + +------------------------------------------- */ + +#pragma once + +#include +#include + +namespace Kernel +{ + class USER_PROCESS; + class KERNEL_PROCESS; + class UserProcessTeam; + + /***********************************************************************************/ + /// @brief Subsystem enum type. + /***********************************************************************************/ + + enum class ProcessSubsystem : Int32 + { + kProcessSubsystemSecurity = 100, + kProcessSubsystemApplication, + kProcessSubsystemService, + kProcessSubsystemDriver, + kProcessSubsystemInvalid = 256U, + kProcessSubsystemCount = 4, + }; + + typedef UInt64 PTime; + + /***********************************************************************************/ + //! @brief Local Process identifier. + /***********************************************************************************/ + typedef Int64 ProcessID; + + /***********************************************************************************/ + //! @brief Local Process status enum. + /***********************************************************************************/ + enum class ProcessStatusKind : Int32 + { + kInvalid, + kStarting, + kRunning, + kKilled, + kFrozen, + kFinished, + kCount, + }; + + /***********************************************************************************/ + //! @brief Affinity is the amount of nano-seconds this process is going to run. + /***********************************************************************************/ + enum class AffinityKind : Int32 + { + kRealTime = 500, + kVeryHigh = 250, + kHigh = 200, + kStandard = 1000, + kLowUsage = 1500, + kVeryLowUsage = 2000, + }; + + /***********************************************************************************/ + //! Operators for AffinityKind + /***********************************************************************************/ + + inline bool operator<(AffinityKind lhs, AffinityKind rhs) + { + Int32 lhs_int = static_cast(lhs); + Int32 rhs_int = static_cast(rhs); + + return lhs_int < rhs_int; + } + + inline bool operator>(AffinityKind lhs, AffinityKind rhs) + { + Int32 lhs_int = static_cast(lhs); + Int32 rhs_int = static_cast(rhs); + + return lhs_int > rhs_int; + } + + inline bool operator<=(AffinityKind lhs, AffinityKind rhs) + { + Int32 lhs_int = static_cast(lhs); + Int32 rhs_int = static_cast(rhs); + + return lhs_int <= rhs_int; + } + + inline bool operator>=(AffinityKind lhs, AffinityKind rhs) + { + Int32 lhs_int = static_cast(lhs); + Int32 rhs_int = static_cast(rhs); + + return lhs_int >= rhs_int; + } + + using ProcessTime = UInt64; + using PID = Int64; + + /***********************************************************************************/ + /// @note For User manager, tells where we run the code. + /***********************************************************************************/ + enum class ProcessLevelRing : Int32 + { + kRingStdUser = 1, + kRingSuperUser = 2, + kRingGuestUser = 5, + kRingCount = 5, + }; + + /***********************************************************************************/ + /// @brief Helper type to describe a code image. + /***********************************************************************************/ + using ImagePtr = VoidPtr; + + /***********************************************************************************/ + /// @brief Helper class to contain a process's image and blob. + /***********************************************************************************/ + struct PROCESS_IMAGE final + { + explicit PROCESS_IMAGE() = default; + + ImagePtr fCode; + ImagePtr fBlob; + + Bool HasCode() + { + return this->fCode != nullptr; + } + + Bool HasImage() + { + return this->fBlob != nullptr; + } + + ErrorOr Leak() + { + if (this->fCode) + { + return ErrorOr{this->fCode}; + } + + return ErrorOr{kErrorInvalidData}; + } + + ErrorOr LeakBlob() + { + if (this->fBlob) + { + return ErrorOr{this->fBlob}; + } + + return ErrorOr{kErrorInvalidData}; + } + }; +} // namespace Kernel diff --git a/dev/kernel/KernelKit/HardwareThreadScheduler.h b/dev/kernel/KernelKit/HardwareThreadScheduler.h index 9af22715..4d2ebc73 100644 --- a/dev/kernel/KernelKit/HardwareThreadScheduler.h +++ b/dev/kernel/KernelKit/HardwareThreadScheduler.h @@ -57,12 +57,12 @@ namespace Kernel operator bool(); public: - void Wake(const bool wakeup = false) noexcept; - void Busy(const bool busy = false) noexcept; + void Wake(const BOOL wakeup = false) noexcept; + void Busy(const BOOL busy = false) noexcept; public: - bool Switch(VoidPtr image, Ptr8 stack_ptr, HAL::StackFramePtr frame, const ThreadID& pid); - bool IsWakeup() noexcept; + BOOL Switch(VoidPtr image, Ptr8 stack_ptr, HAL::StackFramePtr frame, const ThreadID& pid); + BOOL IsWakeup() noexcept; public: HAL::StackFramePtr StackFrame() noexcept; diff --git a/dev/kernel/KernelKit/IPEFDylibObject.h b/dev/kernel/KernelKit/IPEFDylibObject.h index 82f08932..a708fb6c 100644 --- a/dev/kernel/KernelKit/IPEFDylibObject.h +++ b/dev/kernel/KernelKit/IPEFDylibObject.h @@ -99,8 +99,8 @@ namespace Kernel typedef IPEFDylibObject* IDylibRef; - EXTERN_C IDylibRef rtl_init_dylib(USER_PROCESS& header); - EXTERN_C Void rtl_fini_dylib(USER_PROCESS& header, IDylibRef lib, Bool* successful); + EXTERN_C IDylibRef rtl_init_dylib_pef(USER_PROCESS& header); + EXTERN_C Void rtl_fini_dylib_pef(USER_PROCESS& header, IDylibRef lib, Bool* successful); } // namespace Kernel #endif /* ifndef __KERNELKIT_SHARED_OBJECT_H__ */ diff --git a/dev/kernel/KernelKit/PE.h b/dev/kernel/KernelKit/PE.h index fbf8fc20..e2184918 100644 --- a/dev/kernel/KernelKit/PE.h +++ b/dev/kernel/KernelKit/PE.h @@ -16,16 +16,13 @@ #include -#define kPeSignature 0x00004550 +#define kPeSignature (0x00004550) -#define kPeDLLBase 0x4000000 -#define kPeEXEBase 0x1000000 +#define kPeMagic32 (0x010b) +#define kPeMagic64 (0x020b) -#define kPeMagic32 0x010b -#define kPeMagic64 0x020b - -#define kPeMachineAMD64 0x8664 -#define kPeMachineARM64 0xaa64 +#define kPeMachineAMD64 (0x8664) +#define kPeMachineARM64 (0xaa64) typedef struct LDR_EXEC_HEADER final { diff --git a/dev/kernel/KernelKit/PECodeMgr.h b/dev/kernel/KernelKit/PECodeMgr.h index e666c501..23ef4ecf 100644 --- a/dev/kernel/KernelKit/PECodeMgr.h +++ b/dev/kernel/KernelKit/PECodeMgr.h @@ -22,3 +22,58 @@ #include #include #include +#include +#include + +#ifndef INC_PROCESS_SCHEDULER_H +#include +#endif + +#define kPefApplicationMime "application/vnd-portable-executable" + +namespace Kernel +{ + /// + /// \name PE32Loader + /// \brief PE32+ loader class. + /// + class PE32Loader : public LoaderInterface + { + private: + explicit PE32Loader() = delete; + + public: + explicit PE32Loader(const VoidPtr blob); + explicit PE32Loader(const Char* path); + ~PE32Loader() override; + + public: + NE_COPY_DEFAULT(PE32Loader) + + public: + const Char* Path() override; + const Char* AsString() override; + const Char* MIME() override; + + public: + ErrorOr FindStart() override; + VoidPtr FindSymbol(const Char* name, Int32 kind) override; + ErrorOr GetBlob() override; + + public: + bool IsLoaded() noexcept; + + private: +#ifdef __FSKIT_INCLUDES_NEFS__ + OwnPtr> fFile; +#elif defined(__FSKIT_INCLUDES_HEFS__) + OwnPtr> fFile; +#else + OwnPtr> fFile; +#endif // __FSKIT_INCLUDES_NEFS__ + + Ref fPath; + VoidPtr fCachedBlob; + bool fBad; + }; +} // namespace Kernel \ No newline at end of file diff --git a/dev/kernel/KernelKit/PEFCodeMgr.h b/dev/kernel/KernelKit/PEFCodeMgr.h index 9adab8f6..389774fd 100644 --- a/dev/kernel/KernelKit/PEFCodeMgr.h +++ b/dev/kernel/KernelKit/PEFCodeMgr.h @@ -16,7 +16,7 @@ #include #endif -#define kPefApplicationMime "application/vnd-amlal-executable" +#define kPefApplicationMime "application/vnd-nekernel-executable" namespace Kernel { @@ -53,6 +53,8 @@ namespace Kernel private: #ifdef __FSKIT_INCLUDES_NEFS__ OwnPtr> fFile; +#elif defined(__FSKIT_INCLUDES_HEFS__) + OwnPtr> fFile; #else OwnPtr> fFile; #endif // __FSKIT_INCLUDES_NEFS__ diff --git a/dev/kernel/KernelKit/ProcessSchedulerCore.h b/dev/kernel/KernelKit/ProcessSchedulerCore.h deleted file mode 100644 index bd493140..00000000 --- a/dev/kernel/KernelKit/ProcessSchedulerCore.h +++ /dev/null @@ -1,161 +0,0 @@ -/* ------------------------------------------- - - Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved. - -------------------------------------------- */ - -#pragma once - -#include -#include - -namespace Kernel -{ - class USER_PROCESS; - class KERNEL_PROCESS; - class UserProcessTeam; - - /***********************************************************************************/ - /// @brief Subsystem enum type. - /***********************************************************************************/ - - enum class ProcessSubsystem : Int32 - { - kProcessSubsystemSecurity = 100, - kProcessSubsystemApplication, - kProcessSubsystemService, - kProcessSubsystemDriver, - kProcessSubsystemInvalid = 256U, - kProcessSubsystemCount = 4, - }; - - typedef UInt64 PTime; - - /***********************************************************************************/ - //! @brief Local Process identifier. - /***********************************************************************************/ - typedef Int64 ProcessID; - - /***********************************************************************************/ - //! @brief Local Process status enum. - /***********************************************************************************/ - enum class ProcessStatusKind : Int32 - { - kInvalid, - kStarting, - kRunning, - kKilled, - kFrozen, - kFinished, - kCount, - }; - - /***********************************************************************************/ - //! @brief Affinity is the amount of nano-seconds this process is going to run. - /***********************************************************************************/ - enum class AffinityKind : Int32 - { - kRealTime = 500, - kVeryHigh = 250, - kHigh = 200, - kStandard = 1000, - kLowUsage = 1500, - kVeryLowUsage = 2000, - }; - - /***********************************************************************************/ - //! Operators for AffinityKind - /***********************************************************************************/ - - inline bool operator<(AffinityKind lhs, AffinityKind rhs) - { - Int32 lhs_int = static_cast(lhs); - Int32 rhs_int = static_cast(rhs); - - return lhs_int < rhs_int; - } - - inline bool operator>(AffinityKind lhs, AffinityKind rhs) - { - Int32 lhs_int = static_cast(lhs); - Int32 rhs_int = static_cast(rhs); - - return lhs_int > rhs_int; - } - - inline bool operator<=(AffinityKind lhs, AffinityKind rhs) - { - Int32 lhs_int = static_cast(lhs); - Int32 rhs_int = static_cast(rhs); - - return lhs_int <= rhs_int; - } - - inline bool operator>=(AffinityKind lhs, AffinityKind rhs) - { - Int32 lhs_int = static_cast(lhs); - Int32 rhs_int = static_cast(rhs); - - return lhs_int >= rhs_int; - } - - using ProcessTime = UInt64; - using PID = Int64; - - /***********************************************************************************/ - /// @note For User manager, tells where we run the code. - /***********************************************************************************/ - enum class ProcessLevelRing : Int32 - { - kRingStdUser = 1, - kRingSuperUser = 2, - kRingGuestUser = 5, - kRingCount = 5, - }; - - /***********************************************************************************/ - /// @brief Helper type to describe a code image. - /***********************************************************************************/ - using ImagePtr = VoidPtr; - - /***********************************************************************************/ - /// @brief Helper class to contain a process's image and blob. - /***********************************************************************************/ - struct PROCESS_IMAGE final - { - explicit PROCESS_IMAGE() = default; - - ImagePtr fCode; - ImagePtr fBlob; - - Bool HasCode() - { - return this->fCode != nullptr; - } - - Bool HasImage() - { - return this->fBlob != nullptr; - } - - ErrorOr Leak() - { - if (this->fCode) - { - return ErrorOr{this->fCode}; - } - - return ErrorOr{kErrorInvalidData}; - } - - ErrorOr LeakBlob() - { - if (this->fBlob) - { - return ErrorOr{this->fBlob}; - } - - return ErrorOr{kErrorInvalidData}; - } - }; -} // namespace Kernel diff --git a/dev/kernel/KernelKit/UserProcessScheduler.h b/dev/kernel/KernelKit/UserProcessScheduler.h index 6e1ca146..19818213 100644 --- a/dev/kernel/KernelKit/UserProcessScheduler.h +++ b/dev/kernel/KernelKit/UserProcessScheduler.h @@ -15,7 +15,7 @@ #include #include #include -#include +#include #define kSchedMinMicroTime (AffinityKind::kStandard) #define kSchedInvalidPID (-1) diff --git a/dev/kernel/KernelKit/UserProcessScheduler.inl b/dev/kernel/KernelKit/UserProcessScheduler.inl index a18af9c1..e31b5462 100644 --- a/dev/kernel/KernelKit/UserProcessScheduler.inl +++ b/dev/kernel/KernelKit/UserProcessScheduler.inl @@ -3,11 +3,11 @@ Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved. FILE: UserProcessScheduler.inl - PURPOSE: Low level/Ring-3 USER_PROCESS scheduler. + PURPOSE: Low level/Ring-3 process scheduler. ------------------------------------------- */ -/// @brief USER_PROCESS scheduler inline definitions. +/// @brief USER_PROCESS inline definitions. /// @author Amlal El Mahrouss (amlal@nekernel.org) /// @date Tue Apr 22 22:01:07 CEST 2025 @@ -57,7 +57,7 @@ namespace Kernel entry = entry->MemoryNext; } - kout << "Invalid Pointer: Trying to free a pointer which doesn't exist.\r"; + kout << "USER_PROCESS: Trying to free a pointer which doesn't exist.\r"; this->Crash(); diff --git a/dev/kernel/src/IPEFDylibObject.cc b/dev/kernel/src/IPEFDylibObject.cc index df6ec253..9b0b1ab8 100644 --- a/dev/kernel/src/IPEFDylibObject.cc +++ b/dev/kernel/src/IPEFDylibObject.cc @@ -18,13 +18,13 @@ Revision History: - 01/02/24: Reworked dll ABI, expect a rtl_init_dylib and - rtl_fini_dylib (amlel) + 01/02/24: Reworked dll ABI, expect a rtl_init_dylib_pef and + rtl_fini_dylib_pef (amlel) 15/02/24: Breaking changes, changed the name of the routines. (amlel) - 07/28/24: Replace rt_library_free with rtl_fini_dylib + 07/28/24: Replace rt_library_free with rtl_fini_dylib_pef 10/8/24: FIX: Fix log comment. @@ -41,7 +41,7 @@ using namespace Kernel; /** @brief Library initializer. */ /***********************************************************************************/ -EXTERN_C IDylibRef rtl_init_dylib(USER_PROCESS& process) +EXTERN_C IDylibRef rtl_init_dylib_pef(USER_PROCESS& process) { IDylibRef dll_obj = tls_new_class(); @@ -91,7 +91,7 @@ EXTERN_C IDylibRef rtl_init_dylib(USER_PROCESS& process) /** @param successful Reports if successful or not. */ /***********************************************************************************/ -EXTERN_C Void rtl_fini_dylib(USER_PROCESS& process, IDylibRef dll_obj, BOOL* successful) +EXTERN_C Void rtl_fini_dylib_pef(USER_PROCESS& process, IDylibRef dll_obj, BOOL* successful) { MUST_PASS(successful); diff --git a/dev/kernel/src/UserProcessScheduler.cc b/dev/kernel/src/UserProcessScheduler.cc index 68629bb2..8df98f87 100644 --- a/dev/kernel/src/UserProcessScheduler.cc +++ b/dev/kernel/src/UserProcessScheduler.cc @@ -3,7 +3,7 @@ Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved. FILE: UserProcessScheduler.cc - PURPOSE: Low level/Ring-3 USER_PROCESS scheduler. + PURPOSE: Low level/Ring-3 process scheduler. ------------------------------------------- */ @@ -262,7 +262,7 @@ namespace Kernel { Bool success = false; - rtl_fini_dylib(*this, reinterpret_cast(this->DylibDelegate), &success); + rtl_fini_dylib_pef(*this, reinterpret_cast(this->DylibDelegate), &success); if (!success) { @@ -357,7 +357,7 @@ namespace Kernel switch (process.Kind) { case USER_PROCESS::kExecutableDylibKind: { - process.DylibDelegate = rtl_init_dylib(process); + process.DylibDelegate = rtl_init_dylib_pef(process); MUST_PASS(process.DylibDelegate); break; } -- cgit v1.2.3