vm: implement a sparse memory model

This commit is contained in:
2023-02-08 17:13:01 +00:00
parent 6690572bf3
commit a7d4166c89
4 changed files with 285 additions and 9 deletions

View File

@@ -1,3 +1,20 @@
/* ### The flat memory model ###
under this memory model, the system memory is represented by
a single contiguous array of vm_pages. this array spans from
physical address up to the last available byte, as provided by
memblock. any extra reserved regions after the last available
byte will not be included to save memory.
this memory model is good for systems with a smaller amount of
physical memory that is mostly contiguous with few holes or
reserved regions. it is simpler and has less overhead.
for systems with a large amount of memory, or with large
amounts of reserved memory (especially those whose reserved
memory outstripts free memory), the sparse memory model may
be a better choice.
*/
#include <socks/vm.h>
#include <socks/memblock.h>
#include <socks/printk.h>
@@ -8,7 +25,7 @@ static vm_page_t *page_array = NULL;
/* number of pages stored in page_array */
static size_t page_array_count = 0;
void vm_flat_init()
void vm_flat_init(void)
{
printk("vm: using flat memory model");
size_t pmem_size = 0;