X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fpalacios%2Fsvm.c;h=2295912b188ea5332d98d3f3703047553c3dec7a;hb=c5dc4eb6184d792c87f8d17bfec558a1316718ce;hp=793f2d0b1f48cafea71aa7acf12bea313ace569e;hpb=921772c23185aa48406a390c58546ee463f49dc4;p=palacios.git diff --git a/palacios/src/palacios/svm.c b/palacios/src/palacios/svm.c index 793f2d0..2295912 100644 --- a/palacios/src/palacios/svm.c +++ b/palacios/src/palacios/svm.c @@ -87,7 +87,6 @@ static void Init_VMCB_BIOS(vmcb_t * vmcb, struct guest_info * core) { ctrl_area->svm_instrs.STGI = 1; ctrl_area->svm_instrs.CLGI = 1; ctrl_area->svm_instrs.SKINIT = 1; - ctrl_area->svm_instrs.RDTSCP = 1; ctrl_area->svm_instrs.ICEBP = 1; ctrl_area->svm_instrs.WBINVD = 1; ctrl_area->svm_instrs.MONITOR = 1; @@ -99,8 +98,8 @@ static void Init_VMCB_BIOS(vmcb_t * vmcb, struct guest_info * core) { ctrl_area->instrs.HLT = 1; #ifdef CONFIG_TIME_VIRTUALIZE_TSC - ctrl_area->instrs.rdtsc = 1; - ctrl_area->svm_instrs.rdtscp = 1; + ctrl_area->instrs.RDTSC = 1; + ctrl_area->svm_instrs.RDTSCP = 1; #endif // guest_state->cr0 = 0x00000001; // PE @@ -428,6 +427,8 @@ int v3_svm_enter(struct guest_info * info) { vmcb_saved_state_t * guest_state = GET_VMCB_SAVE_STATE_AREA((vmcb_t*)(info->vmm_data)); addr_t exit_code = 0, exit_info1 = 0, exit_info2 = 0; + v3_adjust_time(info); + // Conditionally yield the CPU if the timeslice has expired v3_yield_cond(info); @@ -479,11 +480,6 @@ int v3_svm_enter(struct guest_info * info) { #endif v3_update_timers(info); - - /* If this guest is frequency-lagged behind host time, wait - * for the appropriate host time before resuming the guest. */ - v3_adjust_time(info); - guest_ctrl->TSC_OFFSET = v3_tsc_host_offset(&info->time_state); //V3_Print("Calling v3_svm_launch\n"); @@ -577,7 +573,7 @@ int v3_start_svm_guest(struct guest_info * info) { PrintDebug("SVM core %u: I am starting at CS=0x%x (base=0x%p, limit=0x%x), RIP=0x%p\n", info->cpu_id, info->segments.cs.selector, (void *)(info->segments.cs.base), - info->segments.cs.limit,(void *)(info->rip)); + info->segments.cs.limit, (void *)(info->rip)); @@ -587,6 +583,12 @@ int v3_start_svm_guest(struct guest_info * info) { v3_start_time(info); while (1) { + + if (info->vm_info->run_state == VM_STOPPED) { + info->core_run_state = CORE_STOPPED; + break; + } + if (v3_svm_enter(info) == -1) { vmcb_ctrl_t * guest_ctrl = GET_VMCB_CTRL_AREA((vmcb_t*)(info->vmm_data)); addr_t host_addr; @@ -623,6 +625,13 @@ int v3_start_svm_guest(struct guest_info * info) { break; } + + + if (info->vm_info->run_state == VM_STOPPED) { + info->core_run_state = CORE_STOPPED; + break; + } + /* if ((info->num_exits % 5000) == 0) {