From ba8ddb24e0ac6c7b1a617519a4bde9970610fbcc Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Mon, 11 Mar 2024 20:59:22 +0100 Subject: Kernel: Important changes, needs to be merged to master. - Add Logon executive. - Adding HCore System Call Interface (inside System.Core.dll) - Add _InOut and _StrictInOut inside HintKit. Signed-off-by: Amlal El Mahrouss Signed-off-by: amlal --- Private/Executives/Logon/.gitkeep | 0 .../HALKit/AMD64/HalCoreInterruptHandlerAMD64.cpp | 2 +- Private/HALKit/AMD64/HalKernelMain.cxx | 2 +- Private/HALKit/AMD64/HalSMPCore.cxx | 4 +- Private/HintKit/CompilerHint.hxx | 3 + Private/KernelKit/HError.hpp | 3 + Private/KernelKit/ProcessManager.hpp | 257 ----------------- Private/KernelKit/ProcessScheduler.hpp | 258 +++++++++++++++++ Private/KernelKit/ProcessTeam.hpp | 2 +- Private/KernelKit/ThreadLocalStorage.inl | 2 +- Private/KernelKit/Timer.hpp | 2 +- Private/NewKit/ErrorID.hpp | 15 +- Private/NewKit/KernelCheck.hpp | 2 +- Private/NewKit/UserHeap.hpp | 19 +- Private/Source/PEFCodeManager.cxx | 2 +- Private/Source/PEFSharedObjectRT.cxx | 2 +- Private/Source/ProcessManager.cxx | 310 --------------------- Private/Source/ProcessScheduler.cxx | 309 ++++++++++++++++++++ Private/Source/SMPManager.cxx | 2 +- Private/Source/Semaphore.cxx | 2 +- Private/Source/ThreadLocalStorage.cxx | 2 +- Private/Source/UserHeap.cxx | 4 +- Public/Kits/GPUKit/.gitkeep | 0 Public/Kits/System.Core/Containers/XIFF.hxx | 2 + Public/Kits/System.Core/CoreAPI.hxx | 8 + Public/Kits/System.Core/HCoreBase.hxx | 13 + Public/Kits/System.Core/HCoreHeap.hxx | 13 + Public/Kits/System.Core/HcHeapAPI.h | 23 -- Public/Kits/System.Core/HeapAPI.cxx | 7 +- Public/Kits/System.Core/hcore.h | 15 + Public/Kits/System.Grahpics.GPU/.gitkeep | 0 31 files changed, 663 insertions(+), 622 deletions(-) create mode 100644 Private/Executives/Logon/.gitkeep delete mode 100644 Private/KernelKit/ProcessManager.hpp create mode 100644 Private/KernelKit/ProcessScheduler.hpp delete mode 100644 Private/Source/ProcessManager.cxx create mode 100644 Private/Source/ProcessScheduler.cxx delete mode 100644 Public/Kits/GPUKit/.gitkeep create mode 100644 Public/Kits/System.Core/HCoreBase.hxx create mode 100644 Public/Kits/System.Core/HCoreHeap.hxx delete mode 100644 Public/Kits/System.Core/HcHeapAPI.h create mode 100644 Public/Kits/System.Core/hcore.h create mode 100644 Public/Kits/System.Grahpics.GPU/.gitkeep diff --git a/Private/Executives/Logon/.gitkeep b/Private/Executives/Logon/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/Private/HALKit/AMD64/HalCoreInterruptHandlerAMD64.cpp b/Private/HALKit/AMD64/HalCoreInterruptHandlerAMD64.cpp index 5fe39225..a86499e1 100644 --- a/Private/HALKit/AMD64/HalCoreInterruptHandlerAMD64.cpp +++ b/Private/HALKit/AMD64/HalCoreInterruptHandlerAMD64.cpp @@ -5,7 +5,7 @@ ------------------------------------------- */ #include -#include +#include #include EXTERN_C void idt_handle_gpf(HCore::UIntPtr rsp) { diff --git a/Private/HALKit/AMD64/HalKernelMain.cxx b/Private/HALKit/AMD64/HalKernelMain.cxx index 6716a989..24f03ce9 100644 --- a/Private/HALKit/AMD64/HalKernelMain.cxx +++ b/Private/HALKit/AMD64/HalKernelMain.cxx @@ -14,7 +14,7 @@ #include #include #include -#include +#include #include ///! @brief Disk contains HCore files. diff --git a/Private/HALKit/AMD64/HalSMPCore.cxx b/Private/HALKit/AMD64/HalSMPCore.cxx index a72d6bfe..87bfae3b 100644 --- a/Private/HALKit/AMD64/HalSMPCore.cxx +++ b/Private/HALKit/AMD64/HalSMPCore.cxx @@ -4,10 +4,10 @@ ------------------------------------------- */ -#include +#include using namespace HCore; -Void Process::AssignStart(UIntPtr &imageStart) noexcept { +Void Process::SetStart(UIntPtr &imageStart) noexcept { if (imageStart == 0) this->Crash(); this->StackFrame->Rbp = imageStart; diff --git a/Private/HintKit/CompilerHint.hxx b/Private/HintKit/CompilerHint.hxx index e74f349a..a624a080 100644 --- a/Private/HintKit/CompilerHint.hxx +++ b/Private/HintKit/CompilerHint.hxx @@ -18,4 +18,7 @@ #define _StrictCheckInput #define _StrictCheckOutput +#define _InOut +#define _StrictInOut + #endif // ifndef __HINTKIT_COMPILER_HINT_HXX__ diff --git a/Private/KernelKit/HError.hpp b/Private/KernelKit/HError.hpp index 1b971e94..41bfaf3d 100644 --- a/Private/KernelKit/HError.hpp +++ b/Private/KernelKit/HError.hpp @@ -7,6 +7,7 @@ #pragma once #include +#include namespace HCore { typedef Int32 HError; @@ -25,6 +26,8 @@ inline constexpr HError kErrorMath = 42; inline constexpr HError kErrorNoNetwork = 43; inline constexpr HError kErrorHeapOutOfMemory = 44; inline constexpr HError kErrorNoSuchDisk = 45; +inline constexpr HError kErrorFileExists = 46; +inline constexpr HError kErrorUnimplemented = 0; Boolean ke_bug_check(void) noexcept; } // namespace HCore diff --git a/Private/KernelKit/ProcessManager.hpp b/Private/KernelKit/ProcessManager.hpp deleted file mode 100644 index c7c69093..00000000 --- a/Private/KernelKit/ProcessManager.hpp +++ /dev/null @@ -1,257 +0,0 @@ -/* ------------------------------------------- - - Copyright Mahrouss Logic - -------------------------------------------- */ - -#ifndef __PROCESS_MANAGER__ -#define __PROCESS_MANAGER__ - -#include -#include -#include -#include -#include -#include -#include - -#define kMinMicroTime AffinityKind::kHartStandard - -//////////////////////////////////////////////////// - -// LAST REV: Mon Feb 12 13:52:01 CET 2024 - -//////////////////////////////////////////////////// - -namespace HCore { -class Process; -class ProcessTeam; -class ProcessManager; - -//! @brief Process identifier. -typedef Int64 ProcessID; - -//! @brief Process name length. -inline constexpr SizeT kProcessLen = 256U; - -//! @brief Forward declaration. -class Process; -class ProcessManager; -class ProcessHelper; - -//! @brief Process status enum. -enum class ProcessStatus : Int32 { - kStarting, - kRunning, - kKilled, - kFrozen, - kDead -}; - -//! @brief Affinity is the amount of nano-seconds this process is going -//! to run. -enum class AffinityKind : Int32 { - kInvalid = 300, - kVeryHigh = 250, - kHigh = 200, - kHartStandard = 150, - kLowUsage = 100, - kVeryLowUsage = 50, -}; - -// operator overloading. - -inline bool operator<(AffinityKind lhs, AffinityKind rhs) { - Int32 lhs_int = static_cast(lhs); - Int32 rhs_int = static_cast(rhs); - - return lhs_int < rhs_int; -} - -inline bool operator>(AffinityKind lhs, AffinityKind rhs) { - Int32 lhs_int = static_cast(lhs); - Int32 rhs_int = static_cast(rhs); - - return lhs_int > rhs_int; -} - -inline bool operator<=(AffinityKind lhs, AffinityKind rhs) { - Int32 lhs_int = static_cast(lhs); - Int32 rhs_int = static_cast(rhs); - - return lhs_int <= rhs_int; -} - -inline bool operator>=(AffinityKind lhs, AffinityKind rhs) { - Int32 lhs_int = static_cast(lhs); - Int32 rhs_int = static_cast(rhs); - - return lhs_int >= rhs_int; -} - -// end of operator overloading. - -using ProcessSubsystem = UInt32; -using ProcessTime = UInt64; -using PID = Int64; - -// for permission manager, tells where we run the code. -enum class ProcessSelector : Int { - kRingUser, /* user ring (or ring 3 in x86) */ - kRingDriver, /* ring 2 in x86, hypervisor privileges in other archs */ - kRingKernel, /* machine privileges */ -}; - -// Helper types. -using ImagePtr = VoidPtr; -using HeapPtr = VoidPtr; - -// @name Process -// @brief Process Information Header (PIH) -// Holds information about the running process. -// Thread execution is being abstracted away. -class Process final { - public: - explicit Process(VoidPtr startImage = nullptr) : Image(startImage) { - MUST_PASS(startImage); - } - - ~Process() = default; - - HCORE_COPY_DEFAULT(Process) - - public: - void AssignStart(UIntPtr &imageStart) noexcept; - - public: - Char Name[kProcessLen] = {"Process"}; - ProcessSubsystem SubSystem{0}; - ProcessSelector Selector{ProcessSelector::kRingUser}; - HAL::StackFramePtr StackFrame{nullptr}; - AffinityKind Affinity; - ProcessStatus Status; - - // Memory, images. - HeapPtr HeapCursor{nullptr}; - ImagePtr Image{nullptr}; - HeapPtr HeapPtr{nullptr}; - - // memory usage - SizeT UsedMemory{0}; - SizeT FreeMemory{0}; - - enum { - ExecutableType, - DLLType, - DriverType, - TypeCount, - }; - - ProcessTime PTime; - PID ProcessId{-1}; - Int32 Ring{3}; - Int32 Kind{0}; - - public: - //! @brief boolean operator, check status. - operator bool() { return Status != ProcessStatus::kDead; } - - //! @brief Crash program, exits with code ~0. - void Crash(); - - //! @brief Exits program. - void Exit(Int32 exitCode = 0); - - //! @brief TLS Allocate - VoidPtr New(const SizeT &sz); - - //! @brief TLS Free. - Boolean Delete(VoidPtr ptr, const SizeT &sz); - - //! @brief Process name getter, example: "C RunTime" - const Char *GetName(); - - //! @brief Wakes up threads. - void Wake(const bool wakeup = false); - - public: - const ProcessSelector &GetSelector(); - const ProcessStatus &GetStatus(); - const AffinityKind &GetAffinity(); - - private: - friend ProcessManager; - friend ProcessHelper; -}; - -/// \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); - - MutableArray>& AsArray(); - Ref& AsRef(); - -public: - MutableArray> mProcessList; - Ref mCurrentProcess; - -}; - -using ProcessPtr = Process *; - -//! @brief Kernel scheduler.. -class ProcessManager final { - private: - explicit ProcessManager() = default; - - public: - ~ProcessManager() = default; - - HCORE_COPY_DEFAULT(ProcessManager) - - operator bool() { return mTeam.AsArray().Count() > 0; } - bool operator!() { return mTeam.AsArray().Count() == 0; } - - ProcessTeam& CurrentTeam() { return mTeam; } - - SizeT Add(Ref &headerRef); - bool Remove(SizeT headerIndex); - - Ref &GetCurrent(); - SizeT Run() noexcept; - - static Ref Shared(); - - private: - ProcessTeam mTeam; -}; - -/* - * Just a helper class, which contains some utilities for the scheduler. - */ - -class ProcessHelper final { - public: - static bool Switch(HAL::StackFrame *newStack, const PID &newPid); - static bool CanBeScheduled(Ref &process); - static PID &GetCurrentPID(); - static bool StartScheduling(); -}; - -const Int32 &rt_get_exit_code() noexcept; -} // namespace HCore - -#include - -//////////////////////////////////////////////////// - -// END - -//////////////////////////////////////////////////// - -#endif /* ifndef __PROCESS_MANAGER__ */ diff --git a/Private/KernelKit/ProcessScheduler.hpp b/Private/KernelKit/ProcessScheduler.hpp new file mode 100644 index 00000000..e69d2fcf --- /dev/null +++ b/Private/KernelKit/ProcessScheduler.hpp @@ -0,0 +1,258 @@ +/* ------------------------------------------- + + Copyright Mahrouss Logic + +------------------------------------------- */ + +#ifndef __PROCESS_SCHEDULER__ +#define __PROCESS_SCHEDULER__ + +#include +#include +#include +#include +#include +#include +#include + +#define kMinMicroTime AffinityKind::kHartStandard + +//////////////////////////////////////////////////// + +// LAST REV: Mon Feb 12 13:52:01 CET 2024 + +//////////////////////////////////////////////////// + +namespace HCore { +class Process; +class ProcessTeam; +class ProcessManager; + +//! @brief Process identifier. +typedef Int64 ProcessID; + +//! @brief Process name length. +inline constexpr SizeT kProcessLen = 256U; + +//! @brief Forward declaration. +class Process; +class ProcessManager; +class ProcessHelper; + +//! @brief Process status enum. +enum class ProcessStatus : Int32 { + kStarting, + kRunning, + kKilled, + kFrozen, + kDead +}; + +//! @brief Affinity is the amount of nano-seconds this process is going +//! to run. +enum class AffinityKind : Int32 { + kInvalid = 300, + kVeryHigh = 250, + kHigh = 200, + kHartStandard = 150, + kLowUsage = 100, + kVeryLowUsage = 50, +}; + +// operator overloading. + +inline bool operator<(AffinityKind lhs, AffinityKind rhs) { + Int32 lhs_int = static_cast(lhs); + Int32 rhs_int = static_cast(rhs); + + return lhs_int < rhs_int; +} + +inline bool operator>(AffinityKind lhs, AffinityKind rhs) { + Int32 lhs_int = static_cast(lhs); + Int32 rhs_int = static_cast(rhs); + + return lhs_int > rhs_int; +} + +inline bool operator<=(AffinityKind lhs, AffinityKind rhs) { + Int32 lhs_int = static_cast(lhs); + Int32 rhs_int = static_cast(rhs); + + return lhs_int <= rhs_int; +} + +inline bool operator>=(AffinityKind lhs, AffinityKind rhs) { + Int32 lhs_int = static_cast(lhs); + Int32 rhs_int = static_cast(rhs); + + return lhs_int >= rhs_int; +} + +// end of operator overloading. + +using ProcessSubsystem = UInt32; +using ProcessTime = UInt64; +using PID = Int64; + +// for permission manager, tells where we run the code. +enum class ProcessSelector : Int { + kRingUser, /* user ring (or ring 3 in x86) */ + kRingDriver, /* ring 2 in x86, hypervisor privileges in other archs */ + kRingKernel, /* machine privileges */ +}; + +// Helper types. +using ImagePtr = VoidPtr; +using HeapPtr = VoidPtr; + +// @name Process +// @brief Process Information Header (PIH) +// Holds information about the running process. +// Thread execution is being abstracted away. +class Process final { + public: + explicit Process(VoidPtr startImage = nullptr) : Image(startImage) { + MUST_PASS(startImage); + } + + ~Process() = default; + + HCORE_COPY_DEFAULT(Process) + + public: + void SetStart(UIntPtr &imageStart) noexcept; + + public: + Char Name[kProcessLen] = {"Process"}; + ProcessSubsystem SubSystem{0}; + ProcessSelector Selector{ProcessSelector::kRingUser}; + HAL::StackFramePtr StackFrame{nullptr}; + AffinityKind Affinity; + ProcessStatus Status; + + // Memory, images. + HeapPtr HeapCursor{nullptr}; + ImagePtr Image{nullptr}; + HeapPtr HeapPtr{nullptr}; + + // memory usage + SizeT UsedMemory{0}; + SizeT FreeMemory{0}; + + enum { + ExecutableType, + DLLType, + DriverType, + TypeCount, + }; + + ProcessTime PTime; + PID ProcessId{-1}; + Int32 Ring{3}; + Int32 Kind{0}; + + public: + //! @brief boolean operator, check status. + operator bool() { return Status != ProcessStatus::kDead; } + + //! @brief Crash program, exits with code ~0. + void Crash(); + + //! @brief Exits program. + void Exit(Int32 exitCode = 0); + + //! @brief TLS Allocate + VoidPtr New(const SizeT &sz); + + //! @brief TLS Free. + Boolean Delete(VoidPtr ptr, const SizeT &sz); + + //! @brief Wakes up threads. + void Wake(const bool wakeup = false); + + // Process getters. + public: + //! @brief Process name getter, example: "C RunTime" + const Char *GetName(); + + const ProcessSelector &GetSelector(); + const ProcessStatus &GetStatus(); + const AffinityKind &GetAffinity(); + + private: + friend ProcessManager; + friend ProcessHelper; +}; + +/// \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); + + MutableArray>& AsArray(); + Ref& AsRef(); + +public: + MutableArray> mProcessList; + Ref mCurrentProcess; + +}; + +using ProcessPtr = Process *; + +//! @brief Kernel scheduler.. +class ProcessManager final { + private: + explicit ProcessManager() = default; + + public: + ~ProcessManager() = default; + + HCORE_COPY_DEFAULT(ProcessManager) + + operator bool() { return mTeam.AsArray().Count() > 0; } + bool operator!() { return mTeam.AsArray().Count() == 0; } + + ProcessTeam& CurrentTeam() { return mTeam; } + + SizeT Add(Ref &headerRef); + bool Remove(SizeT headerIndex); + + Ref &GetCurrent(); + SizeT Run() noexcept; + + static Ref Shared(); + + private: + ProcessTeam mTeam; +}; + +/* + * Just a helper class, which contains some utilities for the scheduler. + */ + +class ProcessHelper final { + public: + static bool Switch(HAL::StackFrame *newStack, const PID &newPid); + static bool CanBeScheduled(Ref &process); + static PID &GetCurrentPID(); + static bool StartScheduling(); +}; + +const Int32 &rt_get_exit_code() noexcept; +} // namespace HCore + +#include + +//////////////////////////////////////////////////// + +// END + +//////////////////////////////////////////////////// + +#endif /* ifndef __PROCESS_SCHEDULER__ */ diff --git a/Private/KernelKit/ProcessTeam.hpp b/Private/KernelKit/ProcessTeam.hpp index 31759ff6..b60a8a0d 100644 --- a/Private/KernelKit/ProcessTeam.hpp +++ b/Private/KernelKit/ProcessTeam.hpp @@ -6,4 +6,4 @@ #pragma once -#include \ No newline at end of file +#include \ No newline at end of file diff --git a/Private/KernelKit/ThreadLocalStorage.inl b/Private/KernelKit/ThreadLocalStorage.inl index a9bc04cc..a42c2381 100644 --- a/Private/KernelKit/ThreadLocalStorage.inl +++ b/Private/KernelKit/ThreadLocalStorage.inl @@ -7,7 +7,7 @@ //! @brief Allocates a pointer from the process's tls. #ifndef __PROCESS_MANAGER__ -#include +#include #endif template diff --git a/Private/KernelKit/Timer.hpp b/Private/KernelKit/Timer.hpp index ef726b08..ddfac06a 100644 --- a/Private/KernelKit/Timer.hpp +++ b/Private/KernelKit/Timer.hpp @@ -20,7 +20,7 @@ class HardwareTimerInterface { public: /// @brief Default constructor - HardwareTimerInterface() = default; + explicit HardwareTimerInterface() = default; virtual ~HardwareTimerInterface() = default; public: diff --git a/Private/NewKit/ErrorID.hpp b/Private/NewKit/ErrorID.hpp index d0572e7e..b2cc65d1 100644 --- a/Private/NewKit/ErrorID.hpp +++ b/Private/NewKit/ErrorID.hpp @@ -6,15 +6,14 @@ #pragma once -/// @brief kernel errors. +/// @brief Internal kernel errors. #include #include -#define H_EXEC_ERROR -30 -#define H_FILE_NOT_FOUND -31 -#define H_DIR_NOT_FOUND -32 -#define H_FILE_EXISTS -33 -#define H_TOO_LONG -34 -#define H_INVALID_DATA -35 -#define H_UNIMPLEMENTED -36 +#define H_EXEC_ERROR 33 +#define H_FILE_NOT_FOUND 35 +#define H_DIR_NOT_FOUND 36 +#define H_FILE_EXISTS 46 +#define H_UNIMPLEMENTED 0 +#define H_INVALID_DATA 1 diff --git a/Private/NewKit/KernelCheck.hpp b/Private/NewKit/KernelCheck.hpp index 7fd6dc2d..5eb81761 100644 --- a/Private/NewKit/KernelCheck.hpp +++ b/Private/NewKit/KernelCheck.hpp @@ -32,8 +32,8 @@ enum RUNTIME_CHECK { RUNTIME_CHECK_INVALID_PRIVILEGE, RUNTIME_CHECK_PROCESS, RUNTIME_CHECK_BAD_BEHAVIOR, - RUNTIME_CHECK_COUNT, RUNTIME_CHECK_BOOTSTRAP, + RUNTIME_CHECK_COUNT, }; namespace HCore { diff --git a/Private/NewKit/UserHeap.hpp b/Private/NewKit/UserHeap.hpp index 1bf1997f..d33ea612 100644 --- a/Private/NewKit/UserHeap.hpp +++ b/Private/NewKit/UserHeap.hpp @@ -14,20 +14,25 @@ #include // last-rev 5/11/23 -// file: pool.hpp -// description: memory pool for user programs. +// file: UserHeap.hpp +// description: memory heap for user programs. -#define kPoolMaxSz 4096 +#define kPoolMaxSz (4096) #define kPoolMag 0x5500A1 namespace HCore { -enum { +typedef enum { kPoolHypervisor = 0x2, kPoolShared = 0x4, kPoolUser = 0x6, kPoolRw = 0x8, -}; +} kPoolFlags; -VoidPtr ke_new_heap(Int32 flags); -Int32 ke_free_heap(voidPtr pointer); +/// @brief Allocate a process heap, no zero out is done here. +/// @param flags +/// @return The process's heap. +VoidPtr rt_new_heap(Int32 flags); + + +Int32 rt_free_heap(voidPtr pointer); } // namespace HCore diff --git a/Private/Source/PEFCodeManager.cxx b/Private/Source/PEFCodeManager.cxx index 572b90b3..4c599856 100644 --- a/Private/Source/PEFCodeManager.cxx +++ b/Private/Source/PEFCodeManager.cxx @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/Private/Source/PEFSharedObjectRT.cxx b/Private/Source/PEFSharedObjectRT.cxx index 2b12ab1c..2284451a 100644 --- a/Private/Source/PEFSharedObjectRT.cxx +++ b/Private/Source/PEFSharedObjectRT.cxx @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include #include diff --git a/Private/Source/ProcessManager.cxx b/Private/Source/ProcessManager.cxx deleted file mode 100644 index f1c1ad27..00000000 --- a/Private/Source/ProcessManager.cxx +++ /dev/null @@ -1,310 +0,0 @@ -/* ------------------------------------------- - - Copyright Mahrouss Logic - -------------------------------------------- */ - -/***********************************************************************************/ -/// @file ProcessManager.cxx -/// @brief Process Scheduler API. -/***********************************************************************************/ - -#include -#include -#include -#include -#include - -///! bugs = 0 - -/***********************************************************************************/ -/* This file handles the process scheduling. -/***********************************************************************************/ - -namespace HCore { -/***********************************************************************************/ -/// Exit Code stuff -/***********************************************************************************/ - -static Int32 kExitCode = 0; - -const Int32 &rt_get_exit_code() noexcept { return kExitCode; } - -/***********************************************************************************/ - -void Process::Crash() { - kcout << "ProcessManager: Crashed, ExitCode: -1.\r\n"; - MUST_PASS(!ke_bug_check()); - - this->Exit(-1); -} - -void Process::Wake(const bool should_wakeup) { - this->Status = - should_wakeup ? ProcessStatus::kRunning : ProcessStatus::kFrozen; -} - -/***********************************************************************************/ - -VoidPtr Process::New(const SizeT &sz) { - if (this->FreeMemory < 1) return nullptr; - - if (this->HeapCursor) { - VoidPtr ptr = this->HeapCursor; - this->HeapCursor = (VoidPtr)((UIntPtr)this->HeapCursor + (sizeof(sz))); - - ++this->UsedMemory; - --this->FreeMemory; - - return ptr; - } - - return nullptr; -} - -/***********************************************************************************/ - -/* @brief checks if runtime pointer is in region. */ -bool rt_in_pool_region(VoidPtr pool_ptr, VoidPtr pool, const SizeT &sz) { - Char *_pool_ptr = (Char *)pool_ptr; - Char *_pool = (Char *)pool; - - for (SizeT index = sz; _pool[sz] != 0x55; --index) { - if (&_pool[index] > &_pool_ptr[sz]) continue; - - if (_pool[index] == _pool_ptr[index]) return true; - } - - return false; -} - -/* @brief free pointer from usage. */ -Boolean Process::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. - if (this->UsedMemory < 1) return false; - - if (rt_in_pool_region(ptr, this->HeapCursor, this->UsedMemory)) { - this->HeapCursor = (VoidPtr)((UIntPtr)this->HeapCursor - (sizeof(sz))); - rt_zero_memory(ptr, sz); - - ++this->FreeMemory; - --this->UsedMemory; - - return true; - } - - return false; -} - -const Char *Process::GetName() { return this->Name; } - -const ProcessSelector &Process::GetSelector() { return this->Selector; } - -const ProcessStatus &Process::GetStatus() { return this->Status; } - -/***********************************************************************************/ - -/** -@brief Affinity is the time slot allowed for the process. -*/ -const AffinityKind &Process::GetAffinity() { return this->Affinity; } - -/** -@brief Standard exit proc. -*/ -void Process::Exit(Int32 exit_code) { - if (this->ProcessId != - ProcessManager::Shared().Leak().GetCurrent().Leak().ProcessId) - ke_stop(RUNTIME_CHECK_PROCESS); - - if (this->Ring == (Int32)ProcessSelector::kRingKernel && - ProcessManager::Shared().Leak().GetCurrent().Leak().Ring > 0) - ke_stop(RUNTIME_CHECK_PROCESS); - - kExitCode = exit_code; - - if (this->Ring != (Int32)ProcessSelector::kRingDriver) { - if (this->HeapPtr) ke_free_heap(this->HeapPtr); - - this->HeapPtr = nullptr; - this->HeapCursor = nullptr; - - this->FreeMemory = 0UL; // TODO: fill available heap. - this->UsedMemory = 0UL; - } - - //! Delete image if not done already. - if (this->Image) ke_delete_ke_heap(this->Image); - if (this->StackFrame) ke_delete_ke_heap((VoidPtr)this->StackFrame); - - this->Image = nullptr; - this->StackFrame = nullptr; - - ProcessManager::Shared().Leak().Remove(this->ProcessId); -} - -SizeT ProcessManager::Add(Ref &process) { - if (!process) return -1; - - if (process.Leak().Ring != (Int32)ProcessSelector::kRingKernel) return -1; - - kcout << "ProcessManager::Add(Ref& process)\r\n"; - - process.Leak().HeapPtr = ke_new_heap(kPoolUser | kPoolRw); - process.Leak().ProcessId = mTeam.AsArray().Count(); - process.Leak().HeapCursor = process.Leak().HeapPtr; - - process.Leak().StackFrame = reinterpret_cast( - ke_new_ke_heap(sizeof(HAL::StackFrame), true, false)); - - MUST_PASS(process.Leak().StackFrame); - - UIntPtr imageStart = reinterpret_cast(process.Leak().Image); - - process.Leak().AssignStart(imageStart); - - mTeam.AsArray().Add(process); - - if (!imageStart && process.Leak().Kind == Process::ExecutableType) { - process.Leak().Crash(); - } - - if (!imageStart && process.Leak().Kind == Process::DriverType) { - if (process.Leak().Ring == 3) - process.Leak().Crash(); - else - ke_stop(RUNTIME_CHECK_PROCESS); - } - - return mTeam.AsArray().Count() - 1; -} - -bool ProcessManager::Remove(SizeT process) { - if (process > mTeam.AsArray().Count()) return false; - - kcout << "ProcessManager::Remove(SizeT process)\r\n"; - - return mTeam.AsArray().Remove(process); -} - -SizeT ProcessManager::Run() noexcept { - SizeT processIndex = 0; //! we store this guy to tell the scheduler how many - //! things we have scheduled. - - for (; processIndex < mTeam.AsArray().Count(); ++processIndex) { - auto process = mTeam.AsArray()[processIndex]; - - MUST_PASS(process); //! no need for a MUST_PASS(process.Leak());, it is - //! recursive because of the nature of the class; - - //! run any process needed to be scheduled. - if (ProcessHelper::CanBeScheduled(process.Leak())) { - auto unwrapped_process = *process.Leak(); - - unwrapped_process.PTime = 0; - - // set the current process. - mTeam.AsRef() = unwrapped_process; - - // tell helper to find a core to schedule on. - ProcessHelper::Switch(mTeam.AsRef().Leak().StackFrame, - mTeam.AsRef().Leak().ProcessId); - } else { - // otherwise increment the P-time. - ++mTeam.AsRef().Leak().PTime; - } - } - - return processIndex; -} - -Ref ProcessManager::Shared() { - static ProcessManager ref; - return {ref}; -} - -Ref &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) { - if (process.Leak().Status == ProcessStatus::kFrozen || - process.Leak().Status == ProcessStatus::kDead) - return false; - - if (process.Leak().GetStatus() == ProcessStatus::kStarting) { - if (process.Leak().PTime < static_cast(kMinMicroTime)) { - process.Leak().Status = ProcessStatus::kRunning; - process.Leak().Affinity = AffinityKind::kHartStandard; - - return true; - } - - ++process.Leak().PTime; - } - - return process.Leak().PTime > static_cast(kMinMicroTime); -} - -/** - * @brief Spin scheduler class. - */ -bool ProcessHelper::StartScheduling() { - if (ProcessHelper::CanBeScheduled( - ProcessManager::Shared().Leak().GetCurrent())) { - --ProcessManager::Shared().Leak().GetCurrent().Leak().PTime; - return false; - } - - auto processRef = ProcessManager::Shared().Leak(); - - if (!processRef) - return false; // we have nothing to schedule. simply return. - - SizeT ret = processRef.Run(); - - kcout << StringBuilder::FromInt( - "ProcessHelper::StartScheduling() Iterated over: % jobs.\r\n", ret); - - return true; -} - -/** - * \brief Does a context switch in a CPU. - * \param the_stack the stackframe of the running app. - * \param new_pid the process's PID. -*/ - -bool ProcessHelper::Switch(HAL::StackFrame *the_stack, const PID &new_pid) { - if (!the_stack || new_pid < 0) return false; - - for (SizeT index = 0UL; index < SMPManager::Shared().Leak().Count(); ++index) { - if (SMPManager::Shared().Leak()[index].Leak().Kind() == kInvalidHart) - continue; - - if (SMPManager::Shared().Leak()[index].Leak().StackFrame() == the_stack) { - SMPManager::Shared().Leak()[index].Leak().Busy(false); - continue; - } - - if (SMPManager::Shared().Leak()[index].Leak().IsBusy()) continue; - - if (SMPManager::Shared().Leak()[index].Leak().Kind() != - ThreadKind::kHartBoot && - SMPManager::Shared().Leak()[index].Leak().Kind() != - ThreadKind::kHartSystemReserved) { - SMPManager::Shared().Leak()[index].Leak().Busy(true); - ProcessHelper::GetCurrentPID() = new_pid; - - return SMPManager::Shared().Leak()[index].Leak().Switch(the_stack); - } - } - - return false; -} -} // namespace HCore diff --git a/Private/Source/ProcessScheduler.cxx b/Private/Source/ProcessScheduler.cxx new file mode 100644 index 00000000..a4f8dd2f --- /dev/null +++ b/Private/Source/ProcessScheduler.cxx @@ -0,0 +1,309 @@ +/* ------------------------------------------- + + Copyright Mahrouss Logic + +------------------------------------------- */ + +/***********************************************************************************/ +/// @file ProcessManager.cxx +/// @brief Process Scheduler API. +/***********************************************************************************/ + +#include +#include +#include +#include + +///! bugs = 0 + +/***********************************************************************************/ +/* This file handles the process scheduling. +/***********************************************************************************/ + +namespace HCore { +/***********************************************************************************/ +/// Exit Code stuff +/***********************************************************************************/ + +static Int32 kExitCode = 0; + +const Int32 &rt_get_exit_code() noexcept { return kExitCode; } + +/***********************************************************************************/ + +void Process::Crash() { + kcout << "ProcessManager: Crashed, ExitCode: -1.\r\n"; + MUST_PASS(!ke_bug_check()); + + this->Exit(-1); +} + +void Process::Wake(const bool should_wakeup) { + this->Status = + should_wakeup ? ProcessStatus::kRunning : ProcessStatus::kFrozen; +} + +/***********************************************************************************/ + +VoidPtr Process::New(const SizeT &sz) { + if (this->FreeMemory < 1) return nullptr; + + if (this->HeapCursor) { + VoidPtr ptr = this->HeapCursor; + this->HeapCursor = (VoidPtr)((UIntPtr)this->HeapCursor + (sizeof(sz))); + + ++this->UsedMemory; + --this->FreeMemory; + + return ptr; + } + + return nullptr; +} + +/***********************************************************************************/ + +/* @brief checks if runtime pointer is in region. */ +bool rt_in_pool_region(VoidPtr pool_ptr, VoidPtr pool, const SizeT &sz) { + Char *_pool_ptr = (Char *)pool_ptr; + Char *_pool = (Char *)pool; + + for (SizeT index = sz; _pool[sz] != 0x55; --index) { + if (&_pool[index] > &_pool_ptr[sz]) continue; + + if (_pool[index] == _pool_ptr[index]) return true; + } + + return false; +} + +/* @brief free pointer from usage. */ +Boolean Process::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. + if (this->UsedMemory < 1) return false; + + if (rt_in_pool_region(ptr, this->HeapCursor, this->UsedMemory)) { + this->HeapCursor = (VoidPtr)((UIntPtr)this->HeapCursor - (sizeof(sz))); + rt_zero_memory(ptr, sz); + + ++this->FreeMemory; + --this->UsedMemory; + + return true; + } + + return false; +} + +const Char *Process::GetName() { return this->Name; } + +const ProcessSelector &Process::GetSelector() { return this->Selector; } + +const ProcessStatus &Process::GetStatus() { return this->Status; } + +/***********************************************************************************/ + +/** +@brief Affinity is the time slot allowed for the process. +*/ +const AffinityKind &Process::GetAffinity() { return this->Affinity; } + +/** +@brief Standard exit proc. +*/ +void Process::Exit(Int32 exit_code) { + if (this->ProcessId != + ProcessManager::Shared().Leak().GetCurrent().Leak().ProcessId) + ke_stop(RUNTIME_CHECK_PROCESS); + + if (this->Ring == (Int32)ProcessSelector::kRingKernel && + ProcessManager::Shared().Leak().GetCurrent().Leak().Ring > 0) + ke_stop(RUNTIME_CHECK_PROCESS); + + kExitCode = exit_code; + + if (this->Ring != (Int32)ProcessSelector::kRingDriver) { + if (this->HeapPtr) rt_free_heap(this->HeapPtr); + + this->HeapPtr = nullptr; + this->HeapCursor = nullptr; + + this->FreeMemory = 0UL; // TODO: fill available heap. + this->UsedMemory = 0UL; + } + + //! Delete image if not done already. + if (this->Image) ke_delete_ke_heap(this->Image); + if (this->StackFrame) ke_delete_ke_heap((VoidPtr)this->StackFrame); + + this->Image = nullptr; + this->StackFrame = nullptr; + + ProcessManager::Shared().Leak().Remove(this->ProcessId); +} + +SizeT ProcessManager::Add(Ref &process) { + if (!process) return -1; + + if (process.Leak().Ring != (Int32)ProcessSelector::kRingKernel) return -1; + + kcout << "ProcessManager::Add(Ref& process)\r\n"; + + process.Leak().HeapPtr = rt_new_heap(kPoolUser | kPoolRw); + process.Leak().ProcessId = mTeam.AsArray().Count(); + process.Leak().HeapCursor = process.Leak().HeapPtr; + + process.Leak().StackFrame = reinterpret_cast( + ke_new_ke_heap(sizeof(HAL::StackFrame), true, false)); + + MUST_PASS(process.Leak().StackFrame); + + UIntPtr imageStart = reinterpret_cast(process.Leak().Image); + + process.Leak().SetStart(imageStart); + + mTeam.AsArray().Add(process); + + if (!imageStart && process.Leak().Kind == Process::ExecutableType) { + process.Leak().Crash(); + } + + if (!imageStart && process.Leak().Kind == Process::DriverType) { + if (process.Leak().Ring == 3) + process.Leak().Crash(); + else + ke_stop(RUNTIME_CHECK_PROCESS); + } + + return mTeam.AsArray().Count() - 1; +} + +bool ProcessManager::Remove(SizeT process) { + if (process > mTeam.AsArray().Count()) return false; + + kcout << "ProcessManager::Remove(SizeT process)\r\n"; + + return mTeam.AsArray().Remove(process); +} + +SizeT ProcessManager::Run() noexcept { + SizeT processIndex = 0; //! we store this guy to tell the scheduler how many + //! things we have scheduled. + + for (; processIndex < mTeam.AsArray().Count(); ++processIndex) { + auto process = mTeam.AsArray()[processIndex]; + + MUST_PASS(process); //! no need for a MUST_PASS(process.Leak());, it is + //! recursive because of the nature of the class; + + //! run any process needed to be scheduled. + if (ProcessHelper::CanBeScheduled(process.Leak())) { + auto unwrapped_process = *process.Leak(); + + unwrapped_process.PTime = 0; + + // set the current process. + mTeam.AsRef() = unwrapped_process; + + // tell helper to find a core to schedule on. + ProcessHelper::Switch(mTeam.AsRef().Leak().StackFrame, + mTeam.AsRef().Leak().ProcessId); + } else { + // otherwise increment the P-time. + ++mTeam.AsRef().Leak().PTime; + } + } + + return processIndex; +} + +Ref ProcessManager::Shared() { + static ProcessManager ref; + return {ref}; +} + +Ref &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) { + if (process.Leak().Status == ProcessStatus::kFrozen || + process.Leak().Status == ProcessStatus::kDead) + return false; + + if (process.Leak().GetStatus() == ProcessStatus::kStarting) { + if (process.Leak().PTime < static_cast(kMinMicroTime)) { + process.Leak().Status = ProcessStatus::kRunning; + process.Leak().Affinity = AffinityKind::kHartStandard; + + return true; + } + + ++process.Leak().PTime; + } + + return process.Leak().PTime > static_cast(kMinMicroTime); +} + +/** + * @brief Spin scheduler class. + */ +bool ProcessHelper::StartScheduling() { + if (ProcessHelper::CanBeScheduled( + ProcessManager::Shared().Leak().GetCurrent())) { + --ProcessManager::Shared().Leak().GetCurrent().Leak().PTime; + return false; + } + + auto processRef = ProcessManager::Shared().Leak(); + + if (!processRef) + return false; // we have nothing to schedule. simply return. + + SizeT ret = processRef.Run(); + + kcout << StringBuilder::FromInt( + "ProcessHelper::StartScheduling() Iterated over: % jobs.\r\n", ret); + + return true; +} + +/** + * \brief Does a context switch in a CPU. + * \param the_stack the stackframe of the running app. + * \param new_pid the process's PID. +*/ + +bool ProcessHelper::Switch(HAL::StackFrame *the_stack, const PID &new_pid) { + if (!the_stack || new_pid < 0) return false; + + for (SizeT index = 0UL; index < SMPManager::Shared().Leak().Count(); ++index) { + if (SMPManager::Shared().Leak()[index].Leak().Kind() == kInvalidHart) + continue; + + if (SMPManager::Shared().Leak()[index].Leak().StackFrame() == the_stack) { + SMPManager::Shared().Leak()[index].Leak().Busy(false); + continue; + } + + if (SMPManager::Shared().Leak()[index].Leak().IsBusy()) continue; + + if (SMPManager::Shared().Leak()[index].Leak().Kind() != + ThreadKind::kHartBoot && + SMPManager::Shared().Leak()[index].Leak().Kind() != + ThreadKind::kHartSystemReserved) { + SMPManager::Shared().Leak()[index].Leak().Busy(true); + ProcessHelper::GetCurrentPID() = new_pid; + + return SMPManager::Shared().Leak()[index].Leak().Switch(the_stack); + } + } + + return false; +} +} // namespace HCore diff --git a/Private/Source/SMPManager.cxx b/Private/Source/SMPManager.cxx index 799f2955..b95eb68d 100644 --- a/Private/Source/SMPManager.cxx +++ b/Private/Source/SMPManager.cxx @@ -5,7 +5,7 @@ ------------------------------------------- */ #include -#include +#include #include ///! BUGS: 0 diff --git a/Private/Source/Semaphore.cxx b/Private/Source/Semaphore.cxx index 32051802..75ebfc44 100644 --- a/Private/Source/Semaphore.cxx +++ b/Private/Source/Semaphore.cxx @@ -4,7 +4,7 @@ ------------------------------------------- */ -#include +#include #include #include diff --git a/Private/Source/ThreadLocalStorage.cxx b/Private/Source/ThreadLocalStorage.cxx index 60d02efd..48e4e0a9 100644 --- a/Private/Source/ThreadLocalStorage.cxx +++ b/Private/Source/ThreadLocalStorage.cxx @@ -7,7 +7,7 @@ * ======================================================== */ -#include +#include #include /// bugs 0 diff --git a/Private/Source/UserHeap.cxx b/Private/Source/UserHeap.cxx index b9015920..80d6571d 100644 --- a/Private/Source/UserHeap.cxx +++ b/Private/Source/UserHeap.cxx @@ -144,7 +144,7 @@ STATIC Boolean ke_check_and_free_heap(const SizeT& index, VoidPtr ptr) { /// @brief Creates a new pool pointer. /// @param flags the flags attached to it. /// @return a pool pointer with selected permissions. -VoidPtr ke_new_heap(Int32 flags) { +VoidPtr rt_new_heap(Int32 flags) { if (!HeapManager::IsEnabled()) return nullptr; if (HeapManager::Count() > kPoolMaxSz) return nullptr; @@ -173,7 +173,7 @@ VoidPtr ke_new_heap(Int32 flags) { /// @brief free a pool pointer. /// @param ptr The pool pointer to free. /// @return status code -Int32 ke_free_heap(VoidPtr ptr) { +Int32 rt_free_heap(VoidPtr ptr) { if (!HeapManager::IsEnabled()) return -1; if (ptr) { diff --git a/Public/Kits/GPUKit/.gitkeep b/Public/Kits/GPUKit/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/Public/Kits/System.Core/Containers/XIFF.hxx b/Public/Kits/System.Core/Containers/XIFF.hxx index 28c25bf9..dbfe5b04 100644 --- a/Public/Kits/System.Core/Containers/XIFF.hxx +++ b/Public/Kits/System.Core/Containers/XIFF.hxx @@ -31,6 +31,8 @@ struct PACKED XiffHeader final { DWORD f_SpecificFormatType; // format type. generic }; +typedef struct XiffHeader XiffHeader; + #define kXIFFContainerVideo "XVFF" #define kXIFFContainerAudio "XAFF" #define kXIFFContainerInstaller "XnFF" diff --git a/Public/Kits/System.Core/CoreAPI.hxx b/Public/Kits/System.Core/CoreAPI.hxx index 1cd48442..66d356d7 100644 --- a/Public/Kits/System.Core/CoreAPI.hxx +++ b/Public/Kits/System.Core/CoreAPI.hxx @@ -23,11 +23,16 @@ #define CA_CDECL __attribute__((cdecl)) #define CA_MSCALL __attribute__((ms_abi)) +#define CA_PASCALL CA_STDCALL + typedef __UINT8_TYPE__ BYTE; typedef __UINT16_TYPE__ WORD; typedef __UINT32_TYPE__ DWORD; typedef __UINT64_TYPE__ QWORD; +typedef void* PVOID; +typedef void VOID; + typedef __WCHAR_TYPE__ WCHAR; typedef WCHAR* PWCHAR; @@ -46,3 +51,6 @@ typedef WCHAR* PWCHAR; #ifdef __64x0__ # define _M_64000 5 #endif + +#define CA_STATIC static +#define CA_INLINE inline \ No newline at end of file diff --git a/Public/Kits/System.Core/HCoreBase.hxx b/Public/Kits/System.Core/HCoreBase.hxx new file mode 100644 index 00000000..c8a3a99c --- /dev/null +++ b/Public/Kits/System.Core/HCoreBase.hxx @@ -0,0 +1,13 @@ +/** =========================================== + (C) Mahrouss Logic + ===========================================*/ + +#pragma once + +#include + +typedef struct HcObject { + void(*Release)(void); + void(*Invoke)(void); + void(*QueryInterface)(void); +} *HcObjectPtr; diff --git a/Public/Kits/System.Core/HCoreHeap.hxx b/Public/Kits/System.Core/HCoreHeap.hxx new file mode 100644 index 00000000..88cbbeb7 --- /dev/null +++ b/Public/Kits/System.Core/HCoreHeap.hxx @@ -0,0 +1,13 @@ +/** =========================================== + (C) Mahrouss Logic + ===========================================*/ + +#pragma once + +#include + +CA_EXTERN_C HcObjectPtr HcGetProcessHeap(void); +CA_EXTERN_C void* HcAllocateProcessHeap(HcObjectPtr refObj, long long int sz, int flags); +CA_EXTERN_C void HcFreeProcessHeap(HcObjectPtr refObj, void* ptr); +CA_EXTERN_C long long int HcProcessHeapSize(HcObjectPtr refObj, void* ptr); +CA_EXTERN_C long long int HcProcessHeapExists(HcObjectPtr refObj, void* ptr); diff --git a/Public/Kits/System.Core/HcHeapAPI.h b/Public/Kits/System.Core/HcHeapAPI.h deleted file mode 100644 index 20078ce7..00000000 --- a/Public/Kits/System.Core/HcHeapAPI.h +++ /dev/null @@ -1,23 +0,0 @@ -/** =========================================== - (C) Mahrouss Logic - ===========================================*/ - -#pragma once - -#ifdef __cplusplus -#define EXTERN_C extern "C" -#else -#define EXTERN_C extern -#endif // ifdef __cplusplus - -typedef struct HcObject { - void(*Release)(void); - void(*Invoke)(void); - void(*QueryInterface)(void); -} *HcObjectPtr; - -EXTERN_C HcObjectPtr HcGetProcessHeap(void); -EXTERN_C void* HcAllocateProcessHeap(HcObjectPtr refObj, long long int sz, int flags); -EXTERN_C void HcFreeProcessHeap(HcObjectPtr refObj, void* ptr); -EXTERN_C long long int HcProcessHeapSize(HcObjectPtr refObj, void* ptr); -EXTERN_C long long int HcProcessHeapExists(HcObjectPtr refObj, void* ptr); \ No newline at end of file diff --git a/Public/Kits/System.Core/HeapAPI.cxx b/Public/Kits/System.Core/HeapAPI.cxx index f59e0b1b..2dc7338b 100644 --- a/Public/Kits/System.Core/HeapAPI.cxx +++ b/Public/Kits/System.Core/HeapAPI.cxx @@ -5,7 +5,7 @@ ------------------------------------------- */ #include -#include +#include using namespace HCore; @@ -24,7 +24,10 @@ HHeap* HHeap::Shared() noexcept { void HHeap::Delete(HHeapPtr me) noexcept { HcFreeProcessHeap(kObjectHeap, me); } -SizeT HHeap::Size(HHeapPtr me) noexcept { return HcProcessHeapSize(kObjectHeap, me); } +SizeT HHeap::Size(HHeapPtr me) noexcept { + CA_MUST_PASS(me); + return HcProcessHeapSize(kObjectHeap, me); +} HHeapPtr HHeap::New(const SizeT &sz, const Int32 flags) { SizeT _sz = sz; diff --git a/Public/Kits/System.Core/hcore.h b/Public/Kits/System.Core/hcore.h new file mode 100644 index 00000000..b368b997 --- /dev/null +++ b/Public/Kits/System.Core/hcore.h @@ -0,0 +1,15 @@ +/** =========================================== + (C) Mahrouss Logic + ===========================================*/ + +#pragma once + +/// Core API +#include + +/// Process Heap API +#include + +/// File API & Device API. + +/// Process & Threading API \ No newline at end of file diff --git a/Public/Kits/System.Grahpics.GPU/.gitkeep b/Public/Kits/System.Grahpics.GPU/.gitkeep new file mode 100644 index 00000000..e69de29b -- cgit v1.2.3