From 9792aa512dd8993973ffe7162c32dc873231a9af Mon Sep 17 00:00:00 2001 From: Max Wash Date: Wed, 8 Feb 2023 21:28:47 +0000 Subject: [PATCH] vm: use vm_memory_mode() to determine which model to initialise --- vm/bootstrap.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/vm/bootstrap.c b/vm/bootstrap.c index b10c3c5..4a9520c 100644 --- a/vm/bootstrap.c +++ b/vm/bootstrap.c @@ -22,7 +22,17 @@ kern_status_t vm_bootstrap(const vm_zone_descriptor_t *zones, size_t nr_zones) /* TODO select which memory model to use automatically, and add a kernel boot parameter to override the choice */ vm_set_memory_model(VM_MODEL_SPARSE); - vm_sparse_init(); + + switch (vm_memory_model()) { + case VM_MODEL_SPARSE: + vm_sparse_init(); + break; + case VM_MODEL_FLAT: + vm_flat_init(); + break; + default: + break; + } for (size_t i = 0; i < nr_zones; i++) { vm_zone_init(&node_data->pg_zones[zones[i].zd_id], &zones[i]);