Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


Corrected vmcs load/save in checkpoint/restore code
Peter Dinda [Tue, 22 May 2012 19:30:46 +0000 (14:30 -0500)]
palacios/src/palacios/vmx.c

index 16f3e3b..a024fb7 100644 (file)
@@ -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);