Mercurial > lcfOS
diff cos/kernel/mm.c @ 37:5c20bd53cccd
Cleanup
author | windel |
---|---|
date | Mon, 16 Jan 2012 21:38:55 +0100 |
parents | 8012221dd740 |
children | 24ce177e01e8 |
line wrap: on
line diff
--- a/cos/kernel/mm.c Mon Jan 16 20:47:05 2012 +0100 +++ b/cos/kernel/mm.c Mon Jan 16 21:38:55 2012 +0100 @@ -6,6 +6,7 @@ #include "kernel.h" +// Bitmap that keeps track of all the 4 kB memory pages in the system: static uint64_t *frames = 0; static uint64_t nframes = 0; @@ -55,13 +56,17 @@ return (uint64_t) -1; } -// Memory manager functions: +/* + * Initializes the memory manager, allocating a bitmap once. + */ void init_memory(uint64_t total_mem_size) { + printf("Running with %d MB ram\n", total_mem_size / 1000000); + // Only here placement malloc is used! // - // Allocate and clear bits to remember which 4kb-frames are in use: - nframes = (total_mem_size / 0x1000); + // Allocate and clear bits to remember which 4KiB-frames are in use: + nframes = (total_mem_size / 0x1000); // Calculate number of frames frames = (uint64_t*)kmalloc_int( (nframes / 64) * sizeof(uint64_t) ); memset(frames, 0, (nframes / 64) * sizeof(uint64_t));