diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-01-31 09:42:54 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-01-31 09:42:54 +0100 |
| commit | fc55f0d69d24fb4908cbd811681f2c3fac53614d (patch) | |
| tree | ba09a2cdbb225df7ba1a9ec5a12bcbb90b673ead | |
| parent | 7bed9287589293bd9d712d152539591dee0b28c0 (diff) | |
kernel: add GKit, improve AMD64 HAL.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
| -rw-r--r-- | Private/EFIKit/EFILib.hxx | 11 | ||||
| -rw-r--r-- | Private/HALKit/AMD64/HalHardwareAPIC.cpp (renamed from Private/HALKit/AMD64/HardwareAPIC.cpp) | 0 | ||||
| -rw-r--r-- | Private/HALKit/AMD64/HalHardwareInit.cpp (renamed from Private/HALKit/AMD64/HardwareInit.cpp) | 0 | ||||
| -rw-r--r-- | Private/HALKit/AMD64/HalPlatformAMD64.cpp (renamed from Private/HALKit/AMD64/PlatformAMD64.cpp) | 4 | ||||
| -rw-r--r-- | Private/HALKit/AMD64/HalProcessPrimitives.cxx (renamed from Private/HALKit/AMD64/ProcessPrimitives.cxx) | 0 | ||||
| -rw-r--r-- | Private/HALKit/AMD64/HalProcessor.cpp (renamed from Private/HALKit/AMD64/Processor.cpp) | 0 | ||||
| -rw-r--r-- | Private/HALKit/AMD64/HalRoutines.s | 8 | ||||
| -rw-r--r-- | Private/HALKit/AMD64/Processor.hpp | 24 | ||||
| -rw-r--r-- | Private/HALKit/PowerPC/HalHardware.cpp (renamed from Private/HALKit/PowerPC/Processor.cpp) | 0 | ||||
| -rw-r--r-- | Private/HALKit/PowerPC/StartSequence.s | 6 | ||||
| -rw-r--r-- | Private/KernelKit/PEF.hpp | 6 | ||||
| -rw-r--r-- | Private/KernelKit/SMPManager.hpp | 202 | ||||
| -rw-r--r-- | Private/NewBoot/Source/HEL/AMD64/Entrypoint.cxx | 2 | ||||
| -rw-r--r-- | Private/Source/RuntimeMain.cxx | 3 | ||||
| -rw-r--r-- | Private/Source/SMPManager.cxx | 30 | ||||
| -rw-r--r-- | Public/Kits/.gitkeep (renamed from Public/SDK/.gitkeep) | 0 | ||||
| -rw-r--r-- | Public/Kits/GKit/.gitkeep (renamed from Public/SDK/GPUKit/.gitkeep) | 0 | ||||
| -rw-r--r-- | Public/Kits/GKit/Core.cxx | 14 | ||||
| -rw-r--r-- | Public/Kits/GKit/Core.hpp | 112 | ||||
| -rw-r--r-- | Public/Kits/GKit/Dim2d.cxx | 20 | ||||
| -rw-r--r-- | Public/Kits/GKit/Dim2d.hpp | 37 | ||||
| -rw-r--r-- | Public/Kits/GKit/GFrame.cxx | 16 | ||||
| -rw-r--r-- | Public/Kits/GKit/GFrame.hpp | 59 | ||||
| -rw-r--r-- | Public/Kits/GKit/Makefile | 21 | ||||
| -rw-r--r-- | Public/Kits/GKit/compile_flags.txt | 4 | ||||
| -rw-r--r-- | Public/Kits/GPUKit/.gitkeep (renamed from Public/SDK/SystemKit/.gitkeep) | 0 | ||||
| -rw-r--r-- | Public/Kits/SystemKit/.gitkeep | 0 | ||||
| -rw-r--r-- | Public/Kits/SystemKit/CoreAPI.hxx (renamed from Public/SDK/SystemKit/CoreAPI.hxx) | 0 | ||||
| -rw-r--r-- | Public/Kits/SystemKit/FileAPI.hxx (renamed from Public/SDK/SystemKit/FileAPI.hxx) | 0 | ||||
| -rw-r--r-- | Public/Kits/SystemKit/HeapAPI.hxx (renamed from Public/SDK/SystemKit/HeapAPI.hxx) | 0 | ||||
| -rw-r--r-- | Public/Kits/SystemKit/SystemCall.hxx | 16 | ||||
| -rw-r--r-- | Public/Kits/SystemKit/SystemKit.hxx (renamed from Public/SDK/SystemKit/SystemKit.hxx) | 0 | ||||
| -rw-r--r-- | Public/Kits/SystemKit/ThreadAPI.hxx (renamed from Public/SDK/SystemKit/ThreadAPI.hxx) | 0 | ||||
| -rw-r--r-- | Public/Kits/ZipKit/Defines.hpp (renamed from Public/SDK/ZipKit/Defines.hpp) | 0 | ||||
| -rw-r--r-- | Public/Kits/ZipKit/Makefile (renamed from Public/SDK/ZipKit/Makefile) | 0 | ||||
| -rw-r--r-- | Public/Kits/ZipKit/NewFS-Addon.hpp (renamed from Public/SDK/ZipKit/NewFS-Addon.hpp) | 0 | ||||
| -rw-r--r-- | Public/Kits/ZipKit/Zip.cxx (renamed from Public/SDK/ZipKit/Zip.cxx) | 0 | ||||
| -rw-r--r-- | Public/Kits/ZipKit/Zip.hpp (renamed from Public/SDK/ZipKit/Zip.hpp) | 0 | ||||
| -rw-r--r-- | Public/Kits/ZipKit/zconf.hpp (renamed from Public/SDK/ZipKit/zconf.hpp) | 0 | ||||
| -rw-r--r-- | Public/Kits/ZipKit/zlib.hpp (renamed from Public/SDK/ZipKit/zlib.hpp) | 0 | ||||
| -rw-r--r-- | SPECIFICATION.TXT | 4 |
41 files changed, 452 insertions, 147 deletions
diff --git a/Private/EFIKit/EFILib.hxx b/Private/EFIKit/EFILib.hxx index 3f441a76..147b4fe2 100644 --- a/Private/EFIKit/EFILib.hxx +++ b/Private/EFIKit/EFILib.hxx @@ -12,17 +12,14 @@ #include <EFIKit/EFI.hxx> -#include "NewKit/Defines.hpp" - inline EfiSystemTable* ST = nullptr; inline EfiBootServices* BS = nullptr; namespace EFI { /** @brief Stop Execution of program. -@param SystemTable EFI System Table. */ -inline Void Stop(EfiSystemTable* SystemTable) noexcept { +inline Void Stop() noexcept { while (true) { rt_cli(); rt_halt(); @@ -35,11 +32,15 @@ Bascially frees everything we have in the EFI side. */ inline void ExitBootServices(EfiSystemTable* SystemTable, UInt64 MapKey, EfiHandlePtr ImageHandle) noexcept { + if (!SystemTable) return; + SystemTable->BootServices->ExitBootServices(ImageHandle, MapKey); } } // namespace EFI inline void KeInitEFI(EfiSystemTable* SystemTable) noexcept { + if (!SystemTable) return; + ST = SystemTable; BS = ST->BootServices; } @@ -54,7 +55,7 @@ inline void KeRuntimeStop(const EfiCharType* File, ST->ConOut->OutputString(ST->ConOut, Reason); ST->ConOut->OutputString(ST->ConOut, L" ***\r\n"); - EFI::Stop(ST); + EFI::Stop(); } #ifdef __BOOTLOADER__ diff --git a/Private/HALKit/AMD64/HardwareAPIC.cpp b/Private/HALKit/AMD64/HalHardwareAPIC.cpp index 6d77a8b5..6d77a8b5 100644 --- a/Private/HALKit/AMD64/HardwareAPIC.cpp +++ b/Private/HALKit/AMD64/HalHardwareAPIC.cpp diff --git a/Private/HALKit/AMD64/HardwareInit.cpp b/Private/HALKit/AMD64/HalHardwareInit.cpp index 1856cc2d..1856cc2d 100644 --- a/Private/HALKit/AMD64/HardwareInit.cpp +++ b/Private/HALKit/AMD64/HalHardwareInit.cpp diff --git a/Private/HALKit/AMD64/PlatformAMD64.cpp b/Private/HALKit/AMD64/HalPlatformAMD64.cpp index 1c0d560d..f72be01f 100644 --- a/Private/HALKit/AMD64/PlatformAMD64.cpp +++ b/Private/HALKit/AMD64/HalPlatformAMD64.cpp @@ -25,7 +25,7 @@ void GDTLoader::Load(Register64 &gdt) { reg->limit = gdt.Limit; rt_cli(); - load_gdt(reg); + rt_load_gdt(reg); rt_sti(); } @@ -37,7 +37,7 @@ void IDTLoader::Load(Register64 &idt) { reg->limit = idt.Limit; rt_cli(); - load_idt(reg); + rt_load_idt(reg); rt_sti(); } diff --git a/Private/HALKit/AMD64/ProcessPrimitives.cxx b/Private/HALKit/AMD64/HalProcessPrimitives.cxx index 8d0554f3..8d0554f3 100644 --- a/Private/HALKit/AMD64/ProcessPrimitives.cxx +++ b/Private/HALKit/AMD64/HalProcessPrimitives.cxx diff --git a/Private/HALKit/AMD64/Processor.cpp b/Private/HALKit/AMD64/HalProcessor.cpp index 3d509f79..3d509f79 100644 --- a/Private/HALKit/AMD64/Processor.cpp +++ b/Private/HALKit/AMD64/HalProcessor.cpp diff --git a/Private/HALKit/AMD64/HalRoutines.s b/Private/HALKit/AMD64/HalRoutines.s index 78b9e503..7965c8a8 100644 --- a/Private/HALKit/AMD64/HalRoutines.s +++ b/Private/HALKit/AMD64/HalRoutines.s @@ -1,14 +1,14 @@ -.globl load_idt -.globl load_gdt +.globl rt_load_idt +.globl rt_load_gdt .globl rt_wait_for_io .globl rt_get_current_context .section .text -load_gdt: +rt_load_gdt: lgdt (%rdi) ret -load_idt: +rt_load_idt: lidt (%rdi) sti ret diff --git a/Private/HALKit/AMD64/Processor.hpp b/Private/HALKit/AMD64/Processor.hpp index dc258bcc..bab1d518 100644 --- a/Private/HALKit/AMD64/Processor.hpp +++ b/Private/HALKit/AMD64/Processor.hpp @@ -86,15 +86,24 @@ using InterruptDescriptorArray = Array<InterruptDescriptor, 256>; class SegmentDescriptor final { public: - UIntPtr Base; - UIntPtr BaseMiddle; - UIntPtr BaseHigh; + UInt16 Base; + UInt8 BaseMiddle; + UInt8 BaseHigh; UShort Limit; UChar Gran; - UChar AB; + UChar AccessByte; +}; - operator bool() { return Base > Limit; } +/*** + * @brief Segment Boolean operations + */ +class SegmentDescriptorComparator final { + public: + bool IsValid(SegmentDescriptor &seg) { return seg.Base > seg.Limit; } + bool Equals(SegmentDescriptor &seg, SegmentDescriptor &segRight) { + return seg.Base == segRight.Base && seg.Limit == segRight.Limit; + } }; using SegmentArray = Array<SegmentDescriptor, 6>; @@ -116,8 +125,9 @@ void system_get_cores(voidPtr rsdPtr); extern "C" void idt_handle_system_call(HCore::UIntPtr rsp); extern "C" void idt_handle_generic(HCore::UIntPtr rsp); -extern "C" void load_idt(HCore::voidPtr ptr); -extern "C" void load_gdt(HCore::voidPtr ptr); extern "C" void idt_handle_gpf(HCore::UIntPtr rsp); extern "C" void idt_handle_math(HCore::UIntPtr rsp); extern "C" void idt_handle_pf(HCore::UIntPtr rsp); + +extern "C" void rt_load_idt(HCore::voidPtr ptr); +extern "C" void rt_load_gdt(HCore::voidPtr ptr); diff --git a/Private/HALKit/PowerPC/Processor.cpp b/Private/HALKit/PowerPC/HalHardware.cpp index 04676eff..04676eff 100644 --- a/Private/HALKit/PowerPC/Processor.cpp +++ b/Private/HALKit/PowerPC/HalHardware.cpp diff --git a/Private/HALKit/PowerPC/StartSequence.s b/Private/HALKit/PowerPC/StartSequence.s index 0b9807d0..112ac73f 100644 --- a/Private/HALKit/PowerPC/StartSequence.s +++ b/Private/HALKit/PowerPC/StartSequence.s @@ -1,6 +1,6 @@ -.globl __AssemblerStart +.globl Main .align 4 .text -__AssemblerStart: - b __AssemblerStart +Main: + b Main diff --git a/Private/KernelKit/PEF.hpp b/Private/KernelKit/PEF.hpp index d6c7ec87..161049c1 100644 --- a/Private/KernelKit/PEF.hpp +++ b/Private/KernelKit/PEF.hpp @@ -7,8 +7,8 @@ * ======================================================== */ -#ifndef __PEF_HPP__ -#define __PEF_HPP__ +#ifndef __PEF__ +#define __PEF__ #include <CompilerKit/CompilerKit.hpp> #include <KernelKit/Loader.hpp> @@ -86,4 +86,4 @@ enum { #define kPefStart "__start" -#endif /* ifndef __PEF_HPP__ */ +#endif /* ifndef __PEF__ */ diff --git a/Private/KernelKit/SMPManager.hpp b/Private/KernelKit/SMPManager.hpp index 889f72c1..a7106a9b 100644 --- a/Private/KernelKit/SMPManager.hpp +++ b/Private/KernelKit/SMPManager.hpp @@ -10,112 +10,106 @@ #ifndef _INC_SMP_MANAGER_HPP #define _INC_SMP_MANAGER_HPP -#include <CompilerKit/CompilerKit.hpp> #include <ArchKit/Arch.hpp> +#include <CompilerKit/CompilerKit.hpp> #include <NewKit/Ref.hpp> #define kMaxHarts 8 -namespace HCore -{ - using ThreadID = UInt32; - - enum ThreadKind - { - kSystemReserved, // System reserved thread, well user can't use it - kStandard, // user thread, cannot be used by kernel - kFallback, // fallback thread, cannot be used by user if not clear or used by kernel. - kBoot, // The core we booted from, the mama. - }; - - /// - /// \name ProcessorCore - /// CPU core (PowerPC, Intel, or NewCPU) - /// - - class ProcessorCore final - { - public: - explicit ProcessorCore(); - ~ProcessorCore(); - - public: - HCORE_COPY_DEFAULT(ProcessorCore) - - public: - operator bool(); - - public: - void Wake(const bool wakeup = false) noexcept; - void Busy(const bool busy = false) noexcept; - - public: - bool Switch(HAL::StackFrame* stack); - bool IsWakeup() noexcept; - - public: - HAL::StackFrame* StackFrame() noexcept; - const ThreadKind& Kind() noexcept; - bool IsBusy() noexcept; - const ThreadID& ID() noexcept; - - private: - HAL::StackFrame* m_Stack; - ThreadKind m_Kind; - ThreadID m_ID; - bool m_Wakeup; - bool m_Busy; - Int64 m_PID; - - private: - friend class SMPManager; - - }; - - /// - /// \name ProcessorCore - /// - /// Multi processor manager to manage other cores and dispatch tasks. - /// - - class SMPManager final - { - private: - explicit SMPManager(); - - public: - ~SMPManager(); - - public: - HCORE_COPY_DEFAULT(SMPManager); - - public: - bool Switch(HAL::StackFrame* the); - HAL::StackFramePtr GetStackFrame() noexcept; - - public: - Ref<ProcessorCore> operator[](const SizeT& idx); - bool operator!() noexcept; - operator bool() noexcept; - - public: - /// @brief Shared instance of the SMP Manager. - /// @return the reference to the smp manager. - static Ref<SMPManager> Shared(); - - private: - Array<ProcessorCore, kMaxHarts> m_ThreadList; - ThreadID m_CurrentThread; - - }; - - // @brief wakes up thread. - // wakes up thread from hang. - void rt_wakeup_thread(HAL::StackFrame* stack); - - // @brief makes thread sleep. - // hooks and hangs thread to prevent code from executing. - void rt_hang_thread(HAL::StackFrame* stack); -} // namespace HCore - -#endif // !_INC_SMP_MANAGER_HPP +namespace HCore { +using ThreadID = UInt32; + +enum ThreadKind { + kSystemReserved, // System reserved thread, well user can't use it + kStandard, // user thread, cannot be used by kernel + kFallback, // fallback thread, cannot be used by user if not clear or used by + // kernel. + kBoot, // The core we booted from, the mama. +}; + +/// +/// \name HardwareThread +/// @brief CPU Hardware Thread (PowerPC, Intel, or NewCPU) +/// + +class HardwareThread final { + public: + explicit HardwareThread(); + ~HardwareThread(); + + public: + HCORE_COPY_DEFAULT(HardwareThread) + + public: + operator bool(); + + public: + void Wake(const bool wakeup = false) noexcept; + void Busy(const bool busy = false) noexcept; + + public: + bool Switch(HAL::StackFrame* stack); + bool IsWakeup() noexcept; + + public: + HAL::StackFrame* StackFrame() noexcept; + const ThreadKind& Kind() noexcept; + bool IsBusy() noexcept; + const ThreadID& ID() noexcept; + + private: + HAL::StackFrame* m_Stack; + ThreadKind m_Kind; + ThreadID m_ID; + bool m_Wakeup; + bool m_Busy; + Int64 m_PID; + + private: + friend class SMPManager; +}; + +/// +/// \name SMPManager +/// @brief Multi processor manager to manage other cores and dispatch tasks. +/// + +class SMPManager final { + private: + explicit SMPManager(); + + public: + ~SMPManager(); + + public: + HCORE_COPY_DEFAULT(SMPManager); + + public: + bool Switch(HAL::StackFrame* the); + HAL::StackFramePtr GetStackFrame() noexcept; + + public: + Ref<HardwareThread> operator[](const SizeT& idx); + bool operator!() noexcept; + operator bool() noexcept; + + public: + /// @brief Shared instance of the SMP Manager. + /// @return the reference to the smp manager. + static Ref<SMPManager> Shared(); + + private: + Array<HardwareThread, kMaxHarts> m_ThreadList; + ThreadID m_CurrentThread; +}; + +// @brief wakes up thread. +// wakes up thread from hang. +void rt_wakeup_thread(HAL::StackFrame* stack); + +// @brief makes thread sleep. +// hooks and hangs thread to prevent code from executing. +void rt_hang_thread(HAL::StackFrame* stack); +} // namespace HCore + +#endif // !_INC_SMP_MANAGER_HPP diff --git a/Private/NewBoot/Source/HEL/AMD64/Entrypoint.cxx b/Private/NewBoot/Source/HEL/AMD64/Entrypoint.cxx index 862226c2..5a34572b 100644 --- a/Private/NewBoot/Source/HEL/AMD64/Entrypoint.cxx +++ b/Private/NewBoot/Source/HEL/AMD64/Entrypoint.cxx @@ -26,7 +26,7 @@ EFI_EXTERN_C int EfiMain(EfiHandlePtr ImageHandle, // TODO: Jump Code EFI::ExitBootServices(SystemTable, mapKey, ImageHandle); - EFI::Stop(SystemTable); + EFI::Stop(); return kEfiOk; } diff --git a/Private/Source/RuntimeMain.cxx b/Private/Source/RuntimeMain.cxx index 94a483c5..15c68adc 100644 --- a/Private/Source/RuntimeMain.cxx +++ b/Private/Source/RuntimeMain.cxx @@ -19,6 +19,7 @@ extern "C" void (*__SYSTEM_FINI)(); extern "C" void (**__SYSTEM_INIT)(); extern "C" void RuntimeMain() { + /// Init C++ globals for (HCore::SizeT index_init = 0UL; __SYSTEM_INIT[index_init] != __SYSTEM_FINI; ++index_init) { __SYSTEM_INIT[index_init](); @@ -30,7 +31,7 @@ extern "C" void RuntimeMain() { HCore::ke_init_ke_heap(); HCore::IFilesystemManager::Mount(new HCore::NewFilesystemManager()); - HCore::PEFLoader img("/System/Seeker.cm"); + HCore::PEFLoader img("/System/Shell.exe"); if (!HCore::Utils::execute_from_image(img)) { HCore::ke_stop(RUNTIME_CHECK_BOOTSTRAP); diff --git a/Private/Source/SMPManager.cxx b/Private/Source/SMPManager.cxx index 9dd38d33..6e935fb1 100644 --- a/Private/Source/SMPManager.cxx +++ b/Private/Source/SMPManager.cxx @@ -13,45 +13,45 @@ /// BUGS: 0 -//! This file handles multi processing in HCore. -//! Multi processing is needed for File I/O, networking and scheduling. +///! @brief This file handles multi processing in HCore. +///! @brief Multi processing is needed for multi-tasking operations. namespace HCore { -// A ProcessorCore class takes care of it's owned hardware thread. +// A HardwareThread class takes care of it's owned hardware thread. // It has a stack for it's core. // @brief constructor -ProcessorCore::ProcessorCore() = default; +HardwareThread::HardwareThread() = default; // @brief destructor -ProcessorCore::~ProcessorCore() = default; +HardwareThread::~HardwareThread() = default; //! @brief returns the id -const ThreadID& ProcessorCore::ID() noexcept { return m_ID; } +const ThreadID& HardwareThread::ID() noexcept { return m_ID; } //! @brief returns the kind -const ThreadKind& ProcessorCore::Kind() noexcept { return m_Kind; } +const ThreadKind& HardwareThread::Kind() noexcept { return m_Kind; } //! @brief is the core busy? -bool ProcessorCore::IsBusy() noexcept { return m_Busy; } +bool HardwareThread::IsBusy() noexcept { return m_Busy; } /// @brief Get processor stack frame. -HAL::StackFrame* ProcessorCore::StackFrame() noexcept { +HAL::StackFrame* HardwareThread::StackFrame() noexcept { MUST_PASS(m_Stack); return m_Stack; } -void ProcessorCore::Busy(const bool busy) noexcept { m_Busy = busy; } +void HardwareThread::Busy(const bool busy) noexcept { m_Busy = busy; } -ProcessorCore::operator bool() { return m_Stack; } +HardwareThread::operator bool() { return m_Stack; } /// @brief Wakeup the processor. -void ProcessorCore::Wake(const bool wakeup) noexcept { +void HardwareThread::Wake(const bool wakeup) noexcept { m_Wakeup = wakeup; if (!m_Wakeup) @@ -60,14 +60,14 @@ void ProcessorCore::Wake(const bool wakeup) noexcept { rt_wakeup_thread(m_Stack); } -bool ProcessorCore::Switch(HAL::StackFrame* stack) { +bool HardwareThread::Switch(HAL::StackFrame* stack) { if (stack == nullptr) return false; return rt_do_context_switch(m_Stack, stack) == 0; } ///! @brief Tells if processor is waked up. -bool ProcessorCore::IsWakeup() noexcept { return m_Wakeup; } +bool HardwareThread::IsWakeup() noexcept { return m_Wakeup; } //! @brief Constructor and destructor @@ -125,7 +125,7 @@ bool SMPManager::Switch(HAL::StackFrame* stack) { * @param idx the index * @return the reference to the hardware thread. */ -Ref<ProcessorCore> SMPManager::operator[](const SizeT& idx) { +Ref<HardwareThread> SMPManager::operator[](const SizeT& idx) { return m_ThreadList[idx].Leak(); } diff --git a/Public/SDK/.gitkeep b/Public/Kits/.gitkeep index e69de29b..e69de29b 100644 --- a/Public/SDK/.gitkeep +++ b/Public/Kits/.gitkeep diff --git a/Public/SDK/GPUKit/.gitkeep b/Public/Kits/GKit/.gitkeep index e69de29b..e69de29b 100644 --- a/Public/SDK/GPUKit/.gitkeep +++ b/Public/Kits/GKit/.gitkeep diff --git a/Public/Kits/GKit/Core.cxx b/Public/Kits/GKit/Core.cxx new file mode 100644 index 00000000..1e694734 --- /dev/null +++ b/Public/Kits/GKit/Core.cxx @@ -0,0 +1,14 @@ +/* ------------------------------------------- + + Copyright Mahrouss Logic + + File: Core.cpp + Purpose: + + Revision History: + + 31/01/24: Added file (amlel) + +------------------------------------------- */ + +#include <GKit/Core.hpp> diff --git a/Public/Kits/GKit/Core.hpp b/Public/Kits/GKit/Core.hpp new file mode 100644 index 00000000..5fcf6546 --- /dev/null +++ b/Public/Kits/GKit/Core.hpp @@ -0,0 +1,112 @@ +/* ------------------------------------------- + + Copyright Mahrouss Logic + + File: Core.hpp + Purpose: + + Revision History: + + 31/01/24: Added file (amlel) + +------------------------------------------- */ + +#pragma once + +#include <NewKit/Array.hpp> +#include <NewKit/Defines.hpp> +#include <NewKit/Ref.hpp> +#include <NewKit/String.hpp> + +namespace HCore { +template <typename... T> +class GAction; + +class GString; +class GNumber; +class GVector2; +class GBoolean; + +class GBoolean { + private: + explicit GBoolean() : m_Value(false) {} + + HCore::Boolean m_Value; + + friend class Form; + + public: + static const GBoolean Construct(HCore::StringView& sw, HCore::Boolean value) { + GBoolean boolean; + boolean.m_Value = value; + + return boolean; + } +}; + +template <typename... T> +class GAction { + explicit GAction(HCore::StringView& sw) { m_Name = sw; } + + HCore::StringView m_Name; + void (*m_Action)(T&&... args); + + friend class Form; + + public: + static const GAction Construct(HCore::StringView& sw, + void (*action)(T&&... args)) { + GAction actcls{sw}; + actcls.m_Action = action; + + return actcls; + } +}; + +class GVector2 { + explicit GVector2(HCore::StringView& sw) : m_Vec2() {} + + HCore::Array<HCore::Int, 3> m_Vec2; + + friend class Form; + + public: + static const GVector2 Construct(HCore::StringView& sw, + HCore::Array<HCore::Int, 3>& vec2) { + GVector2 vec{sw}; + vec.m_Vec2 = vec2; + + return vec; + } +}; + +class GNumber { + HCore::Int m_Number{0}; + friend class Form; + + public: + static const GNumber Construct(HCore::Int& number) { + GNumber num; + num.m_Number = number; + + return num; + } +}; + +class GString { + explicit GString(HCore::StringView& content) { + m_Content = new HCore::StringView(); + *m_Content = content; + } + + HCore::StringView* m_Content; + + friend class Form; + + public: + static const GString Construct(HCore::StringView& value) { + GString str{value}; + return str; + } +}; +} // namespace HCore diff --git a/Public/Kits/GKit/Dim2d.cxx b/Public/Kits/GKit/Dim2d.cxx new file mode 100644 index 00000000..9d791ba2 --- /dev/null +++ b/Public/Kits/GKit/Dim2d.cxx @@ -0,0 +1,20 @@ +/* ------------------------------------------- + + Copyright Mahrouss Logic + + File: Dim2d.cpp + Purpose: + + Revision History: + + 31/01/24: Added file (amlel) + +------------------------------------------- */ + +#include <GKit/Dim2d.hpp> + +namespace HCore { +HCore::UInt& Dim2d::X() { return m_X; } + +HCore::UInt& Dim2d::Y() { return m_Y; } +} // namespace HCore diff --git a/Public/Kits/GKit/Dim2d.hpp b/Public/Kits/GKit/Dim2d.hpp new file mode 100644 index 00000000..39d441d4 --- /dev/null +++ b/Public/Kits/GKit/Dim2d.hpp @@ -0,0 +1,37 @@ +/* ------------------------------------------- + + Copyright Mahrouss Logic + + File: Dim2d.hpp + Purpose: + + Revision History: + + 31/01/24: Added file (amlel) + +------------------------------------------- */ + +#ifndef __GORG__DIM2D_HPP__ +#define __GORG__DIM2D_HPP__ + +#include <GKit/Core.hpp> + +namespace HCore { +class Dim2d final { + public: + Dim2d() = delete; + Dim2d(const HCore::UInt& x, const HCore::UInt& y) : m_X(x), m_Y(y) {} + + Dim2d& operator=(const Dim2d&) = default; + Dim2d(const Dim2d&) = default; + + HCore::UInt& X(); + HCore::UInt& Y(); + + private: + HCore::UInt m_X{0}; + HCore::UInt m_Y{0}; +}; +} // namespace HCore + +#endif /* ifndef __GORG__DIM2D_HPP__ */ diff --git a/Public/Kits/GKit/GFrame.cxx b/Public/Kits/GKit/GFrame.cxx new file mode 100644 index 00000000..427c95ba --- /dev/null +++ b/Public/Kits/GKit/GFrame.cxx @@ -0,0 +1,16 @@ +/* ------------------------------------------- + + Copyright Mahrouss Logic + + File: GFrame.cpp + Purpose: + + Revision History: + + 31/01/24: Added file (amlel) + +------------------------------------------- */ + +#include <GKit/GFrame.hpp> + +namespace HCore {} diff --git a/Public/Kits/GKit/GFrame.hpp b/Public/Kits/GKit/GFrame.hpp new file mode 100644 index 00000000..e1262e3f --- /dev/null +++ b/Public/Kits/GKit/GFrame.hpp @@ -0,0 +1,59 @@ +/* ------------------------------------------- + + Copyright Mahrouss Logic + + File: GFrame.hpp + Purpose: + + Revision History: + + 31/01/24: Added file (amlel) + +------------------------------------------- */ + +#pragma once + +#include <GKit/Core.hpp> +#include <GKit/Dim2d.hpp> +#include <NewKit/MutableArray.hpp> + +namespace HCore { +class GFrame { + public: + explicit GFrame(GFrame* parent = nullptr) : m_ParentFrame(parent) {} + ~GFrame() {} + + GFrame& operator=(const GFrame&) = default; + GFrame(const GFrame&) = default; + + virtual void Update() { + if (m_Frames.Count() == 0) return; + + for (int x = 0; x < m_Frames.Count(); ++x) { + if (!m_Frames[x]->ShouldBeUpdated()) continue; + + m_Frames[x]->Update(); + } + + this->Paint(); + } + + virtual void UpdateInput() { + if (m_Frames.Count() == 0) return; + + for (int x = 0; x < m_Frames.Count(); ++x) { + if (!m_Frames[x]->ShouldBeUpdated()) continue; + + m_Frames[x]->UpdateInput(); + } + } + + virtual bool ShouldBeUpdated() { return false; } + + virtual void Paint() = 0; + + private: + HCore::MutableArray<GFrame*> m_Frames; + GFrame* m_ParentFrame; +}; +} // namespace HCore diff --git a/Public/Kits/GKit/Makefile b/Public/Kits/GKit/Makefile new file mode 100644 index 00000000..95ab0ee2 --- /dev/null +++ b/Public/Kits/GKit/Makefile @@ -0,0 +1,21 @@ +################################################## +# ; (C) Mahrouss Logic, 2024, all rights reserved. +# This is the GKit Makefile. +################################################## + +CC=x86_64-w64-mingw32-g++ +CCFLAGS=-c -ffreestanding -fno-rtti -fno-exceptions -std=c++20 +ASM=nasm +ASMFLAGS=-f elf64 + +.PHONY: build-gkit +build-gkit: + $(CC) -I../ -I../../../Private/ $(CCFLAGS) *.cxx + +.PHONY: all +all: build-gkit + @echo "[GKit] done." + +.PHONY: clean +clean: + rm -f *.o diff --git a/Public/Kits/GKit/compile_flags.txt b/Public/Kits/GKit/compile_flags.txt new file mode 100644 index 00000000..6e721e73 --- /dev/null +++ b/Public/Kits/GKit/compile_flags.txt @@ -0,0 +1,4 @@ +-I./ +-I../ +-I../../../Private +-std=c++20 diff --git a/Public/SDK/SystemKit/.gitkeep b/Public/Kits/GPUKit/.gitkeep index e69de29b..e69de29b 100644 --- a/Public/SDK/SystemKit/.gitkeep +++ b/Public/Kits/GPUKit/.gitkeep diff --git a/Public/Kits/SystemKit/.gitkeep b/Public/Kits/SystemKit/.gitkeep new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/Public/Kits/SystemKit/.gitkeep diff --git a/Public/SDK/SystemKit/CoreAPI.hxx b/Public/Kits/SystemKit/CoreAPI.hxx index f3e67e96..f3e67e96 100644 --- a/Public/SDK/SystemKit/CoreAPI.hxx +++ b/Public/Kits/SystemKit/CoreAPI.hxx diff --git a/Public/SDK/SystemKit/FileAPI.hxx b/Public/Kits/SystemKit/FileAPI.hxx index c55d26ff..c55d26ff 100644 --- a/Public/SDK/SystemKit/FileAPI.hxx +++ b/Public/Kits/SystemKit/FileAPI.hxx diff --git a/Public/SDK/SystemKit/HeapAPI.hxx b/Public/Kits/SystemKit/HeapAPI.hxx index 11d4c265..11d4c265 100644 --- a/Public/SDK/SystemKit/HeapAPI.hxx +++ b/Public/Kits/SystemKit/HeapAPI.hxx diff --git a/Public/Kits/SystemKit/SystemCall.hxx b/Public/Kits/SystemKit/SystemCall.hxx new file mode 100644 index 00000000..77614099 --- /dev/null +++ b/Public/Kits/SystemKit/SystemCall.hxx @@ -0,0 +1,16 @@ +/* ------------------------------------------- + + Copyright Mahrouss Logic + + File: SystemCall.hxx + Purpose: + + Revision History: + + 31/01/24: Added file (amlel) + +------------------------------------------- */ + +#pragma once + +/// @brief System Call Interface diff --git a/Public/SDK/SystemKit/SystemKit.hxx b/Public/Kits/SystemKit/SystemKit.hxx index eca53757..eca53757 100644 --- a/Public/SDK/SystemKit/SystemKit.hxx +++ b/Public/Kits/SystemKit/SystemKit.hxx diff --git a/Public/SDK/SystemKit/ThreadAPI.hxx b/Public/Kits/SystemKit/ThreadAPI.hxx index a9490033..a9490033 100644 --- a/Public/SDK/SystemKit/ThreadAPI.hxx +++ b/Public/Kits/SystemKit/ThreadAPI.hxx diff --git a/Public/SDK/ZipKit/Defines.hpp b/Public/Kits/ZipKit/Defines.hpp index fc5e6068..fc5e6068 100644 --- a/Public/SDK/ZipKit/Defines.hpp +++ b/Public/Kits/ZipKit/Defines.hpp diff --git a/Public/SDK/ZipKit/Makefile b/Public/Kits/ZipKit/Makefile index 7665c614..7665c614 100644 --- a/Public/SDK/ZipKit/Makefile +++ b/Public/Kits/ZipKit/Makefile diff --git a/Public/SDK/ZipKit/NewFS-Addon.hpp b/Public/Kits/ZipKit/NewFS-Addon.hpp index 140c7c1f..140c7c1f 100644 --- a/Public/SDK/ZipKit/NewFS-Addon.hpp +++ b/Public/Kits/ZipKit/NewFS-Addon.hpp diff --git a/Public/SDK/ZipKit/Zip.cxx b/Public/Kits/ZipKit/Zip.cxx index 71523143..71523143 100644 --- a/Public/SDK/ZipKit/Zip.cxx +++ b/Public/Kits/ZipKit/Zip.cxx diff --git a/Public/SDK/ZipKit/Zip.hpp b/Public/Kits/ZipKit/Zip.hpp index f0337ffa..f0337ffa 100644 --- a/Public/SDK/ZipKit/Zip.hpp +++ b/Public/Kits/ZipKit/Zip.hpp diff --git a/Public/SDK/ZipKit/zconf.hpp b/Public/Kits/ZipKit/zconf.hpp index 14ab12d7..14ab12d7 100644 --- a/Public/SDK/ZipKit/zconf.hpp +++ b/Public/Kits/ZipKit/zconf.hpp diff --git a/Public/SDK/ZipKit/zlib.hpp b/Public/Kits/ZipKit/zlib.hpp index 540ab3e8..540ab3e8 100644 --- a/Public/SDK/ZipKit/zlib.hpp +++ b/Public/Kits/ZipKit/zlib.hpp diff --git a/SPECIFICATION.TXT b/SPECIFICATION.TXT index fa3167eb..a681984f 100644 --- a/SPECIFICATION.TXT +++ b/SPECIFICATION.TXT @@ -1,8 +1,8 @@ =================================== -0: Generic Information +0: General Information =================================== -- ABI/Format: PEF/PE32+. +- ABI and Format: PEF/PE32+. - Architecture: Microkernel. - Language: C++/(Assembly (AMD64, X64000, X86S, ARM64)) |
