diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-05-23 11:12:31 +0200 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2025-05-23 11:13:38 +0200 |
| commit | 54a0f4c49d9bfb955174c87dae2f442d7f5a8b25 (patch) | |
| tree | ad59d31c9444fcfc6d5f0da7b17c8843710e6014 /dev/kernel/KernelKit/HeapMgr.h | |
| parent | fc67c4af554189c941c811486a0b2b21aa3f54ea (diff) | |
feat!(Kernel): Improvements on the BitMapMgr, HTS, and UPS.
other:
- Add ZXD header file.
- Reworking AMD64 interrupts.
- Improved HTS's design implementation.
- Improved UPS's balancing implementation.
breaking changes:
- Rename MemoryMgr to HeapMgr.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'dev/kernel/KernelKit/HeapMgr.h')
| -rw-r--r-- | dev/kernel/KernelKit/HeapMgr.h | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/dev/kernel/KernelKit/HeapMgr.h b/dev/kernel/KernelKit/HeapMgr.h new file mode 100644 index 00000000..3271dd03 --- /dev/null +++ b/dev/kernel/KernelKit/HeapMgr.h @@ -0,0 +1,58 @@ +/* ------------------------------------------- + + Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved. + +------------------------------------------- */ + +#ifndef INC_KERNEL_HEAP_H +#define INC_KERNEL_HEAP_H + +/// @date 30/01/24 +/// @file: HeapMgr.h +/// @brief: Memory allocation support for the NeKernel. + +#include <KernelKit/KPC.h> +#include <NeKit/KernelPanic.h> +#include <hint/CompilerHint.h> + +namespace Kernel { +/// @brief Declare pointer as free. +/// @param heap_ptr the pointer. +/// @return a status code regarding the deallocation. +Int32 mm_delete_ptr(VoidPtr heap_ptr); + +/// @brief Check if pointer is a valid Kernel pointer. +/// @param heap_ptr the pointer +/// @return if it exists it returns true. +Boolean mm_is_valid_ptr(VoidPtr heap_ptr); + +/// @brief Allocate chunk of memory. +/// @param sz Size of pointer +/// @param wr Read Write bit. +/// @param user User enable bit. +/// @return The newly allocated pointer, or nullptr. +VoidPtr mm_new_ptr(SizeT sz, Bool wr, Bool user, SizeT pad_amount = 0); + +/// @brief Protect the heap with a CRC value. +/// @param heap_ptr pointer. +/// @return if it valid: point has crc now., otherwise fail. +Boolean mm_protect_ptr(VoidPtr heap_ptr); + +/// @brief Makes a Kernel page. +/// @param heap_ptr the page pointer. +/// @return status code +Int32 mm_make_page(VoidPtr heap_ptr); + +/// @brief Overwrites and set the flags of a heap header. +/// @param heap_ptr the pointer to update. +/// @param flags the flags to set. +Int32 mm_make_ptr_flags(VoidPtr heap_ptr, UInt64 flags); + +/// @brief Gets the flags of a heap header. +/// @param heap_ptr the pointer to get. +UInt64 mm_get_ptr_flags(VoidPtr heap_ptr); +} // namespace Kernel + +#include <KernelKit/HeapMgr.inl> + +#endif // !INC_KERNEL_HEAP_H |
