X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fpalacios%2Fvmx.c;h=2d75065cbc48b03381713c41e5b09033adfc9603;hb=5759b7f644b659d0dbde6f5a7e21a88514cbe32d;hp=3417767192ca41bcc1b403f18952535cc700c6ae;hpb=b1a5e7177b66fa319c896492d87f6276508bcbce;p=palacios.git diff --git a/palacios/src/palacios/vmx.c b/palacios/src/palacios/vmx.c index 3417767..2d75065 100644 --- a/palacios/src/palacios/vmx.c +++ b/palacios/src/palacios/vmx.c @@ -650,6 +650,10 @@ int v3_vmx_enter(struct guest_info * info) { // Conditionally yield the CPU if the timeslice has expired v3_yield_cond(info); + /* If this guest is frequency-lagged behind host time, wait + * for the appropriate host time before resuming the guest. */ + v3_adjust_time(info); + // v3_print_guest_state(info); // disable global interrupts for vm state transition @@ -674,10 +678,6 @@ int v3_vmx_enter(struct guest_info * info) { 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); - tsc_offset_high = (uint32_t)((v3_tsc_host_offset(&info->time_state) >> 32) & 0xffffffff); tsc_offset_low = (uint32_t)(v3_tsc_host_offset(&info->time_state) & 0xffffffff); check_vmcs_write(VMCS_TSC_OFFSET_HIGH, tsc_offset_high); @@ -778,12 +778,24 @@ int v3_start_vmx_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_vmx_enter(info) == -1) { v3_print_vmcs(); print_exit_log(info); return -1; } + + + if (info->vm_info->run_state == VM_STOPPED) { + info->core_run_state = CORE_STOPPED; + break; + } /* if ((info->num_exits % 5000) == 0) { V3_Print("VMX Exit number %d\n", (uint32_t)info->num_exits);