diff options
| author | Amlal <amlal.elmahrouss@icloud.com> | 2024-10-28 19:29:04 +0100 |
|---|---|---|
| committer | Amlal <amlal.elmahrouss@icloud.com> | 2024-10-28 19:29:04 +0100 |
| commit | 0511c53e648e5f253cd9e83c9e211aa6600db377 (patch) | |
| tree | 84cabfcb7c3b77d554c6c217ff32c1c5c39d74d5 /dev/ZKAKit/KernelKit | |
| parent | d5c125378d54ceaad7e34e8bac337d9b4665573e (diff) | |
META: Bumping source code.
Signed-off-by: Amlal <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'dev/ZKAKit/KernelKit')
| -rw-r--r-- | dev/ZKAKit/KernelKit/DriveMgr.h | 2 | ||||
| -rw-r--r-- | dev/ZKAKit/KernelKit/LPC.h | 6 | ||||
| -rw-r--r-- | dev/ZKAKit/KernelKit/PECodeMgr.h | 2 | ||||
| -rw-r--r-- | dev/ZKAKit/KernelKit/PEFCodeMgr.h | 4 | ||||
| -rw-r--r-- | dev/ZKAKit/KernelKit/ThreadLocalStorage.inl | 22 | ||||
| -rw-r--r-- | dev/ZKAKit/KernelKit/User.h | 2 | ||||
| -rw-r--r-- | dev/ZKAKit/KernelKit/UserProcessScheduler.h | 37 |
7 files changed, 39 insertions, 36 deletions
diff --git a/dev/ZKAKit/KernelKit/DriveMgr.h b/dev/ZKAKit/KernelKit/DriveMgr.h index 95c0cda4..212d6b71 100644 --- a/dev/ZKAKit/KernelKit/DriveMgr.h +++ b/dev/ZKAKit/KernelKit/DriveMgr.h @@ -13,7 +13,7 @@ #include <KernelKit/DeviceMgr.h> #include <KernelKit/LPC.h> #include <NewKit/Defines.h> -#include <NewKit/String.h> +#include <NewKit/KString.h> #include <NewKit/Ref.h> #define kMaxDriveCountPerMountpoint (4U) diff --git a/dev/ZKAKit/KernelKit/LPC.h b/dev/ZKAKit/KernelKit/LPC.h index 305b504d..c270a447 100644 --- a/dev/ZKAKit/KernelKit/LPC.h +++ b/dev/ZKAKit/KernelKit/LPC.h @@ -11,9 +11,9 @@ /// @file LPC.h /// @brief Local Process Codes. -#define ErrLocalIsOk() (Kernel::UserProcessScheduler::The().CurrentProcess().Leak().GetLocalCode() == Kernel::kErrorSuccess) -#define ErrLocalFailed() (Kernel::UserProcessScheduler::The().CurrentProcess().Leak().GetLocalCode() != Kernel::kErrorSuccess) -#define ErrLocal() Kernel::UserProcessScheduler::The().CurrentProcess().Leak().GetLocalCode() +#define ErrLocalIsOk() (Kernel::UserProcessScheduler::The().GetCurrentProcess().Leak().GetLocalCode() == Kernel::kErrorSuccess) +#define ErrLocalFailed() (Kernel::UserProcessScheduler::The().GetCurrentProcess().Leak().GetLocalCode() != Kernel::kErrorSuccess) +#define ErrLocal() Kernel::UserProcessScheduler::The().GetCurrentProcess().Leak().GetLocalCode() namespace Kernel { diff --git a/dev/ZKAKit/KernelKit/PECodeMgr.h b/dev/ZKAKit/KernelKit/PECodeMgr.h index 14dd8c1a..cadd2737 100644 --- a/dev/ZKAKit/KernelKit/PECodeMgr.h +++ b/dev/ZKAKit/KernelKit/PECodeMgr.h @@ -21,4 +21,4 @@ #include <KernelKit/PE.h> #include <NewKit/ErrorOr.h> -#include <NewKit/String.h> +#include <NewKit/KString.h> diff --git a/dev/ZKAKit/KernelKit/PEFCodeMgr.h b/dev/ZKAKit/KernelKit/PEFCodeMgr.h index f4e9e446..00afa2d8 100644 --- a/dev/ZKAKit/KernelKit/PEFCodeMgr.h +++ b/dev/ZKAKit/KernelKit/PEFCodeMgr.h @@ -9,7 +9,7 @@ #include <KernelKit/PEF.h> #include <NewKit/ErrorOr.h> -#include <NewKit/String.h> +#include <NewKit/KString.h> #include <KernelKit/FileMgr.h> #define kPefApplicationMime "application/vnd-zka-executable" @@ -52,7 +52,7 @@ namespace Kernel OwnPtr<FileStream<Char>> fFile; #endif // __FSKIT_INCLUDES_NEFS__ - Ref<StringView> fPath; + Ref<KString> fPath; VoidPtr fCachedBlob; bool fFatBinary; bool fBad; diff --git a/dev/ZKAKit/KernelKit/ThreadLocalStorage.inl b/dev/ZKAKit/KernelKit/ThreadLocalStorage.inl index 305d3966..9f64ae55 100644 --- a/dev/ZKAKit/KernelKit/ThreadLocalStorage.inl +++ b/dev/ZKAKit/KernelKit/ThreadLocalStorage.inl @@ -16,11 +16,15 @@ inline T* tls_new_ptr(void) noexcept { using namespace Kernel; - auto ref_process = UserProcessScheduler::The().CurrentProcess(); + auto ref_process = UserProcessScheduler::The().GetCurrentProcess(); MUST_PASS(ref_process); - T* pointer = (T*)ref_process.Leak().New(sizeof(T)); - return pointer; + auto pointer = ref_process.Leak().New(sizeof(T)); + + if (pointer.Error()) + return nullptr; + + return reinterpret_cast<T*>(pointer.Leak().Leak()); } //! @brief TLS delete implementation. @@ -28,21 +32,21 @@ template <typename T> inline Kernel::Bool tls_delete_ptr(T* ptr) noexcept { if (!ptr) - return false; + return No; using namespace Kernel; - auto ref_process = UserProcessScheduler::The().CurrentProcess(); + auto ref_process = UserProcessScheduler::The().GetCurrentProcess(); MUST_PASS(ref_process); return ref_process.Leak().Delete(ptr, sizeof(T)); } /// @brief Allocate a C++ class, and then call the constructor of it. -/// @tparam T -/// @tparam ...Args -/// @param ...args -/// @return +/// @tparam T class type. +/// @tparam ...Args varg class type. +/// @param ...args arguments list. +/// @return Class instance. template <typename T, typename... Args> T* tls_new_class(Args&&... args) { diff --git a/dev/ZKAKit/KernelKit/User.h b/dev/ZKAKit/KernelKit/User.h index 914d7ed2..8e7ef5e9 100644 --- a/dev/ZKAKit/KernelKit/User.h +++ b/dev/ZKAKit/KernelKit/User.h @@ -9,7 +9,7 @@ #include <CompilerKit/CompilerKit.h> #include <KernelKit/LPC.h> -#include <NewKit/String.h> +#include <NewKit/KString.h> #include <NewKit/Defines.h> // user mode users. diff --git a/dev/ZKAKit/KernelKit/UserProcessScheduler.h b/dev/ZKAKit/KernelKit/UserProcessScheduler.h index 4be849e2..c093bfb1 100644 --- a/dev/ZKAKit/KernelKit/UserProcessScheduler.h +++ b/dev/ZKAKit/KernelKit/UserProcessScheduler.h @@ -39,7 +39,7 @@ namespace Kernel typedef Int64 ProcessID; //! @brief Local Process name length. - inline constexpr SizeT kProcessLen = 256U; + inline constexpr SizeT kProcessLen = 4096U; //! @brief Local Process status enum. enum class ProcessStatusKind : Int32 @@ -131,18 +131,14 @@ namespace Kernel class UserProcess final { public: - explicit UserProcess(VoidPtr startImage = nullptr) - : Image(startImage) - { - } - - ~UserProcess() = default; + explicit UserProcess(VoidPtr startImage = nullptr); + ~UserProcess(); public: ZKA_COPY_DEFAULT(UserProcess) public: - Char Name[kProcessLen] = {"Process"}; + Char Name[kProcessLen] = {"Application Process (Unnamed)"}; ProcessSubsystem SubSystem{ProcessSubsystem::kProcessSubsystemInvalid}; User* Owner{nullptr}; HAL::StackFramePtr StackFrame{nullptr}; @@ -155,15 +151,17 @@ namespace Kernel SizeT MemoryCursor{0}; SizeT MemoryLimit{kSchedMaxMemoryLimit}; - struct PROCESS_MEMORY_ENTRY final + struct USER_PROCESS_HEAP final { - VoidPtr MemoryEntry; + VoidPtr MemoryEntry{nullptr}; + SizeT MemoryEntrySize{0UL}; + SizeT MemoryEntryPad{0UL}; - struct PROCESS_MEMORY_ENTRY* MemoryPrev; - struct PROCESS_MEMORY_ENTRY* MemoryNext; + struct USER_PROCESS_HEAP* MemoryPrev{nullptr}; + struct USER_PROCESS_HEAP* MemoryNext{nullptr}; }; - PROCESS_MEMORY_ENTRY* MemoryEntryList{nullptr}; + USER_PROCESS_HEAP* MemoryHeap{nullptr}; UIntPtr VMRegister{0UL}; @@ -192,15 +190,15 @@ namespace Kernel ///! @brief TLS allocate. ///! @param sz size of new ptr. - VoidPtr New(const SizeT& sz); + ErrorOr<VoidPtr> New(const SizeT& sz, const SizeT& pad_amount = 0); ///! @brief TLS free. ///! @param ptr the pointer to free. ///! @param sz the size of it. - Boolean Delete(VoidPtr ptr, const SizeT& sz); + Boolean Delete(ErrorOr<VoidPtr> ptr, const SizeT& sz); ///! @brief Wakes up threads. - Void Wake(const bool wakeup = false); + Void Wake(const Bool wakeup = false); public: //! @brief Gets the local exit code. @@ -208,7 +206,7 @@ namespace Kernel ///! @brief Get the process's name ///! @example 'C Runtime Library' - const Char* GetProcessName() noexcept; + const Char* GetName() noexcept; //! @brief return local error code of process. //! @return Int32 local error code. @@ -276,10 +274,11 @@ namespace Kernel const Bool HasMP() override; public: - Ref<UserProcess>& CurrentProcess(); - SizeT Run() noexcept; + Ref<UserProcess>& GetCurrentProcess(); + const SizeT Run() noexcept; public: + STATIC ErrorOr<UserProcessScheduler> TheSafe(); STATIC UserProcessScheduler& The(); private: |
