summaryrefslogtreecommitdiffhomepage
path: root/Private
diff options
context:
space:
mode:
Diffstat (limited to 'Private')
-rw-r--r--Private/Builtins/ACPI/ACPI.hpp1
-rw-r--r--Private/HALKit/AMD64/HalSMPCore.cxx2
-rw-r--r--Private/KernelKit/ProcessScheduler.hpp63
-rw-r--r--Private/KernelKit/Semaphore.hpp8
-rw-r--r--Private/Source/PEFCodeManager.cxx4
-rw-r--r--Private/Source/ProcessScheduler.cxx32
-rw-r--r--Private/Source/ProcessTeam.cxx6
-rw-r--r--Private/Source/Semaphore.cxx4
8 files changed, 59 insertions, 61 deletions
diff --git a/Private/Builtins/ACPI/ACPI.hpp b/Private/Builtins/ACPI/ACPI.hpp
index 1a4329fc..c17acac9 100644
--- a/Private/Builtins/ACPI/ACPI.hpp
+++ b/Private/Builtins/ACPI/ACPI.hpp
@@ -9,7 +9,6 @@
/**
https://uefi.org/specs/ACPI/6.5/05_ACPI_Software_Programming_Model.html
- https://wiki.osdev.org/RSDT
*/
#include <NewKit/Defines.hpp>
diff --git a/Private/HALKit/AMD64/HalSMPCore.cxx b/Private/HALKit/AMD64/HalSMPCore.cxx
index 87bfae3b..d213b2fc 100644
--- a/Private/HALKit/AMD64/HalSMPCore.cxx
+++ b/Private/HALKit/AMD64/HalSMPCore.cxx
@@ -7,7 +7,7 @@
#include <KernelKit/ProcessScheduler.hpp>
using namespace HCore;
-Void Process::SetStart(UIntPtr &imageStart) noexcept {
+Void ProcessHeader::SetStart(UIntPtr &imageStart) noexcept {
if (imageStart == 0) this->Crash();
this->StackFrame->Rbp = imageStart;
diff --git a/Private/KernelKit/ProcessScheduler.hpp b/Private/KernelKit/ProcessScheduler.hpp
index caff1125..bc974a9b 100644
--- a/Private/KernelKit/ProcessScheduler.hpp
+++ b/Private/KernelKit/ProcessScheduler.hpp
@@ -9,10 +9,10 @@
#include <ArchKit/ArchKit.hpp>
#include <KernelKit/FileManager.hpp>
-#include <KernelKit/PermissionSelector.hxx>
#include <KernelKit/LockDelegate.hpp>
-#include <NewKit/MutableArray.hpp>
+#include <KernelKit/PermissionSelector.hxx>
#include <KernelKit/UserHeap.hpp>
+#include <NewKit/MutableArray.hpp>
#define kMinMicroTime AffinityKind::kHartStandard
#define kPIDInvalid (-1)
@@ -24,22 +24,22 @@
////////////////////////////////////////////////////
namespace HCore {
-class Process;
+class ProcessHeader;
class ProcessTeam;
class ProcessManager;
-//! @brief Process identifier.
+//! @brief ProcessHeader identifier.
typedef Int64 ProcessID;
-//! @brief Process name length.
+//! @brief ProcessHeader name length.
inline constexpr SizeT kProcessLen = 256U;
//! @brief Forward declaration.
-class Process;
+class ProcessHeader;
class ProcessManager;
class ProcessHelper;
-//! @brief Process status enum.
+//! @brief ProcessHeader status enum.
enum class ProcessStatus : Int32 {
kStarting,
kRunning,
@@ -106,25 +106,25 @@ enum class ProcessSelector : Int {
using ImagePtr = VoidPtr;
using HeapPtr = VoidPtr;
-// @name Process
-// @brief Process Information Header (PIH)
+// @name ProcessHeader
+// @brief Process Header (PH)
// Holds information about the running process.
// Thread execution is being abstracted away.
-class Process final {
+class ProcessHeader final {
public:
- explicit Process(VoidPtr startImage = nullptr) : Image(startImage) {
+ explicit ProcessHeader(VoidPtr startImage = nullptr) : Image(startImage) {
MUST_PASS(startImage);
}
- ~Process() = default;
+ ~ProcessHeader() = default;
- HCORE_COPY_DEFAULT(Process)
+ HCORE_COPY_DEFAULT(ProcessHeader)
public:
void SetStart(UIntPtr &imageStart) noexcept;
public:
- Char Name[kProcessLen] = {"Process"};
+ Char Name[kProcessLen] = {"HCore Process"};
ProcessSubsystem SubSystem{0};
ProcessSelector Selector{ProcessSelector::kRingUser};
HAL::StackFramePtr StackFrame{nullptr};
@@ -171,9 +171,9 @@ class Process final {
//! @brief Wakes up threads.
void Wake(const bool wakeup = false);
- // Process getters.
+ // ProcessHeader getters.
public:
- //! @brief Process name getter, example: "C RunTime"
+ //! @brief ProcessHeader name getter, example: "C RunTime"
const Char *GetName();
const ProcessSelector &GetSelector();
@@ -188,24 +188,23 @@ class Process final {
/// \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);
+ public:
+ explicit ProcessTeam() = default;
+ ~ProcessTeam() = default;
- MutableArray<Ref<Process>>& AsArray();
- Ref<Process>& AsRef();
+ HCORE_COPY_DEFAULT(ProcessTeam);
-public:
- MutableArray<Ref<Process>> mProcessList;
- Ref<Process> mCurrentProcess;
+ MutableArray<Ref<ProcessHeader>> &AsArray();
+ Ref<ProcessHeader> &AsRef();
+ public:
+ MutableArray<Ref<ProcessHeader>> mProcessList;
+ Ref<ProcessHeader> mCurrentProcess;
};
-using ProcessPtr = Process *;
+using ProcessPtr = ProcessHeader *;
-/// @brief Process manager class.
+/// @brief ProcessHeader manager class.
/// The main class which you call to schedule an app.
class ProcessManager final {
private:
@@ -219,12 +218,12 @@ class ProcessManager final {
operator bool() { return mTeam.AsArray().Count() > 0; }
bool operator!() { return mTeam.AsArray().Count() == 0; }
- ProcessTeam& CurrentTeam() { return mTeam; }
+ ProcessTeam &CurrentTeam() { return mTeam; }
- SizeT Add(Ref<Process> &headerRef);
+ SizeT Add(Ref<ProcessHeader> &headerRef);
bool Remove(SizeT headerIndex);
- Ref<Process> &GetCurrent();
+ Ref<ProcessHeader> &GetCurrent();
SizeT Run() noexcept;
static Ref<ProcessManager> Shared();
@@ -240,7 +239,7 @@ class ProcessManager final {
class ProcessHelper final {
public:
static bool Switch(HAL::StackFrame *newStack, const PID &newPid);
- static bool CanBeScheduled(Ref<Process> &process);
+ static bool CanBeScheduled(Ref<ProcessHeader> &process);
static PID &GetCurrentPID();
static bool StartScheduling();
};
diff --git a/Private/KernelKit/Semaphore.hpp b/Private/KernelKit/Semaphore.hpp
index 6be56f21..9b9dbef3 100644
--- a/Private/KernelKit/Semaphore.hpp
+++ b/Private/KernelKit/Semaphore.hpp
@@ -11,9 +11,9 @@
namespace HCore
{
- class Process;
+ class ProcessHeader;
- typedef Process* ProcessPtr;
+ typedef ProcessHeader* ProcessPtr;
/// @brief Access control class, which locks a task until one is done.
class Semaphore final
@@ -30,8 +30,8 @@ namespace HCore
void Sync() noexcept;
public:
- bool Lock(Process* process);
- bool LockOrWait(Process* process, const Int64& seconds);
+ bool Lock(ProcessHeader* process);
+ bool LockOrWait(ProcessHeader* process, const Int64& seconds);
public:
HCORE_COPY_DEFAULT(Semaphore);
diff --git a/Private/Source/PEFCodeManager.cxx b/Private/Source/PEFCodeManager.cxx
index bd529dca..ec8756d1 100644
--- a/Private/Source/PEFCodeManager.cxx
+++ b/Private/Source/PEFCodeManager.cxx
@@ -141,8 +141,8 @@ bool execute_from_image(PEFLoader &exec) noexcept {
if (errOrStart.Error() != 0) return false;
- Process proc(errOrStart.Leak().Leak());
- Ref<Process> refProc = proc;
+ ProcessHeader proc(errOrStart.Leak().Leak());
+ Ref<ProcessHeader> refProc = proc;
return ProcessManager::Shared().Leak().Add(refProc);
}
diff --git a/Private/Source/ProcessScheduler.cxx b/Private/Source/ProcessScheduler.cxx
index 3432fe70..2ab30e94 100644
--- a/Private/Source/ProcessScheduler.cxx
+++ b/Private/Source/ProcessScheduler.cxx
@@ -6,7 +6,7 @@
/***********************************************************************************/
/// @file ProcessManager.cxx
-/// @brief Process Scheduler API.
+/// @brief ProcessHeader Scheduler API.
/***********************************************************************************/
#include <KernelKit/ProcessScheduler.hpp>
@@ -31,21 +31,21 @@ const Int32 &rt_get_exit_code() noexcept { return kExitCode; }
/***********************************************************************************/
-void Process::Crash() {
+void ProcessHeader::Crash() {
kcout << "ProcessManager: Crashed, ExitCode: -1.\r\n";
MUST_PASS(!ke_bug_check());
this->Exit(-1);
}
-void Process::Wake(const bool should_wakeup) {
+void ProcessHeader::Wake(const bool should_wakeup) {
this->Status =
should_wakeup ? ProcessStatus::kRunning : ProcessStatus::kFrozen;
}
/***********************************************************************************/
-VoidPtr Process::New(const SizeT &sz) {
+VoidPtr ProcessHeader::New(const SizeT &sz) {
if (this->FreeMemory < 1) return nullptr;
if (this->HeapCursor) {
@@ -78,7 +78,7 @@ bool rt_in_pool_region(VoidPtr pool_ptr, VoidPtr pool, const SizeT &sz) {
}
/* @brief free pointer from usage. */
-Boolean Process::Delete(VoidPtr ptr, const SizeT &sz) {
+Boolean ProcessHeader::Delete(VoidPtr ptr, const SizeT &sz) {
if (sz < 1 || this->HeapCursor == this->HeapPtr) return false;
// also check for the amount of allocations we've done so far.
@@ -97,23 +97,23 @@ Boolean Process::Delete(VoidPtr ptr, const SizeT &sz) {
return false;
}
-const Char *Process::GetName() { return this->Name; }
+const Char *ProcessHeader::GetName() { return this->Name; }
-const ProcessSelector &Process::GetSelector() { return this->Selector; }
+const ProcessSelector &ProcessHeader::GetSelector() { return this->Selector; }
-const ProcessStatus &Process::GetStatus() { return this->Status; }
+const ProcessStatus &ProcessHeader::GetStatus() { return this->Status; }
/***********************************************************************************/
/**
@brief Affinity is the time slot allowed for the process.
*/
-const AffinityKind &Process::GetAffinity() { return this->Affinity; }
+const AffinityKind &ProcessHeader::GetAffinity() { return this->Affinity; }
/**
@brief Standard exit proc.
*/
-void Process::Exit(Int32 exit_code) {
+void ProcessHeader::Exit(Int32 exit_code) {
if (this->ProcessId !=
ProcessManager::Shared().Leak().GetCurrent().Leak().ProcessId)
ke_stop(RUNTIME_CHECK_PROCESS);
@@ -144,12 +144,12 @@ void Process::Exit(Int32 exit_code) {
ProcessManager::Shared().Leak().Remove(this->ProcessId);
}
-SizeT ProcessManager::Add(Ref<Process> &process) {
+SizeT ProcessManager::Add(Ref<ProcessHeader> &process) {
if (!process) return -1;
if (process.Leak().Ring != (Int32)ProcessSelector::kRingKernel) return -1;
- kcout << "ProcessManager::Add(Ref<Process>& process)\r\n";
+ kcout << "ProcessManager::Add(Ref<ProcessHeader>& process)\r\n";
process.Leak().HeapPtr = rt_new_heap(kUserHeapUser | kUserHeapRw);
process.Leak().ProcessId = mTeam.AsArray().Count();
@@ -166,11 +166,11 @@ SizeT ProcessManager::Add(Ref<Process> &process) {
mTeam.AsArray().Add(process);
- if (!imageStart && process.Leak().Kind == Process::ExecutableType) {
+ if (!imageStart && process.Leak().Kind == ProcessHeader::ExecutableType) {
process.Leak().Crash();
}
- if (!imageStart && process.Leak().Kind == Process::DriverType) {
+ if (!imageStart && process.Leak().Kind == ProcessHeader::DriverType) {
if (process.Leak().Ring == 3)
process.Leak().Crash();
else
@@ -224,14 +224,14 @@ Ref<ProcessManager> ProcessManager::Shared() {
return {ref};
}
-Ref<Process> &ProcessManager::GetCurrent() { return mTeam.AsRef(); }
+Ref<ProcessHeader> &ProcessManager::GetCurrent() { return mTeam.AsRef(); }
PID &ProcessHelper::GetCurrentPID() {
kcout << "ProcessHelper::GetCurrentPID: Leaking ProcessId...\r\n";
return ProcessManager::Shared().Leak().GetCurrent().Leak().ProcessId;
}
-bool ProcessHelper::CanBeScheduled(Ref<Process> &process) {
+bool ProcessHelper::CanBeScheduled(Ref<ProcessHeader> &process) {
if (process.Leak().Status == ProcessStatus::kFrozen ||
process.Leak().Status == ProcessStatus::kDead)
return false;
diff --git a/Private/Source/ProcessTeam.cxx b/Private/Source/ProcessTeam.cxx
index 9e16c0cd..53b55a0f 100644
--- a/Private/Source/ProcessTeam.cxx
+++ b/Private/Source/ProcessTeam.cxx
@@ -6,14 +6,14 @@
/***********************************************************************************/
/// @file ProcessTeam.cxx
-/// @brief Process Team API.
+/// @brief ProcessHeader Team API.
/***********************************************************************************/
#include <KernelKit/ProcessScheduler.hpp>
namespace HCore {
-MutableArray<Ref<Process>>& ProcessTeam::AsArray() { return mProcessList; }
-Ref<Process>& ProcessTeam::AsRef() { return mCurrentProcess; }
+MutableArray<Ref<ProcessHeader>>& ProcessTeam::AsArray() { return mProcessList; }
+Ref<ProcessHeader>& ProcessTeam::AsRef() { return mCurrentProcess; }
} // namespace HCore
// last rev 05-03-24
diff --git a/Private/Source/Semaphore.cxx b/Private/Source/Semaphore.cxx
index 75ebfc44..9767c8bb 100644
--- a/Private/Source/Semaphore.cxx
+++ b/Private/Source/Semaphore.cxx
@@ -15,7 +15,7 @@ bool Semaphore::Unlock() noexcept {
return fLockingProcess == nullptr;
}
-bool Semaphore::Lock(Process* process) {
+bool Semaphore::Lock(ProcessHeader* process) {
if (!process || fLockingProcess) return false;
fLockingProcess = process;
@@ -25,7 +25,7 @@ bool Semaphore::Lock(Process* process) {
bool Semaphore::IsLocked() const { return fLockingProcess; }
-bool Semaphore::LockOrWait(Process* process, const Int64& seconds) {
+bool Semaphore::LockOrWait(ProcessHeader* process, const Int64& seconds) {
if (process == nullptr) return false;
HardwareTimer timer(Seconds(seconds));