From: Peter Dinda Date: Tue, 1 Jan 2013 00:11:16 +0000 (-0600) Subject: Additional error checking / output for failing memory region operations X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=commitdiff_plain;h=d16a049efb78e13e98ffdbaa8564d4ddc1be7f00;p=palacios.releases.git Additional error checking / output for failing memory region operations --- diff --git a/palacios/src/palacios/vmm_mem.c b/palacios/src/palacios/vmm_mem.c index 0f208b4..6a4f5da 100644 --- a/palacios/src/palacios/vmm_mem.c +++ b/palacios/src/palacios/vmm_mem.c @@ -192,6 +192,7 @@ struct v3_mem_region * __insert_mem_region(struct v3_vm_info * vm, PrintError(vm, VCORE_NONE, "Trying to map a partial overlapped core specific page...\n"); return tmp_region; // This is ugly... } else if (region->core_id == tmp_region->core_id) { + PrintError(vm, VCORE_NONE, "Trying to map a core-overlapping page\n"); return tmp_region; } else if (region->core_id < tmp_region->core_id) { p = &(*p)->rb_left; @@ -213,6 +214,7 @@ int v3_insert_mem_region(struct v3_vm_info * vm, struct v3_mem_region * region) int i = 0; if ((ret = __insert_mem_region(vm, region))) { + PrintError(vm, VCORE_NONE, "Internal insert failed returned region is from 0x%p to 0x%p on vcore %d\n", (void*)(ret->guest_start), (void*)(ret->guest_end), ret->core_id); return -1; } diff --git a/palacios/src/palacios/vmm_mem_hook.c b/palacios/src/palacios/vmm_mem_hook.c index f4040ff..99730d5 100644 --- a/palacios/src/palacios/vmm_mem_hook.c +++ b/palacios/src/palacios/vmm_mem_hook.c @@ -359,6 +359,12 @@ int v3_hook_write_mem(struct v3_vm_info * vm, uint16_t core_id, entry = v3_create_mem_region(vm, core_id, guest_addr_start, guest_addr_end); + if (!entry) { + PrintError(vm, VCORE_NONE, "Cannot allocate a memory region\n"); + V3_Free(hook); + return -1; + } + hook->region = entry; entry->host_addr = host_addr; @@ -370,6 +376,7 @@ int v3_hook_write_mem(struct v3_vm_info * vm, uint16_t core_id, entry->flags.alloced = 1; if (v3_insert_mem_region(vm, entry) == -1) { + PrintError(vm, VCORE_NONE, "Cannot insert memory region\n"); V3_Free(entry); V3_Free(hook); return -1;