VirtualBox

Changeset 43519 in vbox


Ignore:
Timestamp:
Oct 2, 2012 5:14:07 PM (12 years ago)
Author:
vboxsync
Message:

VMX: Convert pending VMX event to TRPM before going to recompiler to handle a page fault.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR0/HWVMXR0.cpp

    r43509 r43519  
    11501150}
    11511151
     1152/**
     1153 * Checks for pending VMX events and converts them to TRPM. Before we execute any instruction
     1154 * outside of VMX, any pending VMX event must be converted so that it can be delivered properly.
     1155 *
     1156 * @returns VBox status code.
     1157 * @param   pVCpu       Pointer to the VMCPU.
     1158 */
     1159static int hmR0VmxCheckPendingEvent(PVMCPU pVCpu)
     1160{
     1161    if (pVCpu->hm.s.Event.fPending)
     1162    {
     1163        TRPMEVENT   enmTrapType;
     1164
     1165        /* If a trap was already pending, we did something wrong! */
     1166        Assert((TRPMQueryTrap(pVCpu, NULL, NULL) == VERR_TRPM_NO_ACTIVE_TRAP));
     1167
     1168        /*
     1169         * Clear the pending event and move it over to TRPM for the rest
     1170         * of the world to see.
     1171         */
     1172        pVCpu->hm.s.Event.fPending = false;
     1173        switch (VMX_EXIT_INTERRUPTION_INFO_TYPE(pVCpu->hm.s.Event.intInfo))
     1174        {
     1175        case VMX_EXIT_INTERRUPTION_INFO_TYPE_EXT:
     1176        case VMX_EXIT_INTERRUPTION_INFO_TYPE_NMI:
     1177            enmTrapType = TRPM_HARDWARE_INT;
     1178            break;
     1179        case VMX_EXIT_INTERRUPTION_INFO_TYPE_SW:
     1180        case VMX_EXIT_INTERRUPTION_INFO_TYPE_SWEXCPT:
     1181        case VMX_EXIT_INTERRUPTION_INFO_TYPE_DBEXCPT:
     1182            enmTrapType = TRPM_SOFTWARE_INT;
     1183            break;
     1184        case VMX_EXIT_INTERRUPTION_INFO_TYPE_HWEXCPT:
     1185            enmTrapType = TRPM_TRAP;
     1186            break;
     1187        default:
     1188            enmTrapType = TRPM_32BIT_HACK;  /* Can't get here. */
     1189            AssertFailed();
     1190        }
     1191        TRPMAssertTrap(pVCpu, VMX_EXIT_INTERRUPTION_INFO_VECTOR(pVCpu->hm.s.Event.intInfo), enmTrapType);
     1192        if (VMX_EXIT_INTERRUPTION_INFO_ERROR_CODE_IS_VALID(pVCpu->hm.s.Event.intInfo))
     1193            TRPMSetErrorCode(pVCpu, pVCpu->hm.s.Event.errCode);
     1194        //@todo: Is there any situation where we need to call TRPMSetFaultAddress()?
     1195    }
     1196    return VINF_SUCCESS;
     1197}
    11521198
    11531199/**
     
    35523598                STAM_COUNTER_INC(&pVCpu->hm.s.StatExitShadowPFEM);
    35533599                TRPMResetTrap(pVCpu);
     3600
     3601                /* If event delivery caused the #PF (shadow or not), tell TRPM. */
     3602                hmR0VmxCheckPendingEvent(pVCpu);
    35543603                break;
    35553604            }
     
    46794728            Log(("VMX_EXIT_TASK_SWITCH: reassert trap %d\n", VMX_EXIT_INTERRUPTION_INFO_VECTOR(pVCpu->hm.s.Event.intInfo)));
    46804729            Assert(!VMX_EXIT_INTERRUPTION_INFO_ERROR_CODE_IS_VALID(pVCpu->hm.s.Event.intInfo));
     4730            //@todo: Why do we assume this had to be a hardware interrupt? What about software interrupts or exceptions?
    46814731            rc2 = TRPMAssertTrap(pVCpu, VMX_EXIT_INTERRUPTION_INFO_VECTOR(pVCpu->hm.s.Event.intInfo), TRPM_HARDWARE_INT);
    46824732            AssertRC(rc2);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette