From c142fe6fda7d09e929c9706b444cdc13ed5e72f3 Mon Sep 17 00:00:00 2001 From: Amlal EL Mahrouss Date: Fri, 28 Jun 2024 08:26:19 +0200 Subject: IMP: Feature Pack #1 - Process scheduler. - System calls. - ACPI support. - Driver kit. - Filesystem support. - Program loader. - newstd/herror APIs. Signed-off-by: Amlal EL Mahrouss --- Kernel/KernelKit/ProcessScheduler.hxx | 17 ++++++++++------- Kernel/KernelKit/SMPManager.hpp | 6 +++--- Kernel/KernelKit/Semaphore.hpp | 5 +++-- 3 files changed, 16 insertions(+), 12 deletions(-) (limited to 'Kernel/KernelKit') diff --git a/Kernel/KernelKit/ProcessScheduler.hxx b/Kernel/KernelKit/ProcessScheduler.hxx index 98008d69..11555b1d 100644 --- a/Kernel/KernelKit/ProcessScheduler.hxx +++ b/Kernel/KernelKit/ProcessScheduler.hxx @@ -141,7 +141,8 @@ namespace NewOS NEWOS_COPY_DEFAULT(ProcessHeader) public: - void SetEntrypoint(UIntPtr& imageStart) noexcept; + void SetEntrypoint(UIntPtr& imageStart) noexcept; + const Int32& GetExitCode() noexcept; public: Char Name[kProcessLen] = {"Process"}; @@ -179,30 +180,32 @@ namespace NewOS } //! @brief Crash the app, exits with code ~0. - void Crash(); + Void Crash(); //! @brief Exits app. - void Exit(Int32 exitCode = 0); + Void Exit(Int32 exitCode = 0); //! @brief TLS Allocate - VoidPtr New(const SizeT& sz); + VoidPtr New(const SizeT& sz); //! @brief TLS Free. - Boolean Delete(VoidPtr ptr, const SizeT& sz); + Boolean Delete(VoidPtr ptr, const SizeT& sz); //! @brief Wakes up threads. - void Wake(const bool wakeup = false); + Void Wake(const bool wakeup = false); // ProcessHeader getters. public: //! @brief ProcessHeader name getter, example: "C RunTime" - const Char* GetName(); + const Char* GetName(); const ProcessSelector& GetSelector(); const ProcessStatus& GetStatus(); const AffinityKind& GetAffinity(); private: + Int32 fLastExitCode{0}; + friend ProcessScheduler; friend ProcessHelper; }; diff --git a/Kernel/KernelKit/SMPManager.hpp b/Kernel/KernelKit/SMPManager.hpp index 1840dd20..9f4166ad 100644 --- a/Kernel/KernelKit/SMPManager.hpp +++ b/Kernel/KernelKit/SMPManager.hpp @@ -4,8 +4,8 @@ ------------------------------------------- */ -#ifndef __SMP_MANAGER__ -#define __SMP_MANAGER__ +#ifndef __INC_SMP_MANAGER_HPP__ +#define __INC_SMP_MANAGER_HPP__ #include #include @@ -126,4 +126,4 @@ namespace NewOS Void rt_hang_thread(HAL::StackFramePtr stack); } // namespace NewOS -#endif // !__SMP_MANAGER__ +#endif // !__INC_SMP_MANAGER_HPP__ diff --git a/Kernel/KernelKit/Semaphore.hpp b/Kernel/KernelKit/Semaphore.hpp index 7850804d..83d711ed 100644 --- a/Kernel/KernelKit/Semaphore.hpp +++ b/Kernel/KernelKit/Semaphore.hpp @@ -7,6 +7,7 @@ #pragma once #include +#include #include namespace NewOS @@ -27,11 +28,11 @@ namespace NewOS bool Unlock() noexcept; public: - void Sync() noexcept; + void WaitForProcess() noexcept; public: bool Lock(ProcessHeader* process); - bool LockOrWait(ProcessHeader* process, const Int64& seconds); + bool LockOrWait(ProcessHeader* process, HardwareTimerInterface* timer); public: NEWOS_COPY_DEFAULT(Semaphore); -- cgit v1.2.3