kernel: port sandbox components

This commit is contained in:
2023-02-03 20:51:23 +00:00
parent 40f83922da
commit 247bb2b530
14 changed files with 16 additions and 85 deletions

View File

@@ -2,11 +2,7 @@
#include <socks/queue.h>
#include <socks/types.h>
#include <socks/vm.h>
#include <string.h>
#include <stdio.h>
#include <inttypes.h>
#include <assert.h>
#include <stdlib.h>
#include <socks/libc/string.h>
static vm_page_t *group_pages_into_block(vm_zone_t *z, phys_addr_t base, phys_addr_t limit, int order)
{
@@ -36,8 +32,6 @@ static void convert_region_to_blocks(vm_zone_t *zone,
int reserved)
{
size_t block_frames = vm_bytes_to_pages(limit - base + 1);
printf("adding region %08zx-%08zx (%zu frames) to zone %s\n",
base, limit, block_frames, zone->z_info.zd_name);
int reset_order = 0;
for (int order = VM_PAGE_MAX_ORDER; order >= VM_PAGE_MIN_ORDER; ) {
@@ -55,12 +49,6 @@ static void convert_region_to_blocks(vm_zone_t *zone,
continue;
}
printf("%s: %zu %s pages at %08" PRIxPTR "\n",
zone->z_info.zd_name,
order_frames,
reserved == 1 ? "reserved" : "free",
base);
phys_addr_t block_limit = base + (order_frames * VM_PAGE_SIZE) - 1;
vm_page_t *block_page = group_pages_into_block(zone, base, block_limit, order);
@@ -76,11 +64,6 @@ static void convert_region_to_blocks(vm_zone_t *zone,
reset_order = 0;
}
if (base > limit + 1) {
printf("too many pages created! %zx > %zx\n", base, limit);
abort();
}
if (base == limit) {
break;
}
@@ -93,8 +76,6 @@ void vm_zone_init(vm_zone_t *z, const vm_zone_descriptor_t *zone_info)
return;
}
printf("initialising zone %s (%08zx-%08zx)\n",
zone_info->zd_name, zone_info->zd_base, zone_info->zd_limit);
memset(z, 0x0, sizeof *z);
memcpy(&z->z_info, zone_info, sizeof *zone_info);
z->z_lock = SPIN_LOCK_INIT;