X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fpalacios%2Fvmx_handler.c;h=4066bf2b18a43c715dea822cf55c6d796a45d65b;hb=96fd46fc682a12bb09782319d3a09d7d71e8a39b;hp=91b56040d797487360b24d1f31c5bf9f1363161c;hpb=43347a912eba44cae132d01668d45743702f3148;p=palacios-OLD.git diff --git a/palacios/src/palacios/vmx_handler.c b/palacios/src/palacios/vmx_handler.c index 91b5604..4066bf2 100644 --- a/palacios/src/palacios/vmx_handler.c +++ b/palacios/src/palacios/vmx_handler.c @@ -32,16 +32,36 @@ #include #include +#ifndef CONFIG_DEBUG_VMX +#undef PrintDebug +#define PrintDebug(fmt, args...) +#endif + #ifdef CONFIG_TELEMETRY #include #endif +/* At this point the GPRs are already copied into the guest_info state */ +int v3_handle_atomic_vmx_exit(struct guest_info * info, struct vmx_exit_info * exit_info) { + struct vmx_data * vmx_info = (struct vmx_data *)(info->vmm_data); + + switch (exit_info->exit_reason) { + case VMEXIT_INTR_WINDOW: + // This is here because we touch the VMCS + vmcs_read(VMCS_PROC_CTRLS, &(vmx_info->pri_proc_ctrls.value)); + vmx_info->pri_proc_ctrls.int_wndw_exit = 0; + vmcs_write(VMCS_PROC_CTRLS, vmx_info->pri_proc_ctrls.value); +#ifdef CONFIG_DEBUG_INTERRUPTS + PrintDebug("Interrupts available again! (RIP=%llx)\n", info->rip); +#endif + break; + } + return 0; +} /* At this point the GPRs are already copied into the guest_info state */ int v3_handle_vmx_exit(struct guest_info * info, struct vmx_exit_info * exit_info) { - struct vmx_data * vmx_info = (struct vmx_data *)(info->vmm_data); - /* PrintError("Handling VMEXIT: %s (%u), %lu (0x%lx)\n", v3_vmx_exit_code_to_str(exit_info->exit_reason), @@ -94,6 +114,18 @@ int v3_handle_vmx_exit(struct guest_info * info, struct vmx_exit_info * exit_inf } break; + + case VMEXIT_RDTSC: +#ifdef CONFIG_DEBUG_TIME + PrintDebug("RDTSC\n"); +#endif + if (v3_handle_rdtsc(info) == -1) { + PrintError("Error Handling RDTSC instruction\n"); + return -1; + } + + break; + case VMEXIT_CPUID: if (v3_handle_cpuid(info) == -1) { PrintError("Error Handling CPUID instruction\n"); @@ -204,15 +236,8 @@ int v3_handle_vmx_exit(struct guest_info * info, struct vmx_exit_info * exit_inf // Interrupts are handled outside switch break; case VMEXIT_INTR_WINDOW: - - vmcs_read(VMCS_PROC_CTRLS, &(vmx_info->pri_proc_ctrls.value)); - vmx_info->pri_proc_ctrls.int_wndw_exit = 0; - vmcs_write(VMCS_PROC_CTRLS, vmx_info->pri_proc_ctrls.value); - -#ifdef CONFIG_DEBUG_INTERRUPTS - PrintDebug("Interrupts available again! (RIP=%llx)\n", info->rip); -#endif - + // This is handled in the atomic part of the vmx code, + // not in the generic (interruptable) vmx handler break; default: PrintError("Unhandled VMEXIT: %s (%u), %lu (0x%lx)\n",