X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fpalacios%2Fvmm_checkpoint.c;h=3258779a7d452ccc9b433171c67879edf0049be4;hb=e3f45cda75462948e8d2ad89a6167fbecc8d13f5;hp=8f5e5ac6711c47906a9e87255820cda1bd905daf;hpb=a9a6c3664c8fdbdb9841a55d1a2fca7f4fa8f5de;p=palacios.git diff --git a/palacios/src/palacios/vmm_checkpoint.c b/palacios/src/palacios/vmm_checkpoint.c index 8f5e5ac..3258779 100644 --- a/palacios/src/palacios/vmm_checkpoint.c +++ b/palacios/src/palacios/vmm_checkpoint.c @@ -26,6 +26,7 @@ #include #include #include +#include #include @@ -186,9 +187,7 @@ int v3_chkpt_close_ctx(struct v3_chkpt_ctx * ctx) { } -/* Temporary */ -#define V3_CHKPT_STD_SAVE(ctx,x) v3_chkpt_save(ctx,#x,sizeof(x),&(x)) -#define V3_CHKPT_STD_LOAD(ctx,x) v3_chkpt_load(ctx,#x,sizeof(x),&(x)) + int v3_chkpt_save(struct v3_chkpt_ctx * ctx, char * tag, uint64_t len, void * buf) { @@ -312,6 +311,8 @@ static int load_core(struct guest_info * info, struct v3_chkpt * chkpt) { ctx = v3_chkpt_open_ctx(chkpt, NULL, key_name); + v3_chkpt_load_64(ctx, "RIP", &(info->rip)); + V3_CHKPT_STD_LOAD(ctx, info->vm_regs); V3_CHKPT_STD_LOAD(ctx, info->ctrl_regs.cr0); @@ -333,6 +334,20 @@ static int load_core(struct guest_info * info, struct v3_chkpt * chkpt) { info->cpu_mode = v3_get_vm_cpu_mode(info); info->mem_mode = v3_get_vm_mem_mode(info); + if (info->shdw_pg_mode == SHADOW_PAGING) { + if (v3_get_vm_mem_mode(info) == VIRTUAL_MEM) { + if (v3_activate_shadow_pt(info) == -1) { + PrintError("Failed to activate shadow page tables\n"); + return -1; + } + } else { + if (v3_activate_passthrough_pt(info) == -1) { + PrintError("Failed to activate passthrough page tables\n"); + return -1; + } + } + } + switch (cpu_type) { case V3_SVM_CPU: @@ -373,6 +388,8 @@ static int load_core(struct guest_info * info, struct v3_chkpt * chkpt) { return -1; } + v3_print_guest_state(info); + return 0; } @@ -384,11 +401,15 @@ static int save_core(struct guest_info * info, struct v3_chkpt * chkpt) { memset(key_name, 0, 16); + v3_print_guest_state(info); + snprintf(key_name, 16, "guest_info%d", info->vcpu_id); ctx = v3_chkpt_open_ctx(chkpt, NULL, key_name); + v3_chkpt_save_64(ctx, "RIP", &(info->rip)); + V3_CHKPT_STD_SAVE(ctx, info->vm_regs); V3_CHKPT_STD_SAVE(ctx, info->ctrl_regs.cr0); @@ -477,12 +498,12 @@ int v3_chkpt_save_vm(struct v3_vm_info * vm, char * store, char * url) { goto out; } - /* - if ((ret = v3_chkpt_save_dev(vm)) == -1) { + + if ((ret = v3_save_vm_devices(vm, chkpt)) == -1) { PrintError("Unable to save devices\n"); goto out; } - */ + if ((ret = save_header(vm, chkpt)) == -1) { PrintError("Unable to save header\n"); @@ -490,12 +511,11 @@ int v3_chkpt_save_vm(struct v3_vm_info * vm, char * store, char * url) { } for (i = 0; i < vm->num_cores; i++){ - if ((ret = save_core(&(vm->cores[i]), chkpt)) == -1) { PrintError("chkpt of core %d failed\n", i); goto out; } - } + } out: @@ -533,12 +553,11 @@ int v3_chkpt_load_vm(struct v3_vm_info * vm, char * store, char * url) { } - /* Don't handle devices just yet - if (v3_chkpt_load_dev(vm) == -1) { + if ((ret = v3_load_vm_devices(vm, chkpt)) == -1) { PrintError("Unable to load devies\n"); + goto out; } - */ if ((ret = load_header(vm, chkpt)) == -1) { PrintError("Unable to load header\n"); @@ -553,7 +572,7 @@ int v3_chkpt_load_vm(struct v3_vm_info * vm, char * store, char * url) { } } - out: + out: /* Resume the guest if it was running and we didn't just trash the state*/ if (vm->run_state == VM_RUNNING) {