X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=blobdiff_plain;f=palacios%2Fsrc%2Fpalacios%2Fsvm.c;h=e62f5a7629ecd28a9019a8bdf12241d3b1bfdff0;hp=7889c11b510234554f6783c1e6f764fb9af03500;hb=d8fc6aa4bc2a5d9cec50923e9d2bd30f867dd50a;hpb=639fdba00d36b2a60fad3d28703459354cf8744f diff --git a/palacios/src/palacios/svm.c b/palacios/src/palacios/svm.c index 7889c11..e62f5a7 100644 --- a/palacios/src/palacios/svm.c +++ b/palacios/src/palacios/svm.c @@ -132,29 +132,33 @@ int init_svm_guest(struct guest_info *info) { // can we start a kernel thread here... int start_svm_guest(struct guest_info *info) { - - + vmcb_saved_state_t * guest_state = GET_VMCB_SAVE_STATE_AREA((vmcb_t*)(info->vmm_data)); + vmcb_ctrl_t * guest_ctrl = GET_VMCB_CTRL_AREA((vmcb_t*)(info->vmm_data)); PrintDebug("Launching SVM VM (vmcb=%x)\n", info->vmm_data); //PrintDebugVMCB((vmcb_t*)(info->vmm_data)); while (1) { + ullong_t tmp_tsc; CLGI(); + rdtscll(info->time_state.cached_host_tsc); + guest_ctrl->TSC_OFFSET = info->time_state.guest_tsc - info->time_state.cached_host_tsc; //PrintDebug("SVM Launch Args (vmcb=%x), (info=%x), (vm_regs=%x)\n", info->vmm_data, &(info->vm_regs)); //PrintDebug("Launching to RIP: %x\n", info->rip); safe_svm_launch((vmcb_t*)(info->vmm_data), &(info->vm_regs)); //launch_svm((vmcb_t*)(info->vmm_data)); //PrintDebug("SVM Returned\n"); - + rdtscll(tmp_tsc); + info->time_state.guest_tsc += tmp_tsc - info->time_state.cached_host_tsc; STGI(); if (handle_svm_exit(info) != 0) { - vmcb_saved_state_t * guest_state = GET_VMCB_SAVE_STATE_AREA((vmcb_t*)(info->vmm_data)); + addr_t host_addr; addr_t linear_addr = 0;