summaryrefslogtreecommitdiffhomepage
path: root/dev
diff options
context:
space:
mode:
Diffstat (limited to 'dev')
-rw-r--r--dev/boot/modules/SysChk/SysChk.cc2
-rw-r--r--dev/boot/src/HEL/AMD64/BootEFI.cc2
-rw-r--r--dev/kernel/HALKit/AMD64/HalKernelMain.cc4
-rw-r--r--dev/kernel/HALKit/AMD64/HalSchedulerCorePrimitivesAMD64.cc2
-rw-r--r--dev/kernel/HALKit/ARM64/HalSchedulerCorePrimitivesARM64.cc2
-rw-r--r--dev/kernel/KernelKit/BinaryMutex.h8
-rw-r--r--dev/kernel/KernelKit/IPEFDylibObject.h4
-rw-r--r--dev/kernel/KernelKit/ProcessSchedulerCore.h137
-rw-r--r--dev/kernel/KernelKit/UserProcessScheduler.h180
-rw-r--r--dev/kernel/KernelKit/UserProcessScheduler.inl9
-rw-r--r--dev/kernel/NetworkKit/IPC.h2
-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
17 files changed, 227 insertions, 209 deletions
diff --git a/dev/boot/modules/SysChk/SysChk.cc b/dev/boot/modules/SysChk/SysChk.cc
index 1b1de6f4..9bdeb38d 100644
--- a/dev/boot/modules/SysChk/SysChk.cc
+++ b/dev/boot/modules/SysChk/SysChk.cc
@@ -31,6 +31,8 @@ EXTERN_C Int32 SysChkModuleMain(Kernel::HEL::BootInfoHeader* handover)
NE_UNUSED(handover);
#if defined(__ATA_PIO__)
+ fw_init_efi((EfiSystemTable*)handover->f_FirmwareCustomTables[1]);
+
Boot::BootTextWriter writer;
Boot::BDiskFormatFactory<BootDeviceATA> partition_factory;
diff --git a/dev/boot/src/HEL/AMD64/BootEFI.cc b/dev/boot/src/HEL/AMD64/BootEFI.cc
index 85b7f729..ae6d4deb 100644
--- a/dev/boot/src/HEL/AMD64/BootEFI.cc
+++ b/dev/boot/src/HEL/AMD64/BootEFI.cc
@@ -164,7 +164,7 @@ EFI_EXTERN_C EFI_API Int32 BootloaderMain(EfiHandlePtr image_handle,
Int32 trials = 5 * 10000000;
- writer.Write("BootZ: Allocating sufficent memory, trying with 4GB...\r");
+ writer.Write("BootZ: Allocating sufficent memory, trying 4GB...\r");
while (BS->AllocatePool(EfiLoaderData, handover_hdr->f_BitMapSize, &handover_hdr->f_BitMapStart) != kEfiOk)
{
diff --git a/dev/kernel/HALKit/AMD64/HalKernelMain.cc b/dev/kernel/HALKit/AMD64/HalKernelMain.cc
index 5c50b3e3..c2be925a 100644
--- a/dev/kernel/HALKit/AMD64/HalKernelMain.cc
+++ b/dev/kernel/HALKit/AMD64/HalKernelMain.cc
@@ -21,13 +21,13 @@ EXTERN_C Kernel::VoidPtr kInterruptVectorTable[];
EXTERN_C Kernel::VoidPtr mp_user_switch_proc;
EXTERN_C Kernel::Char mp_user_switch_proc_stack_begin[];
-STATIC Kernel::Array<ProcessTeam, kSchedTeamCount> kTeams;
+STATIC Kernel::Array<UserProcessTeam, kSchedTeamCount> kTeams;
STATIC Kernel::Void hal_pre_init_scheduler()
{
for (Kernel::SizeT i = 0U; i < Kernel::UserProcessScheduler::The().CurrentTeam().AsArray().Count(); ++i)
{
- Kernel::UserProcessScheduler::The().CurrentTeam().AsArray()[i] = Kernel::Process();
+ Kernel::UserProcessScheduler::The().CurrentTeam().AsArray()[i] = Kernel::UserProcess();
Kernel::UserProcessScheduler::The().CurrentTeam().AsArray()[i].Status = Kernel::ProcessStatusKind::kKilled;
}
}
diff --git a/dev/kernel/HALKit/AMD64/HalSchedulerCorePrimitivesAMD64.cc b/dev/kernel/HALKit/AMD64/HalSchedulerCorePrimitivesAMD64.cc
index edad0e97..c2739f27 100644
--- a/dev/kernel/HALKit/AMD64/HalSchedulerCorePrimitivesAMD64.cc
+++ b/dev/kernel/HALKit/AMD64/HalSchedulerCorePrimitivesAMD64.cc
@@ -14,7 +14,7 @@ namespace Kernel
/// @param
/***********************************************************************************/
- EXTERN_C Void __zka_pure_call(Process* process)
+ EXTERN_C Void __zka_pure_call(UserProcess* process)
{
if (process)
process->Crash();
diff --git a/dev/kernel/HALKit/ARM64/HalSchedulerCorePrimitivesARM64.cc b/dev/kernel/HALKit/ARM64/HalSchedulerCorePrimitivesARM64.cc
index 594ee76e..2f5c92e5 100644
--- a/dev/kernel/HALKit/ARM64/HalSchedulerCorePrimitivesARM64.cc
+++ b/dev/kernel/HALKit/ARM64/HalSchedulerCorePrimitivesARM64.cc
@@ -14,7 +14,7 @@ namespace Kernel
/// @param void
/***********************************************************************************/
- EXTERN_C Void __zka_pure_call(Process* process)
+ EXTERN_C Void __zka_pure_call(UserProcess* process)
{
if (process)
process->Crash();
diff --git a/dev/kernel/KernelKit/BinaryMutex.h b/dev/kernel/KernelKit/BinaryMutex.h
index 675396fd..ec1e355d 100644
--- a/dev/kernel/KernelKit/BinaryMutex.h
+++ b/dev/kernel/KernelKit/BinaryMutex.h
@@ -12,9 +12,9 @@
namespace Kernel
{
- class Process;
+ class UserProcess;
- typedef Process& UserProcessRef;
+ typedef UserProcess& UserProcessRef;
/// @brief Access control class, which locks a task until one is done.
class BinaryMutex final
@@ -31,8 +31,8 @@ namespace Kernel
BOOL WaitForProcess(const Int16& sec) noexcept;
public:
- bool Lock(Process& process);
- bool LockOrWait(Process& process, TimerInterface* timer);
+ bool Lock(UserProcess& process);
+ bool LockOrWait(UserProcess& process, TimerInterface* timer);
public:
NE_COPY_DEFAULT(BinaryMutex)
diff --git a/dev/kernel/KernelKit/IPEFDylibObject.h b/dev/kernel/KernelKit/IPEFDylibObject.h
index f1edc1d5..4769f0f9 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(Process& header);
- EXTERN_C Void rtl_fini_dylib(Process& header, IDylibRef lib, Bool* successful);
+ EXTERN_C IDylibRef rtl_init_dylib(UserProcess& header);
+ EXTERN_C Void rtl_fini_dylib(UserProcess& header, IDylibRef lib, Bool* successful);
} // namespace Kernel
#endif /* ifndef __KERNELKIT_SHARED_OBJECT_H__ */
diff --git a/dev/kernel/KernelKit/ProcessSchedulerCore.h b/dev/kernel/KernelKit/ProcessSchedulerCore.h
new file mode 100644
index 00000000..002e685e
--- /dev/null
+++ b/dev/kernel/KernelKit/ProcessSchedulerCore.h
@@ -0,0 +1,137 @@
+/* -------------------------------------------
+
+ Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved.
+
+------------------------------------------- */
+
+#pragma once
+
+#include <NewKit/Defines.h>
+
+namespace Kernel
+{
+ class UserProcess;
+ class KernelProcess;
+ 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<Int>(lhs);
+ Int32 rhs_int = static_cast<Int>(rhs);
+
+ return lhs_int < rhs_int;
+ }
+
+ inline bool operator>(AffinityKind lhs, AffinityKind rhs)
+ {
+ Int32 lhs_int = static_cast<Int>(lhs);
+ Int32 rhs_int = static_cast<Int>(rhs);
+
+ return lhs_int > rhs_int;
+ }
+
+ inline bool operator<=(AffinityKind lhs, AffinityKind rhs)
+ {
+ Int32 lhs_int = static_cast<Int>(lhs);
+ Int32 rhs_int = static_cast<Int>(rhs);
+
+ return lhs_int <= rhs_int;
+ }
+
+ inline bool operator>=(AffinityKind lhs, AffinityKind rhs)
+ {
+ Int32 lhs_int = static_cast<Int>(lhs);
+ Int32 rhs_int = static_cast<Int>(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;
+
+ struct ProcessImage final
+ {
+ explicit ProcessImage() = default;
+
+ ImagePtr fCode;
+ ImagePtr fBlob;
+
+ Bool HasCode()
+ {
+ return this->fCode != nullptr;
+ }
+
+ Bool HasImage()
+ {
+ return this->fBlob != nullptr;
+ }
+ };
+} // namespace Kernel
diff --git a/dev/kernel/KernelKit/UserProcessScheduler.h b/dev/kernel/KernelKit/UserProcessScheduler.h
index 25ff20e5..4ba4b779 100644
--- a/dev/kernel/KernelKit/UserProcessScheduler.h
+++ b/dev/kernel/KernelKit/UserProcessScheduler.h
@@ -8,18 +8,19 @@
#define INC_PROCESS_SCHEDULER_H
/// @file UserProcessScheduler.h
-/// @brief User Process scheduler code and definitions.
+/// @brief User UserProcess scheduler code and definitions.
/// @author Amlal El Mahrouss (amlal@nekernel.org)
#include <ArchKit/ArchKit.h>
#include <KernelKit/LockDelegate.h>
#include <KernelKit/User.h>
#include <NewKit/MutableArray.h>
+#include <KernelKit/ProcessSchedulerCore.h>
#define kSchedMinMicroTime (AffinityKind::kStandard)
#define kSchedInvalidPID (-1)
#define kSchedProcessLimitPerTeam (32U)
-#define kSchedTeamCount (512)
+#define kSchedTeamCount (512U)
#define kSchedMaxMemoryLimit gib_cast(128) /* max physical memory limit */
#define kSchedMaxStackSz mib_cast(8) /* maximum stack size */
@@ -35,147 +36,24 @@ namespace Kernel
//! @brief Forward declarations.
class IDylibObject;
- class Process;
- class ProcessTeam;
class UserProcessScheduler;
class UserProcessHelper;
- 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<Int>(lhs);
- Int32 rhs_int = static_cast<Int>(rhs);
-
- return lhs_int < rhs_int;
- }
-
- inline bool operator>(AffinityKind lhs, AffinityKind rhs)
- {
- Int32 lhs_int = static_cast<Int>(lhs);
- Int32 rhs_int = static_cast<Int>(rhs);
-
- return lhs_int > rhs_int;
- }
-
- inline bool operator<=(AffinityKind lhs, AffinityKind rhs)
- {
- Int32 lhs_int = static_cast<Int>(lhs);
- Int32 rhs_int = static_cast<Int>(rhs);
-
- return lhs_int <= rhs_int;
- }
-
- inline bool operator>=(AffinityKind lhs, AffinityKind rhs)
- {
- Int32 lhs_int = static_cast<Int>(lhs);
- Int32 rhs_int = static_cast<Int>(rhs);
-
- return lhs_int >= rhs_int;
- }
-
- /***********************************************************************************/
- /// @brief Subsystem enum type.
- /***********************************************************************************/
-
- enum class ProcessSubsystem : Int32
- {
- kProcessSubsystemSecurity = 100,
- kProcessSubsystemApplication,
- kProcessSubsystemService,
- kProcessSubsystemDriver,
- kProcessSubsystemInvalid = 256U,
- kProcessSubsystemCount = 4,
- };
-
- 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;
-
- struct ProcessImage final
- {
- explicit ProcessImage() = default;
-
- ImagePtr fCode;
- ImagePtr fBlob;
-
- Bool HasCode()
- {
- return this->fCode != nullptr;
- }
-
- Bool HasImage()
- {
- return this->fBlob != nullptr;
- }
- };
-
/***********************************************************************************/
- /// @name Process
- /// @brief Process class, holds information about the running process/thread.
+ /// @name UserProcess
+ /// @brief UserProcess class, holds information about the running process/thread.
/***********************************************************************************/
- class Process final
+ class UserProcess final
{
public:
- explicit Process();
- ~Process();
+ explicit UserProcess();
+ ~UserProcess();
public:
- NE_COPY_DEFAULT(Process)
+ NE_COPY_DEFAULT(UserProcess)
public:
- Char Name[kSchedNameLen] = {"Process"};
+ Char Name[kSchedNameLen] = {"UserProcess"};
ProcessSubsystem SubSystem{ProcessSubsystem::kProcessSubsystemInvalid};
User* Owner{nullptr};
HAL::StackFramePtr StackFrame{nullptr};
@@ -208,7 +86,7 @@ namespace Kernel
ProcessSignal ProcessSignal;
ProcessMemoryHeapList* ProcessMemoryHeap{nullptr};
- ProcessTeam* ProcessParentTeam;
+ UserProcessTeam* ProcessParentTeam;
VoidPtr VMRegister{0UL};
@@ -220,7 +98,7 @@ namespace Kernel
kExecutableKindCount,
};
- ProcessTime PTime{0}; //! @brief Process allocated tine.
+ ProcessTime PTime{0}; //! @brief UserProcess allocated tine.
PID ProcessId{kSchedInvalidPID};
Int32 Kind{kExecutableKind};
@@ -294,31 +172,31 @@ namespace Kernel
/// \brief Processs Team (contains multiple processes inside it.)
/// Equivalent to a process batch
- class ProcessTeam final
+ class UserProcessTeam final
{
public:
- explicit ProcessTeam();
- ~ProcessTeam() = default;
+ explicit UserProcessTeam();
+ ~UserProcessTeam() = default;
- NE_COPY_DEFAULT(ProcessTeam)
+ NE_COPY_DEFAULT(UserProcessTeam)
- Array<Process, kSchedProcessLimitPerTeam>& AsArray();
- Ref<Process>& AsRef();
+ Array<UserProcess, kSchedProcessLimitPerTeam>& AsArray();
+ Ref<UserProcess>& AsRef();
ProcessID& Id() noexcept;
public:
- Array<Process, kSchedProcessLimitPerTeam> mProcessList;
- Ref<Process> mCurrentProcess;
+ Array<UserProcess, kSchedProcessLimitPerTeam> mProcessList;
+ Ref<UserProcess> mCurrentProcess;
ProcessID mTeamId{0};
ProcessID mProcessCount{0};
};
- typedef Array<Process, kSchedProcessLimitPerTeam> UserThreadArray;
+ typedef Array<UserProcess, kSchedProcessLimitPerTeam> UserThreadArray;
- using UserProcessRef = Process&;
+ using UserProcessRef = UserProcess&;
/***********************************************************************************/
- /// @brief Process scheduler class.
+ /// @brief UserProcess scheduler class.
/// The main class which you call to schedule user processes.
/***********************************************************************************/
class UserProcessScheduler final : public ISchedulable
@@ -336,8 +214,8 @@ namespace Kernel
bool operator!();
public:
- ProcessTeam& CurrentTeam();
- BOOL SwitchTeam(ProcessTeam& team);
+ UserProcessTeam& CurrentTeam();
+ BOOL SwitchTeam(UserProcessTeam& team);
public:
ProcessID Spawn(const Char* name, VoidPtr code, VoidPtr image);
@@ -348,19 +226,19 @@ namespace Kernel
Bool HasMP() override;
public:
- Ref<Process>& CurrentProcess();
+ Ref<UserProcess>& CurrentProcess();
SizeT Run() noexcept;
public:
STATIC UserProcessScheduler& The();
private:
- ProcessTeam mTeam{};
+ UserProcessTeam mTeam{};
};
/***********************************************************************************/
/**
- * \brief Process helper class, which contains needed utilities for the scheduler.
+ * \brief UserProcess helper class, which contains needed utilities for the scheduler.
*/
/***********************************************************************************/
@@ -368,7 +246,7 @@ namespace Kernel
{
public:
STATIC Bool Switch(VoidPtr image_ptr, UInt8* stack_ptr, HAL::StackFramePtr frame_ptr, PID new_pid);
- STATIC Bool CanBeScheduled(const Process& process);
+ STATIC Bool CanBeScheduled(const UserProcess& process);
STATIC ErrorOr<PID> TheCurrentPID();
STATIC SizeT StartScheduling();
};
diff --git a/dev/kernel/KernelKit/UserProcessScheduler.inl b/dev/kernel/KernelKit/UserProcessScheduler.inl
index ea57cf65..4179545c 100644
--- a/dev/kernel/KernelKit/UserProcessScheduler.inl
+++ b/dev/kernel/KernelKit/UserProcessScheduler.inl
@@ -3,12 +3,13 @@
Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved.
FILE: UserProcessScheduler.inl
- PURPOSE: Low level/Ring-3 Process scheduler.
+ PURPOSE: Low level/Ring-3 UserProcess scheduler.
------------------------------------------- */
-/// @brief Process scheduler inline definitions.
+/// @brief UserProcess scheduler inline definitions.
/// @author Amlal El Mahrouss (amlal@nekernel.org)
+/// @date Tue Apr 22 22:01:07 CEST 2025
namespace Kernel
{
@@ -17,14 +18,14 @@ namespace Kernel
/***********************************************************************************/
template <typename T>
- Boolean Process::Delete(ErrorOr<T*> ptr)
+ Boolean UserProcess::Delete(ErrorOr<T*> ptr)
{
if (!ptr)
return No;
if (!this->ProcessMemoryHeap)
{
- kout << "Process's heap is empty.\r";
+ kout << "UserProcess's heap is empty.\r";
return No;
}
diff --git a/dev/kernel/NetworkKit/IPC.h b/dev/kernel/NetworkKit/IPC.h
index 6304740c..6de306b2 100644
--- a/dev/kernel/NetworkKit/IPC.h
+++ b/dev/kernel/NetworkKit/IPC.h
@@ -34,7 +34,7 @@ namespace Kernel
struct PACKED IPC_ADDR final
{
UInt64 UserProcessID;
- UInt64 ProcessTeam;
+ UInt64 UserProcessTeam;
////////////////////////////////////
// some operators.
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 ||