From 5b30cacacf0f0ca6fb06bb34389f04b05ceb2b15 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Sun, 25 May 2025 09:56:46 +0200 Subject: kernel!: lots of changes, see commit details. refactor(hal): unify file naming and drop redundant architecture suffixes feat(build): rename kernel and bootloader to 'ne_kernel' and 'ne_bootz' refactor(memory): replace mm_get_phys_address with mm_get_page_addr feat(bitmap): track bitmap allocator usage and add out-of-memory error fix(heap): correct heap magic naming and alignment logic chore(fs): downgrade HeFS disk size check to warning chore(tools): clean up formatting in 'ping' and 'manual' docs(design): update OS_DESIGN.drawio to reflect Hypr86 and new layout Signed-off-by: Amlal El Mahrouss --- dev/kernel/src/HeapMgr.cc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'dev/kernel/src/HeapMgr.cc') diff --git a/dev/kernel/src/HeapMgr.cc b/dev/kernel/src/HeapMgr.cc index 5280bcc3..2fdfe748 100644 --- a/dev/kernel/src/HeapMgr.cc +++ b/dev/kernel/src/HeapMgr.cc @@ -25,8 +25,8 @@ //! @file HeapMgr.cc //! @brief Heap system that serves as the main memory manager. -#define kMemoryMgrMagic (0xD4D75) -#define kMemoryMgrAlignSz (4U) +#define kHeapMgrMagic (0xD4D75) +#define kHeapMgrAlignSz (4U) namespace Kernel { /// @brief Implementation details. @@ -68,7 +68,7 @@ namespace Detail { UInt32 fPad; /// @brief Padding bytes for header. - UInt8 fPadding[kMemoryMgrAlignSz]; + UInt8 fPadding[kHeapMgrAlignSz]; }; /// @brief Check for heap address validity. @@ -112,7 +112,7 @@ _Output VoidPtr mm_alloc_ptr(SizeT sz, Bool wr, Bool user, SizeT pad_amount) { sizeof(Detail::MM_INFORMATION_BLOCK)); heap_info_ptr->fSize = sz_fix; - heap_info_ptr->fMagic = kMemoryMgrMagic; + heap_info_ptr->fMagic = kHeapMgrMagic; heap_info_ptr->fCRC32 = 0U; // dont fill it for now. heap_info_ptr->fOffset = reinterpret_cast(heap_info_ptr) + sizeof(Detail::MM_INFORMATION_BLOCK); @@ -122,7 +122,7 @@ _Output VoidPtr mm_alloc_ptr(SizeT sz, Bool wr, Bool user, SizeT pad_amount) { heap_info_ptr->fPresent = Yes; heap_info_ptr->fPad = pad_amount; - rt_set_memory(heap_info_ptr->fPadding, 0, kMemoryMgrAlignSz); + rt_set_memory(heap_info_ptr->fPadding, 0, kHeapMgrAlignSz); auto result = reinterpret_cast(heap_info_ptr->fOffset); @@ -191,7 +191,7 @@ _Output Int32 mm_free_ptr(VoidPtr heap_ptr) { reinterpret_cast((UIntPtr) (heap_ptr) - sizeof(Detail::MM_INFORMATION_BLOCK)); - if (heap_info_ptr && heap_info_ptr->fMagic == kMemoryMgrMagic) { + if (heap_info_ptr && heap_info_ptr->fMagic == kHeapMgrMagic) { if (!heap_info_ptr->fPresent) { return kErrorHeapNotPresent; } @@ -231,7 +231,7 @@ _Output Boolean mm_is_valid_ptr(VoidPtr heap_ptr) { reinterpret_cast((UIntPtr) (heap_ptr) - sizeof(Detail::MM_INFORMATION_BLOCK)); - return (heap_info_ptr && heap_info_ptr->fPresent && heap_info_ptr->fMagic == kMemoryMgrMagic); + return (heap_info_ptr && heap_info_ptr->fPresent && heap_info_ptr->fMagic == kHeapMgrMagic); } return No; @@ -247,7 +247,7 @@ _Output Boolean mm_protect_ptr(VoidPtr heap_ptr) { sizeof(Detail::MM_INFORMATION_BLOCK)); /// if valid, present and is heap header, then compute crc32 - if (heap_info_ptr && heap_info_ptr->fPresent && kMemoryMgrMagic == heap_info_ptr->fMagic) { + if (heap_info_ptr && heap_info_ptr->fPresent && kHeapMgrMagic == heap_info_ptr->fMagic) { heap_info_ptr->fCRC32 = ke_calculate_crc32((Char*) heap_info_ptr->fOffset, heap_info_ptr->fSize); -- cgit v1.2.3