diff options
| author | Miguel <m.i@gmx.at> | 2018-09-10 00:54:35 +0200 |
|---|---|---|
| committer | Miguel <m.i@gmx.at> | 2018-09-10 00:54:35 +0200 |
| commit | 88c5873713a4eda47d299abd9cecaa49221ec9fe (patch) | |
| tree | 0eeb21f69824ddbef5e3076704fc099d65848244 /kernel/mem.h | |
| parent | 074490c63dd09fc941b1162f62af1985ee9576d3 (diff) | |
physical memory manager review et al.
Diffstat (limited to 'kernel/mem.h')
| -rw-r--r-- | kernel/mem.h | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/kernel/mem.h b/kernel/mem.h index 76d12b0..6871e11 100644 --- a/kernel/mem.h +++ b/kernel/mem.h @@ -1,6 +1,31 @@ +/** + * @file + * + * Physical Memory Manager + * ======================= + * + * Allocating and Deallocating memory pagewise. Run mem_init() first. + * + * + * Memory Map + * ---------- + * This will allow to mark a bit on/off for each page to indicte if it is + * currently used or not. + * + * Remember that we have 4096 bytes per page so we need 1048576 bits to + * cover the whole 32bit addressable memory 2^32 byte (4GB). + * + * This results in a 128KiB map we which allocate statically. + */ + #include "multiboot.h" -typedef uint32_t physical_address; -physical_address* pmmngr_alloc_block (); -void pmmngr_free_block (physical_address* p); + +/** + * Init the physical memory manager. Please provide the multiboot_information + * strucutre filled by your bootloader (as grub). + * This is required for memory map et al. + */ uint32_t mem_init(multiboot_information *info); +void* mem_alloc_block (); +void mem_free_block(void* p); uint32_t mem_get_free_blocks_count(); |
