X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fpalacios%2Fmmu%2Fvmm_shdw_pg_tlb.c;h=02be430e9852c90deee112029cfb6c1ac6edc20a;hb=2fff50d3e72abf29655326449ed4dc5cf6e8f429;hp=60b2d214c80a713b5b5e8744c1686660526dc3a0;hpb=94f67717b6461df514dc225ed84f03b44c44061b;p=palacios.git diff --git a/palacios/src/palacios/mmu/vmm_shdw_pg_tlb.c b/palacios/src/palacios/mmu/vmm_shdw_pg_tlb.c index 60b2d21..02be430 100644 --- a/palacios/src/palacios/mmu/vmm_shdw_pg_tlb.c +++ b/palacios/src/palacios/mmu/vmm_shdw_pg_tlb.c @@ -65,7 +65,7 @@ static struct shadow_page_data * create_new_shadow_pt(struct guest_info * core) if (page_tail->cr3 != cur_cr3) { - PrintDebug("Reusing old shadow Page: %p (cur_CR3=%p)(page_cr3=%p) \n", + PrintDebug(core->vm_info, core, "Reusing old shadow Page: %p (cur_CR3=%p)(page_cr3=%p) \n", (void *)(addr_t)page_tail->page_pa, (void *)(addr_t)cur_cr3, (void *)(addr_t)(page_tail->cr3)); @@ -82,9 +82,20 @@ static struct shadow_page_data * create_new_shadow_pt(struct guest_info * core) // else page_tail = (struct shadow_page_data *)V3_Malloc(sizeof(struct shadow_page_data)); + + if (!page_tail) { + PrintError(core->vm_info, core, "Cannot allocate\n"); + return NULL; + } + page_tail->page_pa = (addr_t)V3_AllocPages(1); - PrintDebug("Allocating new shadow Page: %p (cur_cr3=%p)\n", + if (!page_tail->page_pa) { + PrintError(core->vm_info, core, "Cannot allocate page\n"); + return NULL; + } + + PrintDebug(core->vm_info, core, "Allocating new shadow Page: %p (cur_cr3=%p)\n", (void *)(addr_t)page_tail->page_pa, (void *)(addr_t)cur_cr3); @@ -101,7 +112,7 @@ static struct shadow_page_data * create_new_shadow_pt(struct guest_info * core) static int vtlb_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) { - V3_Print("VTLB initialization\n"); + V3_Print(vm, VCORE_NONE, "VTLB initialization\n"); return 0; } @@ -113,10 +124,15 @@ static int vtlb_local_init(struct guest_info * core) { struct v3_shdw_pg_state * state = &(core->shdw_pg_state); struct vtlb_local_state * vtlb_state = NULL; - V3_Print("VTLB local initialization\n"); + V3_Print(core->vm_info, core, "VTLB local initialization\n"); vtlb_state = (struct vtlb_local_state *)V3_Malloc(sizeof(struct vtlb_local_state)); + if (!vtlb_state) { + PrintError(core->vm_info, core, "Cannot allocate\n"); + return -1; + } + INIT_LIST_HEAD(&(vtlb_state->page_list)); state->local_impl_data = vtlb_state; @@ -158,7 +174,7 @@ static int vtlb_activate_shdw_pt(struct guest_info * core) { case LONG_16_COMPAT: return activate_shadow_pt_64(core); default: - PrintError("Invalid CPU mode: %s\n", v3_cpu_mode_to_str(v3_get_vm_cpu_mode(core))); + PrintError(core->vm_info, core, "Invalid CPU mode: %s\n", v3_cpu_mode_to_str(v3_get_vm_cpu_mode(core))); return -1; } @@ -184,7 +200,7 @@ static int vtlb_handle_pf(struct guest_info * core, addr_t fault_addr, pf_error_ return handle_shadow_pagefault_64(core, fault_addr, error_code); break; default: - PrintError("Unhandled CPU Mode: %s\n", v3_cpu_mode_to_str(v3_get_vm_cpu_mode(core))); + PrintError(core->vm_info, core, "Unhandled CPU Mode: %s\n", v3_cpu_mode_to_str(v3_get_vm_cpu_mode(core))); return -1; } } @@ -202,7 +218,7 @@ static int vtlb_handle_invlpg(struct guest_info * core, addr_t vaddr) { case LONG_16_COMPAT: return handle_shadow_invlpg_64(core, vaddr); default: - PrintError("Invalid CPU mode: %s\n", v3_cpu_mode_to_str(v3_get_vm_cpu_mode(core))); + PrintError(core->vm_info, core, "Invalid CPU mode: %s\n", v3_cpu_mode_to_str(v3_get_vm_cpu_mode(core))); return -1; } }