summaryrefslogtreecommitdiffhomepage
path: root/dev/kernel/src
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-04-22 22:11:14 +0200
committerAmlal El Mahrouss <amlal@nekernel.org>2025-04-22 22:11:14 +0200
commitd67240d20d1d4bbe33134e640fd632cfd5fc6795 (patch)
tree999395dbf586a8cb704376024de60f7d80f21f4e /dev/kernel/src
parent70756582de9f79eb2961c7aa91f1b0cdfe11cfc4 (diff)
dev, kernel: WiP changes done to kernel and SysChk module.
- Getting SysChk to work again. - Refactor scheduler. Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'dev/kernel/src')
-rw-r--r--dev/kernel/src/BinaryMutex.cc6
-rw-r--r--dev/kernel/src/IPEFDylibObject.cc4
-rw-r--r--dev/kernel/src/Network/IPCAddr.cc8
-rw-r--r--dev/kernel/src/Network/IPCMsg.cc4
-rw-r--r--dev/kernel/src/ProcessTeam.cc14
-rw-r--r--dev/kernel/src/UserProcessScheduler.cc48
6 files changed, 42 insertions, 42 deletions
diff --git a/dev/kernel/src/BinaryMutex.cc b/dev/kernel/src/BinaryMutex.cc
index 1ed08fa9..ea6d5408 100644
--- a/dev/kernel/src/BinaryMutex.cc
+++ b/dev/kernel/src/BinaryMutex.cc
@@ -16,7 +16,7 @@ namespace Kernel
{
if (fLockingProcess)
{
- fLockingProcess = Process();
+ fLockingProcess = UserProcess();
fLockingProcess.Status = ProcessStatusKind::kFrozen;
return Yes;
}
@@ -27,7 +27,7 @@ namespace Kernel
/***********************************************************************************/
/// @brief Locks process in the semaphore.
/***********************************************************************************/
- Bool BinaryMutex::Lock(Process& process)
+ Bool BinaryMutex::Lock(UserProcess& process)
{
if (!process || fLockingProcess)
return No;
@@ -48,7 +48,7 @@ namespace Kernel
/***********************************************************************************/
/// @brief Try lock or wait.
/***********************************************************************************/
- Bool BinaryMutex::LockOrWait(Process& process, TimerInterface* timer)
+ Bool BinaryMutex::LockOrWait(UserProcess& process, TimerInterface* timer)
{
if (timer == nullptr)
return No;
diff --git a/dev/kernel/src/IPEFDylibObject.cc b/dev/kernel/src/IPEFDylibObject.cc
index 3dd956c9..a42d267a 100644
--- a/dev/kernel/src/IPEFDylibObject.cc
+++ b/dev/kernel/src/IPEFDylibObject.cc
@@ -41,7 +41,7 @@ using namespace Kernel;
/** @brief Library initializer. */
/***********************************************************************************/
-EXTERN_C IDylibRef rtl_init_dylib(Process& process)
+EXTERN_C IDylibRef rtl_init_dylib(UserProcess& process)
{
IDylibRef dll_obj = tls_new_class<IPEFDylibObject>();
@@ -91,7 +91,7 @@ EXTERN_C IDylibRef rtl_init_dylib(Process& process)
/** @param successful Reports if successful or not. */
/***********************************************************************************/
-EXTERN_C Void rtl_fini_dylib(Process& process, IDylibRef dll_obj, BOOL* successful)
+EXTERN_C Void rtl_fini_dylib(UserProcess& process, IDylibRef dll_obj, BOOL* successful)
{
MUST_PASS(successful);
diff --git a/dev/kernel/src/Network/IPCAddr.cc b/dev/kernel/src/Network/IPCAddr.cc
index a56aec14..80a14264 100644
--- a/dev/kernel/src/Network/IPCAddr.cc
+++ b/dev/kernel/src/Network/IPCAddr.cc
@@ -12,21 +12,21 @@ namespace Kernel
{
bool IPC_ADDR::operator==(const IPC_ADDR& addr) noexcept
{
- return addr.UserProcessID == this->UserProcessID && addr.ProcessTeam == this->ProcessTeam;
+ return addr.UserProcessID == this->UserProcessID && addr.UserProcessTeam == this->UserProcessTeam;
}
bool IPC_ADDR::operator==(IPC_ADDR& addr) noexcept
{
- return addr.UserProcessID == this->UserProcessID && addr.ProcessTeam == this->ProcessTeam;
+ return addr.UserProcessID == this->UserProcessID && addr.UserProcessTeam == this->UserProcessTeam;
}
bool IPC_ADDR::operator!=(const IPC_ADDR& addr) noexcept
{
- return addr.UserProcessID != this->UserProcessID || addr.ProcessTeam != this->ProcessTeam;
+ return addr.UserProcessID != this->UserProcessID || addr.UserProcessTeam != this->UserProcessTeam;
}
bool IPC_ADDR::operator!=(IPC_ADDR& addr) noexcept
{
- return addr.UserProcessID != this->UserProcessID || addr.ProcessTeam != this->ProcessTeam;
+ return addr.UserProcessID != this->UserProcessID || addr.UserProcessTeam != this->UserProcessTeam;
}
} // namespace Kernel
diff --git a/dev/kernel/src/Network/IPCMsg.cc b/dev/kernel/src/Network/IPCMsg.cc
index ceb0ae98..457776b3 100644
--- a/dev/kernel/src/Network/IPCMsg.cc
+++ b/dev/kernel/src/Network/IPCMsg.cc
@@ -91,10 +91,10 @@ namespace Kernel
(*pckt_in)->IpcPacketSize = sizeof(IPC_MSG);
(*pckt_in)->IpcTo.UserProcessID = 0;
- (*pckt_in)->IpcTo.ProcessTeam = 0;
+ (*pckt_in)->IpcTo.UserProcessTeam = 0;
(*pckt_in)->IpcFrom.UserProcessID = 0;
- (*pckt_in)->IpcFrom.ProcessTeam = 0;
+ (*pckt_in)->IpcFrom.UserProcessTeam = 0;
return Yes;
}
diff --git a/dev/kernel/src/ProcessTeam.cc b/dev/kernel/src/ProcessTeam.cc
index 87d21d67..5ac3efeb 100644
--- a/dev/kernel/src/ProcessTeam.cc
+++ b/dev/kernel/src/ProcessTeam.cc
@@ -5,19 +5,19 @@
------------------------------------------- */
/***********************************************************************************/
-/// @file ProcessTeam.cc
+/// @file UserProcessTeam.cc
/// @brief Process teams implementation.
/***********************************************************************************/
-#include <KernelKit/ProcessScheduler.h>
+#include <KernelKit/UserProcessScheduler.h>
namespace Kernel
{
- ProcessTeam::ProcessTeam()
+ UserProcessTeam::UserProcessTeam()
{
for (SizeT i = 0U; i < this->mProcessList.Count(); ++i)
{
- this->mProcessList[i] = Process();
+ this->mProcessList[i] = UserProcess();
this->mProcessList[i].PTime = 0;
this->mProcessList[i].Status = ProcessStatusKind::kKilled;
}
@@ -30,7 +30,7 @@ namespace Kernel
/// @return The list of process to schedule.
/***********************************************************************************/
- Array<Process, kSchedProcessLimitPerTeam>& ProcessTeam::AsArray()
+ Array<UserProcess, kSchedProcessLimitPerTeam>& UserProcessTeam::AsArray()
{
return this->mProcessList;
}
@@ -40,7 +40,7 @@ namespace Kernel
/// @return The team's ID.
/***********************************************************************************/
- ProcessID& ProcessTeam::Id() noexcept
+ ProcessID& UserProcessTeam::Id() noexcept
{
return this->mTeamId;
}
@@ -50,7 +50,7 @@ namespace Kernel
/// @return The current process header.
/***********************************************************************************/
- Ref<Process>& ProcessTeam::AsRef()
+ Ref<UserProcess>& UserProcessTeam::AsRef()
{
return this->mCurrentProcess;
}
diff --git a/dev/kernel/src/UserProcessScheduler.cc b/dev/kernel/src/UserProcessScheduler.cc
index d8d34010..5295c15a 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 Process scheduler.
+ PURPOSE: Low level/Ring-3 UserProcess scheduler.
------------------------------------------- */
@@ -37,8 +37,8 @@ namespace Kernel
STATIC UserProcessScheduler kScheduler;
- Process::Process() = default;
- Process::~Process() = default;
+ UserProcess::UserProcess() = default;
+ UserProcess::~UserProcess() = default;
/// @brief Gets the last exit code.
/// @note Not thread-safe.
@@ -53,7 +53,7 @@ namespace Kernel
/// @brief Crashes the current process.
/***********************************************************************************/
- Void Process::Crash()
+ Void UserProcess::Crash()
{
if (this->Status != ProcessStatusKind::kRunning)
return;
@@ -66,7 +66,7 @@ namespace Kernel
/// @brief boolean operator, check status.
/***********************************************************************************/
- Process::operator bool()
+ UserProcess::operator bool()
{
return this->Status == ProcessStatusKind::kRunning;
}
@@ -77,7 +77,7 @@ namespace Kernel
/// @return Int32 the last exit code.
/***********************************************************************************/
- const UInt32& Process::GetExitCode() noexcept
+ const UInt32& UserProcess::GetExitCode() noexcept
{
return this->fLastExitCode;
}
@@ -86,7 +86,7 @@ namespace Kernel
/// @brief Error code variable getter.
/***********************************************************************************/
- Int32& Process::GetLocalCode() noexcept
+ Int32& UserProcess::GetLocalCode() noexcept
{
return this->fLocalCode;
}
@@ -96,7 +96,7 @@ namespace Kernel
/// @param should_wakeup if the program shall wakeup or not.
/***********************************************************************************/
- Void Process::Wake(Bool should_wakeup)
+ Void UserProcess::Wake(Bool should_wakeup)
{
this->Status =
should_wakeup ? ProcessStatusKind::kRunning : ProcessStatusKind::kFrozen;
@@ -106,7 +106,7 @@ namespace Kernel
/** @brief Allocate pointer to track list. */
/***********************************************************************************/
- ErrorOr<VoidPtr> Process::New(SizeT sz, SizeT pad_amount)
+ ErrorOr<VoidPtr> UserProcess::New(SizeT sz, SizeT pad_amount)
{
#ifdef __NE_VIRTUAL_MEMORY_SUPPORT__
auto vm_register = hal_read_cr3();
@@ -159,7 +159,7 @@ namespace Kernel
/// @brief Gets the name of the current process.
/***********************************************************************************/
- const Char* Process::GetName() noexcept
+ const Char* UserProcess::GetName() noexcept
{
return this->Name;
}
@@ -168,13 +168,13 @@ namespace Kernel
/// @brief Gets the owner of the process.
/***********************************************************************************/
- const User* Process::GetOwner() noexcept
+ const User* UserProcess::GetOwner() noexcept
{
return this->Owner;
}
- /// @brief Process status getter.
- const ProcessStatusKind& Process::GetStatus() noexcept
+ /// @brief UserProcess status getter.
+ const ProcessStatusKind& UserProcess::GetStatus() noexcept
{
return this->Status;
}
@@ -185,7 +185,7 @@ namespace Kernel
*/
/***********************************************************************************/
- const AffinityKind& Process::GetAffinity() noexcept
+ const AffinityKind& UserProcess::GetAffinity() noexcept
{
return this->Affinity;
}
@@ -197,7 +197,7 @@ namespace Kernel
*/
/***********************************************************************************/
- Void Process::Exit(const Int32& exit_code)
+ Void UserProcess::Exit(const Int32& exit_code)
{
this->Status = exit_code > 0 ? ProcessStatusKind::kKilled : ProcessStatusKind::kFrozen;
this->fLastExitCode = exit_code;
@@ -305,7 +305,7 @@ namespace Kernel
++this->mTeam.mProcessCount;
- Process& process = this->mTeam.mProcessList[pid];
+ UserProcess& process = this->mTeam.mProcessList[pid];
process.Image.fCode = code;
process.Image.fBlob = image;
@@ -356,12 +356,12 @@ namespace Kernel
// React according to process kind.
switch (process.Kind)
{
- case Process::kExecutableDylibKind: {
+ case UserProcess::kExecutableDylibKind: {
process.DylibDelegate = rtl_init_dylib(process);
MUST_PASS(process.DylibDelegate);
break;
}
- case Process::kExecutableKind: {
+ case UserProcess::kExecutableKind: {
break;
}
default: {
@@ -457,7 +457,7 @@ namespace Kernel
/***********************************************************************************/
/// @brief Run User scheduler object.
- /// @return Process count executed within a team.
+ /// @return UserProcess count executed within a team.
/***********************************************************************************/
SizeT UserProcessScheduler::Run() noexcept
@@ -507,7 +507,7 @@ namespace Kernel
/// @brief Gets the current scheduled team.
/// @return
- ProcessTeam& UserProcessScheduler::CurrentTeam()
+ UserProcessTeam& UserProcessScheduler::CurrentTeam()
{
return mTeam;
}
@@ -519,7 +519,7 @@ namespace Kernel
/// @retval false team was not switched.
/***********************************************************************************/
- BOOL UserProcessScheduler::SwitchTeam(ProcessTeam& team)
+ BOOL UserProcessScheduler::SwitchTeam(UserProcessTeam& team)
{
if (team.AsArray().Count() < 1)
return No;
@@ -531,13 +531,13 @@ namespace Kernel
/// @brief Gets current running process.
/// @return
- Ref<Process>& UserProcessScheduler::CurrentProcess()
+ Ref<UserProcess>& UserProcessScheduler::CurrentProcess()
{
return mTeam.AsRef();
}
/// @brief Current proccess id getter.
- /// @return Process ID integer.
+ /// @return UserProcess ID integer.
ErrorOr<PID> UserProcessHelper::TheCurrentPID()
{
if (!kScheduler.CurrentProcess())
@@ -551,7 +551,7 @@ namespace Kernel
/// @param process the process reference.
/// @retval true can be schedulded.
/// @retval false cannot be schedulded.
- Bool UserProcessHelper::CanBeScheduled(const Process& process)
+ Bool UserProcessHelper::CanBeScheduled(const UserProcess& process)
{
if (process.Status == ProcessStatusKind::kKilled ||
process.Status == ProcessStatusKind::kFinished ||