X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fpalacios%2Fvmx_handler.c;h=432b571daaa705b7fc455cafc4742244a54fef29;hb=b91f96a59e8709a444eb345b0f2b255e9ed9b877;hp=44d32829266288ab18f43d1a504fccde5351a940;hpb=fcc9962fe5d3b877f8f25de8745d0d4d1eaf394e;p=palacios.git diff --git a/palacios/src/palacios/vmx_handler.c b/palacios/src/palacios/vmx_handler.c index 44d3282..432b571 100644 --- a/palacios/src/palacios/vmx_handler.c +++ b/palacios/src/palacios/vmx_handler.c @@ -33,12 +33,12 @@ #include #include -#ifndef CONFIG_DEBUG_VMX +#ifndef V3_CONFIG_DEBUG_VMX #undef PrintDebug #define PrintDebug(fmt, args...) #endif -#ifdef CONFIG_TELEMETRY +#ifdef V3_CONFIG_TELEMETRY #include #endif @@ -75,7 +75,8 @@ int v3_handle_vmx_exit(struct guest_info * info, struct vmx_exit_info * exit_inf } -#ifdef CONFIG_TELEMETRY + +#ifdef V3_CONFIG_TELEMETRY if (info->vm_info->enable_telemetry) { v3_telemetry_start_exit(info); } @@ -88,7 +89,7 @@ int v3_handle_vmx_exit(struct guest_info * info, struct vmx_exit_info * exit_inf // JRL: Change "0x0e" to a macro value if ((uint8_t)exit_info->int_info == 14) { -#ifdef CONFIG_DEBUG_SHADOW_PAGING +#ifdef V3_CONFIG_DEBUG_SHADOW_PAGING PrintDebug("Page Fault at %p error_code=%x\n", (void *)exit_info->exit_qual, *(uint32_t *)&error_code); #endif @@ -102,6 +103,9 @@ int v3_handle_vmx_exit(struct guest_info * info, struct vmx_exit_info * exit_inf PrintError("Page fault in unimplemented paging mode\n"); return -1; } + } else if ((uint8_t)exit_info->int_info == 2) { + // NMI. Don't do anything + V3_Print("NMI Exception Received\n"); } else { PrintError("Unknown exception: 0x%x\n", (uint8_t)exit_info->int_info); v3_print_GPRs(info); @@ -131,7 +135,7 @@ int v3_handle_vmx_exit(struct guest_info * info, struct vmx_exit_info * exit_inf break; case VMEXIT_RDTSC: -#ifdef CONFIG_DEBUG_TIME +#ifdef V3_CONFIG_DEBUG_TIME PrintDebug("RDTSC\n"); #endif if (v3_handle_rdtsc(info) == -1) { @@ -224,12 +228,22 @@ int v3_handle_vmx_exit(struct guest_info * info, struct vmx_exit_info * exit_inf return -1; } break; + case 4: + //PrintDebug("Handling CR4 Access\n"); + if (v3_vmx_handle_cr4_access(info, cr_qual) == -1) { + PrintError("Error in CR4 access handler\n"); + return -1; + } + break; default: PrintError("Unhandled CR access: %d\n", cr_qual->cr_id); return -1; } - info->rip += exit_info->instr_len; + // TODO: move RIP increment into all of the above individual CR + // handlers, not just v3_vmx_handle_cr4_access() + if (cr_qual->cr_id != 4) + info->rip += exit_info->instr_len; break; } @@ -257,7 +271,10 @@ int v3_handle_vmx_exit(struct guest_info * info, struct vmx_exit_info * exit_inf // This is handled in the atomic part of the vmx code, // not in the generic (interruptable) vmx handler break; - + case VMEXIT_EXPIRED_PREEMPT_TIMER: + V3_Print("VMX Preempt Timer Expired.\n"); + // This just forces an exit and is handled outside the switch + break; default: PrintError("Unhandled VMEXIT: %s (%u), %lu (0x%lx)\n", @@ -268,7 +285,7 @@ int v3_handle_vmx_exit(struct guest_info * info, struct vmx_exit_info * exit_inf } -#ifdef CONFIG_TELEMETRY +#ifdef V3_CONFIG_TELEMETRY if (info->vm_info->enable_telemetry) { v3_telemetry_end_exit(info, exit_info->exit_reason); }