diff options
Diffstat (limited to 'dev/ZKA/KernelKit')
| -rw-r--r-- | dev/ZKA/KernelKit/FileMgr.hxx | 20 | ||||
| -rw-r--r-- | dev/ZKA/KernelKit/HardwareThreadScheduler.hxx | 5 | ||||
| -rw-r--r-- | dev/ZKA/KernelKit/Heap.hxx | 10 | ||||
| -rw-r--r-- | dev/ZKA/KernelKit/UserProcessScheduler.hxx | 19 |
4 files changed, 31 insertions, 23 deletions
diff --git a/dev/ZKA/KernelKit/FileMgr.hxx b/dev/ZKA/KernelKit/FileMgr.hxx index 86eade6a..5b2b8fa8 100644 --- a/dev/ZKA/KernelKit/FileMgr.hxx +++ b/dev/ZKA/KernelKit/FileMgr.hxx @@ -74,28 +74,28 @@ namespace Kernel @brief Filesystem Mgr Interface class @brief Used to provide common I/O for a specific filesystem. */ - class FilesystemMgrInterface + class IFilesystemMgr { public: - explicit FilesystemMgrInterface() = default; - virtual ~FilesystemMgrInterface() = default; + explicit IFilesystemMgr() = default; + virtual ~IFilesystemMgr() = default; public: - ZKA_COPY_DEFAULT(FilesystemMgrInterface); + ZKA_COPY_DEFAULT(IFilesystemMgr); public: /// @brief Mounts a new filesystem into an active state. /// @param interface the filesystem interface /// @return - static bool Mount(FilesystemMgrInterface* interface); + static bool Mount(IFilesystemMgr* interface); /// @brief Unmounts the active filesystem /// @return - static FilesystemMgrInterface* Unmount(); + static IFilesystemMgr* Unmount(); /// @brief Getter, gets the active filesystem. /// @return - static FilesystemMgrInterface* GetMounted(); + static IFilesystemMgr* GetMounted(); public: virtual NodePtr Create(_Input const Char* path) = 0; @@ -137,10 +137,10 @@ namespace Kernel #ifdef __FSKIT_USE_NEFS__ /** - * @brief Based of FilesystemMgrInterface, takes care of managing NeFS + * @brief Based of IFilesystemMgr, takes care of managing NeFS * disks. */ - class NewFilesystemMgr final : public FilesystemMgrInterface + class NewFilesystemMgr final : public IFilesystemMgr { public: explicit NewFilesystemMgr(); @@ -192,7 +192,7 @@ namespace Kernel * @tparam FSClass Filesystem contract who takes care of it. */ template <typename Encoding = Char, - typename FSClass = FilesystemMgrInterface> + typename FSClass = IFilesystemMgr> class FileStream final { public: diff --git a/dev/ZKA/KernelKit/HardwareThreadScheduler.hxx b/dev/ZKA/KernelKit/HardwareThreadScheduler.hxx index f5b64883..e4b83659 100644 --- a/dev/ZKA/KernelKit/HardwareThreadScheduler.hxx +++ b/dev/ZKA/KernelKit/HardwareThreadScheduler.hxx @@ -88,11 +88,10 @@ namespace Kernel class HardwareThreadScheduler final { private: - explicit HardwareThreadScheduler(); - friend class UserProcessHelper; public: + explicit HardwareThreadScheduler(); ~HardwareThreadScheduler(); ZKA_COPY_DEFAULT(HardwareThreadScheduler); @@ -102,7 +101,7 @@ namespace Kernel public: Ref<HardwareThread*> operator[](const SizeT& idx); bool operator!() noexcept; - operator bool() noexcept; + operator bool() noexcept; public: /// @brief Shared instance of the MP Mgr. diff --git a/dev/ZKA/KernelKit/Heap.hxx b/dev/ZKA/KernelKit/Heap.hxx index 27c79c83..f9d2df06 100644 --- a/dev/ZKA/KernelKit/Heap.hxx +++ b/dev/ZKA/KernelKit/Heap.hxx @@ -44,8 +44,16 @@ namespace Kernel /// @brief Makes a Kernel page. /// @param heap_ptr the page pointer. - /// @return + /// @return status code Int32 mm_make_ke_page(VoidPtr heap_ptr); + + + template <typename T, typename... Args> + inline T* mm_new_class(Args&&... args) + { + T* ptr = new T(move(args)...); + return ptr; + } } // namespace Kernel #endif // !_INC_KERNEL_HEAP_HXX_ diff --git a/dev/ZKA/KernelKit/UserProcessScheduler.hxx b/dev/ZKA/KernelKit/UserProcessScheduler.hxx index c35b65e1..845c0081 100644 --- a/dev/ZKA/KernelKit/UserProcessScheduler.hxx +++ b/dev/ZKA/KernelKit/UserProcessScheduler.hxx @@ -150,7 +150,7 @@ namespace Kernel UInt8* StackReserve{nullptr}; // Memory, images pointers. - ImagePtr Image{nullptr}; + ImagePtr Image{nullptr}; SizeT StackSize{mib_cast(8)}; @@ -168,9 +168,9 @@ namespace Kernel { VoidPtr MemoryEntry; - struct PROCESS_MEMORY_ENTRY *MemoryPrev; - struct PROCESS_MEMORY_ENTRY *MemoryNext; - } * MemoryEntryList{nullptr}; + struct PROCESS_MEMORY_ENTRY* MemoryPrev; + struct PROCESS_MEMORY_ENTRY* MemoryNext; + }* MemoryEntryList{nullptr}; SizeT MemoryPD{0}; @@ -259,6 +259,8 @@ namespace Kernel /// The main class which you call to schedule processes. class UserProcessScheduler final { + friend class UserProcessHelper; + public: explicit UserProcessScheduler() = default; @@ -266,14 +268,14 @@ namespace Kernel ZKA_COPY_DEFAULT(UserProcessScheduler) - operator bool(); + operator bool(); bool operator!(); public: UserProcessTeam& CurrentTeam(); public: - SizeT Add(UserProcess& processRef); + SizeT Add(UserProcess processRef); Bool Remove(ProcessID processSlot); public: @@ -294,11 +296,10 @@ namespace Kernel class UserProcessHelper final { public: - STATIC bool Switch(VoidPtr image_ptr, UInt8* stack_ptr, HAL::StackFramePtr frame_ptr, const PID& new_pid); - STATIC bool CanBeScheduled(const UserProcess process); + STATIC bool Switch(VoidPtr image_ptr, UInt8* stack_ptr, HAL::StackFramePtr frame_ptr, const PID& new_pid); + STATIC bool CanBeScheduled(const UserProcess& process); STATIC PID& TheCurrentPID(); STATIC SizeT StartScheduling(); - }; const UInt32& sched_get_exit_code(void) noexcept; |
