diff options
| author | Amlal El Mahrouss <amlal@el-mahrouss-logic.com> | 2024-03-27 17:38:23 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@el-mahrouss-logic.com> | 2024-03-27 17:38:23 +0100 |
| commit | 1ce16b83dba0326b13dfa3399c1497ac6b1af14d (patch) | |
| tree | 8a5e4063b5d4cf6ce4f42dd500073994e9ef8954 /Public/Developer/System.Core/Sources/Heap.c | |
| parent | 6a18e607ffc4e83f2bd953c9de5c14f18e077df8 (diff) | |
Kernel && Developer:
Developer:
- Rework System API to use C instead of C++
- Add new calls in Thread.h
- Documented code.
Kernel:
- Rework handover stage, separated the Processor specific code from
the cross platform code.
Signed-off-by: Amlal El Mahrouss <amlal@el-mahrouss-logic.com>
Diffstat (limited to 'Public/Developer/System.Core/Sources/Heap.c')
| -rw-r--r-- | Public/Developer/System.Core/Sources/Heap.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/Public/Developer/System.Core/Sources/Heap.c b/Public/Developer/System.Core/Sources/Heap.c new file mode 100644 index 00000000..390ae072 --- /dev/null +++ b/Public/Developer/System.Core/Sources/Heap.c @@ -0,0 +1,46 @@ +/* ------------------------------------------- + + Copyright Mahrouss Logic + +------------------------------------------- */ + +#include <System.Core/Headers/Heap.h> + +/// @brief Allocate from the user's heap. +/// @param refObj Process object. +/// @param sz size of object. +/// @param flags flags. +/// @return +CA_EXTERN_C PtrVoidType RtAllocateProcessHeap(ObjectRef refObj, QWordType sz, + DWordType flags) { + CA_MUST_PASS(sz); + CA_MUST_PASS(flags); + + return (PtrVoidType)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 VoidType RtFreeProcessHeap(ObjectRef refObj, PtrVoidType 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 QWordType RtProcessHeapSize(ObjectRef refObj, PtrVoidType 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 BooleanType RtProcessHeapExists(ObjectRef refObj, PtrVoidType ptr) { + CA_MUST_PASS(ptr); + return refObj->Invoke(refObj, kProcessCallCheckPtr, ptr); +} |
