summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAmlal EL Mahrouss <113760121+amlel-el-mahrouss@users.noreply.github.com>2025-01-25 08:11:24 +0100
committerGitHub <noreply@github.com>2025-01-25 08:11:24 +0100
commita37ea0c0daca3ee73dd2abbb34decbd7b6799ef8 (patch)
treed41056232d9e56a4ecebb8407dd96ec2222b3e4e
parent3142554fd2e6326d8a5399b4cee904c797f9a277 (diff)
META: Refactor GetCurrentProcess to CurrentProcess
-rw-r--r--dev/Kernel/HALKit/AMD64/HalCoreInterruptHandlerAMD64.cc12
-rw-r--r--dev/Kernel/KernelKit/LPC.h6
-rw-r--r--dev/Kernel/KernelKit/ThreadLocalStorage.inl4
-rw-r--r--dev/Kernel/KernelKit/UserProcessScheduler.h2
-rw-r--r--dev/Kernel/src/UserProcessScheduler.cc8
5 files changed, 16 insertions, 16 deletions
diff --git a/dev/Kernel/HALKit/AMD64/HalCoreInterruptHandlerAMD64.cc b/dev/Kernel/HALKit/AMD64/HalCoreInterruptHandlerAMD64.cc
index a6c205f6..2c7e043c 100644
--- a/dev/Kernel/HALKit/AMD64/HalCoreInterruptHandlerAMD64.cc
+++ b/dev/Kernel/HALKit/AMD64/HalCoreInterruptHandlerAMD64.cc
@@ -15,7 +15,7 @@ STATIC BOOL kIsScheduling = NO;
/// @param rsp
EXTERN_C void idt_handle_gpf(Kernel::UIntPtr rsp)
{
- auto process = Kernel::UserProcessScheduler::The().GetCurrentProcess();
+ auto process = Kernel::UserProcessScheduler::The().CurrentProcess();
if (process.Leak().Status != Kernel::ProcessStatusKind::kRunning)
return;
@@ -39,7 +39,7 @@ EXTERN_C void idt_handle_gpf(Kernel::UIntPtr rsp)
/// @param rsp
EXTERN_C void idt_handle_pf(Kernel::UIntPtr rsp)
{
- auto process = Kernel::UserProcessScheduler::The().GetCurrentProcess();
+ auto process = Kernel::UserProcessScheduler::The().CurrentProcess();
if (process.Leak().Status != Kernel::ProcessStatusKind::kRunning)
return;
@@ -86,7 +86,7 @@ EXTERN_C void idt_handle_scheduler(Kernel::UIntPtr rsp)
/// @param rsp
EXTERN_C void idt_handle_math(Kernel::UIntPtr rsp)
{
- auto process = Kernel::UserProcessScheduler::The().GetCurrentProcess();
+ auto process = Kernel::UserProcessScheduler::The().CurrentProcess();
if (process.Leak().Status != Kernel::ProcessStatusKind::kRunning)
return;
@@ -110,7 +110,7 @@ EXTERN_C void idt_handle_math(Kernel::UIntPtr rsp)
/// @param rsp
EXTERN_C void idt_handle_generic(Kernel::UIntPtr rsp)
{
- auto process = Kernel::UserProcessScheduler::The().GetCurrentProcess();
+ auto process = Kernel::UserProcessScheduler::The().CurrentProcess();
if (process.Leak().Status != Kernel::ProcessStatusKind::kRunning)
return;
@@ -132,7 +132,7 @@ EXTERN_C void idt_handle_generic(Kernel::UIntPtr rsp)
EXTERN_C Kernel::Void idt_handle_breakpoint(Kernel::UIntPtr rip)
{
- auto process = Kernel::UserProcessScheduler::The().GetCurrentProcess();
+ auto process = Kernel::UserProcessScheduler::The().CurrentProcess();
if (process.Leak().Status != Kernel::ProcessStatusKind::kRunning)
return;
@@ -156,7 +156,7 @@ EXTERN_C Kernel::Void idt_handle_breakpoint(Kernel::UIntPtr rip)
/// @param rsp
EXTERN_C void idt_handle_ud(Kernel::UIntPtr rsp)
{
- auto process = Kernel::UserProcessScheduler::The().GetCurrentProcess();
+ auto process = Kernel::UserProcessScheduler::The().CurrentProcess();
if (process.Leak().Status != Kernel::ProcessStatusKind::kRunning)
return;
diff --git a/dev/Kernel/KernelKit/LPC.h b/dev/Kernel/KernelKit/LPC.h
index 434a3efc..ee093929 100644
--- a/dev/Kernel/KernelKit/LPC.h
+++ b/dev/Kernel/KernelKit/LPC.h
@@ -11,9 +11,9 @@
/// @file LPC.h
/// @brief Local Process Codes.
-#define err_local_ok() (Kernel::UserProcessScheduler::The().GetCurrentProcess().Leak().GetLocalCode() == Kernel::kErrorSuccess)
-#define err_local_fail() (Kernel::UserProcessScheduler::The().GetCurrentProcess().Leak().GetLocalCode() != Kernel::kErrorSuccess)
-#define err_local_get() (Kernel::UserProcessScheduler::The().GetCurrentProcess().Leak().GetLocalCode())
+#define err_local_ok() (Kernel::UserProcessScheduler::The().CurrentProcess().Leak().GetLocalCode() == Kernel::kErrorSuccess)
+#define err_local_fail() (Kernel::UserProcessScheduler::The().CurrentProcess().Leak().GetLocalCode() != Kernel::kErrorSuccess)
+#define err_local_get() (Kernel::UserProcessScheduler::The().CurrentProcess().Leak().GetLocalCode())
#define err_global_ok() (Kernel::kErrorLocalNumber == Kernel::kErrorSuccess)
#define err_global_fail() (Kernel::kErrorLocalNumber != Kernel::kErrorSuccess)
diff --git a/dev/Kernel/KernelKit/ThreadLocalStorage.inl b/dev/Kernel/KernelKit/ThreadLocalStorage.inl
index 6573209a..cfdcf47c 100644
--- a/dev/Kernel/KernelKit/ThreadLocalStorage.inl
+++ b/dev/Kernel/KernelKit/ThreadLocalStorage.inl
@@ -16,7 +16,7 @@ inline T* tls_new_ptr(void) noexcept
{
using namespace Kernel;
- auto ref_process = UserProcessScheduler::The().GetCurrentProcess();
+ auto ref_process = UserProcessScheduler::The().CurrentProcess();
MUST_PASS(ref_process);
auto pointer = ref_process.Leak().New(sizeof(T));
@@ -37,7 +37,7 @@ inline Kernel::Bool tls_delete_ptr(T* obj) noexcept
if (!obj)
return No;
- auto ref_process = UserProcessScheduler::The().GetCurrentProcess();
+ auto ref_process = UserProcessScheduler::The().CurrentProcess();
MUST_PASS(ref_process);
ErrorOr<T*> obj_wrapped{obj};
diff --git a/dev/Kernel/KernelKit/UserProcessScheduler.h b/dev/Kernel/KernelKit/UserProcessScheduler.h
index 0682a9cd..98488226 100644
--- a/dev/Kernel/KernelKit/UserProcessScheduler.h
+++ b/dev/Kernel/KernelKit/UserProcessScheduler.h
@@ -303,7 +303,7 @@ namespace Kernel
const Bool HasMP() override;
public:
- Ref<UserProcess>& GetCurrentProcess();
+ Ref<UserProcess>& CurrentProcess();
const SizeT Run() noexcept;
public:
diff --git a/dev/Kernel/src/UserProcessScheduler.cc b/dev/Kernel/src/UserProcessScheduler.cc
index 2b71b08b..613792a0 100644
--- a/dev/Kernel/src/UserProcessScheduler.cc
+++ b/dev/Kernel/src/UserProcessScheduler.cc
@@ -442,7 +442,7 @@ namespace Kernel
if (UserProcessHelper::CanBeScheduled(process))
{
// Set current process header.
- this->GetCurrentProcess() = process;
+ this->CurrentProcess() = process;
process.PTime = static_cast<Int32>(process.Affinity);
@@ -476,7 +476,7 @@ namespace Kernel
/// @brief Gets current running process.
/// @return
- Ref<UserProcess>& UserProcessScheduler::GetCurrentProcess()
+ Ref<UserProcess>& UserProcessScheduler::CurrentProcess()
{
return mTeam.AsRef();
}
@@ -485,11 +485,11 @@ namespace Kernel
/// @return UserProcess ID integer.
ErrorOr<PID> UserProcessHelper::TheCurrentPID()
{
- if (!kProcessScheduler.GetCurrentProcess())
+ if (!kProcessScheduler.CurrentProcess())
return ErrorOr<PID>{kErrorProcessFault};
kcout << "UserProcessHelper::TheCurrentPID: Leaking ProcessId...\r";
- return ErrorOr<PID>{kProcessScheduler.GetCurrentProcess().Leak().ProcessId};
+ return ErrorOr<PID>{kProcessScheduler.CurrentProcess().Leak().ProcessId};
}
/// @brief Check if process can be schedulded.