X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fpalacios%2Fvmm_mem.c;h=238fdc578a8457e7616abae482a03b12a6b5c21b;hb=refs%2Fheads%2Fdevel;hp=a074bfc392da6ca75aad44d4befa1c6eb0cf41eb;hpb=a48fed88738b625fea8a606f5b327d32db91f009;p=palacios.releases.git diff --git a/palacios/src/palacios/vmm_mem.c b/palacios/src/palacios/vmm_mem.c index a074bfc..238fdc5 100644 --- a/palacios/src/palacios/vmm_mem.c +++ b/palacios/src/palacios/vmm_mem.c @@ -185,12 +185,11 @@ int v3_init_mem_map(struct v3_vm_info * vm) { PrintDebug(VM_NONE, VCORE_NONE, "v3_init_mem_map: %llu base regions will be allocated of %llu base regions in guest\n", (uint64_t)num_base_regions_host_mem, (uint64_t)map->num_base_regions); - map->base_regions = V3_AllocPages(CEIL_DIV(sizeof(struct v3_mem_region) * map->num_base_regions, PAGE_SIZE_4KB)); + map->base_regions = V3_VMalloc(sizeof(struct v3_mem_region) * map->num_base_regions); if (map->base_regions == NULL) { PrintError(vm, VCORE_NONE, "Could not allocate base region array\n"); return -1; } - map->base_regions = V3_VAddr(map->base_regions); memset(map->base_regions, 0, sizeof(struct v3_mem_region) * map->num_base_regions); @@ -218,11 +217,12 @@ int v3_init_mem_map(struct v3_vm_info * vm) { #ifdef V3_CONFIG_SWAPPING // nothing to do - memset will have done it. #endif - + region->host_addr = (addr_t)V3_AllocPagesExtended(block_pages, PAGE_SIZE_4KB, node_id, - 0); // no constraints + vm->resource_control.pg_filter_func, + vm->resource_control.pg_filter_state); if ((void *)region->host_addr == NULL) { PrintError(vm, VCORE_NONE, "Could not allocate guest memory\n"); @@ -297,8 +297,7 @@ void v3_delete_mem_map(struct v3_vm_info * vm) { #endif } - V3_FreePages(V3_PAddr(map->base_regions), - CEIL_DIV(sizeof(struct v3_mem_region) * map->num_base_regions, PAGE_SIZE_4KB)); + V3_VFree(map->base_regions); } @@ -525,7 +524,7 @@ static struct v3_mem_region * get_next_mem_region( struct v3_vm_info * vm, uint1 } - if (parent->guest_start > guest_addr) { + if (!parent || parent->guest_start > guest_addr) { return parent; } else if (parent->guest_end < guest_addr) { struct rb_node * node = &(parent->tree_node);