Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


More updates getting basic version of time handling working.
[palacios-OLD.git] / palacios / src / palacios / vmx.c
index bb93054..f12e17f 100644 (file)
@@ -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,13 @@ 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", 
+
+    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;
@@ -692,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++;