That goddamn auto&
Setting frames works now!
This commit is contained in:
		
							parent
							
								
									1daa3df74e
								
							
						
					
					
						commit
						f641b5fc8d
					
				
					 2 changed files with 7 additions and 9 deletions
				
			
		|  | @ -3,7 +3,8 @@ | |||
|  * Eryn Wells <eryn@erynwells.me> | ||||
|  */ | ||||
| /**
 | ||||
|  * 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); | ||||
|  |  | |||
|  | @ -3,7 +3,8 @@ | |||
|  * Eryn Wells <eryn@erynwells.me> | ||||
|  */ | ||||
| /**
 | ||||
|  * 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(); | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue