diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-09-04 22:20:17 +0200 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-09-04 22:20:17 +0200 |
| commit | 1069f411d413e2185f6536b01b8993187056fcd8 (patch) | |
| tree | 2b8bbfd6f2e497bd0e8a533f1fbf1ecd3fef29b6 /dev/ZKA/KernelKit | |
| parent | 0aaf98a4875893914b3c75cb0eb1eb0971412377 (diff) | |
[ IMP ] BMP allocator needs more tweaking and fixes, to be usable.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'dev/ZKA/KernelKit')
| -rw-r--r-- | dev/ZKA/KernelKit/CodeMgr.hxx | 2 | ||||
| -rw-r--r-- | dev/ZKA/KernelKit/IDLLObject.hxx (renamed from dev/ZKA/KernelKit/DLLInterface.hxx) | 14 | ||||
| -rw-r--r-- | dev/ZKA/KernelKit/IPEFDLLObject.hxx (renamed from dev/ZKA/KernelKit/PEFDLLInterface.hxx) | 18 | ||||
| -rw-r--r-- | dev/ZKA/KernelKit/UserProcessScheduler.hxx | 36 |
4 files changed, 36 insertions, 34 deletions
diff --git a/dev/ZKA/KernelKit/CodeMgr.hxx b/dev/ZKA/KernelKit/CodeMgr.hxx index 8c4f090f..c8f9cca9 100644 --- a/dev/ZKA/KernelKit/CodeMgr.hxx +++ b/dev/ZKA/KernelKit/CodeMgr.hxx @@ -16,7 +16,7 @@ #include <KernelKit/PECodeMgr.hxx> #include <KernelKit/PEFCodeMgr.hxx> -#include <KernelKit/PEFDLLInterface.hxx> +#include <KernelKit/IPEFDLLObject.hxx> namespace Kernel { diff --git a/dev/ZKA/KernelKit/DLLInterface.hxx b/dev/ZKA/KernelKit/IDLLObject.hxx index 13f36b82..39580307 100644 --- a/dev/ZKA/KernelKit/DLLInterface.hxx +++ b/dev/ZKA/KernelKit/IDLLObject.hxx @@ -13,11 +13,11 @@ namespace Kernel { - class DLLInterface + class IDLLObject { public: - explicit DLLInterface() = default; - virtual ~DLLInterface() = default; + explicit IDLLObject() = default; + virtual ~IDLLObject() = default; struct DLL_TRAITS final { @@ -30,7 +30,7 @@ namespace Kernel } }; - ZKA_COPY_DEFAULT(DLLInterface); + ZKA_COPY_DEFAULT(IDLLObject); virtual DLL_TRAITS** GetAddressOf() = 0; virtual DLL_TRAITS* Get() = 0; @@ -38,12 +38,6 @@ namespace Kernel virtual Void Mount(DLL_TRAITS* to_mount) = 0; virtual Void Unmount() = 0; - - template <typename SymbolType> - SymbolType Load(const Char* symbol_name, SizeT len, Int32 kind) - { - return nullptr; - } }; /// @brief Pure implementation, missing method/function handler. diff --git a/dev/ZKA/KernelKit/PEFDLLInterface.hxx b/dev/ZKA/KernelKit/IPEFDLLObject.hxx index d664bfd8..013173d1 100644 --- a/dev/ZKA/KernelKit/PEFDLLInterface.hxx +++ b/dev/ZKA/KernelKit/IPEFDLLObject.hxx @@ -11,9 +11,9 @@ #define __KERNELKIT_SHARED_OBJECT_HXX__ #include <KernelKit/PEF.hxx> -#include <KernelKit/PEFCodeMgr.hxx> #include <NewKit/Defines.hxx> -#include <KernelKit/DLLInterface.hxx> +#include <KernelKit/PEFCodeMgr.hxx> +#include <KernelKit/IDLLObject.hxx> namespace Kernel { @@ -21,14 +21,14 @@ namespace Kernel * @brief Shared Library class * Load library from this class */ - class PEFDLLInterface final : public DLLInterface + class IPEFDLLObject final : public IDLLObject { public: - explicit PEFDLLInterface() = default; - ~PEFDLLInterface() = default; + explicit IPEFDLLObject() = default; + ~IPEFDLLObject() = default; public: - ZKA_COPY_DEFAULT(PEFDLLInterface); + ZKA_COPY_DEFAULT(IPEFDLLObject); private: DLL_TRAITS* fMounted{nullptr}; @@ -96,10 +96,10 @@ namespace Kernel PEFLoader* fLoader{nullptr}; }; - typedef DLLInterface* DLLInterfacePtr; + typedef IPEFDLLObject* IDLL; - EXTERN_C DLLInterfacePtr rtl_init_shared_object(UserProcess* header); - EXTERN_C Void rtl_fini_shared_object(UserProcess* header, DLLInterfacePtr lib, Bool* successful); + EXTERN_C IDLL rtl_init_shared_object(UserProcess* header); + EXTERN_C Void rtl_fini_shared_object(UserProcess* header, IDLL lib, Bool* successful); } // namespace Kernel #endif /* ifndef __KERNELKIT_SHARED_OBJECT_HXX__ */ diff --git a/dev/ZKA/KernelKit/UserProcessScheduler.hxx b/dev/ZKA/KernelKit/UserProcessScheduler.hxx index 78d75af6..d5172fe9 100644 --- a/dev/ZKA/KernelKit/UserProcessScheduler.hxx +++ b/dev/ZKA/KernelKit/UserProcessScheduler.hxx @@ -10,12 +10,10 @@ #include <ArchKit/ArchKit.hxx> #include <KernelKit/LockDelegate.hxx> #include <KernelKit/User.hxx> -#include <KernelKit/DLLInterface.hxx> #include <NewKit/MutableArray.hxx> #define kSchedMinMicroTime (AffinityKind::kStandard) #define kSchedInvalidPID (-1) -#define kSchedMaxStackSz (4096) /* Max stack sz */ #define kSchedProcessLimitPerTeam (16U) //////////////////////////////////////////////////// @@ -29,7 +27,7 @@ namespace Kernel //! @note Forward declarations. class UserProcess; - class PEFDLLInterface; + class IPEFDLLObject; class UserProcessTeam; class UserProcessScheduler; class UserProcessHelper; @@ -148,24 +146,33 @@ namespace Kernel User* Owner{nullptr}; HAL::StackFramePtr StackFrame{nullptr}; AffinityKind Affinity{AffinityKind::kStandard}; - ProcessStatusKind Status{ProcessStatusKind::kDead}; + ProcessStatusKind Status{ProcessStatusKind::kDead}; UInt8* StackReserve{nullptr}; // Memory, images pointers. - HeapPtrKind HeapCursor{nullptr}; ImagePtr Image{nullptr}; - HeapPtrKind HeapPtr{nullptr}; SizeT StackSize{mib_cast(8)}; - // shared library handle, reserved for kDLLKind types of executables only. - DLLInterface* DLLPtr{nullptr}; - UserProcess* Parent{nullptr}; + //! @brief Shared library handle, reserved for kDLLKind types of executables only. + IPEFDLLObject* DLLPtr{nullptr}; + + /// @brief Parent process, reserved for threads only. + UserProcess* Parent{nullptr}; // Memory usage. - SizeT UsedMemory{0}; - SizeT FreeMemory{0}; - SizeT SizeMemory{mib_cast(64)}; + SizeT MemoryCursor{0}; + SizeT MemoryLimit{gib_cast(128)}; + + struct PROCESS_MEMORY_ENTRY + { + VoidPtr MemoryEntry; + + struct PROCESS_MEMORY_ENTRY *MemoryPrev; + struct PROCESS_MEMORY_ENTRY *MemoryNext; + } * MemoryEntryList{nullptr}; + + SizeT MemoryPD{0}; enum { @@ -213,9 +220,9 @@ namespace Kernel //! @return Int32 local error code. Int32& GetLocalCode() noexcept; - const User* GetOwner() noexcept; + const User* GetOwner() noexcept; const ProcessStatusKind& GetStatus() noexcept; - const AffinityKind& GetAffinity() noexcept; + const AffinityKind& GetAffinity() noexcept; private: UInt32 fLastExitCode{0}; @@ -291,6 +298,7 @@ namespace Kernel STATIC bool CanBeScheduled(UserProcess& process); STATIC PID& TheCurrentPID(); STATIC SizeT StartScheduling(); + STATIC Void Init(); }; const UInt32& sched_get_exit_code(void) noexcept; |
