sandbox: vm: organise pages into zoned blocks

This commit is contained in:
2023-01-28 19:24:28 +00:00
parent 0227cb822b
commit d0341a5e35
6 changed files with 188 additions and 39 deletions

View File

@@ -16,6 +16,6 @@ extern int queue_test(void);
int main(int argc, const char **argv)
{
queue_test();
memory_test();
return 0;
}

View File

@@ -95,7 +95,13 @@ int memory_test(void)
printf("allocated %d bytes at 0x%" PRIxPTR "\n", size, alloc);
}
vm_bootstrap();
vm_zone_descriptor_t zones[] = {
{ .zd_id = VM_ZONE_DMA, .zd_name = "dma", .zd_base = 0x0, .zd_limit = MB_TO_BYTES(16) - 1 },
{ .zd_id = VM_ZONE_NORMAL, .zd_name = "normal", .zd_base = MB_TO_BYTES(16), .zd_limit = MB_TO_BYTES(1024) - 1 },
{ .zd_id = VM_ZONE_HIGHMEM, .zd_name = "highmem", .zd_base = MB_TO_BYTES(1024), .zd_limit = UINTPTR_MAX },
};
vm_bootstrap(zones, sizeof zones / sizeof zones[0]);
printf("memory regions:\n");