diff options
Diffstat (limited to 'kernel/include/mm/physical_mm.h')
-rw-r--r-- | kernel/include/mm/physical_mm.h | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/kernel/include/mm/physical_mm.h b/kernel/include/mm/physical_mm.h index 2fa85ea..3075bf9 100644 --- a/kernel/include/mm/physical_mm.h +++ b/kernel/include/mm/physical_mm.h @@ -34,17 +34,35 @@ namespace PhysicalMM { +/* Initialize the memory map by getting all free regions, setting all blocks to + * used, initializing regions marked free by the memory map provided by + * multiboot, and deinitializing the memory used by the kernel */ void initialize(void); -uint32_t find_free_block(void); + +/* Find and allocate a free memory block, returning the physical address of the + * block */ void *allocate_block(void); + +/* Free an allocated memory block, given the physical address (from + * allocate_block) */ void free_block(void *physical_address); +/*-- BITMAP --*/ + +/* Marks the block as 'used' */ void set_used(const uint32_t bit, uint32_t *total_free_blocks, uint32_t *memory_map); + +/* Marks the block as 'unused' */ void set_usable(const uint32_t bit, uint32_t *total_free_blocks, uint32_t *memory_map); + +/* Returns: + * True if the bit is set (block is in use) + * False if the bit is unset (block isn't in use) + */ bool test_bit(const uint32_t bit, uint32_t *memory_map); } |