X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fpalacios%2Fvmx.c;h=ef0f614d23c2eeec292a4fd747d3d3231d9ec24f;hb=e02cc15e36e8f5d7ee66390986351748dd9a16a1;hp=f71df0a7bc23b3a7c2435f559d55525e5ffd9e48;hpb=d54fc24e6cfb62cc2fedfb63d3ae68ff636e3a01;p=palacios.git diff --git a/palacios/src/palacios/vmx.c b/palacios/src/palacios/vmx.c index f71df0a..ef0f614 100644 --- a/palacios/src/palacios/vmx.c +++ b/palacios/src/palacios/vmx.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -662,11 +663,11 @@ 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. */ + // Perform any additional yielding needed for time adjustment v3_adjust_time(info); - // v3_print_guest_state(info); + // Update timer devices prior to entering VM. + v3_update_timers(info); // disable global interrupts for vm state transition v3_disable_ints(); @@ -688,7 +689,8 @@ int v3_vmx_enter(struct guest_info * info) { vmcs_write(VMCS_GUEST_CR3, guest_cr3); } - v3_update_timers(info); + // Perform last-minute time bookkeeping prior to entering the VM + v3_time_enter_vm(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); @@ -713,6 +715,9 @@ int v3_vmx_enter(struct guest_info * info) { return -1; } + // Immediate exit from VM time bookkeeping + v3_time_exit_vm(info); + info->num_exits++; /* Update guest state */