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.


Update svm and vmx checkpoint functionality to new interface
Peter Dinda [Wed, 26 Dec 2012 17:15:40 +0000 (11:15 -0600)]
palacios/src/palacios/svm.c
palacios/src/palacios/vmx.c

index a4e9443..9e45738 100644 (file)
@@ -382,31 +382,31 @@ int v3_deinit_svm_vmcb(struct guest_info * core) {
 #ifdef V3_CONFIG_CHECKPOINT
 int v3_svm_save_core(struct guest_info * core, void * ctx){
 
-    if (v3_chkpt_save_8(ctx, "cpl", &(core->cpl)) == -1) { 
-       PrintError("Could not save SVM cpl\n");
-       return -1;
-    }
-
-    if (v3_chkpt_save(ctx, "vmcb_data", PAGE_SIZE, core->vmm_data) == -1) { 
-       PrintError("Could not save SVM vmcb\n");
-       return -1;
-    }
+  if (V3_CHKPT_SAVE(ctx, "cpl", core->cpl)) { 
+    PrintError("Could not save SVM cpl\n");
+    return -1;
+  }
 
-    return 0;
+  if (v3_chkpt_save(ctx, "vmcb_data", PAGE_SIZE, core->vmm_data)) { 
+    PrintError("Could not save SVM vmcb\n");
+    return -1;
+  }
+  
+  return 0;
 }
 
 int v3_svm_load_core(struct guest_info * core, void * ctx){
     
-    if (v3_chkpt_load_8(ctx, "cpl", &(core->cpl)) == -1) { 
-       PrintError("Could not load SVM cpl\n");
-       return -1;
-    }
-
-    if (v3_chkpt_load(ctx, "vmcb_data", PAGE_SIZE, core->vmm_data) == -1) {
-       return -1;
-    }
+  if (V3_CHKPT_LOAD(ctx, "cpl", core->cpl)) { 
+    PrintError("Could not load SVM cpl\n");
+    return -1;
+  }
 
-    return 0;
+  if (v3_chkpt_load(ctx, "vmcb_data", PAGE_SIZE, core->vmm_data) == -1) {
+    return -1;
+  }
+  
+  return 0;
 }
 #endif
 
index 833d08e..2718b1c 100644 (file)
@@ -670,65 +670,66 @@ int v3_deinit_vmx_vmcs(struct guest_info * core) {
  * JRL: This is broken
  */
 int v3_vmx_save_core(struct guest_info * core, void * ctx){
-    struct vmx_data * vmx_info = (struct vmx_data *)(core->vmm_data);
-
-    // note that the vmcs pointer is an HPA, but we need an HVA
-    if (v3_chkpt_save(ctx, "vmcs_data", PAGE_SIZE_4KB, 
-                     V3_VAddr((void*) (vmx_info->vmcs_ptr_phys))) ==-1) {
-       PrintError("Could not save vmcs data for VMX\n");
-       return -1;
-    }
-
-    return 0;
+  struct vmx_data * vmx_info = (struct vmx_data *)(core->vmm_data);
+  
+  // note that the vmcs pointer is an HPA, but we need an HVA
+  if (v3_chkpt_save(ctx, "vmcs_data", PAGE_SIZE_4KB, 
+                   V3_VAddr((void*) (vmx_info->vmcs_ptr_phys)))) {
+    PrintError("Could not save vmcs data for VMX\n");
+    return -1;
+  }
+  
+  return 0;
 }
 
 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;
-    addr_t vmcs_page_paddr;  //HPA
-
-    vmcs_page_paddr = (addr_t) V3_AllocPages(1);
-    
-    if (!vmcs_page_paddr) { 
-       PrintError("Could not allocate space for a vmcs in VMX\n");
-       return -1;
-    }
-
-    if (v3_chkpt_load(ctx, "vmcs_data", PAGE_SIZE_4KB, 
-                     V3_VAddr((void *)vmcs_page_paddr)) == -1) { 
-       PrintError("Could not load vmcs data for VMX\n");
-       return -1;
-    }
-
-    vmcs_clear(vmx_info->vmcs_ptr_phys);
-
-    // 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);
-
-    shadow_cr0 = (struct cr0_32 *)&(core->ctrl_regs.cr0);
+  struct vmx_data * vmx_info = (struct vmx_data *)(core->vmm_data);
+  struct cr0_32 * shadow_cr0;
+  addr_t vmcs_page_paddr;  //HPA
+  
+  vmcs_page_paddr = (addr_t) V3_AllocPages(1);
+  
+  if (!vmcs_page_paddr) { 
+    PrintError("Could not allocate space for a vmcs in VMX\n");
+    return -1;
+  }
+  
+  if (v3_chkpt_load(ctx, "vmcs_data", PAGE_SIZE_4KB, 
+                   V3_VAddr((void *)vmcs_page_paddr)) == -1) { 
+    PrintError("Could not load vmcs data for VMX\n");
+    V3_FreePages((void*)vmcs_page_paddr,1);
+    return -1;
+  }
+
+  vmcs_clear(vmx_info->vmcs_ptr_phys);
+  
+  // 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);
 
+  shadow_cr0 = (struct cr0_32 *)&(core->ctrl_regs.cr0);
 
-    /* Get the CPU mode to set the guest_ia32e entry ctrl */
 
-    if (core->shdw_pg_mode == SHADOW_PAGING) {
-       if (v3_get_vm_mem_mode(core) == VIRTUAL_MEM) {
-           if (v3_activate_shadow_pt(core) == -1) {
-               PrintError("Failed to activate shadow page tables\n");
-               return -1;
-           }
-       } else {
-           if (v3_activate_passthrough_pt(core) == -1) {
-               PrintError("Failed to activate passthrough page tables\n");
-               return -1;
-           }
-       }
+  /* Get the CPU mode to set the guest_ia32e entry ctrl */
+  
+  if (core->shdw_pg_mode == SHADOW_PAGING) {
+    if (v3_get_vm_mem_mode(core) == VIRTUAL_MEM) {
+      if (v3_activate_shadow_pt(core) == -1) {
+       PrintError("Failed to activate shadow page tables\n");
+       return -1;
+      }
+    } else {
+      if (v3_activate_passthrough_pt(core) == -1) {
+       PrintError("Failed to activate passthrough page tables\n");
+       return -1;
+      }
     }
-
-    return 0;
+  }
+  
+  return 0;
 }
 #endif