From af8a516fc22865abd80d6e26f1541fa3d6bebfdc Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Thu, 9 May 2024 00:42:44 +0200 Subject: MHR-23: :boom:, refactors. - Move NewBoot to /Boot, thus making Kernel directory only containing the kernel. Signed-off-by: Amlal El Mahrouss --- Kernel/KernelKit/KernelHeap.hpp | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 Kernel/KernelKit/KernelHeap.hpp (limited to 'Kernel/KernelKit/KernelHeap.hpp') diff --git a/Kernel/KernelKit/KernelHeap.hpp b/Kernel/KernelKit/KernelHeap.hpp new file mode 100644 index 00000000..bb21e981 --- /dev/null +++ b/Kernel/KernelKit/KernelHeap.hpp @@ -0,0 +1,39 @@ +/* ------------------------------------------- + + Copyright SoftwareLabs + +------------------------------------------- */ + +#pragma once + +// last-rev 30/01/24 +// file: KernelHeap.hpp +// description: heap allocation for the kernel. + +#include + +namespace NewOS +{ + + /// @brief Declare pointer as free. + /// @param heapPtr the pointer. + /// @return + Int32 ke_delete_ke_heap(voidPtr allocatedPtr); + + /// @brief Check if pointer is a valid kernel pointer. + /// @param heapPtr the pointer + /// @return if it exists. + Boolean ke_is_valid_heap(VoidPtr ptr); + + /// @brief allocate chunk of memory. + /// @param sz size of pointer + /// @param rw read write (true to enable it) + /// @param user is it accesible by user processes? + /// @return the pointer + voidPtr ke_new_ke_heap(SizeT sz, const bool rw, const bool user); + + /// @brief Protect the heap with a CRC value. + /// @param heapPtr HIB pointer. + /// @return if it valid: point has crc now., otherwise fail. + Boolean ke_protect_ke_heap(VoidPtr heapPtr); +} // namespace NewOS -- cgit v1.2.3