From: Peter Dinda Date: Tue, 28 Apr 2015 17:03:40 +0000 (-0500) Subject: Minor compile warning fixup and error checks X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=commitdiff_plain;h=022f63d320c2837822dc7f6be84f860a01f02d7c Minor compile warning fixup and error checks --- diff --git a/palacios/src/devices/8259a.c b/palacios/src/devices/8259a.c index 08a8231..6609a5c 100644 --- a/palacios/src/devices/8259a.c +++ b/palacios/src/devices/8259a.c @@ -595,7 +595,7 @@ static int write_master_port1(struct guest_info * core, ushort_t port, void * sr if (IS_OCW2(cw)) { // handle the EOI here struct ocw2 * cw2 = (struct ocw2*)&cw; - int eoi_irq; + int eoi_irq=-1; PrintDebug(core->vm_info, core, "8259 PIC: Master: Handling OCW2 = %x (wr_Master1)\n", cw); @@ -750,7 +750,7 @@ static int write_slave_port1(struct guest_info * core, ushort_t port, void * src state->slave_state = ICW2; } else if (state->slave_state == READY) { if (IS_OCW2(cw)) { - int eoi_irq; + int eoi_irq = -1; // handle the EOI here struct ocw2 * cw2 = (struct ocw2 *)&cw; diff --git a/palacios/src/palacios/vmm_checkpoint.c b/palacios/src/palacios/vmm_checkpoint.c index 8156cdf..82c505b 100644 --- a/palacios/src/palacios/vmm_checkpoint.c +++ b/palacios/src/palacios/vmm_checkpoint.c @@ -1275,7 +1275,7 @@ int v3_chkpt_send_vm(struct v3_vm_info * vm, char * store, char * url, v3_chkpt_ int iter = 0; bool last_modpage_iteration=false; struct v3_bitmap modified_pages_to_send; - uint64_t start_time; + uint64_t start_time=0; uint64_t stop_time; int num_mod_pages=0; struct mem_migration_state *mm_state; diff --git a/palacios/src/palacios/vmm_debug.c b/palacios/src/palacios/vmm_debug.c index cc31a52..e209d54 100644 --- a/palacios/src/palacios/vmm_debug.c +++ b/palacios/src/palacios/vmm_debug.c @@ -488,6 +488,11 @@ void v3_print_idt(struct guest_info * core, addr_t idtr_base) { PrintError(core->vm_info, core, "idtr base address != linear translation, might be something funky with cs\n"); } + if (!base_hva) { + PrintError(core->vm_info, core "idtr address does not translate! skipping.\n"); + return ; + } + int i; char *types[16] = {" ILGL","aTSS16"," LDT","bTSS16","call16"," task","intr16","trap16", " ILGL","aTSS32"," ILGL","bTSS32","call32"," ILGL","intr32","trap32"}; @@ -533,6 +538,11 @@ void v3_print_gdt(struct guest_info * core, addr_t gdtr_base) { PrintError(core->vm_info, core, "gdtr base address != linear translation, might be something funky with cs\n"); } + if (!base_hva) { + PrintError(core->vm_info, core "gdtr address does not translate! skipping.\n"); + return ; + } + int i; char* cd[2] = {"data","code"}; // TODO: handle possibility of gate/segment descriptor @@ -600,6 +610,11 @@ void v3_print_idt(struct guest_info * core, addr_t idtr_base) { PrintError(core->vm_info, core, "idtr base address != linear translation, might be something funky with cs\n"); } + if (!base_hva) { + PrintError(core->vm_info, core, "idtr address does not translate! skipping.\n"); + return ; + } + int i; char *types[16] = {"ILGL","ILGL"," LDT","ILGL","ILGL","ILGL","ILGL","ILGL","ILGL", "aTSS","ILGL","bTSS","call","ILGL","intr","trap"}; @@ -645,6 +660,11 @@ void v3_print_gdt(struct guest_info * core, addr_t gdtr_base) { PrintError(core->vm_info, core, "gdtr base address != linear translation, might be something funky with cs\n"); } + if (!base_hva) { + PrintError(core->vm_info, core, "gdtr address does not translate! skipping.\n"); + return ; + } + int i; char* cd[2] = {"data","code"}; // TODO: handle possibility of gate/segment descriptor @@ -693,6 +713,11 @@ void v3_print_ldt(struct guest_info * core, addr_t ldtr_base) { PrintError(core->vm_info, core, "ldtr base address != linear translation, might be something funky with cs\n"); } + if (!base_hva) { + PrintError(core->vm_info, core, "ldtr address does not translate! skipping.\n"); + return ; + } + int i; char* cd[2] = {"data","code"}; // TODO: handle possibility of gate/segment descriptor @@ -740,6 +765,12 @@ void v3_print_tss(struct guest_info * core, addr_t tr_base) { if (tr_base != get_addr_linear(core, tr_base, &(core->segments.cs))) { PrintError(core->vm_info, core, "tr base address != linear translation, might be something funky with cs\n"); } + + if (!base_hva) { + PrintError(core->vm_info, core, "tr address does not translate! skipping.\n"); + return ; + } + t=(struct tss_long*)base_hva; V3_Print(core->vm_info, core," res1 : 0x%llx\n", (uint64_t) t->res1); diff --git a/palacios/src/palacios/vmm_fp.c b/palacios/src/palacios/vmm_fp.c index d3b6ca3..c2f2d41 100644 --- a/palacios/src/palacios/vmm_fp.c +++ b/palacios/src/palacios/vmm_fp.c @@ -35,7 +35,7 @@ int v3_can_handle_fp_state() if (can_do_fp!=-1) { return can_do_fp; } else { - uint32_t eax, ebx, ecx, edx; + uint32_t eax=0, ebx=0, ecx=0, edx=0; v3_cpuid(CPUID_FEATURE_IDS,&eax,&ebx,&ecx,&edx); diff --git a/palacios/src/palacios/vmm_swapping.c b/palacios/src/palacios/vmm_swapping.c index 90475d1..e3095d0 100644 --- a/palacios/src/palacios/vmm_swapping.c +++ b/palacios/src/palacios/vmm_swapping.c @@ -31,8 +31,6 @@ #include -#include -#include /* @@ -471,7 +469,7 @@ static int swap_out_region_internal(struct v3_vm_info *vm, struct v3_mem_region for (i=0, fail=0; inum_cores;i++ ) { struct guest_info * core = &(vm->cores[i]); - int rc; + int rc=0; if (core->shdw_pg_mode == SHADOW_PAGING) { v3_mem_mode_t mem_mode = v3_get_vm_mem_mode(core);