diff options
| author | Amlal El Mahrouss <amlalelmahrouss@icloud.com> | 2024-03-08 11:45:31 +0000 |
|---|---|---|
| committer | Amlal El Mahrouss <amlalelmahrouss@icloud.com> | 2024-03-08 11:45:31 +0000 |
| commit | 842d35cdd8511adf379c4ccb52010b9b71e0757f (patch) | |
| tree | 5d49b59f49d633fe10aaf416056b2a413f60f1e8 /Private/KernelKit | |
| parent | db0c8756f85c4a1f1f7770b704528d135ed765b9 (diff) | |
HCR-14:
- Improve kernel scheduler.
- Defined a ProcessTeam object.
- Define an entrypoint for a PE personality as a helper macro.
Diffstat (limited to 'Private/KernelKit')
| -rw-r--r-- | Private/KernelKit/PE.hpp | 2 | ||||
| -rw-r--r-- | Private/KernelKit/ProcessManager.hpp | 14 | ||||
| -rw-r--r-- | Private/KernelKit/ProcessTeam.hpp | 35 |
3 files changed, 45 insertions, 6 deletions
diff --git a/Private/KernelKit/PE.hpp b/Private/KernelKit/PE.hpp index c9e4e19c..9ab094d9 100644 --- a/Private/KernelKit/PE.hpp +++ b/Private/KernelKit/PE.hpp @@ -118,4 +118,6 @@ typedef struct ExecImportDirectory { U32 mThunkTableRva; } ExecImportDirectory, *ExecImportDirectoryPtr; +#define kPeStart "__hcore_subsys_start" + #endif /* ifndef __PE__ */ diff --git a/Private/KernelKit/ProcessManager.hpp b/Private/KernelKit/ProcessManager.hpp index 277a2985..d7a3d39e 100644 --- a/Private/KernelKit/ProcessManager.hpp +++ b/Private/KernelKit/ProcessManager.hpp @@ -9,6 +9,7 @@ #include <ArchKit/ArchKit.hpp> #include <KernelKit/FileManager.hpp> +#include <KernelKit/ProcessTeam.hpp> #include <KernelKit/PermissionSelector.hxx> #include <NewKit/LockDelegate.hpp> #include <NewKit/MutableArray.hpp> @@ -191,11 +192,13 @@ class ProcessManager final { HCORE_COPY_DEFAULT(ProcessManager) - operator bool() { return m_Headers.Count() > 0; } - bool operator!() { return m_Headers.Count() == 0; } + operator bool() { return mTeam.AsArray().Count() > 0; } + bool operator!() { return mTeam.AsArray().Count() == 0; } - bool Add(Ref<Process> &Header); - bool Remove(SizeT Header); + ProcessTeam& CurrentTeam() { return mTeam; } + + SizeT Add(Ref<Process> &headerRef); + bool Remove(SizeT headerIndex); Ref<Process> &GetCurrent(); SizeT Run() noexcept; @@ -203,8 +206,7 @@ class ProcessManager final { static Ref<ProcessManager> Shared(); private: - MutableArray<Ref<Process>> m_Headers; - Ref<Process> m_CurrentProcess; + ProcessTeam mTeam; }; /* diff --git a/Private/KernelKit/ProcessTeam.hpp b/Private/KernelKit/ProcessTeam.hpp new file mode 100644 index 00000000..1fb78d1d --- /dev/null +++ b/Private/KernelKit/ProcessTeam.hpp @@ -0,0 +1,35 @@ +/* ------------------------------------------- + + Copyright Mahrouss Logic + +------------------------------------------- */ + +#pragma once + +#include <ArchKit/ArchKit.hpp> +#include <KernelKit/FileManager.hpp> +#include <KernelKit/PermissionSelector.hxx> +#include <NewKit/LockDelegate.hpp> +#include <NewKit/MutableArray.hpp> +#include <NewKit/UserHeap.hpp> + +/// kernel namespace +namespace HCore { +/// \brief Processs Team (contains multiple processes inside it.) +/// Equivalent to a process batch +class ProcessTeam final { +public: + explicit ProcessTeam() = default; + ~ProcessTeam() = default; + + HCORE_COPY_DEFAULT(ProcessTeam); + + MutableArray<Ref<Process>>& AsArray() { return mProcessList; } + Ref<Process>& AsRef() { return mCurrentProcess; } + +public: + MutableArray<Ref<Process>> mProcessList; + Ref<Process> mCurrentProcess; + +}; +} // namespace HCore
\ No newline at end of file |
