summaryrefslogtreecommitdiffhomepage
path: root/Public/Kits
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@el-mahrouss-logic.com>2024-03-19 10:05:31 +0100
committerAmlal El Mahrouss <amlal@el-mahrouss-logic.com>2024-03-19 10:05:31 +0100
commitbaf2afd8cd672dcb9c13d956dfdd73b61dfee558 (patch)
tree0734d2fe6d480e9805121e1c7d5e42f20bf4e8f4 /Public/Kits
parent98347089c7e4e2b306d25a0db77e00aa2ea50882 (diff)
unstable, secret: See below.
System.Core: - Add RunTime init function. - Add ReadMe.md Kernel: - Improve TLS code, use Encoder class instead of casting directly. - Refactor process team to include processscheduler.hpp instead. ObjectKit: - Rename Object.hxx to ObjectKit.hxx Builtins/AHCI: - Rename API.hxx to Interface.hxx Signed-off-by: Amlal El Mahrouss <amlal@el-mahrouss-logic.com>
Diffstat (limited to 'Public/Kits')
-rw-r--r--Public/Kits/System.Core/Defs.hxx20
-rw-r--r--Public/Kits/System.Core/HCoreHeap+Impl.cxx44
-rw-r--r--Public/Kits/System.Core/HCoreHeap_ObjectAPI.cxx27
-rw-r--r--Public/Kits/System.Core/Heap+Impl.cxx (renamed from Public/Kits/System.Core/Heap.cxx)1
-rw-r--r--Public/Kits/System.Core/ReadMe.md10
-rw-r--r--Public/Kits/System.Core/RuntimeInit.cxx12
-rw-r--r--Public/Kits/System.Core/Threading.hxx9
7 files changed, 80 insertions, 43 deletions
diff --git a/Public/Kits/System.Core/Defs.hxx b/Public/Kits/System.Core/Defs.hxx
index d1e5d483..bcb3585c 100644
--- a/Public/Kits/System.Core/Defs.hxx
+++ b/Public/Kits/System.Core/Defs.hxx
@@ -14,7 +14,7 @@
#undef CA_MUST_PASS
#endif
-#include <ObjectKit/Object.hxx>
+#include <ObjectKit/ObjectKit.hxx>
#ifdef _DEBUG
#define CA_MUST_PASS(e) { if (!e) { __assert_chk_fail() } }
@@ -97,15 +97,15 @@ typedef bool BOOL;
CA_INLINE ObjectPtr kInstanceObject;
-enum {
- kProcessHeapCallAlloc = 1,
- kProcessHeapCallFree,
- kProcessHeapCallSize,
- kProcessHeapCallCheck,
- kProcessHeapCallAllocStack,
- kProcessHeapCallOpenHandle,
- kProcessHeapCallCloseHandle,
- kProcessHeapCallsCnt,
+enum HcProcessCall {
+ kProcessCallAllocPtr = 1,
+ kProcessCallFreePtr,
+ kProcessCallSizePtr,
+ kProcessCallCheckPtr,
+ kProcessCallAllocStack,
+ kProcessCallOpenHandle,
+ kProcessCallCloseHandle,
+ kProcessCallsCount = 7,
};
#include <System.Core/HintBase.hxx>
diff --git a/Public/Kits/System.Core/HCoreHeap+Impl.cxx b/Public/Kits/System.Core/HCoreHeap+Impl.cxx
new file mode 100644
index 00000000..0e1b1732
--- /dev/null
+++ b/Public/Kits/System.Core/HCoreHeap+Impl.cxx
@@ -0,0 +1,44 @@
+/** ===========================================
+ (C) Mahrouss Logic
+ ===========================================*/
+
+#include <System.Core/HCoreHeap.hxx>
+
+/// @brief Allocate from the user's heap.
+/// @param refObj
+/// @param sz
+/// @param flags
+/// @return
+CA_EXTERN_C PVOID HcAllocateProcessHeap(ObjectPtr refObj, QWORD sz, DWORD flags)
+{
+ return (PVOID)refObj->Invoke(refObj, kProcessCallAllocPtr, sz, flags);
+}
+
+/// @brief Free pointer from the user's heap.
+/// @param refObj
+/// @param ptr
+/// @return
+CA_EXTERN_C VOID HcFreeProcessHeap(ObjectPtr refObj, PVOID ptr)
+{
+ CA_UNREFERENCED_PARAMETER(refObj->Invoke(refObj, kProcessCallFreePtr, ptr));
+}
+
+/// @brief Get pointer size.
+/// @param refObj
+/// @param ptr
+/// @return
+CA_EXTERN_C QWORD HcProcessHeapSize(ObjectPtr refObj, PVOID ptr)
+{
+ return refObj->Invoke(refObj, kProcessCallSizePtr, ptr);
+}
+
+/// @brief Check if the pointer exists.
+/// @param refObj Process object.
+/// @param ptr
+/// @return
+CA_EXTERN_C QWORD HcProcessHeapExists(ObjectPtr refObj, PVOID ptr)
+{
+ return refObj->Invoke(refObj, kProcessCallCheckPtr, ptr);
+}
+
+// EOF.
diff --git a/Public/Kits/System.Core/HCoreHeap_ObjectAPI.cxx b/Public/Kits/System.Core/HCoreHeap_ObjectAPI.cxx
deleted file mode 100644
index 86b2bf47..00000000
--- a/Public/Kits/System.Core/HCoreHeap_ObjectAPI.cxx
+++ /dev/null
@@ -1,27 +0,0 @@
-/** ===========================================
- (C) Mahrouss Logic
- ===========================================*/
-
-#include <System.Core/HCoreHeap.hxx>
-
-CA_EXTERN_C PVOID HcAllocateProcessHeap(ObjectPtr refObj, QWORD sz, DWORD flags)
-{
- return (PVOID)refObj->Invoke(refObj, kProcessHeapCallAlloc, sz, flags);
-}
-
-CA_EXTERN_C VOID HcFreeProcessHeap(ObjectPtr refObj, PVOID ptr)
-{
- CA_UNREFERENCED_PARAMETER(refObj->Invoke(refObj, kProcessHeapCallFree, ptr));
-}
-
-CA_EXTERN_C QWORD HcProcessHeapSize(ObjectPtr refObj, PVOID ptr)
-{
- return refObj->Invoke(refObj, kProcessHeapCallSize, ptr);
-}
-
-CA_EXTERN_C QWORD HcProcessHeapExists(ObjectPtr refObj, PVOID ptr)
-{
- return refObj->Invoke(refObj, kProcessHeapCallCheck, ptr);
-}
-
-// eof.
diff --git a/Public/Kits/System.Core/Heap.cxx b/Public/Kits/System.Core/Heap+Impl.cxx
index aaac37a8..e3dcb11c 100644
--- a/Public/Kits/System.Core/Heap.cxx
+++ b/Public/Kits/System.Core/Heap+Impl.cxx
@@ -14,7 +14,6 @@ Heap* Heap::Shared() noexcept {
if (!heap) {
heap = new Heap();
- kInstanceObject = HcGetProcessObject();
}
return heap;
diff --git a/Public/Kits/System.Core/ReadMe.md b/Public/Kits/System.Core/ReadMe.md
new file mode 100644
index 00000000..92bfca25
--- /dev/null
+++ b/Public/Kits/System.Core/ReadMe.md
@@ -0,0 +1,10 @@
+# System.Core
+## Core System API.
+
+Currently contains:
+- System Call Interface.
+- Heap API.
+- System Heap API.
+- File API.
+- Core functions and data types.
+- System Threading API. \ No newline at end of file
diff --git a/Public/Kits/System.Core/RuntimeInit.cxx b/Public/Kits/System.Core/RuntimeInit.cxx
new file mode 100644
index 00000000..b6022bef
--- /dev/null
+++ b/Public/Kits/System.Core/RuntimeInit.cxx
@@ -0,0 +1,12 @@
+/** ===========================================
+ (C) Mahrouss Logic
+ ===========================================*/
+
+#include <System.Core/HCoreHeap.hxx>
+
+/// @brief Inits the C runtime
+/// @return if it was succesful or not.
+DWORD HcInitRuntime(VOID) {
+ kInstanceObject = HcGetProcessObject();
+ return 0;
+} \ No newline at end of file
diff --git a/Public/Kits/System.Core/Threading.hxx b/Public/Kits/System.Core/Threading.hxx
index 5d5ed0a6..bddbbf3f 100644
--- a/Public/Kits/System.Core/Threading.hxx
+++ b/Public/Kits/System.Core/Threading.hxx
@@ -14,17 +14,16 @@
#include <System.Core/Defs.hxx>
/// @brief Thread Information Block variant for scheduling.
-struct ThreadInformationBlock final {
- const CHAR Name[255]; // Module Name
+struct PACKED ThreadInformationBlock final {
const UINT_PTR StartAddress; // Start Address
const UINT_PTR StartHeap; // Allocation Heap
const UINT_PTR StartStack; // Stack Pointer.
- const DWORD Arch; // Architecture and/or platform.
- const WORD TID; // Execution Thread ID.
+ const WORD ThreadID; // Execution Thread ID.
};
ThreadInformationBlock* HcCreateThread(_Input PVOID Start,
- _Optional _InOut PVOID HeapOpt, _Optional _InOut PVOID StackOpt);
+ _Optional _InOut PVOID HeapOpt,
+ _Optional _InOut PVOID StackOpt);
BOOL HcDestroyThread(_Input ThreadInformationBlock* TIB);