X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fpalacios%2Fsvm_handler.c;h=6d38fb7cc38bbf79f05d22bbc3b6448056ff5558;hb=a7dc3322984b3c76fe990de506418e180ec1b0de;hp=aaed6c6eed6d330e69de71b1769a1d5432dcd36c;hpb=04e582f922cfa2e9fb7304e1987a3d2298c43868;p=palacios.git diff --git a/palacios/src/palacios/svm_handler.c b/palacios/src/palacios/svm_handler.c index aaed6c6..6d38fb7 100644 --- a/palacios/src/palacios/svm_handler.c +++ b/palacios/src/palacios/svm_handler.c @@ -32,7 +32,7 @@ #include #include #include - +#include @@ -72,11 +72,13 @@ int v3_handle_svm_exit(struct guest_info * info) { if ((info->intr_state.irq_pending == 1) && (guest_ctrl->guest_ctrl.V_IRQ == 0)) { - // Interrupt was taken in the guest + #ifdef DEBUG_INTERRUPTS PrintDebug("Interrupt %d taken by guest\n", info->intr_state.irq_vector); #endif if (!guest_ctrl->exit_int_info.valid) { + info->intr_state.irq_pending = 0; + // PrintDebug("Injected Interrupt %d\n", info->intr_state.irq_vector); v3_injecting_intr(info, info->intr_state.irq_vector, EXTERNAL_IRQ); } else { #ifdef DEBUG_INTERRUPTS @@ -85,14 +87,12 @@ int v3_handle_svm_exit(struct guest_info * info) { } } - info->intr_state.irq_pending = 0; + // Disable printing io exits due to bochs debug messages //if (!((exit_code == VMEXIT_IOIO) && ((ushort_t)(guest_ctrl->exit_info1 >> 16) == 0x402))) { - - // PrintDebug("SVM Returned: Exit Code: 0x%x \t\t(tsc=%ul)\n",exit_code, (uint_t)info->time_state.guest_tsc); if ((0) && (exit_code <= VMEXIT_EXCP14)) { uchar_t instr[32]; @@ -139,7 +139,7 @@ int v3_handle_svm_exit(struct guest_info * info) { switch (exit_code) { case VMEXIT_IOIO: { struct svm_io_info * io_info = (struct svm_io_info *)&(guest_ctrl->exit_info1); - + if (io_info->type == 0) { if (io_info->str) { @@ -247,12 +247,20 @@ int v3_handle_svm_exit(struct guest_info * info) { } break; } - case VMEXIT_NPF: + case VMEXIT_NPF: { + addr_t fault_addr = guest_ctrl->exit_info2; + pf_error_t * error_code = (pf_error_t *)&(guest_ctrl->exit_info1); - PrintError("Currently unhandled Nested Page Fault\n"); - return -1; - + if (info->shdw_pg_mode == NESTED_PAGING) { + if (v3_handle_nested_pagefault(info, fault_addr, *error_code) == -1) { + return -1; + } + } else { + PrintError("Currently unhandled Nested Page Fault\n"); + return -1; + } break; + } case VMEXIT_INVLPG: if (info->shdw_pg_mode == SHADOW_PAGING) { #ifdef DEBUG_SHADOW_PAGING @@ -352,8 +360,14 @@ int v3_handle_svm_exit(struct guest_info * info) { // Update the low level state + if (info->intr_state.irq_pending == 1) { + + guest_ctrl->guest_ctrl.V_IRQ = 1; + guest_ctrl->guest_ctrl.V_INTR_VECTOR = info->intr_state.irq_vector; + guest_ctrl->guest_ctrl.V_IGN_TPR = 1; + guest_ctrl->guest_ctrl.V_INTR_PRIO = 0xf; - if (v3_excp_pending(info)) { + } else if (v3_excp_pending(info)) { uint_t excp = v3_get_excp_number(info); guest_ctrl->EVENTINJ.type = SVM_INJECTION_EXCEPTION;