summaryrefslogtreecommitdiffhomepage
path: root/Public/Kits/System.Core/HeapCoreImpl.cxx
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@el-mahrouss-logic.com>2024-03-19 21:01:12 +0100
committerAmlal El Mahrouss <amlal@el-mahrouss-logic.com>2024-03-19 21:01:12 +0100
commitde413aa50bac1342e4ac8c7a66697ea3b551c2e4 (patch)
treeeef86262346e556f276727da3d8175ead9c6ff1d /Public/Kits/System.Core/HeapCoreImpl.cxx
parentaf7bb25934e8f6781cb7b34ef345ef9af723a2ff (diff)
Kernel(Secret): Major commit.
- Extensive cleanup of the code, and kernel improvements. - The System API has been reworked to be better designed. What is needed now: - AHCI disk driver. - HCFS/NewFS driver. - EPM layout implementation. - Separate bootloader and kernel.
Diffstat (limited to 'Public/Kits/System.Core/HeapCoreImpl.cxx')
-rw-r--r--Public/Kits/System.Core/HeapCoreImpl.cxx47
1 files changed, 47 insertions, 0 deletions
diff --git a/Public/Kits/System.Core/HeapCoreImpl.cxx b/Public/Kits/System.Core/HeapCoreImpl.cxx
new file mode 100644
index 00000000..2980a3de
--- /dev/null
+++ b/Public/Kits/System.Core/HeapCoreImpl.cxx
@@ -0,0 +1,47 @@
+/** ===========================================
+ (C) Mahrouss Logic
+ ===========================================*/
+
+#include <System.Core/Heap.hxx>
+
+/// @brief Allocate from the user's heap.
+/// @param refObj Process object.
+/// @param sz size of object.
+/// @param flags flags.
+/// @return
+CA_EXTERN_C PVOID HcAllocateProcessHeap(ObjectPtr refObj, QWORD sz, DWORD flags)
+{
+ CA_MUST_PASS(sz);
+ CA_MUST_PASS(flags);
+
+ return (PVOID)refObj->Invoke(refObj, kProcessCallAllocPtr, sz, flags);
+}
+
+/// @brief Free pointer from the user's heap.
+/// @param refObj Process object.
+/// @param ptr the pointer to free.
+CA_EXTERN_C VOID HcFreeProcessHeap(ObjectPtr refObj, PVOID ptr)
+{
+ CA_MUST_PASS(ptr);
+ CA_UNREFERENCED_PARAMETER(refObj->Invoke(refObj, kProcessCallFreePtr, ptr));
+}
+
+/// @brief Get pointer size.
+/// @param refObj Process object.
+/// @param ptr the pointer to find.
+/// @return the size.
+CA_EXTERN_C QWORD HcProcessHeapSize(ObjectPtr refObj, PVOID ptr)
+{
+ CA_MUST_PASS(ptr);
+ return refObj->Invoke(refObj, kProcessCallSizePtr, ptr);
+}
+
+/// @brief Check if the pointer exists.
+/// @param refObj Process object.
+/// @param ptr the pointer to check.
+/// @return if it exists
+CA_EXTERN_C BOOL HcProcessHeapExists(ObjectPtr refObj, PVOID ptr)
+{
+ CA_MUST_PASS(ptr);
+ return refObj->Invoke(refObj, kProcessCallCheckPtr, ptr);
+}