X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=blobdiff_plain;f=palacios%2Fsrc%2Fpalacios%2Fvmm_mem.c;h=4248845379e107959fb34066abc76e047e091c16;hp=0f1c0048c407853bb9f26e612cff89c881af9273;hb=123a1ba27ea09c8fa77a1b36ce625b43d7c48b14;hpb=3a4e54ec208ea3589963b410d2d73292bbc4a8fe diff --git a/palacios/src/palacios/vmm_mem.c b/palacios/src/palacios/vmm_mem.c index 0f1c004..4248845 100644 --- a/palacios/src/palacios/vmm_mem.c +++ b/palacios/src/palacios/vmm_mem.c @@ -21,11 +21,11 @@ #include #include #include +#include #include #include - #define MEM_OFFSET_HCALL 0x1000 @@ -41,7 +41,7 @@ static int mem_offset_hypercall(struct guest_info * info, uint_t hcall_id, void } -void v3_init_shadow_map(struct guest_info * info) { +int v3_init_shadow_map(struct guest_info * info) { v3_shdw_map_t * map = &(info->mem_map); addr_t mem_pages = info->mem_size >> 12; @@ -56,9 +56,17 @@ void v3_init_shadow_map(struct guest_info * info) { map->base_region.host_type = SHDW_REGION_ALLOCATED; map->base_region.host_addr = (addr_t)V3_AllocPages(mem_pages); + + if ((void *)map->base_region.host_addr == NULL) { + PrintError("Could not allocate Guest memory\n"); + return -1; + } + //memset(V3_VAddr((void *)map->base_region.host_addr), 0xffffffff, map->base_region.guest_end); v3_register_hypercall(info, MEM_OFFSET_HCALL, mem_offset_hypercall, NULL); + + return 0; } void v3_delete_shadow_map(struct guest_info * info) { @@ -387,7 +395,7 @@ addr_t v3_get_shadow_addr(struct v3_shadow_region * reg, addr_t guest_addr) { (reg->host_type != SHDW_REGION_FULL_HOOK)) { return (guest_addr - reg->guest_start) + reg->host_addr; } else { - PrintError("MEM Region Invalid\n"); + // PrintError("MEM Region Invalid\n"); return 0; }