From 7e5be1572c043484293ee0cdd840dd41f54e87ee Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Fri, 29 Mar 2024 17:01:55 +0100 Subject: Kernel and SystemLib: See below. What has been done: - Rename most System.Core to SystemLib. - Reworked it's API and the concept of ObjectRef to become the ApplicationRef object. - Remove unused ODF and XIFF file format from tree, ODF will be part of the text editing program. - Update Readme for SystemLib. - Add Support folder on NewFS partitions. What is next: - NewFS filesystem support. - Program loading. - Preemptive scheduler on non-SMP systems using timers. Signed-off-by: Amlal El Mahrouss --- Public/Developer/SystemLib/Sources/Heap.c | 42 +++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 Public/Developer/SystemLib/Sources/Heap.c (limited to 'Public/Developer/SystemLib/Sources/Heap.c') diff --git a/Public/Developer/SystemLib/Sources/Heap.c b/Public/Developer/SystemLib/Sources/Heap.c new file mode 100644 index 00000000..c9b2b938 --- /dev/null +++ b/Public/Developer/SystemLib/Sources/Heap.c @@ -0,0 +1,42 @@ +/* ------------------------------------------- + + Copyright Mahrouss Logic + +------------------------------------------- */ + +#include + +/// @brief Allocate from the user's heap. +/// @param sz size of object. +/// @param flags flags. +/// @return +CA_EXTERN_C PtrVoidType RtAllocateProcessPtr(QWordType sz, + DWordType flags) { + 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 RtFreeProcessPtr(PtrVoidType ptr) { + 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 RtProcessPtrSize(PtrVoidType ptr) { + 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 RtProcessPtrExists(PtrVoidType ptr) { + CA_MUST_PASS(ptr); + return kSharedApplication->Invoke(kSharedApplication, kCallCheckPtr, ptr); +} -- cgit v1.2.3