summaryrefslogtreecommitdiffhomepage
path: root/SDK/Library/CoreSystem/Sources/Heap.c
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-05-09 00:42:44 +0200
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-05-09 00:42:44 +0200
commitaf8a516fc22865abd80d6e26f1541fa3d6bebfdc (patch)
tree96d42a10945fc03df022389aef54708383c1d616 /SDK/Library/CoreSystem/Sources/Heap.c
parenta874e9cc98df994178d55996943fe81799c61d2f (diff)
MHR-23: :boom:, refactors.
- Move NewBoot to /Boot, thus making Kernel directory only containing the kernel. Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'SDK/Library/CoreSystem/Sources/Heap.c')
-rw-r--r--SDK/Library/CoreSystem/Sources/Heap.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/SDK/Library/CoreSystem/Sources/Heap.c b/SDK/Library/CoreSystem/Sources/Heap.c
new file mode 100644
index 00000000..546384e2
--- /dev/null
+++ b/SDK/Library/CoreSystem/Sources/Heap.c
@@ -0,0 +1,55 @@
+/* -------------------------------------------
+
+ Copyright SoftwareLabs
+
+------------------------------------------- */
+
+#include <Headers/Defines.h>
+#include <Headers/Heap.h>
+
+/// @brief Allocate from the user's heap.
+/// @param sz size of object.
+/// @param flags flags.
+/// @return
+CA_EXTERN_C PtrVoidType RtTlsAllocate(QWordType sz, DWordType flags)
+{
+ CA_MUST_PASS(kSharedApplication);
+ CA_MUST_PASS(sz);
+ CA_MUST_PASS(flags);
+
+ return (PtrVoidType)kSharedApplication->Invoke(kSharedApplication,
+ kCallAllocPtr, sz, flags);
+}
+
+/// @brief Free pointer from the user's heap.
+/// @param ptr the pointer to free.
+CA_EXTERN_C VoidType RtTlsFree(PtrVoidType ptr)
+{
+ CA_MUST_PASS(kSharedApplication);
+ CA_MUST_PASS(ptr);
+
+ CA_UNREFERENCED_PARAMETER(
+ kSharedApplication->Invoke(kSharedApplication, kCallFreePtr, ptr));
+}
+
+/// @brief Get pointer size.
+/// @param ptr the pointer to find.
+/// @return the size.
+CA_EXTERN_C QWordType RtTlsGetSize(PtrVoidType ptr)
+{
+ CA_MUST_PASS(kSharedApplication);
+
+ CA_MUST_PASS(ptr);
+ return kSharedApplication->Invoke(kSharedApplication, kCallSizePtr, ptr);
+}
+
+/// @brief Check if the pointer exists.
+/// @param ptr the pointer to check.
+/// @return if it exists
+CA_EXTERN_C BooleanType RtTlsPtrExists(PtrVoidType ptr)
+{
+ CA_MUST_PASS(kSharedApplication);
+
+ CA_MUST_PASS(ptr);
+ return kSharedApplication->Invoke(kSharedApplication, kCallCheckPtr, ptr);
+}