summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@el-mahrouss-logic.com>2024-03-10 15:41:08 +0100
committerAmlal El Mahrouss <amlal@el-mahrouss-logic.com>2024-03-10 15:41:08 +0100
commit5468ca71a59c9e24c1d392554e8f97f0c1705394 (patch)
tree1e8af47da852d4ad02a2ea48a967694c7bfc19c3
parent94d7585ae766d777f41d07b1a98051d12a6a0256 (diff)
Kernel: Reworked StorageKit to add AHCI support.
Signed-off-by: Amlal El Mahrouss <amlal@el-mahrouss-logic.com>
-rw-r--r--Private/CRT/__cxxkit_alloca.hxx13
-rw-r--r--Private/Drivers/AHCI/API.hxx10
-rw-r--r--Private/FirmwareKit/EFI.hxx13
-rw-r--r--Private/FirmwareKit/EFI/API.hxx13
-rw-r--r--Private/FirmwareKit/EFI/EFI.hxx13
-rw-r--r--Private/FirmwareKit/EPM.hxx15
-rw-r--r--Private/FirmwareKit/Handover.hxx13
-rw-r--r--Private/HALKit/AMD64/CPUID.hxx5
-rw-r--r--Private/HALKit/AMD64/HalInstallTIB.asm3
-rw-r--r--Private/HALKit/AMD64/HalSMPCoreManager.asm22
-rw-r--r--Private/KernelKit/SMPManager.hpp13
-rw-r--r--Private/NewBoot/BootKit/Arch/AHCI.hxx13
-rw-r--r--Private/NewBoot/BootKit/Arch/ATA.hxx13
-rw-r--r--Private/NewBoot/BootKit/BootKit.hxx13
-rw-r--r--Private/NewBoot/BootKit/EPM.hxx13
-rw-r--r--Private/NewBoot/BootKit/Platform.hxx13
-rw-r--r--Private/NewBoot/BootKit/Protocol.hxx13
-rw-r--r--Private/NewBoot/Source/BootMain.cxx13
-rw-r--r--Private/NewBoot/Source/HEL/AMD64/AMD64-AHCI.cxx13
-rw-r--r--Private/NewBoot/Source/HEL/AMD64/AMD64-ATA.cxx13
-rw-r--r--Private/NewKit/Array.hpp16
-rw-r--r--Private/NewKit/ErrorID.hpp2
-rw-r--r--Private/NewKit/Function.hpp1
-rw-r--r--Private/Source/PEFSharedObjectRT.cxx4
-rw-r--r--Private/Source/ProcessManager.cxx8
-rw-r--r--Private/Source/SMPManager.cxx4
-rw-r--r--Private/StorageKit/AHCI.hpp27
-rw-r--r--Private/StorageKit/NVME.hpp10
-rw-r--r--Private/StorageKit/Storage.hpp4
-rw-r--r--Private/makefile10
-rw-r--r--Public/Kits/System.Core/.gitkeep (renamed from Public/Kits/GKit/.gitkeep)0
-rw-r--r--Public/Kits/System.Core/Containers/XIFF.hxx (renamed from Public/Kits/SystemKit/XIFF.hxx)2
-rw-r--r--Public/Kits/System.Core/CoreAPI.hxx (renamed from Public/Kits/SystemKit/CoreAPI.hxx)0
-rw-r--r--Public/Kits/System.Core/FileAPI.hxx (renamed from Public/Kits/SystemKit/FileAPI.hxx)0
-rw-r--r--Public/Kits/System.Core/HcHeapAPI.h23
-rw-r--r--Public/Kits/System.Core/HeapAPI.cxx34
-rw-r--r--Public/Kits/System.Core/HeapAPI.hxx (renamed from Public/Kits/SystemKit/HeapAPI.hxx)0
-rw-r--r--Public/Kits/System.Core/Makefile20
-rw-r--r--Public/Kits/System.Core/System.hxx (renamed from Public/Kits/SystemKit/SystemKit.hxx)8
-rw-r--r--Public/Kits/System.Core/ThreadAPI.hxx (renamed from Public/Kits/SystemKit/ThreadAPI.hxx)0
-rw-r--r--Public/Kits/System.Core/compile_flags.txt (renamed from Public/Kits/GKit/compile_flags.txt)0
-rw-r--r--Public/Kits/System.Graphics/.gitkeep (renamed from Public/Kits/SystemKit/.gitkeep)0
-rw-r--r--Public/Kits/System.Graphics/Core.cxx (renamed from Public/Kits/GKit/Core.cxx)2
-rw-r--r--Public/Kits/System.Graphics/Core.hxx (renamed from Public/Kits/GKit/Core.hxx)0
-rw-r--r--Public/Kits/System.Graphics/Dim2d.cxx (renamed from Public/Kits/GKit/Dim2d.cxx)2
-rw-r--r--Public/Kits/System.Graphics/Dim2d.hxx (renamed from Public/Kits/GKit/Dim2d.hxx)2
-rw-r--r--Public/Kits/System.Graphics/Frame.cxx (renamed from Public/Kits/GKit/Frame.cxx)2
-rw-r--r--Public/Kits/System.Graphics/Frame.hxx (renamed from Public/Kits/GKit/Frame.hxx)4
-rw-r--r--Public/Kits/System.Graphics/Makefile (renamed from Public/Kits/GKit/Makefile)2
-rw-r--r--Public/Kits/System.Graphics/Stylesheet.hxx (renamed from Public/Kits/GKit/Stylesheet.hxx)18
-rw-r--r--Public/Kits/System.Graphics/compile_flags.txt (renamed from Public/Kits/SystemKit/compile_flags.txt)0
-rw-r--r--Public/Kits/System.Zip/Defines.hpp (renamed from Public/Kits/ZipKit/Defines.hpp)5
-rw-r--r--Public/Kits/System.Zip/Makefile (renamed from Public/Kits/ZipKit/Makefile)2
-rw-r--r--Public/Kits/System.Zip/NewFS-Addon.hpp (renamed from Public/Kits/ZipKit/NewFS-Addon.hpp)0
-rw-r--r--Public/Kits/System.Zip/Zip.cxx (renamed from Public/Kits/ZipKit/Zip.cxx)10
-rw-r--r--Public/Kits/System.Zip/Zip.hpp (renamed from Public/Kits/ZipKit/Zip.hpp)8
-rw-r--r--Public/Kits/System.Zip/compile_flags.txt (renamed from Public/Kits/ZipKit/compile_flags.txt)0
-rw-r--r--Public/Kits/System.Zip/zconf.hpp (renamed from Public/Kits/ZipKit/zconf.hpp)0
-rw-r--r--Public/Kits/System.Zip/zlib.hpp (renamed from Public/Kits/ZipKit/zlib.hpp)4
59 files changed, 266 insertions, 218 deletions
diff --git a/Private/CRT/__cxxkit_alloca.hxx b/Private/CRT/__cxxkit_alloca.hxx
index 3b2ab753..e106a373 100644
--- a/Private/CRT/__cxxkit_alloca.hxx
+++ b/Private/CRT/__cxxkit_alloca.hxx
@@ -1,11 +1,8 @@
-/*
- * ========================================================
- *
- * HCore
- * Copyright Mahrouss Logic, all rights reserved.
- *
- * ========================================================
- */
+/* -------------------------------------------
+
+ Copyright Mahrouss Logic
+
+------------------------------------------- */
#pragma once
diff --git a/Private/Drivers/AHCI/API.hxx b/Private/Drivers/AHCI/API.hxx
deleted file mode 100644
index 5ef58d84..00000000
--- a/Private/Drivers/AHCI/API.hxx
+++ /dev/null
@@ -1,10 +0,0 @@
-/* -------------------------------------------
-
- Copyright Mahrouss Logic
-
-------------------------------------------- */
-
-#pragma once
-
-#include <Drivers/AHCI/Defines.hxx>
-
diff --git a/Private/FirmwareKit/EFI.hxx b/Private/FirmwareKit/EFI.hxx
index 3ef28288..14c8c709 100644
--- a/Private/FirmwareKit/EFI.hxx
+++ b/Private/FirmwareKit/EFI.hxx
@@ -1,11 +1,8 @@
-/*
- * ========================================================
- *
- * h-core
- * Copyright, Mahrouss Logic, all rights reserved.
- *
- * ========================================================
- */
+/* -------------------------------------------
+
+ Copyright Mahrouss Logic
+
+------------------------------------------- */
#include <FirmwareKit/EFI/API.hxx>
#include <FirmwareKit/EFI/EFI.hxx>
diff --git a/Private/FirmwareKit/EFI/API.hxx b/Private/FirmwareKit/EFI/API.hxx
index ffbb1eaa..b2d6c940 100644
--- a/Private/FirmwareKit/EFI/API.hxx
+++ b/Private/FirmwareKit/EFI/API.hxx
@@ -1,11 +1,8 @@
-/*
- * ========================================================
- *
- * h-core
- * Copyright, Mahrouss Logic, all rights reserved.
- *
- * ========================================================
- */
+/* -------------------------------------------
+
+ Copyright Mahrouss Logic
+
+------------------------------------------- */
#ifndef __EFI_API__
#define __EFI_API__
diff --git a/Private/FirmwareKit/EFI/EFI.hxx b/Private/FirmwareKit/EFI/EFI.hxx
index e9dd3ac8..bec95655 100644
--- a/Private/FirmwareKit/EFI/EFI.hxx
+++ b/Private/FirmwareKit/EFI/EFI.hxx
@@ -1,11 +1,8 @@
-/*
- * ========================================================
- *
- * h-core
- * Copyright, Mahrouss Logic, all rights reserved.
- *
- * ========================================================
- */
+/* -------------------------------------------
+
+ Copyright Mahrouss Logic
+
+------------------------------------------- */
#ifndef __EFI__
#define __EFI__
diff --git a/Private/FirmwareKit/EPM.hxx b/Private/FirmwareKit/EPM.hxx
index 77f9901a..e941eedb 100644
--- a/Private/FirmwareKit/EPM.hxx
+++ b/Private/FirmwareKit/EPM.hxx
@@ -1,11 +1,8 @@
-/*
- * ========================================================
- *
- * h-core
- * Copyright, Mahrouss Logic, all rights reserved.
- *
- * ========================================================
- */
+/* -------------------------------------------
+
+ Copyright Mahrouss Logic
+
+------------------------------------------- */
/**
@brief The Explicit Partition Map scheme.
@@ -36,7 +33,7 @@ struct __attribute__((packed)) BootBlock {
/**
* @brief The EPM partition block.
- * used to explain a partition inside a media.
+ * used to describe a partition inside a media.
*/
struct __attribute__((packed)) PartitionBlock {
char name[32];
diff --git a/Private/FirmwareKit/Handover.hxx b/Private/FirmwareKit/Handover.hxx
index c85eaddd..e7d27020 100644
--- a/Private/FirmwareKit/Handover.hxx
+++ b/Private/FirmwareKit/Handover.hxx
@@ -1,11 +1,8 @@
-/*
- * ========================================================
- *
- * NewBoot
- * Copyright Mahrouss Logic, all rights reserved.
- *
- * ========================================================
- */
+/* -------------------------------------------
+
+ Copyright Mahrouss Logic
+
+------------------------------------------- */
/**
* @file Handover.hxx
diff --git a/Private/HALKit/AMD64/CPUID.hxx b/Private/HALKit/AMD64/CPUID.hxx
index 85eb4893..2eac5bcb 100644
--- a/Private/HALKit/AMD64/CPUID.hxx
+++ b/Private/HALKit/AMD64/CPUID.hxx
@@ -13,7 +13,7 @@
#pragma once
-typedef enum {
+enum {
CPU_FEATURE_ECX_SSE3 = 1 << 0,
CPU_FEATURE_ECX_PCLMUL = 1 << 1,
CPU_FEATURE_ECX_DTES64 = 1 << 2,
@@ -75,5 +75,6 @@ typedef enum {
CPU_FEATURE_EDX_TM = 1 << 29,
CPU_FEATURE_EDX_IA64 = 1 << 30,
CPU_FEATURE_EDX_PBE = 1 << 31
-} CPU_FEATURE;
+};
+typedef int CPU_FEATURE; \ No newline at end of file
diff --git a/Private/HALKit/AMD64/HalInstallTIB.asm b/Private/HALKit/AMD64/HalInstallTIB.asm
index 3391dc26..2346b19c 100644
--- a/Private/HALKit/AMD64/HalInstallTIB.asm
+++ b/Private/HALKit/AMD64/HalInstallTIB.asm
@@ -11,6 +11,9 @@
[global rt_install_tib]
+;; changed: rs, fs
+;; expected: rcx, rdx
+
rt_install_tib:
mov rcx, gs ;; TIB -> Thread Information Block
mov rdx, fs ;; PIB -> Process Information Block
diff --git a/Private/HALKit/AMD64/HalSMPCoreManager.asm b/Private/HALKit/AMD64/HalSMPCoreManager.asm
index eeda0d6e..66cfec3a 100644
--- a/Private/HALKit/AMD64/HalSMPCoreManager.asm
+++ b/Private/HALKit/AMD64/HalSMPCoreManager.asm
@@ -15,28 +15,6 @@
section .text
rt_do_context_switch:
- mov r15, rcx
-
- mov [r15+0], rax
- mov [r15+8], rbx
- mov [r15+16], rcx
- mov [r15+24], rdx
- mov [r15+32], rsi
- mov [r15+40], rdi
- mov [r15+48], rbp
- mov [r15+56], rsp
- mov [r15+64], r8
- mov [r15+72], r9
- mov [r15+80], r10
- mov [r15+88], r11
- mov [r15+96], r12
- mov [r15+104], r13
- mov [r15+112], r14
- mov [r15+120], r15
-
- pop r15
- pop rax
-
retfq
rt_get_current_context:
diff --git a/Private/KernelKit/SMPManager.hpp b/Private/KernelKit/SMPManager.hpp
index 25db164f..465ff1fc 100644
--- a/Private/KernelKit/SMPManager.hpp
+++ b/Private/KernelKit/SMPManager.hpp
@@ -100,17 +100,22 @@ class SMPManager final {
/// @return the reference to the smp manager.
static Ref<SMPManager> Shared();
+ public:
+ /// @brief Returns the amount of threads present in the system.
+ /// @returns SizeT the amount of cores present.
+ SizeT Count() noexcept;
+
private:
Array<HardwareThread, kMaxHarts> m_ThreadList;
ThreadID m_CurrentThread{0};
};
-// @brief wakes up thread.
-// wakes up thread from hang.
+/// @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.
+/// @brief makes thread sleep.
+/// hooks and hangs thread to prevent code from executing.
void rt_hang_thread(HAL::StackFrame* stack);
} // namespace HCore
diff --git a/Private/NewBoot/BootKit/Arch/AHCI.hxx b/Private/NewBoot/BootKit/Arch/AHCI.hxx
index f4e635c7..78a2c9c6 100644
--- a/Private/NewBoot/BootKit/Arch/AHCI.hxx
+++ b/Private/NewBoot/BootKit/Arch/AHCI.hxx
@@ -1,11 +1,8 @@
-/*
- * ========================================================
- *
- * NewBoot
- * Copyright Mahrouss Logic, all rights reserved.
- *
- * ========================================================
- */
+/* -------------------------------------------
+
+ Copyright Mahrouss Logic
+
+------------------------------------------- */
#pragma once
diff --git a/Private/NewBoot/BootKit/Arch/ATA.hxx b/Private/NewBoot/BootKit/Arch/ATA.hxx
index fd413705..3370fdba 100644
--- a/Private/NewBoot/BootKit/Arch/ATA.hxx
+++ b/Private/NewBoot/BootKit/Arch/ATA.hxx
@@ -1,11 +1,8 @@
-/*
- * ========================================================
- *
- * NewBoot
- * Copyright Mahrouss Logic, all rights reserved.
- *
- * ========================================================
- */
+/* -------------------------------------------
+
+ Copyright Mahrouss Logic
+
+------------------------------------------- */
#pragma once
diff --git a/Private/NewBoot/BootKit/BootKit.hxx b/Private/NewBoot/BootKit/BootKit.hxx
index 164bc48c..93f5c6e2 100644
--- a/Private/NewBoot/BootKit/BootKit.hxx
+++ b/Private/NewBoot/BootKit/BootKit.hxx
@@ -1,11 +1,8 @@
-/*
- * ========================================================
- *
- * NewBoot
- * Copyright Mahrouss Logic, all rights reserved.
- *
- * ========================================================
- */
+/* -------------------------------------------
+
+ Copyright Mahrouss Logic
+
+------------------------------------------- */
/***********************************************************************************/
/// @file Boot.hxx
diff --git a/Private/NewBoot/BootKit/EPM.hxx b/Private/NewBoot/BootKit/EPM.hxx
index 2d20237d..6aa7decf 100644
--- a/Private/NewBoot/BootKit/EPM.hxx
+++ b/Private/NewBoot/BootKit/EPM.hxx
@@ -1,11 +1,8 @@
-/*
- * ========================================================
- *
- * h-core
- * Copyright, Mahrouss Logic, all rights reserved.
- *
- * ========================================================
- */
+/* -------------------------------------------
+
+ Copyright Mahrouss Logic
+
+------------------------------------------- */
#pragma once
diff --git a/Private/NewBoot/BootKit/Platform.hxx b/Private/NewBoot/BootKit/Platform.hxx
index 346357cb..997a79db 100644
--- a/Private/NewBoot/BootKit/Platform.hxx
+++ b/Private/NewBoot/BootKit/Platform.hxx
@@ -1,11 +1,8 @@
-/*
- * ========================================================
- *
- * h-core
- * Copyright, Mahrouss Logic, all rights reserved.
- *
- * ========================================================
- */
+/* -------------------------------------------
+
+ Copyright Mahrouss Logic
+
+------------------------------------------- */
#pragma once
diff --git a/Private/NewBoot/BootKit/Protocol.hxx b/Private/NewBoot/BootKit/Protocol.hxx
index d3dc1ab1..c8572192 100644
--- a/Private/NewBoot/BootKit/Protocol.hxx
+++ b/Private/NewBoot/BootKit/Protocol.hxx
@@ -1,11 +1,8 @@
-/*
- * ========================================================
- *
- * NewBoot
- * Copyright Mahrouss Logic, all rights reserved.
- *
- * ========================================================
- */
+/* -------------------------------------------
+
+ Copyright Mahrouss Logic
+
+------------------------------------------- */
#pragma once
diff --git a/Private/NewBoot/Source/BootMain.cxx b/Private/NewBoot/Source/BootMain.cxx
index f60853bd..829c98ad 100644
--- a/Private/NewBoot/Source/BootMain.cxx
+++ b/Private/NewBoot/Source/BootMain.cxx
@@ -1,11 +1,8 @@
-/*
- * ========================================================
- *
- * NewBoot
- * Copyright Mahrouss Logic, all rights reserved.
- *
- * ========================================================
- */
+/* -------------------------------------------
+
+ Copyright Mahrouss Logic
+
+------------------------------------------- */
#include <BootKit/BootKit.hxx>
#include <KernelKit/MSDOS.hpp>
diff --git a/Private/NewBoot/Source/HEL/AMD64/AMD64-AHCI.cxx b/Private/NewBoot/Source/HEL/AMD64/AMD64-AHCI.cxx
index 357bd591..dbb0bde4 100644
--- a/Private/NewBoot/Source/HEL/AMD64/AMD64-AHCI.cxx
+++ b/Private/NewBoot/Source/HEL/AMD64/AMD64-AHCI.cxx
@@ -1,11 +1,8 @@
-/*
- * ========================================================
- *
- * NewBoot
- * Copyright Mahrouss Logic, all rights reserved.
- *
- * ========================================================
- */
+/* -------------------------------------------
+
+ Copyright Mahrouss Logic
+
+------------------------------------------- */
/**
* @file AHCI.cxx
diff --git a/Private/NewBoot/Source/HEL/AMD64/AMD64-ATA.cxx b/Private/NewBoot/Source/HEL/AMD64/AMD64-ATA.cxx
index 13ee3dbf..551b0200 100644
--- a/Private/NewBoot/Source/HEL/AMD64/AMD64-ATA.cxx
+++ b/Private/NewBoot/Source/HEL/AMD64/AMD64-ATA.cxx
@@ -1,11 +1,8 @@
-/*
- * ========================================================
- *
- * NewBoot
- * Copyright Mahrouss Logic, all rights reserved.
- *
- * ========================================================
- */
+/* -------------------------------------------
+
+ Copyright Mahrouss Logic
+
+------------------------------------------- */
/**
* @file ATA.cxx
diff --git a/Private/NewKit/Array.hpp b/Private/NewKit/Array.hpp
index 3e1ee47d..c6153421 100644
--- a/Private/NewKit/Array.hpp
+++ b/Private/NewKit/Array.hpp
@@ -15,8 +15,8 @@ template <typename T, Size N>
class Array final
{
public:
- Array() {}
- ~Array() {}
+ explicit Array() = default;
+ ~Array() = default;
Array &operator=(const Array &) = default;
Array(const Array &) = default;
@@ -41,6 +41,18 @@ public:
return true;
}
+ SizeT Count() const
+ {
+ SizeT cntElems = 0UL;
+ for (auto Val : m_Array)
+ {
+ if (Val)
+ ++cntElems;
+ }
+
+ return cntElems;
+ }
+
const T *CData()
{
return m_Array;
diff --git a/Private/NewKit/ErrorID.hpp b/Private/NewKit/ErrorID.hpp
index 73d0425e..d0572e7e 100644
--- a/Private/NewKit/ErrorID.hpp
+++ b/Private/NewKit/ErrorID.hpp
@@ -6,6 +6,8 @@
#pragma once
+/// @brief kernel errors.
+
#include <NewKit/ErrorOr.hpp>
#include <NewKit/Defines.hpp>
diff --git a/Private/NewKit/Function.hpp b/Private/NewKit/Function.hpp
index 3addc636..04a93bee 100644
--- a/Private/NewKit/Function.hpp
+++ b/Private/NewKit/Function.hpp
@@ -35,6 +35,7 @@ namespace HCore
{
return m_Fn;
}
+
bool operator!()
{
return !m_Fn;
diff --git a/Private/Source/PEFSharedObjectRT.cxx b/Private/Source/PEFSharedObjectRT.cxx
index 60a3ea8f..2b12ab1c 100644
--- a/Private/Source/PEFSharedObjectRT.cxx
+++ b/Private/Source/PEFSharedObjectRT.cxx
@@ -35,7 +35,7 @@ using namespace HCore;
/* @brief Library runtime initializer. */
/***********************************************************************************/
-extern "C" SharedObjectPtr ke_library_init(void) {
+EXTERN_C SharedObjectPtr rt_library_init(void) {
SharedObjectPtr library = hcore_tls_new_class<SharedObject>();
if (!library) {
@@ -73,7 +73,7 @@ extern "C" SharedObjectPtr ke_library_init(void) {
/* @param SharedObjectPtr the library to free. */
/***********************************************************************************/
-extern "C" Void ke_library_free(SharedObjectPtr lib, bool *successful) {
+EXTERN_C Void rt_library_free(SharedObjectPtr lib, bool *successful) {
MUST_PASS(successful);
// sanity check (will also trigger a bug check)
diff --git a/Private/Source/ProcessManager.cxx b/Private/Source/ProcessManager.cxx
index 056eac5c..f1c1ad27 100644
--- a/Private/Source/ProcessManager.cxx
+++ b/Private/Source/ProcessManager.cxx
@@ -274,10 +274,16 @@ bool ProcessHelper::StartScheduling() {
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 < kMaxHarts; ++index) {
+ for (SizeT index = 0UL; index < SMPManager::Shared().Leak().Count(); ++index) {
if (SMPManager::Shared().Leak()[index].Leak().Kind() == kInvalidHart)
continue;
diff --git a/Private/Source/SMPManager.cxx b/Private/Source/SMPManager.cxx
index 66595ab9..799f2955 100644
--- a/Private/Source/SMPManager.cxx
+++ b/Private/Source/SMPManager.cxx
@@ -164,4 +164,8 @@ SMPManager::operator bool() noexcept { return !m_ThreadList.Empty(); }
* @return
*/
bool SMPManager::operator!() noexcept { return m_ThreadList.Empty(); }
+
+/// @brief Returns the amount of core present.
+/// @return the number of cores.
+SizeT SMPManager::Count() noexcept { return m_ThreadList.Count(); }
} // namespace HCore
diff --git a/Private/StorageKit/AHCI.hpp b/Private/StorageKit/AHCI.hpp
new file mode 100644
index 00000000..c6943e9f
--- /dev/null
+++ b/Private/StorageKit/AHCI.hpp
@@ -0,0 +1,27 @@
+/* -------------------------------------------
+
+ Copyright Mahrouss Logic
+
+------------------------------------------- */
+
+#pragma once
+
+#include <KernelKit/DeviceManager.hpp>
+#include <NewKit/OwnPtr.hpp>
+
+namespace HCore {
+class AHCIPacket;
+
+class AHCIDevice : public DeviceInterface<AHCIPacket> {
+ public:
+};
+
+class AHCIPacket final {
+ UIntPtr DataPtr;
+ SizeT DataSz;
+ UInt8 PortId;
+ UInt8 PortRdy;
+ Lba Begin;
+ Lba End;
+};
+} // namespace HCore \ No newline at end of file
diff --git a/Private/StorageKit/NVME.hpp b/Private/StorageKit/NVME.hpp
index 2adef888..83de59d9 100644
--- a/Private/StorageKit/NVME.hpp
+++ b/Private/StorageKit/NVME.hpp
@@ -35,11 +35,11 @@ class NVMEDevice : public DeviceInterface<NVMEPacket> {
void (*fCleanup)(void);
};
-class NVMEPacket {
+class NVMEPacket final {
UIntPtr DataPtr;
- SizeT DataSz;
- UInt64 DriveID;
-
- UInt8 Bits;
+ SizeT DataSz;
+ UInt8 Namespace;
+ Lba Begin;
+ Lba End;
};
} // namespace HCore
diff --git a/Private/StorageKit/Storage.hpp b/Private/StorageKit/Storage.hpp
index aecdbf8f..8e05f557 100644
--- a/Private/StorageKit/Storage.hpp
+++ b/Private/StorageKit/Storage.hpp
@@ -14,7 +14,7 @@ typedef HCore::UInt16 SKScsiPacket[12];
extern const SKScsiPacket kCDRomPacketTemplate;
-#define f_kDriveSectorSize 512
-#define f_kDriveSize(last_lba) ((last_lba + 1) * f_kDriveSectorSize)
+#define f_kDriveSectorSize (512)
+#define f_kDriveSize(LAST_LBA) ((LAST_LBA + 1) * f_kDriveSectorSize)
#include <StorageKit/StorageCore.inl>
diff --git a/Private/makefile b/Private/makefile
index fbbad166..67491247 100644
--- a/Private/makefile
+++ b/Private/makefile
@@ -6,15 +6,7 @@
CC = x86_64-w64-mingw32-gcc
LD = x86_64-w64-mingw32-ld
CCFLAGS = -c -ffreestanding -mgeneral-regs-only -mno-red-zone -fno-rtti -fno-exceptions -std=c++20 -D__FSKIT_NEWFS__ -D__HAVE_HCORE_APIS__ -D__HCORE__ -I../ -I./
-
-UNAME := $(shell uname)
-
-ifeq ($(UNAME), Darwin)
-ASM = nasm
-else
-# Otherwise Windows NT.
-ASM = nasm.exe
-endif
+ASM = nasm
# Add assembler, linker, and object files variables.
ASMFLAGS = -f win64
diff --git a/Public/Kits/GKit/.gitkeep b/Public/Kits/System.Core/.gitkeep
index e69de29b..e69de29b 100644
--- a/Public/Kits/GKit/.gitkeep
+++ b/Public/Kits/System.Core/.gitkeep
diff --git a/Public/Kits/SystemKit/XIFF.hxx b/Public/Kits/System.Core/Containers/XIFF.hxx
index 83560e10..28c25bf9 100644
--- a/Public/Kits/SystemKit/XIFF.hxx
+++ b/Public/Kits/System.Core/Containers/XIFF.hxx
@@ -12,7 +12,7 @@
------------------------------------------------------- */
-#include <SystemKit/CoreAPI.hxx>
+#include <System.Core/CoreAPI.hxx>
/// @brief four-character code for XIFF.
#define kFourCCLength_XIFF 4
diff --git a/Public/Kits/SystemKit/CoreAPI.hxx b/Public/Kits/System.Core/CoreAPI.hxx
index 1cd48442..1cd48442 100644
--- a/Public/Kits/SystemKit/CoreAPI.hxx
+++ b/Public/Kits/System.Core/CoreAPI.hxx
diff --git a/Public/Kits/SystemKit/FileAPI.hxx b/Public/Kits/System.Core/FileAPI.hxx
index 66ecef22..66ecef22 100644
--- a/Public/Kits/SystemKit/FileAPI.hxx
+++ b/Public/Kits/System.Core/FileAPI.hxx
diff --git a/Public/Kits/System.Core/HcHeapAPI.h b/Public/Kits/System.Core/HcHeapAPI.h
new file mode 100644
index 00000000..20078ce7
--- /dev/null
+++ b/Public/Kits/System.Core/HcHeapAPI.h
@@ -0,0 +1,23 @@
+/** ===========================================
+ (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
new file mode 100644
index 00000000..f59e0b1b
--- /dev/null
+++ b/Public/Kits/System.Core/HeapAPI.cxx
@@ -0,0 +1,34 @@
+/* -------------------------------------------
+
+ Copyright Mahrouss Logic
+
+------------------------------------------- */
+
+#include <System.Core/HeapAPI.hxx>
+#include <System.Core/HcHeapAPI.h>
+
+using namespace HCore;
+
+STATIC HcObjectPtr kObjectHeap;
+
+HHeap* HHeap::Shared() noexcept {
+ static HHeap* heap = nullptr;
+
+ if (!heap) {
+ heap = new HHeap();
+ kObjectHeap = HcGetProcessHeap();
+ }
+
+ return heap;
+}
+
+void HHeap::Delete(HHeapPtr me) noexcept { HcFreeProcessHeap(kObjectHeap, me); }
+
+SizeT HHeap::Size(HHeapPtr me) noexcept { return HcProcessHeapSize(kObjectHeap, me); }
+
+HHeapPtr HHeap::New(const SizeT &sz, const Int32 flags) {
+ SizeT _sz = sz;
+ if (!_sz) ++_sz;
+
+ return HcAllocateProcessHeap(kObjectHeap, _sz, flags);
+} \ No newline at end of file
diff --git a/Public/Kits/SystemKit/HeapAPI.hxx b/Public/Kits/System.Core/HeapAPI.hxx
index 9391bc4f..9391bc4f 100644
--- a/Public/Kits/SystemKit/HeapAPI.hxx
+++ b/Public/Kits/System.Core/HeapAPI.hxx
diff --git a/Public/Kits/System.Core/Makefile b/Public/Kits/System.Core/Makefile
new file mode 100644
index 00000000..d710b2e8
--- /dev/null
+++ b/Public/Kits/System.Core/Makefile
@@ -0,0 +1,20 @@
+##################################################
+# ; (C) Mahrouss Logic, 2024, all rights reserved.
+# This is the System.Graphics Makefile.
+##################################################
+
+CC=x86_64-w64-mingw32-g++
+CCFLAGS=-shared -ffreestanding -fno-rtti -fno-exceptions -std=c++20
+OUTPUT=System.Core.dll
+
+.PHONY: build-gkit
+build-gkit:
+ $(CC) -I../ -I$(HOME) -I../../../Private/ $(CCFLAGS) *.cxx -o $(OUTPUT)
+
+.PHONY: all
+all: build-gkit
+ @echo "[System.Core.dll] Build done."
+
+.PHONY: clean
+clean:
+ rm -f *.o
diff --git a/Public/Kits/SystemKit/SystemKit.hxx b/Public/Kits/System.Core/System.hxx
index a4462f1c..97d4bdac 100644
--- a/Public/Kits/SystemKit/SystemKit.hxx
+++ b/Public/Kits/System.Core/System.hxx
@@ -10,9 +10,9 @@
------------------------------------------------------- */
-#include <SystemKit/CoreAPI.hxx>
-#include <SystemKit/FileAPI.hxx>
-#include <SystemKit/HeapAPI.hxx>
-#include <SystemKit/ThreadAPI.hxx>
+#include <System.Core/CoreAPI.hxx>
+#include <System.Core/FileAPI.hxx>
+#include <System.Core/HeapAPI.hxx>
+#include <System.Core/ThreadAPI.hxx>
using namespace HCore;
diff --git a/Public/Kits/SystemKit/ThreadAPI.hxx b/Public/Kits/System.Core/ThreadAPI.hxx
index ec15a64c..ec15a64c 100644
--- a/Public/Kits/SystemKit/ThreadAPI.hxx
+++ b/Public/Kits/System.Core/ThreadAPI.hxx
diff --git a/Public/Kits/GKit/compile_flags.txt b/Public/Kits/System.Core/compile_flags.txt
index 6e721e73..6e721e73 100644
--- a/Public/Kits/GKit/compile_flags.txt
+++ b/Public/Kits/System.Core/compile_flags.txt
diff --git a/Public/Kits/SystemKit/.gitkeep b/Public/Kits/System.Graphics/.gitkeep
index e69de29b..e69de29b 100644
--- a/Public/Kits/SystemKit/.gitkeep
+++ b/Public/Kits/System.Graphics/.gitkeep
diff --git a/Public/Kits/GKit/Core.cxx b/Public/Kits/System.Graphics/Core.cxx
index 4030041f..9a218f88 100644
--- a/Public/Kits/GKit/Core.cxx
+++ b/Public/Kits/System.Graphics/Core.cxx
@@ -11,4 +11,4 @@
------------------------------------------- */
-#include <GKit/Core.hxx>
+#include <System.Graphics/Core.hxx>
diff --git a/Public/Kits/GKit/Core.hxx b/Public/Kits/System.Graphics/Core.hxx
index db9aa36f..db9aa36f 100644
--- a/Public/Kits/GKit/Core.hxx
+++ b/Public/Kits/System.Graphics/Core.hxx
diff --git a/Public/Kits/GKit/Dim2d.cxx b/Public/Kits/System.Graphics/Dim2d.cxx
index a7df5cef..8623a0e1 100644
--- a/Public/Kits/GKit/Dim2d.cxx
+++ b/Public/Kits/System.Graphics/Dim2d.cxx
@@ -11,7 +11,7 @@
------------------------------------------- */
-#include <GKit/Dim2d.hxx>
+#include <System.Graphics/Dim2d.hxx>
namespace HCore {
HCore::UInt& Dim2d::X() { return m_X; }
diff --git a/Public/Kits/GKit/Dim2d.hxx b/Public/Kits/System.Graphics/Dim2d.hxx
index 0e6c1519..a4f5fa8d 100644
--- a/Public/Kits/GKit/Dim2d.hxx
+++ b/Public/Kits/System.Graphics/Dim2d.hxx
@@ -15,7 +15,7 @@
#ifndef __DIM2D__
#define __DIM2D__
-#include <GKit/Core.hxx>
+#include <System.Graphics/Core.hxx>
namespace HCore {
class G_API Dim2d final {
diff --git a/Public/Kits/GKit/Frame.cxx b/Public/Kits/System.Graphics/Frame.cxx
index ee2d3a3f..10726b57 100644
--- a/Public/Kits/GKit/Frame.cxx
+++ b/Public/Kits/System.Graphics/Frame.cxx
@@ -11,7 +11,7 @@
------------------------------------------- */
-#include <GKit/Frame.hxx>
+#include <System.Graphics/Frame.hxx>
namespace HCore {
diff --git a/Public/Kits/GKit/Frame.hxx b/Public/Kits/System.Graphics/Frame.hxx
index 1d87c41a..e0d52a4c 100644
--- a/Public/Kits/GKit/Frame.hxx
+++ b/Public/Kits/System.Graphics/Frame.hxx
@@ -13,8 +13,8 @@
#pragma once
-#include <GKit/Core.hxx>
-#include <GKit/Dim2d.hxx>
+#include <System.Graphics/Core.hxx>
+#include <System.Graphics/Dim2d.hxx>
#include <NewKit/MutableArray.hpp>
namespace HCore {
diff --git a/Public/Kits/GKit/Makefile b/Public/Kits/System.Graphics/Makefile
index b8c8949d..c049857f 100644
--- a/Public/Kits/GKit/Makefile
+++ b/Public/Kits/System.Graphics/Makefile
@@ -1,6 +1,6 @@
##################################################
# ; (C) Mahrouss Logic, 2024, all rights reserved.
-# This is the GKit Makefile.
+# This is the System.Graphics Makefile.
##################################################
CC=x86_64-w64-mingw32-g++
diff --git a/Public/Kits/GKit/Stylesheet.hxx b/Public/Kits/System.Graphics/Stylesheet.hxx
index d9c88660..79efbcf4 100644
--- a/Public/Kits/GKit/Stylesheet.hxx
+++ b/Public/Kits/System.Graphics/Stylesheet.hxx
@@ -2,7 +2,7 @@
Copyright Mahrouss Logic
- File: Stylesheet.hpp
+ File: Stylesheet.hxx
Purpose:
Revision History:
@@ -15,17 +15,17 @@
/// TODO: Stylesheets for GUI.
-#include <GKit/Core.hxx>
-#include <GKit/Dim2d.hxx>
+#include <System.Graphics/Core.hxx>
+#include <System.Graphics/Dim2d.hxx>
#include <NewKit/MutableArray.hpp>
namespace HCore {
-class G_API Stylesheet final {
+class G_API GStylesheet final {
public:
- explicit Stylesheet() = default;
- ~Stylesheet() = default;
+ explicit GStylesheet() = default;
+ ~GStylesheet() = default;
- HCORE_COPY_DEFAULT(Stylesheet);
+ HCORE_COPY_DEFAULT(GStylesheet);
MutableArray<StringView>& Props() { return mProps; }
@@ -35,8 +35,8 @@ class G_API Stylesheet final {
class StylesheetParser final {
public:
- static MutableArray<Stylesheet> FromBlob(WideChar* Blob, SizeT BlobSz) {
- MutableArray<Stylesheet> stylesheet;
+ static MutableArray<GStylesheet> FromBlob(WideChar* Blob, SizeT BlobSz) {
+ MutableArray<GStylesheet> stylesheet;
if (!Blob || BlobSz < 1) return stylesheet;
diff --git a/Public/Kits/SystemKit/compile_flags.txt b/Public/Kits/System.Graphics/compile_flags.txt
index 6e721e73..6e721e73 100644
--- a/Public/Kits/SystemKit/compile_flags.txt
+++ b/Public/Kits/System.Graphics/compile_flags.txt
diff --git a/Public/Kits/ZipKit/Defines.hpp b/Public/Kits/System.Zip/Defines.hpp
index fc5e6068..f4620413 100644
--- a/Public/Kits/ZipKit/Defines.hpp
+++ b/Public/Kits/System.Zip/Defines.hpp
@@ -9,9 +9,6 @@
#pragma once
-#include <NewKit/Defines.hpp>
-#include <SystemKit/SystemKit.hxx>
-
-using namespace HCore;
+#include <System.Core/System.hxx>
#define ZIPKIT_VERSION "1.0.1"
diff --git a/Public/Kits/ZipKit/Makefile b/Public/Kits/System.Zip/Makefile
index f27eb6ce..4423d876 100644
--- a/Public/Kits/ZipKit/Makefile
+++ b/Public/Kits/System.Zip/Makefile
@@ -1,6 +1,6 @@
##################################################
# ; (C) Mahrouss Logic, 2024, all rights reserved.
-# This is the ZipKit Makefile.
+# This is the System.Zip Makefile.
##################################################
CC=x86_64-w64-mingw32-g++
diff --git a/Public/Kits/ZipKit/NewFS-Addon.hpp b/Public/Kits/System.Zip/NewFS-Addon.hpp
index 1018bd22..1018bd22 100644
--- a/Public/Kits/ZipKit/NewFS-Addon.hpp
+++ b/Public/Kits/System.Zip/NewFS-Addon.hpp
diff --git a/Public/Kits/ZipKit/Zip.cxx b/Public/Kits/System.Zip/Zip.cxx
index bc09ebf2..81a39a18 100644
--- a/Public/Kits/ZipKit/Zip.cxx
+++ b/Public/Kits/System.Zip/Zip.cxx
@@ -7,14 +7,12 @@
* ========================================================
*/
-#include <ZipKit/Zip.hpp>
-
-// very hacky thing because of gcc...
-#include <SystemKit/CoreAPI.hxx>
+#include <System.Zip/Zip.hpp>
+#include <System.Core/CoreAPI.hxx>
#define kInitialSz 4096
-namespace ZipKit {
+namespace System::Zip {
ZipStream::ZipStream()
: fSharedData(HHeap::Shared()->New(kInitialSz, kHeapExpandable)),
fSharedSz(kInitialSz) {}
@@ -74,4 +72,4 @@ void ZipStream::Inflate(const char *name, void *data) {
inflate(&inflate_stream, Z_NO_FLUSH);
inflateEnd(&inflate_stream);
}
-} // namespace ZipKit
+} // namespace System.Zip
diff --git a/Public/Kits/ZipKit/Zip.hpp b/Public/Kits/System.Zip/Zip.hpp
index 8f8979d9..490fb27c 100644
--- a/Public/Kits/ZipKit/Zip.hpp
+++ b/Public/Kits/System.Zip/Zip.hpp
@@ -12,10 +12,10 @@
#define Z_SOLO 1
#include <CompilerKit/CompilerKit.hpp>
-#include <ZipKit/Defines.hpp>
-#include <ZipKit/zlib.hpp>
+#include <System.Zip/Defines.hpp>
+#include <System.Zip/zlib.hpp>
-namespace ZipKit {
+namespace System::Zip {
class ZipStream;
class ZipStream final {
@@ -38,6 +38,6 @@ class ZipStream final {
private:
z_stream fStream;
};
-} // namespace ZipKit
+} // namespace System.Zip
#define kZipKitMime "application/x-bzip"
diff --git a/Public/Kits/ZipKit/compile_flags.txt b/Public/Kits/System.Zip/compile_flags.txt
index 6e721e73..6e721e73 100644
--- a/Public/Kits/ZipKit/compile_flags.txt
+++ b/Public/Kits/System.Zip/compile_flags.txt
diff --git a/Public/Kits/ZipKit/zconf.hpp b/Public/Kits/System.Zip/zconf.hpp
index 14ab12d7..14ab12d7 100644
--- a/Public/Kits/ZipKit/zconf.hpp
+++ b/Public/Kits/System.Zip/zconf.hpp
diff --git a/Public/Kits/ZipKit/zlib.hpp b/Public/Kits/System.Zip/zlib.hpp
index 540ab3e8..c7a88aea 100644
--- a/Public/Kits/ZipKit/zlib.hpp
+++ b/Public/Kits/System.Zip/zlib.hpp
@@ -28,13 +28,13 @@
(zlib format), rfc1951 (deflate format) and rfc1952 (gzip format).
*/
-// ZipKit is based on zlib, free software from Jean-loup Gailly and Mark Adler
+// System.Zip is based on zlib, free software from Jean-loup Gailly and Mark Adler
// (c) Western Company Corporation, all rights reserved.
#ifndef ZLIB_H
#define ZLIB_H
-#include <ZipKit/zconf.hpp>
+#include <System.Zip/zconf.hpp>
#ifdef __cplusplus
extern "C" {