From: Peter Dinda Date: Tue, 22 May 2012 19:30:46 +0000 (-0500) Subject: Corrected vmcs load/save in checkpoint/restore code X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=commitdiff_plain;h=412aa4f1b022a7966fe89ff905ef2ba5613ab368;p=palacios.git Corrected vmcs load/save in checkpoint/restore code --- diff --git a/palacios/src/palacios/vmx.c b/palacios/src/palacios/vmx.c index 16f3e3b..a024fb7 100644 --- a/palacios/src/palacios/vmx.c +++ b/palacios/src/palacios/vmx.c @@ -640,9 +640,11 @@ int v3_deinit_vmx_vmcs(struct guest_info * core) { * JRL: This is broken */ int v3_vmx_save_core(struct guest_info * core, void * ctx){ - uint64_t vmcs_ptr = vmcs_store(); + struct vmx_data * vmx_info = (struct vmx_data *)(core->vmm_data); - v3_chkpt_save(ctx, "vmcs_data", PAGE_SIZE, (void *)vmcs_ptr); + // note that the vmcs pointer is an HPA, but we need an HVA + v3_chkpt_save(ctx, "vmcs_data", PAGE_SIZE_4KB, V3_VAddr((void*) + (vmx_info->vmcs_ptr_phys))); return 0; } @@ -650,12 +652,18 @@ int v3_vmx_save_core(struct guest_info * core, void * ctx){ int v3_vmx_load_core(struct guest_info * core, void * ctx){ struct vmx_data * vmx_info = (struct vmx_data *)(core->vmm_data); struct cr0_32 * shadow_cr0; - char vmcs[PAGE_SIZE_4KB]; + addr_t vmcs_page_paddr; //HPA + + vmcs_page_paddr = (addr_t) V3_AllocPages(1); - v3_chkpt_load(ctx, "vmcs_data", PAGE_SIZE_4KB, vmcs); + v3_chkpt_load(ctx, "vmcs_data", PAGE_SIZE_4KB, V3_VAddr((void *)vmcs_page_paddr)); vmcs_clear(vmx_info->vmcs_ptr_phys); - vmcs_load((addr_t)vmcs); + + // Probably need to delete the old one... + V3_FreePages((void*)(vmx_info->vmcs_ptr_phys),1); + + vmcs_load(vmcs_page_paddr); v3_vmx_save_vmcs(core);