diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-12-30 20:56:19 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-12-30 20:56:19 +0100 |
| commit | e02c25872a51595954da9eb33a321a7d7ed7e5d2 (patch) | |
| tree | d3fff54b2ff74a5916d0f1b270ec2e8dfa490b79 /dev/Kernel/src/BitMapMgr.cc | |
| parent | 224e747b04022a5b8f8577fd730e907febf90a75 (diff) | |
IMPL: Process scheduler and bit map mgr fixes.
- Finally got it working, at least before execution, need to fix
the VMMgr now.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'dev/Kernel/src/BitMapMgr.cc')
| -rw-r--r-- | dev/Kernel/src/BitMapMgr.cc | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/dev/Kernel/src/BitMapMgr.cc b/dev/Kernel/src/BitMapMgr.cc index 7f289073..aa32cb93 100644 --- a/dev/Kernel/src/BitMapMgr.cc +++ b/dev/Kernel/src/BitMapMgr.cc @@ -82,9 +82,12 @@ namespace Kernel /// @return The new address which was found. auto FindBitMap(VoidPtr base_ptr, SizeT size, Bool wr, Bool user) -> VoidPtr { + if (!size) + return nullptr; + VoidPtr base = reinterpret_cast<VoidPtr>(((UIntPtr)base_ptr) + kPageSize); - while (base && size) + while (((UIntPtr)base) < (reinterpret_cast<UIntPtr>(base) + kHandoverHeader->f_BitMapSize)) { UIntPtr* ptr_bit_set = reinterpret_cast<UIntPtr*>(base); @@ -106,8 +109,6 @@ namespace Kernel } else if (ptr_bit_set[kBitMapMagIdx] != kBitMapMagic) { - UIntPtr* ptr_bit_set = reinterpret_cast<UIntPtr*>(base_ptr); - ptr_bit_set[kBitMapMagIdx] = kBitMapMagic; ptr_bit_set[kBitMapSizeIdx] = size; ptr_bit_set[kBitMapUsedIdx] = Yes; @@ -120,10 +121,7 @@ namespace Kernel return (VoidPtr)ptr_bit_set; } - base = reinterpret_cast<VoidPtr>(reinterpret_cast<UIntPtr>(base_ptr) + (ptr_bit_set[0] != kBitMapMagic ? size : ptr_bit_set[1])); - - if ((UIntPtr)base_ptr < (reinterpret_cast<UIntPtr>(base) + kHandoverHeader->f_BitMapSize)) - return nullptr; + base = reinterpret_cast<VoidPtr>(reinterpret_cast<UIntPtr>(base) + ((ptr_bit_set[kBitMapMagIdx] != kBitMapMagic) ? size : ptr_bit_set[kBitMapSizeIdx])); } return nullptr; @@ -145,7 +143,7 @@ namespace Kernel kcout << "Size of BitMap (MIB): " << number(MIB(ptr_bit_set[kBitMapSizeIdx])) << endl; kcout << "Size of BitMap (GIB): " << number(GIB(ptr_bit_set[kBitMapSizeIdx])) << endl; kcout << "Size of BitMap (TIB): " << number(TIB(ptr_bit_set[kBitMapSizeIdx])) << endl; - kcout << "Address Of BitMap: " << hex_number((UIntPtr)ptr_bit_set) << endl; + kcout << "Address Of BitMap Header: " << hex_number((UIntPtr)ptr_bit_set) << endl; } }; } // namespace Detail |
