From 55059428bfd6a18451bc1ed3ee64e7bb04c395cd Mon Sep 17 00:00:00 2001 From: amlal Date: Sat, 16 Mar 2024 14:22:21 +0100 Subject: HCR-14: See below. - Pretty big modifications, add kernel mouse. Signed-off-by: amlal --- Public/Kits/System.Core/Heap.cxx | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 Public/Kits/System.Core/Heap.cxx (limited to 'Public/Kits/System.Core/Heap.cxx') diff --git a/Public/Kits/System.Core/Heap.cxx b/Public/Kits/System.Core/Heap.cxx new file mode 100644 index 00000000..c7401aad --- /dev/null +++ b/Public/Kits/System.Core/Heap.cxx @@ -0,0 +1,38 @@ +/* ------------------------------------------- + + Copyright Mahrouss Logic + +------------------------------------------- */ + +#include +#include + +using namespace HCore; +using namespace System; + +STATIC HcObjectPtr kObjectHeap; + +Heap* Heap::Shared() noexcept { + static Heap* heap = nullptr; + + if (!heap) { + heap = new Heap(); + kObjectHeap = HcGetProcessHeap(); + } + + return heap; +} + +void Heap::Delete(HeapPtr me) noexcept { HcFreeProcessHeap(kObjectHeap, me); } + +SizeT Heap::Size(HeapPtr me) noexcept { + CA_MUST_PASS(me); + return HcProcessHeapSize(kObjectHeap, me); +} + +HeapPtr Heap::New(const SizeT &sz, const Int32 flags) { + SizeT _sz = sz; + if (!_sz) ++_sz; + + return HcAllocateProcessHeap(kObjectHeap, _sz, flags); +} \ No newline at end of file -- cgit v1.2.3