From 7477a0f942c374b652da4f80cdb36d4661aac3c8 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Sun, 13 Oct 2024 15:29:55 +0200 Subject: IMP: Delete the memory list when exiting process. IMP: Add Allocation (and delete) of MemoryList. IMP: BitMap allocator must now allocate directories as well. IMP: Add Handover arch to check if executable is an AMD64 executable or ARM64 executable. FIX: Add ::EFI::Stop, when a thread doesn't load correctly. Signed-off-by: Amlal El Mahrouss --- dev/zka/src/BitMapMgr.cxx | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'dev/zka/src/BitMapMgr.cxx') diff --git a/dev/zka/src/BitMapMgr.cxx b/dev/zka/src/BitMapMgr.cxx index e577bd7e..8e8a2208 100644 --- a/dev/zka/src/BitMapMgr.cxx +++ b/dev/zka/src/BitMapMgr.cxx @@ -6,7 +6,7 @@ #include -#define cBitMpMagic ((Kernel::UIntPtr)0x10210) +#define kBitMapMagic (0x10210) #ifdef __ZKA_AMD64__ #include @@ -44,7 +44,7 @@ namespace Kernel UIntPtr* ptr_bit_set = reinterpret_cast(page_ptr); if (!ptr_bit_set[cBitMapMagIdx] || - ptr_bit_set[cBitMapMagIdx] != cBitMpMagic) + ptr_bit_set[cBitMapMagIdx] != kBitMapMagic) return No; return Yes; @@ -57,7 +57,7 @@ namespace Kernel UIntPtr* ptr_bit_set = reinterpret_cast(page_ptr); - ptr_bit_set[cBitMapMagIdx] = cBitMpMagic; + ptr_bit_set[cBitMapMagIdx] = kBitMapMagic; ptr_bit_set[cBitMapUsedIdx] = No; this->GetBitMapStatus(ptr_bit_set); @@ -93,7 +93,7 @@ namespace Kernel { UIntPtr* ptr_bit_set = reinterpret_cast(base); - if (ptr_bit_set[cBitMapMagIdx] == cBitMpMagic && + if (ptr_bit_set[cBitMapMagIdx] == kBitMapMagic && ptr_bit_set[cBitMapSizeIdx] <= size) { if (ptr_bit_set[cBitMapUsedIdx] == No) @@ -109,11 +109,11 @@ namespace Kernel return (VoidPtr)ptr_bit_set; } } - else if (ptr_bit_set[cBitMapMagIdx] != cBitMpMagic) + else if (ptr_bit_set[cBitMapMagIdx] != kBitMapMagic) { UIntPtr* ptr_bit_set = reinterpret_cast(base_ptr); - ptr_bit_set[cBitMapMagIdx] = cBitMpMagic; + ptr_bit_set[cBitMapMagIdx] = kBitMapMagic; ptr_bit_set[cBitMapSizeIdx] = size; ptr_bit_set[cBitMapUsedIdx] = Yes; @@ -125,7 +125,7 @@ namespace Kernel return (VoidPtr)ptr_bit_set; } - base = reinterpret_cast(reinterpret_cast(base_ptr) + (ptr_bit_set[0] != cBitMpMagic ? size : ptr_bit_set[1])); + base = reinterpret_cast(reinterpret_cast(base_ptr) + (ptr_bit_set[0] != kBitMapMagic ? size : ptr_bit_set[1])); if ((UIntPtr)base_ptr < (reinterpret_cast(base) + kHandoverHeader->f_BitMapSize)) return nullptr; @@ -158,8 +158,8 @@ namespace Kernel /// @brief Allocate a new page to be used by the OS. /// @param wr read/write bit. /// @param user user bit. - /// @return - auto mm_alloc_bitmap(Boolean wr, Boolean user, SizeT size) -> VoidPtr + /// @return a new bitmap allocated pointer. + auto mm_alloc_bitmap(Boolean wr, Boolean user, SizeT size, Bool is_page) -> VoidPtr { VoidPtr ptr_new = nullptr; Detail::IBitMapAllocator traits; @@ -183,6 +183,7 @@ namespace Kernel return (UIntPtr*)ptr_new; } + /// @brief Free Bitmap, and mark it a absent in page terms. auto mm_free_bitmap(VoidPtr page_ptr) -> Bool { if (!page_ptr) -- cgit v1.2.3