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.


Cleanup based on cppcheck pass (Core)
[palacios.git] / palacios / src / palacios / vmm_checkpoint.c
index d96cbee..a67560e 100644 (file)
@@ -260,7 +260,7 @@ int v3_chkpt_close_ctx(struct v3_chkpt_ctx * ctx) {
 
 
 int v3_chkpt_save(struct v3_chkpt_ctx * ctx, char * tag, uint64_t len, void * buf) {
-    struct v3_chkpt * chkpt = ctx->chkpt;    
+    struct v3_chkpt * chkpt;
     int rc;
 
     if (!ctx) { 
@@ -268,6 +268,8 @@ int v3_chkpt_save(struct v3_chkpt_ctx * ctx, char * tag, uint64_t len, void * bu
       return -1;
     }
 
+    chkpt = ctx->chkpt;    
+
     if (chkpt->current_ctx != ctx) { 
       PrintError(VM_NONE, VCORE_NONE, "Attempt to save on context that is not the current context for the store\n");
       return -1;
@@ -285,13 +287,15 @@ int v3_chkpt_save(struct v3_chkpt_ctx * ctx, char * tag, uint64_t len, void * bu
 
 
 int v3_chkpt_load(struct v3_chkpt_ctx * ctx, char * tag, uint64_t len, void * buf) {
-    struct v3_chkpt * chkpt = ctx->chkpt;    
+    struct v3_chkpt * chkpt;    
     int rc;
 
     if (!ctx) { 
       PrintError(VM_NONE, VCORE_NONE, "Attempt to load tag %s from null context\n",tag);
       return -1;
     }
+
+    chkpt = ctx->chkpt;    
     
     if (chkpt->current_ctx != ctx) { 
       PrintError(VM_NONE, VCORE_NONE, "Attempt to load from context that is not the current context for the store\n");
@@ -490,7 +494,7 @@ static struct mem_migration_state *start_page_tracking(struct v3_vm_info *vm)
        v3_invalidate_shadow_pts(&(vm->cores[i]));
       }
     } else if (vm->cores[0].shdw_pg_mode==NESTED_PAGING) { 
-      //v3_register_nested_paging_event_callback(vm,nested_paging_callback,m);
+       //v3_register_nested_paging_event_callback(vm,nested_paging_callback,m);
       
       for (i=0;i<vm->num_cores;i++) {
        //v3_invalidate_nested_addr_range(&(vm->cores[i]),0,vm->mem_size-1);
@@ -784,6 +788,15 @@ static int load_core(struct guest_info * info, struct v3_chkpt * chkpt, v3_chkpt
     // Run state is needed to determine when AP cores need
     // to be immediately run after resume
     V3_CHKPT_LOAD(ctx,"run_state",info->core_run_state,loadfailout);
+    V3_CHKPT_LOAD(ctx,"cpu_mode",info->cpu_mode,loadfailout);
+    V3_CHKPT_LOAD(ctx,"mem_mode",info->mem_mode,loadfailout);
+
+    V3_CHKPT_LOAD(ctx,"CPL",info->cpl,loadfailout);
+
+    if (info->cpl != info->segments.ss.dpl) { 
+       V3_Print(info->vm_info,info,"Strange, CPL=%d but ss.dpl=%d on core save\n",info->cpl,info->segments.ss.dpl);
+    }
+
 
     V3_CHKPT_LOAD(ctx, "RIP", info->rip, loadfailout);
     
@@ -839,7 +852,11 @@ static int load_core(struct guest_info * info, struct v3_chkpt * chkpt, v3_chkpt
     V3_CHKPT_LOAD(ctx, "GDTR", info->segments.gdtr, loadfailout);
     V3_CHKPT_LOAD(ctx, "IDTR", info->segments.idtr, loadfailout);
     V3_CHKPT_LOAD(ctx, "TR", info->segments.tr, loadfailout);
-    
+
+    if (info->cpl != info->segments.ss.dpl) { 
+       V3_Print(info->vm_info,info,"Strange, CPL=%d but ss.dpl=%d on core load\n",info->cpl,info->segments.ss.dpl);
+    }
+
     // several MSRs...
     V3_CHKPT_LOAD(ctx, "STAR", info->msrs.star, loadfailout);
     V3_CHKPT_LOAD(ctx, "LSTAR", info->msrs.lstar, loadfailout);
@@ -971,9 +988,13 @@ static int save_core(struct guest_info * info, struct v3_chkpt * chkpt, v3_chkpt
     }
 
     V3_CHKPT_SAVE(ctx,"run_state",info->core_run_state,savefailout);
+    V3_CHKPT_SAVE(ctx,"cpu_mode",info->cpu_mode,savefailout);
+    V3_CHKPT_SAVE(ctx,"mem_mode",info->mem_mode,savefailout);
+    
+    V3_CHKPT_SAVE(ctx,"CPL",info->cpl,savefailout);
 
     V3_CHKPT_SAVE(ctx, "RIP", info->rip, savefailout);
-    
+
     // GPRs
     V3_CHKPT_SAVE(ctx,"RDI",info->vm_regs.rdi, savefailout); 
     V3_CHKPT_SAVE(ctx,"RSI",info->vm_regs.rsi, savefailout); 
@@ -1258,7 +1279,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;