X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fpalacios%2Fvmx.c;h=f12e17fcb9135a1301939625862483b953279f0e;hb=cd3edffa0e451af761b9dcee021ca06ebb301345;hp=a297be2b7d4f6f1d254e58faeff5ced11bc9e5f1;hpb=ef944e47f418cfbf344757e3fbab5e40927966fe;p=palacios-OLD.git diff --git a/palacios/src/palacios/vmx.c b/palacios/src/palacios/vmx.c index a297be2..f12e17f 100644 --- a/palacios/src/palacios/vmx.c +++ b/palacios/src/palacios/vmx.c @@ -225,6 +225,10 @@ static int init_vmcs_bios(struct guest_info * info, struct vmx_data * vmx_state) vmx_state->pri_proc_ctrls.invlpg_exit = 1; vmx_state->pri_proc_ctrls.use_msr_bitmap = 1; vmx_state->pri_proc_ctrls.pause_exit = 1; +#ifdef CONFIG_TIME_VIRTUALIZE_TSC + vmx_state->pri_proc_ctrls.tsc_offset = 1; + vmx_state->pri_proc_ctrls.rdtsc_exit = 1; +#endif vmx_ret |= check_vmcs_write(VMCS_IO_BITMAP_A_ADDR, (addr_t)V3_PAddr(info->vm_info->io_map.arch_data)); vmx_ret |= check_vmcs_write(VMCS_IO_BITMAP_B_ADDR, @@ -665,14 +669,14 @@ int v3_vmx_enter(struct guest_info * info) { } v3_update_timers(info); - v3_resume_time(info); - tsc_offset_high = - (uint32_t)((info->time_state.host_offset >> 32) & 0xffffffff); - tsc_offset_low = (uint32_t)(info->time_state.host_offset & 0xffffffff); + 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); check_vmcs_write(VMCS_TSC_OFFSET, tsc_offset_low); - + + PrintDebug("Stored 0x%x_%x into vmcs TSC offset.\n", + tsc_offset_high, tsc_offset_low); if (info->vm_info->run_state == VM_STOPPED) { info->vm_info->run_state = VM_RUNNING; ret = v3_vmx_launch(&(info->vm_regs), info, &(info->ctrl_regs)); @@ -691,10 +695,9 @@ int v3_vmx_enter(struct guest_info * info) { return -1; } - v3_pause_time(info); -#ifdef OPTION_TIME_MASK_OVERHEAD - v3_offset_time(info, -VMX_ENTRY_OVERHEAD); -#endif + /* If this guest is frequency-lagged behind host time, wait + * for the appropriate host time. */ + v3_adjust_time(info); info->num_exits++;