diff --git a/src/memory/FrameAllocator.cc b/src/memory/FrameAllocator.cc index b21788d..9cc3205 100644 --- a/src/memory/FrameAllocator.cc +++ b/src/memory/FrameAllocator.cc @@ -3,7 +3,8 @@ * Eryn Wells */ /** - * An object to tracks and allocate physical page frames. + * This file deals with page frames, chunks of physical memory of `pageSize` + * length that can be filled with pages. */ #include "Kernel.hh" @@ -53,16 +54,14 @@ FrameAllocator::allocate() // Find the first bitmap with a free slot, and the first free slot, and return it. const u32 pagesPerBitmap = Bitmap::length; for (usize i = 0; i < mNumberOfPages; i++) { - auto bitmap = mBitmap[i]; + auto& bitmap = mBitmap[i]; if (bitmap.isFull()) { continue; } - kstd::printFormat("Found partially full bitmap %ld -> %02X\n", i, u8(bitmap)); for (usize j = 0; j < pagesPerBitmap; j++) { if (bitmap.isSet(j)) { continue; } - kstd::printFormat("Found unset bit %ld\n", j); bitmap.set(j); usize page = i * pagesPerBitmap + j; void* pageAddress = addressOfPage(page); diff --git a/src/memory/FrameAllocator.hh b/src/memory/FrameAllocator.hh index d59a4f2..ad6c200 100644 --- a/src/memory/FrameAllocator.hh +++ b/src/memory/FrameAllocator.hh @@ -3,7 +3,8 @@ * Eryn Wells */ /** - * An object to tracks and allocate physical page frames. + * This file deals with page frames, chunks of physical memory of `pageSize` + * length that can be filled with pages. */ #ifndef __MEMORY_FRAMEALLOCATOR_HH__ @@ -22,10 +23,8 @@ struct FrameAllocator void initialize(const StartupInformation& startupInformation); /** - * Allocate a page. Find a free page, mark it in use, and return its - * address. - * - * @return The base address of a free page, or 0 if no page could be allocated. + * Allocate a page frame. Find a free page frame, mark it in use, and return + * its address. */ void* allocate();