VirtualBox

Changeset 45498 in vbox for trunk/src


Ignore:
Timestamp:
Apr 11, 2013 8:46:47 PM (12 years ago)
Author:
vboxsync
Message:

VMMR0/HMVMXR0: leaner, part 2.

File:
1 edited

Legend:

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

    r45496 r45498  
    201201*******************************************************************************/
    202202static void               hmR0VmxFlushVpid(PVM pVM, PVMCPU pVCpu, VMX_FLUSH_VPID enmFlush, RTGCPTR GCPtr);
    203 static int                hmR0VmxInjectEventVmcs(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, uint64_t u64IntrInfo,
     203static int                hmR0VmxInjectEventVmcs(PVMCPU pVCpu, PCPUMCTX pMixedCtx, uint64_t u64IntrInfo,
    204204                                                 uint32_t cbInstr, uint32_t u32ErrCode);
    205205#if HC_ARCH_BITS == 32 && !defined(VBOX_WITH_HYBRID_32BIT_KERNEL)
     
    207207#endif
    208208#if 0
    209 DECLINLINE(int)           hmR0VmxHandleExit(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient,
    210                                             unsigned rcReason);
     209DECLINLINE(int)           hmR0VmxHandleExit(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient, unsigned rcReason);
    211210#endif
    212211
    213 static DECLCALLBACK(int)  hmR0VmxExitXcptNmi(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
    214 static DECLCALLBACK(int)  hmR0VmxExitExtInt(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
    215 static DECLCALLBACK(int)  hmR0VmxExitTripleFault(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
    216 static DECLCALLBACK(int)  hmR0VmxExitInitSignal(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
    217 static DECLCALLBACK(int)  hmR0VmxExitSipi(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
    218 static DECLCALLBACK(int)  hmR0VmxExitIoSmi(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
    219 static DECLCALLBACK(int)  hmR0VmxExitSmi(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
    220 static DECLCALLBACK(int)  hmR0VmxExitIntWindow(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
    221 static DECLCALLBACK(int)  hmR0VmxExitNmiWindow(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
    222 static DECLCALLBACK(int)  hmR0VmxExitTaskSwitch(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
    223 static DECLCALLBACK(int)  hmR0VmxExitCpuid(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
    224 static DECLCALLBACK(int)  hmR0VmxExitGetsec(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
    225 static DECLCALLBACK(int)  hmR0VmxExitHlt(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
    226 static DECLCALLBACK(int)  hmR0VmxExitInvd(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
    227 static DECLCALLBACK(int)  hmR0VmxExitInvlpg(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
    228 static DECLCALLBACK(int)  hmR0VmxExitRdpmc(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
    229 static DECLCALLBACK(int)  hmR0VmxExitRdtsc(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
    230 static DECLCALLBACK(int)  hmR0VmxExitRsm(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
    231 static DECLCALLBACK(int)  hmR0VmxExitInjectXcptUD(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
    232 static DECLCALLBACK(int)  hmR0VmxExitMovCRx(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
    233 static DECLCALLBACK(int)  hmR0VmxExitMovDRx(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
    234 static DECLCALLBACK(int)  hmR0VmxExitIoInstr(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
    235 static DECLCALLBACK(int)  hmR0VmxExitRdmsr(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
    236 static DECLCALLBACK(int)  hmR0VmxExitWrmsr(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
    237 static DECLCALLBACK(int)  hmR0VmxExitErrInvalidGuestState(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
    238 static DECLCALLBACK(int)  hmR0VmxExitErrMsrLoad(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
    239 static DECLCALLBACK(int)  hmR0VmxExitErrUndefined(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
    240 static DECLCALLBACK(int)  hmR0VmxExitMwait(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
    241 static DECLCALLBACK(int)  hmR0VmxExitMtf(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
    242 static DECLCALLBACK(int)  hmR0VmxExitMonitor(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
    243 static DECLCALLBACK(int)  hmR0VmxExitPause(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
    244 static DECLCALLBACK(int)  hmR0VmxExitErrMachineCheck(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
    245 static DECLCALLBACK(int)  hmR0VmxExitTprBelowThreshold(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
    246 static DECLCALLBACK(int)  hmR0VmxExitApicAccess(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
    247 static DECLCALLBACK(int)  hmR0VmxExitXdtrAccess(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
    248 static DECLCALLBACK(int)  hmR0VmxExitXdtrAccess(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
    249 static DECLCALLBACK(int)  hmR0VmxExitEptViolation(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
    250 static DECLCALLBACK(int)  hmR0VmxExitEptMisconfig(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
    251 static DECLCALLBACK(int)  hmR0VmxExitRdtscp(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
    252 static DECLCALLBACK(int)  hmR0VmxExitPreemptTimer(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
    253 static DECLCALLBACK(int)  hmR0VmxExitWbinvd(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
    254 static DECLCALLBACK(int)  hmR0VmxExitXsetbv(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
    255 static DECLCALLBACK(int)  hmR0VmxExitRdrand(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
    256 static DECLCALLBACK(int)  hmR0VmxExitInvpcid(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
    257 static DECLCALLBACK(int)  hmR0VmxExitXcptNM(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
    258 static DECLCALLBACK(int)  hmR0VmxExitXcptPF(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
    259 static DECLCALLBACK(int)  hmR0VmxExitXcptMF(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
    260 static DECLCALLBACK(int)  hmR0VmxExitXcptDB(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
    261 static DECLCALLBACK(int)  hmR0VmxExitXcptBP(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
    262 static DECLCALLBACK(int)  hmR0VmxExitXcptGP(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
    263 static DECLCALLBACK(int)  hmR0VmxExitXcptGeneric(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
     212static DECLCALLBACK(int)  hmR0VmxExitXcptNmi(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
     213static DECLCALLBACK(int)  hmR0VmxExitExtInt(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
     214static DECLCALLBACK(int)  hmR0VmxExitTripleFault(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
     215static DECLCALLBACK(int)  hmR0VmxExitInitSignal(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
     216static DECLCALLBACK(int)  hmR0VmxExitSipi(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
     217static DECLCALLBACK(int)  hmR0VmxExitIoSmi(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
     218static DECLCALLBACK(int)  hmR0VmxExitSmi(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
     219static DECLCALLBACK(int)  hmR0VmxExitIntWindow(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
     220static DECLCALLBACK(int)  hmR0VmxExitNmiWindow(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
     221static DECLCALLBACK(int)  hmR0VmxExitTaskSwitch(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
     222static DECLCALLBACK(int)  hmR0VmxExitCpuid(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
     223static DECLCALLBACK(int)  hmR0VmxExitGetsec(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
     224static DECLCALLBACK(int)  hmR0VmxExitHlt(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
     225static DECLCALLBACK(int)  hmR0VmxExitInvd(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
     226static DECLCALLBACK(int)  hmR0VmxExitInvlpg(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
     227static DECLCALLBACK(int)  hmR0VmxExitRdpmc(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
     228static DECLCALLBACK(int)  hmR0VmxExitRdtsc(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
     229static DECLCALLBACK(int)  hmR0VmxExitRsm(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
     230static DECLCALLBACK(int)  hmR0VmxExitInjectXcptUD(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
     231static DECLCALLBACK(int)  hmR0VmxExitMovCRx(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
     232static DECLCALLBACK(int)  hmR0VmxExitMovDRx(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
     233static DECLCALLBACK(int)  hmR0VmxExitIoInstr(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
     234static DECLCALLBACK(int)  hmR0VmxExitRdmsr(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
     235static DECLCALLBACK(int)  hmR0VmxExitWrmsr(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
     236static DECLCALLBACK(int)  hmR0VmxExitErrInvalidGuestState(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
     237static DECLCALLBACK(int)  hmR0VmxExitErrMsrLoad(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
     238static DECLCALLBACK(int)  hmR0VmxExitErrUndefined(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
     239static DECLCALLBACK(int)  hmR0VmxExitMwait(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
     240static DECLCALLBACK(int)  hmR0VmxExitMtf(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
     241static DECLCALLBACK(int)  hmR0VmxExitMonitor(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
     242static DECLCALLBACK(int)  hmR0VmxExitPause(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
     243static DECLCALLBACK(int)  hmR0VmxExitErrMachineCheck(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
     244static DECLCALLBACK(int)  hmR0VmxExitTprBelowThreshold(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
     245static DECLCALLBACK(int)  hmR0VmxExitApicAccess(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
     246static DECLCALLBACK(int)  hmR0VmxExitXdtrAccess(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
     247static DECLCALLBACK(int)  hmR0VmxExitXdtrAccess(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
     248static DECLCALLBACK(int)  hmR0VmxExitEptViolation(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
     249static DECLCALLBACK(int)  hmR0VmxExitEptMisconfig(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
     250static DECLCALLBACK(int)  hmR0VmxExitRdtscp(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
     251static DECLCALLBACK(int)  hmR0VmxExitPreemptTimer(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
     252static DECLCALLBACK(int)  hmR0VmxExitWbinvd(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
     253static DECLCALLBACK(int)  hmR0VmxExitXsetbv(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
     254static DECLCALLBACK(int)  hmR0VmxExitRdrand(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
     255static DECLCALLBACK(int)  hmR0VmxExitInvpcid(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
     256static DECLCALLBACK(int)  hmR0VmxExitXcptNM(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
     257static DECLCALLBACK(int)  hmR0VmxExitXcptPF(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
     258static DECLCALLBACK(int)  hmR0VmxExitXcptMF(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
     259static DECLCALLBACK(int)  hmR0VmxExitXcptDB(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
     260static DECLCALLBACK(int)  hmR0VmxExitXcptBP(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
     261static DECLCALLBACK(int)  hmR0VmxExitXcptGP(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
     262static DECLCALLBACK(int)  hmR0VmxExitXcptGeneric(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
    264263
    265264/*******************************************************************************
     
    271270 *
    272271 * @returns VBox status code.
    273  * @param   pVM             Pointer to the VM.
    274272 * @param   pVCpu           Pointer to the VMCPU.
    275273 * @param   pMixedCtx       Pointer to the guest-CPU context. The data may be
     
    278276 * @param   pVmxTransient   Pointer to the VMX-transient structure.
    279277 */
    280 typedef DECLCALLBACK(int) FNVMEXITHANDLER(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
     278typedef DECLCALLBACK(int) FNVMEXITHANDLER(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
    281279/** Pointer to VM-exit handler. */
    282280typedef FNVMEXITHANDLER *PFNVMEXITHANDLER;
     
    46234621 * @retval VINF_EM_RESET if we detected a triple-fault condition.
    46244622 *
    4625  * @param   pVM             Pointer to the VM.
    46264623 * @param   pVCpu           Pointer to the VMCPU.
    46274624 * @param   pMixedCtx       Pointer to the guest-CPU context. The data may be
     
    46324629 * @remarks No-long-jump zone!!!
    46334630 */
    4634 static int hmR0VmxCheckExitDueToEventDelivery(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
     4631static int hmR0VmxCheckExitDueToEventDelivery(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
    46354632{
    46364633    int rc = hmR0VmxReadIdtVectoringInfoVmcs(pVmxTransient);
     
    57605757
    57615758    STAM_COUNTER_INC(&pVCpu->hm.s.StatIntInject);
    5762     return hmR0VmxInjectEventVmcs(pVM, pVCpu, pMixedCtx, u32IntrInfo, 0 /* cbInstr */, uErrCode);
     5759    return hmR0VmxInjectEventVmcs(pVCpu, pMixedCtx, u32IntrInfo, 0 /* cbInstr */, uErrCode);
    57635760}
    57645761
     
    57835780    {
    57845781        Log(("Pending event\n"));
    5785         int rc = hmR0VmxInjectEventVmcs(pVM, pVCpu, pMixedCtx, pVCpu->hm.s.Event.u64IntrInfo, 0 /* cbInstr */,
     5782        int rc = hmR0VmxInjectEventVmcs(pVCpu, pMixedCtx, pVCpu->hm.s.Event.u64IntrInfo, 0 /* cbInstr */,
    57865783                                    pVCpu->hm.s.Event.u32ErrCode);
    57875784        AssertRCReturn(rc, rc);
     
    58015798        uIntrInfo |= (VMX_EXIT_INTERRUPTION_INFO_TYPE_NMI << VMX_EXIT_INTERRUPTION_INFO_TYPE_SHIFT);
    58025799        Log(("Injecting NMI\n"));
    5803         int rc = hmR0VmxInjectEventVmcs(pVM, pVCpu, pMixedCtx, uIntrInfo, 0 /* cbInstr */, 0 /* u32ErrCode */);
     5800        int rc = hmR0VmxInjectEventVmcs(pVCpu, pMixedCtx, uIntrInfo, 0 /* cbInstr */, 0 /* u32ErrCode */);
    58045801        AssertRCReturn(rc, rc);
    58055802        return rc;
     
    58685865 *
    58695866 * @returns VBox status code (informational status code included).
    5870  * @param   pVM             Pointer to the VM.
    58715867 * @param   pVCpu           Pointer to the VMCPU.
    58725868 * @param   pMixedCtx       Pointer to the guest-CPU context. The data may be
     
    58745870 *                          before using them.
    58755871 */
    5876 DECLINLINE(int) hmR0VmxInjectXcptUD(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx)
     5872DECLINLINE(int) hmR0VmxInjectXcptUD(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
    58775873{
    58785874    /* Refer Intel spec. 24.8.3 "VM-entry Controls for Event Injection" for the format of u32IntrInfo. */
    58795875    uint32_t u32IntrInfo = X86_XCPT_UD | (1 << VMX_EXIT_INTERRUPTION_INFO_VALID_SHIFT);
    58805876    STAM_COUNTER_INC(&pVCpu->hm.s.StatIntInject);
    5881     return hmR0VmxInjectEventVmcs(pVM, pVCpu, pMixedCtx, u32IntrInfo, 0 /* cbInstr */, 0 /* u32ErrCode */);
     5877    return hmR0VmxInjectEventVmcs(pVCpu, pMixedCtx, u32IntrInfo, 0 /* cbInstr */, 0 /* u32ErrCode */);
    58825878}
    58835879
     
    58875883 *
    58885884 * @returns VBox status code (informational status code included).
    5889  * @param   pVM             Pointer to the VM.
    58905885 * @param   pVCpu           Pointer to the VMCPU.
    58915886 * @param   pMixedCtx       Pointer to the guest-CPU context. The data may be
     
    58935888 *                          before using them.
    58945889 */
    5895 DECLINLINE(int) hmR0VmxInjectXcptDF(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx)
     5890DECLINLINE(int) hmR0VmxInjectXcptDF(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
    58965891{
    58975892    /* Inject the double-fault. */
     
    59005895    u32IntrInfo         |= VMX_EXIT_INTERRUPTION_INFO_ERROR_CODE_VALID;
    59015896    STAM_COUNTER_INC(&pVCpu->hm.s.StatIntInject);
    5902     return hmR0VmxInjectEventVmcs(pVM, pVCpu, pMixedCtx, u32IntrInfo, 0 /* cbInstr */, 0 /* u32ErrCode */);
     5897    return hmR0VmxInjectEventVmcs(pVCpu, pMixedCtx, u32IntrInfo, 0 /* cbInstr */, 0 /* u32ErrCode */);
    59035898}
    59045899
     
    59085903 *
    59095904 * @returns VBox status code (informational status code included).
    5910  * @param   pVM             Pointer to the VM.
    59115905 * @param   pVCpu           Pointer to the VMCPU.
    59125906 * @param   pMixedCtx       Pointer to the guest-CPU context. The data may be
     
    59145908 *                          before using them.
    59155909 */
    5916 DECLINLINE(int) hmR0VmxInjectXcptDB(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx)
     5910DECLINLINE(int) hmR0VmxInjectXcptDB(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
    59175911{
    59185912    /* Inject the debug-exception. */
     
    59205914    u32IntrInfo         |= (VMX_EXIT_INTERRUPTION_INFO_TYPE_HW_XCPT << VMX_EXIT_INTERRUPTION_INFO_TYPE_SHIFT);
    59215915    STAM_COUNTER_INC(&pVCpu->hm.s.StatIntInject);
    5922     return hmR0VmxInjectEventVmcs(pVM, pVCpu, pMixedCtx, u32IntrInfo, 0 /* cbInstr */, 0 /* u32ErrCode */);
     5916    return hmR0VmxInjectEventVmcs(pVCpu, pMixedCtx, u32IntrInfo, 0 /* cbInstr */, 0 /* u32ErrCode */);
    59235917}
    59245918
     
    59285922 *
    59295923 * @returns VBox status code (informational status code included).
    5930  * @param   pVM             Pointer to the VM.
    59315924 * @param   pVCpu           Pointer to the VMCPU.
    59325925 * @param   pMixedCtx       Pointer to the guest-CPU context. The data may be
     
    59365929 *                          stack.
    59375930 */
    5938 DECLINLINE(int) hmR0VmxInjectXcptOF(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, uint32_t cbInstr)
     5931DECLINLINE(int) hmR0VmxInjectXcptOF(PVMCPU pVCpu, PCPUMCTX pMixedCtx, uint32_t cbInstr)
    59395932{
    59405933    /* Inject the overflow exception. */
     
    59425935    u32IntrInfo         |= (VMX_EXIT_INTERRUPTION_INFO_TYPE_SW_INT << VMX_EXIT_INTERRUPTION_INFO_TYPE_SHIFT);
    59435936    STAM_COUNTER_INC(&pVCpu->hm.s.StatIntInject);
    5944     return hmR0VmxInjectEventVmcs(pVM, pVCpu, pMixedCtx, u32IntrInfo, cbInstr, 0 /* u32ErrCode */);
     5937    return hmR0VmxInjectEventVmcs(pVCpu, pMixedCtx, u32IntrInfo, cbInstr, 0 /* u32ErrCode */);
    59455938}
    59465939
     
    59505943 *
    59515944 * @returns VBox status code (informational status code included).
    5952  * @param   pVM             Pointer to the VM.
    59535945 * @param   pVCpu           Pointer to the VMCPU.
    59545946 * @param   pMixedCtx       Pointer to the guest-CPU context. The data may be
     
    59575949 * @param   u32ErrorCode    The error code associated with the #GP.
    59585950 */
    5959 DECLINLINE(int) hmR0VmxInjectXcptGP(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, bool fErrorCodeValid, uint32_t u32ErrorCode)
     5951DECLINLINE(int) hmR0VmxInjectXcptGP(PVMCPU pVCpu, PCPUMCTX pMixedCtx, bool fErrorCodeValid, uint32_t u32ErrorCode)
    59605952{
    59615953    /* Inject the general-protection fault. */
     
    59655957        u32IntrInfo |= VMX_EXIT_INTERRUPTION_INFO_ERROR_CODE_VALID;
    59665958    STAM_COUNTER_INC(&pVCpu->hm.s.StatIntInject);
    5967     return hmR0VmxInjectEventVmcs(pVM, pVCpu, pMixedCtx, u32IntrInfo, 0 /* cbInstr */, u32ErrorCode);
     5959    return hmR0VmxInjectEventVmcs(pVCpu, pMixedCtx, u32IntrInfo, 0 /* cbInstr */, u32ErrorCode);
    59685960}
    59695961
     
    59735965 *
    59745966 * @returns VBox status code (informational status code included).
    5975  * @param   pVM             Pointer to the VM.
    59765967 * @param   pVCpu           Pointer to the VMCPU.
    59775968 * @param   pMixedCtx       Pointer to the guest-CPU context. The data may be
     
    59825973 *                          stack.
    59835974 */
    5984 DECLINLINE(int) hmR0VmxInjectIntN(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, uint16_t uVector, uint32_t cbInstr)
     5975DECLINLINE(int) hmR0VmxInjectIntN(PVMCPU pVCpu, PCPUMCTX pMixedCtx, uint16_t uVector, uint32_t cbInstr)
    59855976{
    59865977    /* Inject the INTn. */
     
    59885979    u32IntrInfo         |= (VMX_EXIT_INTERRUPTION_INFO_TYPE_SW_INT << VMX_EXIT_INTERRUPTION_INFO_TYPE_SHIFT);
    59895980    STAM_COUNTER_INC(&pVCpu->hm.s.StatIntInject);
    5990     return hmR0VmxInjectEventVmcs(pVM, pVCpu, pMixedCtx, u32IntrInfo, cbInstr, 0 /* u32ErrCode */);
     5981    return hmR0VmxInjectEventVmcs(pVCpu, pMixedCtx, u32IntrInfo, cbInstr, 0 /* u32ErrCode */);
    59915982}
    59925983
     
    60266017 * @retval VINF_EM_RESET if event injection resulted in a triple-fault.
    60276018 *
    6028  * @param   pVM             Pointer to the VM.
    60296019 * @param   pVCpu           Pointer to the VMCPU.
    60306020 * @param   pMixedCtx       Pointer to the guest-CPU context. The data may be
     
    60396029 * @remarks No-long-jump zone!!!
    60406030 */
    6041 static int hmR0VmxInjectEventVmcs(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, uint64_t u64IntrInfo, uint32_t cbInstr,
     6031static int hmR0VmxInjectEventVmcs(PVMCPU pVCpu, PCPUMCTX pMixedCtx, uint64_t u64IntrInfo, uint32_t cbInstr,
    60426032                                  uint32_t u32ErrCode)
    60436033{
     
    60616051    if (CPUMIsGuestInRealModeEx(pMixedCtx))
    60626052    {
     6053        PVM pVM = pVCpu->CTX_SUFF(pVM);
    60636054        if (!pVM->hm.s.vmx.fUnrestrictedGuest)
    60646055        {
     
    60816072                {
    60826073                    /* If we're injecting a #GP with no valid IDT entry, inject a double-fault. */
    6083                     return hmR0VmxInjectXcptDF(pVM, pVCpu, pMixedCtx);
     6074                    return hmR0VmxInjectXcptDF(pVCpu, pMixedCtx);
    60846075                }
    60856076
    60866077                /* If we're injecting an interrupt/exception with no valid IDT entry, inject a general-protection fault. */
    60876078                /* No error codes for exceptions in real-mode. See Intel spec. 20.1.4 "Interrupt and Exception Handling" */
    6088                 return hmR0VmxInjectXcptGP(pVM, pVCpu, pMixedCtx, false /* fErrCodeValid */, 0 /* u32ErrCode */);
     6079                return hmR0VmxInjectXcptGP(pVCpu, pMixedCtx, false /* fErrCodeValid */, 0 /* u32ErrCode */);
    60896080            }
    60906081
     
    66516642        STAM_PROFILE_ADV_STOP_START(&pVCpu->hm.s.StatExit1, &pVCpu->hm.s.StatExit2, x);
    66526643        AssertMsg(VmxTransient.uExitReason <= VMX_EXIT_MAX, ("%#x\n", VmxTransient.uExitReason));
    6653         rc = (*s_apfnVMExitHandlers[VmxTransient.uExitReason])(pVM, pVCpu, pCtx, &VmxTransient);
     6644        rc = (*s_apfnVMExitHandlers[VmxTransient.uExitReason])(pVCpu, pCtx, &VmxTransient);
    66546645        STAM_PROFILE_ADV_STOP(&pVCpu->hm.s.StatExit2, x);
    66556646        if (rc != VINF_SUCCESS)
     
    66706661}
    66716662
    6672 #if 0
     6663#if 1
    66736664DECLINLINE(int) hmR0VmxHandleExit(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient, unsigned rcReason)
    66746665{
     
    66766667    switch (rcReason)
    66776668    {
    6678         case VMX_EXIT_EPT_MISCONFIG:           rc = hmR0VmxExitEptMisconfig(pVM, pVCpu, pMixedCtx, pVmxTransient); break;
    6679         case VMX_EXIT_EPT_VIOLATION:           rc = hmR0VmxExitEptViolation(pVM, pVCpu, pMixedCtx, pVmxTransient); break;
    6680         case VMX_EXIT_IO_INSTR:                rc = hmR0VmxExitIoInstr(pVM, pVCpu, pMixedCtx, pVmxTransient); break;
    6681         case VMX_EXIT_CPUID:                   rc = hmR0VmxExitCpuid(pVM, pVCpu, pMixedCtx, pVmxTransient); break;
    6682         case VMX_EXIT_RDTSC:                   rc = hmR0VmxExitRdtsc(pVM, pVCpu, pMixedCtx, pVmxTransient); break;
    6683         case VMX_EXIT_RDTSCP:                  rc = hmR0VmxExitRdtscp(pVM, pVCpu, pMixedCtx, pVmxTransient); break;
    6684         case VMX_EXIT_APIC_ACCESS:             rc = hmR0VmxExitApicAccess(pVM, pVCpu, pMixedCtx, pVmxTransient); break;
    6685         case VMX_EXIT_XCPT_NMI:                rc = hmR0VmxExitXcptNmi(pVM, pVCpu, pMixedCtx, pVmxTransient); break;
    6686         case VMX_EXIT_MOV_CRX:                 rc = hmR0VmxExitMovCRx(pVM, pVCpu, pMixedCtx, pVmxTransient); break;
    6687         case VMX_EXIT_EXT_INT:                 rc = hmR0VmxExitExtInt(pVM, pVCpu, pMixedCtx, pVmxTransient); break;
    6688         case VMX_EXIT_INT_WINDOW:              rc = hmR0VmxExitIntWindow(pVM, pVCpu, pMixedCtx, pVmxTransient); break;
    6689         case VMX_EXIT_MWAIT:                   rc = hmR0VmxExitMwait(pVM, pVCpu, pMixedCtx, pVmxTransient); break;
    6690         case VMX_EXIT_MONITOR:                 rc = hmR0VmxExitMonitor(pVM, pVCpu, pMixedCtx, pVmxTransient); break;
    6691         case VMX_EXIT_TASK_SWITCH:             rc = hmR0VmxExitTaskSwitch(pVM, pVCpu, pMixedCtx, pVmxTransient); break;
    6692         case VMX_EXIT_PREEMPT_TIMER:           rc = hmR0VmxExitPreemptTimer(pVM, pVCpu, pMixedCtx, pVmxTransient); break;
    6693         case VMX_EXIT_RDMSR:                   rc = hmR0VmxExitRdmsr(pVM, pVCpu, pMixedCtx, pVmxTransient); break;
    6694         case VMX_EXIT_WRMSR:                   rc = hmR0VmxExitWrmsr(pVM, pVCpu, pMixedCtx, pVmxTransient); break;
    6695         case VMX_EXIT_MOV_DRX:                 rc = hmR0VmxExitMovDRx(pVM, pVCpu, pMixedCtx, pVmxTransient); break;
    6696         case VMX_EXIT_TPR_BELOW_THRESHOLD:     rc = hmR0VmxExitTprBelowThreshold(pVM, pVCpu, pMixedCtx, pVmxTransient); break;
    6697         case VMX_EXIT_HLT:                     rc = hmR0VmxExitHlt(pVM, pVCpu, pMixedCtx, pVmxTransient); break;
    6698         case VMX_EXIT_INVD:                    rc = hmR0VmxExitInvd(pVM, pVCpu, pMixedCtx, pVmxTransient); break;
    6699         case VMX_EXIT_INVLPG:                  rc = hmR0VmxExitInvlpg(pVM, pVCpu, pMixedCtx, pVmxTransient); break;
    6700         case VMX_EXIT_RSM:                     rc = hmR0VmxExitRsm(pVM, pVCpu, pMixedCtx, pVmxTransient); break;
    6701         case VMX_EXIT_MTF:                     rc = hmR0VmxExitMtf(pVM, pVCpu, pMixedCtx, pVmxTransient); break;
    6702         case VMX_EXIT_PAUSE:                   rc = hmR0VmxExitPause(pVM, pVCpu, pMixedCtx, pVmxTransient); break;
    6703         case VMX_EXIT_XDTR_ACCESS:             rc = hmR0VmxExitXdtrAccess(pVM, pVCpu, pMixedCtx, pVmxTransient); break;
    6704         case VMX_EXIT_TR_ACCESS:               rc = hmR0VmxExitXdtrAccess(pVM, pVCpu, pMixedCtx, pVmxTransient); break;
    6705         case VMX_EXIT_WBINVD:                  rc = hmR0VmxExitWbinvd(pVM, pVCpu, pMixedCtx, pVmxTransient); break;
    6706         case VMX_EXIT_XSETBV:                  rc = hmR0VmxExitXsetbv(pVM, pVCpu, pMixedCtx, pVmxTransient); break;
    6707         case VMX_EXIT_RDRAND:                  rc = hmR0VmxExitRdrand(pVM, pVCpu, pMixedCtx, pVmxTransient); break;
    6708         case VMX_EXIT_INVPCID:                 rc = hmR0VmxExitInvpcid(pVM, pVCpu, pMixedCtx, pVmxTransient); break;
    6709         case VMX_EXIT_GETSEC:                  rc = hmR0VmxExitGetsec(pVM, pVCpu, pMixedCtx, pVmxTransient); break;
    6710         case VMX_EXIT_RDPMC:                   rc = hmR0VmxExitRdpmc(pVM, pVCpu, pMixedCtx, pVmxTransient); break;
    6711 
    6712         case VMX_EXIT_TRIPLE_FAULT:            rc = hmR0VmxExitTripleFault(pVM, pVCpu, pMixedCtx, pVmxTransient); break;
    6713         case VMX_EXIT_NMI_WINDOW:              rc = hmR0VmxExitNmiWindow(pVM, pVCpu, pMixedCtx, pVmxTransient); break;
    6714         case VMX_EXIT_INIT_SIGNAL:             rc = hmR0VmxExitInitSignal(pVM, pVCpu, pMixedCtx, pVmxTransient); break;
    6715         case VMX_EXIT_SIPI:                    rc = hmR0VmxExitSipi(pVM, pVCpu, pMixedCtx, pVmxTransient); break;
    6716         case VMX_EXIT_IO_SMI:                  rc = hmR0VmxExitIoSmi(pVM, pVCpu, pMixedCtx, pVmxTransient); break;
    6717         case VMX_EXIT_SMI:                     rc = hmR0VmxExitSmi(pVM, pVCpu, pMixedCtx, pVmxTransient); break;
    6718         case VMX_EXIT_ERR_MSR_LOAD:            rc = hmR0VmxExitErrMsrLoad(pVM, pVCpu, pMixedCtx, pVmxTransient); break;
    6719         case VMX_EXIT_ERR_INVALID_GUEST_STATE: rc = hmR0VmxExitErrInvalidGuestState(pVM, pVCpu, pMixedCtx, pVmxTransient); break;
    6720         case VMX_EXIT_ERR_MACHINE_CHECK:       rc = hmR0VmxExitErrMachineCheck(pVM, pVCpu, pMixedCtx, pVmxTransient); break;
     6669        case VMX_EXIT_EPT_MISCONFIG:           rc = hmR0VmxExitEptMisconfig(pVCpu, pMixedCtx, pVmxTransient); break;
     6670        case VMX_EXIT_EPT_VIOLATION:           rc = hmR0VmxExitEptViolation(pVCpu, pMixedCtx, pVmxTransient); break;
     6671        case VMX_EXIT_IO_INSTR:                rc = hmR0VmxExitIoInstr(pVCpu, pMixedCtx, pVmxTransient); break;
     6672        case VMX_EXIT_CPUID:                   rc = hmR0VmxExitCpuid(pVCpu, pMixedCtx, pVmxTransient); break;
     6673        case VMX_EXIT_RDTSC:                   rc = hmR0VmxExitRdtsc(pVCpu, pMixedCtx, pVmxTransient); break;
     6674        case VMX_EXIT_RDTSCP:                  rc = hmR0VmxExitRdtscp(pVCpu, pMixedCtx, pVmxTransient); break;
     6675        case VMX_EXIT_APIC_ACCESS:             rc = hmR0VmxExitApicAccess(pVCpu, pMixedCtx, pVmxTransient); break;
     6676        case VMX_EXIT_XCPT_NMI:                rc = hmR0VmxExitXcptNmi(pVCpu, pMixedCtx, pVmxTransient); break;
     6677        case VMX_EXIT_MOV_CRX:                 rc = hmR0VmxExitMovCRx(pVCpu, pMixedCtx, pVmxTransient); break;
     6678        case VMX_EXIT_EXT_INT:                 rc = hmR0VmxExitExtInt(pVCpu, pMixedCtx, pVmxTransient); break;
     6679        case VMX_EXIT_INT_WINDOW:              rc = hmR0VmxExitIntWindow(pVCpu, pMixedCtx, pVmxTransient); break;
     6680        case VMX_EXIT_MWAIT:                   rc = hmR0VmxExitMwait(pVCpu, pMixedCtx, pVmxTransient); break;
     6681        case VMX_EXIT_MONITOR:                 rc = hmR0VmxExitMonitor(pVCpu, pMixedCtx, pVmxTransient); break;
     6682        case VMX_EXIT_TASK_SWITCH:             rc = hmR0VmxExitTaskSwitch(pVCpu, pMixedCtx, pVmxTransient); break;
     6683        case VMX_EXIT_PREEMPT_TIMER:           rc = hmR0VmxExitPreemptTimer(pVCpu, pMixedCtx, pVmxTransient); break;
     6684        case VMX_EXIT_RDMSR:                   rc = hmR0VmxExitRdmsr(pVCpu, pMixedCtx, pVmxTransient); break;
     6685        case VMX_EXIT_WRMSR:                   rc = hmR0VmxExitWrmsr(pVCpu, pMixedCtx, pVmxTransient); break;
     6686        case VMX_EXIT_MOV_DRX:                 rc = hmR0VmxExitMovDRx(pVCpu, pMixedCtx, pVmxTransient); break;
     6687        case VMX_EXIT_TPR_BELOW_THRESHOLD:     rc = hmR0VmxExitTprBelowThreshold(pVCpu, pMixedCtx, pVmxTransient); break;
     6688        case VMX_EXIT_HLT:                     rc = hmR0VmxExitHlt(pVCpu, pMixedCtx, pVmxTransient); break;
     6689        case VMX_EXIT_INVD:                    rc = hmR0VmxExitInvd(pVCpu, pMixedCtx, pVmxTransient); break;
     6690        case VMX_EXIT_INVLPG:                  rc = hmR0VmxExitInvlpg(pVCpu, pMixedCtx, pVmxTransient); break;
     6691        case VMX_EXIT_RSM:                     rc = hmR0VmxExitRsm(pVCpu, pMixedCtx, pVmxTransient); break;
     6692        case VMX_EXIT_MTF:                     rc = hmR0VmxExitMtf(pVCpu, pMixedCtx, pVmxTransient); break;
     6693        case VMX_EXIT_PAUSE:                   rc = hmR0VmxExitPause(pVCpu, pMixedCtx, pVmxTransient); break;
     6694        case VMX_EXIT_XDTR_ACCESS:             rc = hmR0VmxExitXdtrAccess(pVCpu, pMixedCtx, pVmxTransient); break;
     6695        case VMX_EXIT_TR_ACCESS:               rc = hmR0VmxExitXdtrAccess(pVCpu, pMixedCtx, pVmxTransient); break;
     6696        case VMX_EXIT_WBINVD:                  rc = hmR0VmxExitWbinvd(pVCpu, pMixedCtx, pVmxTransient); break;
     6697        case VMX_EXIT_XSETBV:                  rc = hmR0VmxExitXsetbv(pVCpu, pMixedCtx, pVmxTransient); break;
     6698        case VMX_EXIT_RDRAND:                  rc = hmR0VmxExitRdrand(pVCpu, pMixedCtx, pVmxTransient); break;
     6699        case VMX_EXIT_INVPCID:                 rc = hmR0VmxExitInvpcid(pVCpu, pMixedCtx, pVmxTransient); break;
     6700        case VMX_EXIT_GETSEC:                  rc = hmR0VmxExitGetsec(pVCpu, pMixedCtx, pVmxTransient); break;
     6701        case VMX_EXIT_RDPMC:                   rc = hmR0VmxExitRdpmc(pVCpu, pMixedCtx, pVmxTransient); break;
     6702
     6703        case VMX_EXIT_TRIPLE_FAULT:            rc = hmR0VmxExitTripleFault(pVCpu, pMixedCtx, pVmxTransient); break;
     6704        case VMX_EXIT_NMI_WINDOW:              rc = hmR0VmxExitNmiWindow(pVCpu, pMixedCtx, pVmxTransient); break;
     6705        case VMX_EXIT_INIT_SIGNAL:             rc = hmR0VmxExitInitSignal(pVCpu, pMixedCtx, pVmxTransient); break;
     6706        case VMX_EXIT_SIPI:                    rc = hmR0VmxExitSipi(pVCpu, pMixedCtx, pVmxTransient); break;
     6707        case VMX_EXIT_IO_SMI:                  rc = hmR0VmxExitIoSmi(pVCpu, pMixedCtx, pVmxTransient); break;
     6708        case VMX_EXIT_SMI:                     rc = hmR0VmxExitSmi(pVCpu, pMixedCtx, pVmxTransient); break;
     6709        case VMX_EXIT_ERR_MSR_LOAD:            rc = hmR0VmxExitErrMsrLoad(pVCpu, pMixedCtx, pVmxTransient); break;
     6710        case VMX_EXIT_ERR_INVALID_GUEST_STATE: rc = hmR0VmxExitErrInvalidGuestState(pVCpu, pMixedCtx, pVmxTransient); break;
     6711        case VMX_EXIT_ERR_MACHINE_CHECK:       rc = hmR0VmxExitErrMachineCheck(pVCpu, pMixedCtx, pVmxTransient); break;
    67216712
    67226713        case VMX_EXIT_VMCALL:
     
    67336724        case VMX_EXIT_INVVPID:
    67346725        case VMX_EXIT_VMFUNC:
    6735             rc = hmR0VmxExitInjectXcptUD(pVM, pVCpu, pMixedCtx, pVmxTransient);
     6726            rc = hmR0VmxExitInjectXcptUD(pVCpu, pMixedCtx, pVmxTransient);
    67366727            break;
    67376728        default:
    6738             rc = hmR0VmxExitErrUndefined(pVM, pVCpu, pMixedCtx, pVmxTransient);
     6729            rc = hmR0VmxExitErrUndefined(pVCpu, pMixedCtx, pVmxTransient);
    67396730            break;
    67406731    }
     
    67566747# define VMX_VALIDATE_EXIT_HANDLER_PARAMS() \
    67576748            do {                                                      \
    6758                 AssertPtr(pVM);                                       \
    67596749                AssertPtr(pVCpu);                                     \
    67606750                AssertPtr(pMixedCtx);                                 \
     
    68096799 * VM-exit handler for external interrupts (VMX_EXIT_EXT_INT).
    68106800 */
    6811 static DECLCALLBACK(int) hmR0VmxExitExtInt(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
     6801static DECLCALLBACK(int) hmR0VmxExitExtInt(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
    68126802{
    68136803    VMX_VALIDATE_EXIT_HANDLER_PARAMS();
     
    68206810 * VM-exit handler for exceptions and NMIs (VMX_EXIT_XCPT_NMI).
    68216811 */
    6822 static DECLCALLBACK(int) hmR0VmxExitXcptNmi(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
     6812static DECLCALLBACK(int) hmR0VmxExitXcptNmi(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
    68236813{
    68246814    VMX_VALIDATE_EXIT_HANDLER_PARAMS();
     
    68346824
    68356825    /* If this VM-exit occurred while delivering an event through the guest IDT, handle it accordingly. */
    6836     rc = hmR0VmxCheckExitDueToEventDelivery(pVM, pVCpu, pMixedCtx, pVmxTransient);
     6826    rc = hmR0VmxCheckExitDueToEventDelivery(pVCpu, pMixedCtx, pVmxTransient);
    68376827    if (RT_UNLIKELY(rc == VINF_VMX_DOUBLE_FAULT))
    68386828        return VINF_SUCCESS;
     
    68516841            switch (uVector)
    68526842            {
    6853                 case X86_XCPT_PF: rc = hmR0VmxExitXcptPF(pVM, pVCpu, pMixedCtx, pVmxTransient);      break;
    6854                 case X86_XCPT_GP: rc = hmR0VmxExitXcptGP(pVM, pVCpu, pMixedCtx, pVmxTransient);      break;
    6855                 case X86_XCPT_NM: rc = hmR0VmxExitXcptNM(pVM, pVCpu, pMixedCtx, pVmxTransient);      break;
    6856                 case X86_XCPT_MF: rc = hmR0VmxExitXcptMF(pVM, pVCpu, pMixedCtx, pVmxTransient);      break;
    6857                 case X86_XCPT_DB: rc = hmR0VmxExitXcptDB(pVM, pVCpu, pMixedCtx, pVmxTransient);      break;
    6858                 case X86_XCPT_BP: rc = hmR0VmxExitXcptBP(pVM, pVCpu, pMixedCtx, pVmxTransient);      break;
     6843                case X86_XCPT_PF: rc = hmR0VmxExitXcptPF(pVCpu, pMixedCtx, pVmxTransient);      break;
     6844                case X86_XCPT_GP: rc = hmR0VmxExitXcptGP(pVCpu, pMixedCtx, pVmxTransient);      break;
     6845                case X86_XCPT_NM: rc = hmR0VmxExitXcptNM(pVCpu, pMixedCtx, pVmxTransient);      break;
     6846                case X86_XCPT_MF: rc = hmR0VmxExitXcptMF(pVCpu, pMixedCtx, pVmxTransient);      break;
     6847                case X86_XCPT_DB: rc = hmR0VmxExitXcptDB(pVCpu, pMixedCtx, pVmxTransient);      break;
     6848                case X86_XCPT_BP: rc = hmR0VmxExitXcptBP(pVCpu, pMixedCtx, pVmxTransient);      break;
    68596849#ifdef VBOX_ALWAYS_TRAP_ALL_EXCEPTIONS
    68606850                case X86_XCPT_XF: STAM_COUNTER_INC(&pVCpu->hm.s.StatExitGuestXF);
    6861                                   rc = hmR0VmxExitXcptGeneric(pVM, pVCpu, pMixedCtx, pVmxTransient); break;
     6851                                  rc = hmR0VmxExitXcptGeneric(pVCpu, pMixedCtx, pVmxTransient); break;
    68626852                case X86_XCPT_DE: STAM_COUNTER_INC(&pVCpu->hm.s.StatExitGuestDE);
    6863                                   rc = hmR0VmxExitXcptGeneric(pVM, pVCpu, pMixedCtx, pVmxTransient); break;
     6853                                  rc = hmR0VmxExitXcptGeneric(pVCpu, pMixedCtx, pVmxTransient); break;
    68646854                case X86_XCPT_UD: STAM_COUNTER_INC(&pVCpu->hm.s.StatExitGuestUD);
    6865                                   rc = hmR0VmxExitXcptGeneric(pVM, pVCpu, pMixedCtx, pVmxTransient); break;
     6855                                  rc = hmR0VmxExitXcptGeneric(pVCpu, pMixedCtx, pVmxTransient); break;
    68666856                case X86_XCPT_SS: STAM_COUNTER_INC(&pVCpu->hm.s.StatExitGuestSS);
    6867                                   rc = hmR0VmxExitXcptGeneric(pVM, pVCpu, pMixedCtx, pVmxTransient); break;
     6857                                  rc = hmR0VmxExitXcptGeneric(pVCpu, pMixedCtx, pVmxTransient); break;
    68686858                case X86_XCPT_NP: STAM_COUNTER_INC(&pVCpu->hm.s.StatExitGuestNP);
    6869                                   rc = hmR0VmxExitXcptGeneric(pVM, pVCpu, pMixedCtx, pVmxTransient); break;
     6859                                  rc = hmR0VmxExitXcptGeneric(pVCpu, pMixedCtx, pVmxTransient); break;
    68706860#endif
    68716861                default:
     
    68776867                    if (pVCpu->hm.s.vmx.RealMode.fRealOnV86Active)
    68786868                    {
    6879                         Assert(pVM->hm.s.vmx.pRealModeTSS);
    6880                         Assert(PDMVmmDevHeapIsEnabled(pVM));
     6869                        Assert(pVCpu->CTX_SUFF(pVM)->hm.s.vmx.pRealModeTSS);
     6870                        Assert(PDMVmmDevHeapIsEnabled(pVCpu->CTX_SUFF(pVM)));
    68816871                        rc  = hmR0VmxReadExitInstrLenVmcs(pVCpu, pVmxTransient);
    68826872                        rc |= hmR0VmxReadExitIntrErrorCodeVmcs(pVCpu, pVmxTransient);
    68836873                        AssertRCReturn(rc, rc);
    6884                         rc = hmR0VmxInjectEventVmcs(pVM, pVCpu, pMixedCtx,
     6874                        rc = hmR0VmxInjectEventVmcs(pVCpu, pMixedCtx,
    68856875                                                    VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(uExitIntrInfo),
    68866876                                                    pVmxTransient->cbInstr, pVmxTransient->uExitIntrErrorCode);
     
    69136903 * VM-exit handler for interrupt-window exiting (VMX_EXIT_INT_WINDOW).
    69146904 */
    6915 static DECLCALLBACK(int) hmR0VmxExitIntWindow(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
     6905static DECLCALLBACK(int) hmR0VmxExitIntWindow(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
    69166906{
    69176907    VMX_VALIDATE_EXIT_HANDLER_PARAMS();
     
    69326922 * VM-exit handler for NMI-window exiting (VMX_EXIT_NMI_WINDOW).
    69336923 */
    6934 static DECLCALLBACK(int) hmR0VmxExitNmiWindow(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
     6924static DECLCALLBACK(int) hmR0VmxExitNmiWindow(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
    69356925{
    69366926    VMX_VALIDATE_EXIT_HANDLER_PARAMS();
     
    69436933 * VM-exit handler for WBINVD (VMX_EXIT_WBINVD). Conditional VM-exit.
    69446934 */
    6945 static DECLCALLBACK(int) hmR0VmxExitWbinvd(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
     6935static DECLCALLBACK(int) hmR0VmxExitWbinvd(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
    69466936{
    69476937    VMX_VALIDATE_EXIT_HANDLER_PARAMS();
     
    69546944 * VM-exit handler for INVD (VMX_EXIT_INVD). Unconditional VM-exit.
    69556945 */
    6956 static DECLCALLBACK(int) hmR0VmxExitInvd(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
     6946static DECLCALLBACK(int) hmR0VmxExitInvd(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
    69576947{
    69586948    VMX_VALIDATE_EXIT_HANDLER_PARAMS();
     
    69656955 * VM-exit handler for CPUID (VMX_EXIT_CPUID). Unconditional VM-exit.
    69666956 */
    6967 static DECLCALLBACK(int) hmR0VmxExitCpuid(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
     6957static DECLCALLBACK(int) hmR0VmxExitCpuid(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
    69686958{
    69696959    VMX_VALIDATE_EXIT_HANDLER_PARAMS();
     6960    PVM pVM = pVCpu->CTX_SUFF(pVM);
    69706961    int rc = EMInterpretCpuId(pVM, pVCpu, CPUMCTX2CORE(pMixedCtx));
    69716962    if (RT_LIKELY(rc == VINF_SUCCESS))
     
    69876978 * VM-exit handler for GETSEC (VMX_EXIT_GETSEC). Unconditional VM-exit.
    69886979 */
    6989 static DECLCALLBACK(int) hmR0VmxExitGetsec(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
     6980static DECLCALLBACK(int) hmR0VmxExitGetsec(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
    69906981{
    69916982    VMX_VALIDATE_EXIT_HANDLER_PARAMS();
     
    70046995 * VM-exit handler for RDTSC (VMX_EXIT_RDTSC). Conditional VM-exit.
    70056996 */
    7006 static DECLCALLBACK(int) hmR0VmxExitRdtsc(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
     6997static DECLCALLBACK(int) hmR0VmxExitRdtsc(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
    70076998{
    70086999    VMX_VALIDATE_EXIT_HANDLER_PARAMS();
     
    70107001    AssertRCReturn(rc, rc);
    70117002
     7003    PVM pVM = pVCpu->CTX_SUFF(pVM);
    70127004    rc = EMInterpretRdtsc(pVM, pVCpu, CPUMCTX2CORE(pMixedCtx));
    70137005    if (RT_LIKELY(rc == VINF_SUCCESS))
     
    70327024 * VM-exit handler for RDTSCP (VMX_EXIT_RDTSCP). Conditional VM-exit.
    70337025 */
    7034 static DECLCALLBACK(int) hmR0VmxExitRdtscp(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
     7026static DECLCALLBACK(int) hmR0VmxExitRdtscp(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
    70357027{
    70367028    VMX_VALIDATE_EXIT_HANDLER_PARAMS();
     
    70397031    AssertRCReturn(rc, rc);
    70407032
     7033    PVM pVM = pVCpu->CTX_SUFF(pVM);
    70417034    rc = EMInterpretRdtscp(pVM, pVCpu, pMixedCtx);
    70427035    if (RT_LIKELY(rc == VINF_SUCCESS))
     
    70617054 * VM-exit handler for RDPMC (VMX_EXIT_RDPMC). Conditional VM-exit.
    70627055 */
    7063 static DECLCALLBACK(int) hmR0VmxExitRdpmc(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
     7056static DECLCALLBACK(int) hmR0VmxExitRdpmc(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
    70647057{
    70657058    VMX_VALIDATE_EXIT_HANDLER_PARAMS();
     
    70687061    AssertRCReturn(rc, rc);
    70697062
     7063    PVM pVM = pVCpu->CTX_SUFF(pVM);
    70707064    rc = EMInterpretRdpmc(pVM, pVCpu, CPUMCTX2CORE(pMixedCtx));
    70717065    if (RT_LIKELY(rc == VINF_SUCCESS))
     
    70877081 * VM-exit handler for INVLPG (VMX_EXIT_INVLPG). Conditional VM-exit.
    70887082 */
    7089 static DECLCALLBACK(int) hmR0VmxExitInvlpg(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
     7083static DECLCALLBACK(int) hmR0VmxExitInvlpg(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
    70907084{
    70917085    VMX_VALIDATE_EXIT_HANDLER_PARAMS();
     
    70947088    AssertRCReturn(rc, rc);
    70957089
     7090    PVM pVM = pVCpu->CTX_SUFF(pVM);
    70967091    VBOXSTRICTRC rc2 = EMInterpretInvlpg(pVM, pVCpu, CPUMCTX2CORE(pMixedCtx), pVmxTransient->uExitQualification);
    70977092    rc = VBOXSTRICTRC_VAL(rc2);
     
    71127107 * VM-exit handler for MONITOR (VMX_EXIT_MONITOR). Conditional VM-exit.
    71137108 */
    7114 static DECLCALLBACK(int) hmR0VmxExitMonitor(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
     7109static DECLCALLBACK(int) hmR0VmxExitMonitor(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
    71157110{
    71167111    VMX_VALIDATE_EXIT_HANDLER_PARAMS();
     
    71207115    AssertRCReturn(rc, rc);
    71217116
     7117    PVM pVM = pVCpu->CTX_SUFF(pVM);
    71227118    rc = EMInterpretMonitor(pVM, pVCpu, CPUMCTX2CORE(pMixedCtx));
    71237119    if (RT_LIKELY(rc == VINF_SUCCESS))
     
    71367132 * VM-exit handler for MWAIT (VMX_EXIT_MWAIT). Conditional VM-exit.
    71377133 */
    7138 static DECLCALLBACK(int) hmR0VmxExitMwait(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
     7134static DECLCALLBACK(int) hmR0VmxExitMwait(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
    71397135{
    71407136    VMX_VALIDATE_EXIT_HANDLER_PARAMS();
     
    71447140    AssertRCReturn(rc, rc);
    71457141
     7142    PVM pVM = pVCpu->CTX_SUFF(pVM);
    71467143    VBOXSTRICTRC rc2 = EMInterpretMWait(pVM, pVCpu, CPUMCTX2CORE(pMixedCtx));
    71477144    rc = VBOXSTRICTRC_VAL(rc2);
     
    71737170 * VM-exit handler for RSM (VMX_EXIT_RSM). Unconditional VM-exit.
    71747171 */
    7175 static DECLCALLBACK(int) hmR0VmxExitRsm(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
     7172static DECLCALLBACK(int) hmR0VmxExitRsm(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
    71767173{
    71777174    /*
     
    71817178     * See Intel spec. "33.15.5 Enabling the Dual-Monitor Treatment".
    71827179     */
    7183     AssertMsgFailed(("Unexpected RSM VM-exit. pVM=%p pVCpu=%p pMixedCtx=%p\n", pVM, pVCpu, pMixedCtx));
     7180    AssertMsgFailed(("Unexpected RSM VM-exit. pVCpu=%p pMixedCtx=%p\n", pVCpu, pMixedCtx));
    71847181    return VERR_VMX_UNEXPECTED_EXIT_CODE;
    71857182}
     
    71897186 * VM-exit handler for SMI (VMX_EXIT_SMI). Unconditional VM-exit.
    71907187 */
    7191 static DECLCALLBACK(int) hmR0VmxExitSmi(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
     7188static DECLCALLBACK(int) hmR0VmxExitSmi(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
    71927189{
    71937190    /*
     
    71967193     * See Intel spec. "33.15.6 Activating the Dual-Monitor Treatment" and Intel spec. 25.3 "Other Causes of VM-Exits"
    71977194     */
    7198     AssertMsgFailed(("Unexpected SMI VM-exit. pVM=%p pVCpu=%p pMixedCtx=%p\n", pVM, pVCpu, pMixedCtx));
     7195    AssertMsgFailed(("Unexpected SMI VM-exit. pVCpu=%p pMixedCtx=%p\n", pVCpu, pMixedCtx));
    71997196    return VERR_VMX_UNEXPECTED_EXIT_CODE;
    72007197}
     
    72047201 * VM-exit handler for IO SMI (VMX_EXIT_IO_SMI). Unconditional VM-exit.
    72057202 */
    7206 static DECLCALLBACK(int) hmR0VmxExitIoSmi(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
     7203static DECLCALLBACK(int) hmR0VmxExitIoSmi(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
    72077204{
    72087205    /* Same treatment as VMX_EXIT_SMI. See comment in hmR0VmxExitSmi(). */
    7209     AssertMsgFailed(("Unexpected IO SMI VM-exit. pVM=%p pVCpu=%p pMixedCtx=%p\n", pVM, pVCpu, pMixedCtx));
     7206    AssertMsgFailed(("Unexpected IO SMI VM-exit. pVCpu=%p pMixedCtx=%p\n", pVCpu, pMixedCtx));
    72107207    return VERR_VMX_UNEXPECTED_EXIT_CODE;
    72117208}
     
    72157212 * VM-exit handler for SIPI (VMX_EXIT_SIPI). Conditional VM-exit.
    72167213 */
    7217 static DECLCALLBACK(int) hmR0VmxExitSipi(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
     7214static DECLCALLBACK(int) hmR0VmxExitSipi(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
    72187215{
    72197216    /*
     
    72227219     * See Intel spec. 25.3 "Other Causes of VM-exits".
    72237220     */
    7224     AssertMsgFailed(("Unexpected SIPI VM-exit. pVM=%p pVCpu=%p pMixedCtx=%p\n", pVM, pVCpu, pMixedCtx));
     7221    AssertMsgFailed(("Unexpected SIPI VM-exit. pVCpu=%p pMixedCtx=%p\n", pVCpu, pMixedCtx));
    72257222    return VERR_VMX_UNEXPECTED_EXIT_CODE;
    72267223}
     
    72317228 * VM-exit.
    72327229 */
    7233 static DECLCALLBACK(int) hmR0VmxExitInitSignal(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
     7230static DECLCALLBACK(int) hmR0VmxExitInitSignal(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
    72347231{
    72357232    /*
     
    72477244 * VM-exit.
    72487245 */
    7249 static DECLCALLBACK(int) hmR0VmxExitTripleFault(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
     7246static DECLCALLBACK(int) hmR0VmxExitTripleFault(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
    72507247{
    72517248    VMX_VALIDATE_EXIT_HANDLER_PARAMS();
     
    72577254 * VM-exit handler for HLT (VMX_EXIT_HLT). Conditional VM-exit.
    72587255 */
    7259 static DECLCALLBACK(int) hmR0VmxExitHlt(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
     7256static DECLCALLBACK(int) hmR0VmxExitHlt(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
    72607257{
    72617258    VMX_VALIDATE_EXIT_HANDLER_PARAMS();
     
    72807277 * VM-exit handler for instructions that result in a #UD exception delivered to the guest.
    72817278 */
    7282 static DECLCALLBACK(int) hmR0VmxExitInjectXcptUD(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
     7279static DECLCALLBACK(int) hmR0VmxExitInjectXcptUD(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
    72837280{
    72847281    VMX_VALIDATE_EXIT_HANDLER_PARAMS();
    7285     return hmR0VmxInjectXcptUD(pVM, pVCpu, pMixedCtx);
     7282    return hmR0VmxInjectXcptUD(pVCpu, pMixedCtx);
    72867283}
    72877284
     
    72907287 * VM-exit handler for expiry of the VMX preemption timer.
    72917288 */
    7292 static DECLCALLBACK(int) hmR0VmxExitPreemptTimer(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
     7289static DECLCALLBACK(int) hmR0VmxExitPreemptTimer(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
    72937290{
    72947291    VMX_VALIDATE_EXIT_HANDLER_PARAMS();
     
    72997296
    73007297    /* If there are any timer events pending, fall back to ring-3, otherwise resume guest execution. */
     7298    PVM pVM = pVCpu->CTX_SUFF(pVM);
    73017299    bool fTimersPending = TMTimerPollBool(pVM, pVCpu);
    73027300    STAM_COUNTER_INC(&pVCpu->hm.s.StatExitPreemptTimer);
     
    73087306 * VM-exit handler for XSETBV (VMX_EXIT_XSETBV). Unconditional VM-exit.
    73097307 */
    7310 static DECLCALLBACK(int) hmR0VmxExitXsetbv(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
     7308static DECLCALLBACK(int) hmR0VmxExitXsetbv(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
    73117309{
    73127310    VMX_VALIDATE_EXIT_HANDLER_PARAMS();
     
    73207318 * VM-exit handler for INVPCID (VMX_EXIT_INVPCID). Conditional VM-exit.
    73217319 */
    7322 static DECLCALLBACK(int) hmR0VmxExitInvpcid(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
     7320static DECLCALLBACK(int) hmR0VmxExitInvpcid(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
    73237321{
    73247322    VMX_VALIDATE_EXIT_HANDLER_PARAMS();
     
    73337331 * Error VM-exit.
    73347332 */
    7335 static DECLCALLBACK(int) hmR0VmxExitErrInvalidGuestState(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
     7333static DECLCALLBACK(int) hmR0VmxExitErrInvalidGuestState(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
    73367334{
    73377335    uint32_t    uIntrState;
     
    73647362    Log(("VMX_VMCS64_CTRL_EPTP_FULL                  %#RX64\n", u64Val));
    73657363
     7364    PVM pVM = pVCpu->CTX_SUFF(pVM);
    73667365    HMDumpRegs(pVM, pVCpu, pMixedCtx);
    73677366
     
    73747373 * (VMX_EXIT_ERR_MSR_LOAD). Error VM-exit.
    73757374 */
    7376 static DECLCALLBACK(int) hmR0VmxExitErrMsrLoad(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
    7377 {
    7378     AssertMsgFailed(("Unexpected MSR-load exit. pVM=%p pVCpu=%p pMixedCtx=%p\n", pVM, pVCpu, pMixedCtx));
     7375static DECLCALLBACK(int) hmR0VmxExitErrMsrLoad(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
     7376{
     7377    AssertMsgFailed(("Unexpected MSR-load exit. pVCpu=%p pMixedCtx=%p\n", pVCpu, pMixedCtx));
    73797378    return VERR_VMX_UNEXPECTED_EXIT_CODE;
    73807379}
     
    73857384 * (VMX_EXIT_ERR_MACHINE_CHECK). Error VM-exit.
    73867385 */
    7387 static DECLCALLBACK(int) hmR0VmxExitErrMachineCheck(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
    7388 {
    7389     AssertMsgFailed(("Unexpected machine-check event exit. pVM=%p pVCpu=%p pMixedCtx=%p\n", pVM, pVCpu, pMixedCtx));
     7386static DECLCALLBACK(int) hmR0VmxExitErrMachineCheck(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
     7387{
     7388    AssertMsgFailed(("Unexpected machine-check event exit. pVCpu=%p pMixedCtx=%p\n", pVCpu, pMixedCtx));
    73907389    return VERR_VMX_UNEXPECTED_EXIT_CODE;
    73917390}
     
    73967395 * theory.
    73977396 */
    7398 static DECLCALLBACK(int) hmR0VmxExitErrUndefined(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
    7399 {
    7400     AssertMsgFailed(("Huh!? Undefined VM-exit reason %d. pVM=%p pVCpu=%p pMixedCtx=%p\n", pVmxTransient->uExitReason,
    7401                      pVM, pVCpu, pMixedCtx));
     7397static DECLCALLBACK(int) hmR0VmxExitErrUndefined(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
     7398{
     7399    AssertMsgFailed(("Huh!? Undefined VM-exit reason %d. pVCpu=%p pMixedCtx=%p\n", pVmxTransient->uExitReason, pVCpu, pMixedCtx));
    74027400    return VERR_VMX_UNDEFINED_EXIT_CODE;
    74037401}
     
    74097407 * Conditional VM-exit.
    74107408 */
    7411 static DECLCALLBACK(int) hmR0VmxExitXdtrAccess(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
     7409static DECLCALLBACK(int) hmR0VmxExitXdtrAccess(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
    74127410{
    74137411    VMX_VALIDATE_EXIT_HANDLER_PARAMS();
     
    74167414    if (pVCpu->hm.s.vmx.u32ProcCtls2 & VMX_VMCS_CTRL_PROC_EXEC2_DESCRIPTOR_TABLE_EXIT)
    74177415        return VERR_EM_INTERPRETER;
    7418     AssertMsgFailed(("Unexpected XDTR access. pVM=%p pVCpu=%p pMixedCtx=%p\n", pVM, pVCpu, pMixedCtx));
     7416    AssertMsgFailed(("Unexpected XDTR access. pVCpu=%p pMixedCtx=%p\n", pVCpu, pMixedCtx));
    74197417    return VERR_VMX_UNEXPECTED_EXIT_CODE;
    74207418}
     
    74247422 * VM-exit handler for RDRAND (VMX_EXIT_RDRAND). Conditional VM-exit.
    74257423 */
    7426 static DECLCALLBACK(int) hmR0VmxExitRdrand(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
     7424static DECLCALLBACK(int) hmR0VmxExitRdrand(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
    74277425{
    74287426    VMX_VALIDATE_EXIT_HANDLER_PARAMS();
     
    74317429    if (pVCpu->hm.s.vmx.u32ProcCtls2 & VMX_VMCS_CTRL_PROC_EXEC2_RDRAND_EXIT)
    74327430        return VERR_EM_INTERPRETER;
    7433     AssertMsgFailed(("Unexpected RDRAND exit. pVM=%p pVCpu=%p pMixedCtx=%p\n", pVM, pVCpu, pMixedCtx));
     7431    AssertMsgFailed(("Unexpected RDRAND exit. pVCpu=%p pMixedCtx=%p\n", pVCpu, pMixedCtx));
    74347432    return VERR_VMX_UNEXPECTED_EXIT_CODE;
    74357433}
     
    74397437 * VM-exit handler for RDMSR (VMX_EXIT_RDMSR).
    74407438 */
    7441 static DECLCALLBACK(int) hmR0VmxExitRdmsr(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
     7439static DECLCALLBACK(int) hmR0VmxExitRdmsr(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
    74427440{
    74437441    VMX_VALIDATE_EXIT_HANDLER_PARAMS();
     
    74487446    AssertRCReturn(rc, rc);
    74497447
     7448    PVM pVM = pVCpu->CTX_SUFF(pVM);
    74507449    rc = EMInterpretRdmsr(pVM, pVCpu, CPUMCTX2CORE(pMixedCtx));
    74517450    AssertMsg(rc == VINF_SUCCESS || rc == VERR_EM_INTERPRETER,
     
    74667465 * VM-exit handler for WRMSR (VMX_EXIT_WRMSR).
    74677466 */
    7468 static DECLCALLBACK(int) hmR0VmxExitWrmsr(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
     7467static DECLCALLBACK(int) hmR0VmxExitWrmsr(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
    74697468{
    74707469    VMX_VALIDATE_EXIT_HANDLER_PARAMS();
    74717470    int rc = VINF_SUCCESS;
     7471    PVM pVM = pVCpu->CTX_SUFF(pVM);
     7472
    74727473    /* If TPR patching is active, LSTAR holds the guest TPR, writes to it must be propagated to the APIC. */
    74737474    if (   pVM->hm.s.fTPRPatchingActive
     
    75517552 * VM-exit handler for PAUSE (VMX_EXIT_PAUSE). Conditional VM-exit.
    75527553 */
    7553 static DECLCALLBACK(int) hmR0VmxExitPause(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
     7554static DECLCALLBACK(int) hmR0VmxExitPause(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
    75547555{
    75557556    VMX_VALIDATE_EXIT_HANDLER_PARAMS();
     
    75587559    if (pVCpu->hm.s.vmx.u32ProcCtls & VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_PAUSE_EXIT)
    75597560        return VERR_EM_INTERPRETER;
    7560     AssertMsgFailed(("Unexpected PAUSE exit. pVM=%p pVCpu=%p pMixedCtx=%p\n", pVM, pVCpu, pMixedCtx));
     7561    AssertMsgFailed(("Unexpected PAUSE exit. pVCpu=%p pMixedCtx=%p\n", pVCpu, pMixedCtx));
    75617562    return VERR_VMX_UNEXPECTED_EXIT_CODE;
    75627563}
     
    75677568 * threshold (VMX_EXIT_TPR_BELOW_THRESHOLD). Conditional VM-exit.
    75687569 */
    7569 static DECLCALLBACK(int) hmR0VmxExitTprBelowThreshold(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
     7570static DECLCALLBACK(int) hmR0VmxExitTprBelowThreshold(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
    75707571{
    75717572    VMX_VALIDATE_EXIT_HANDLER_PARAMS();
     
    75937594 *         recompiler.
    75947595 */
    7595 static DECLCALLBACK(int) hmR0VmxExitMovCRx(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
     7596static DECLCALLBACK(int) hmR0VmxExitMovCRx(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
    75967597{
    75977598    VMX_VALIDATE_EXIT_HANDLER_PARAMS();
     
    76017602    const RTGCUINTPTR uExitQualification = pVmxTransient->uExitQualification;
    76027603    const uint32_t uAccessType           = VMX_EXIT_QUALIFICATION_CRX_ACCESS(uExitQualification);
     7604    PVM pVM                              = pVCpu->CTX_SUFF(pVM);
    76037605    switch (uAccessType)
    76047606    {
     
    77217723 * VM-exit.
    77227724 */
    7723 static DECLCALLBACK(int) hmR0VmxExitIoInstr(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
     7725static DECLCALLBACK(int) hmR0VmxExitIoInstr(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
    77247726{
    77257727    VMX_VALIDATE_EXIT_HANDLER_PARAMS();
     
    77487750    const uint32_t cbSize  = s_aIOSize[uIOWidth];
    77497751    const uint32_t cbInstr = pVmxTransient->cbInstr;
     7752    PVM pVM                = pVCpu->CTX_SUFF(pVM);
    77507753    if (fIOString)
    77517754    {
     
    78587861
    78597862                        /* Inject #DB and get on with guest execution. */
    7860                         rc = hmR0VmxInjectXcptDB(pVM, pVCpu, pMixedCtx);
     7863                        rc = hmR0VmxInjectXcptDB(pVCpu, pMixedCtx);
    78617864                        AssertRCReturn(rc, rc);
    78627865                        break;
     
    78907893 * VM-exit.
    78917894 */
    7892 static DECLCALLBACK(int) hmR0VmxExitTaskSwitch(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
     7895static DECLCALLBACK(int) hmR0VmxExitTaskSwitch(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
    78937896{
    78947897    VMX_VALIDATE_EXIT_HANDLER_PARAMS();
     
    79307933 * VM-exit handler for monitor-trap-flag (VMX_EXIT_MTF). Conditional VM-exit.
    79317934 */
    7932 static DECLCALLBACK(int) hmR0VmxExitMtf(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
     7935static DECLCALLBACK(int) hmR0VmxExitMtf(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
    79337936{
    79347937    VMX_VALIDATE_EXIT_HANDLER_PARAMS();
     
    79457948 * VM-exit handler for APIC access (VMX_EXIT_APIC_ACCESS). Conditional VM-exit.
    79467949 */
    7947 static DECLCALLBACK(int) hmR0VmxExitApicAccess(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
     7950static DECLCALLBACK(int) hmR0VmxExitApicAccess(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
    79487951{
    79497952    VMX_VALIDATE_EXIT_HANDLER_PARAMS();
     
    79517954
    79527955    /* If this VM-exit occurred while delivering an event through the guest IDT, handle it accordingly. */
    7953     rc = hmR0VmxCheckExitDueToEventDelivery(pVM, pVCpu, pMixedCtx, pVmxTransient);
     7956    rc = hmR0VmxCheckExitDueToEventDelivery(pVCpu, pMixedCtx, pVmxTransient);
    79547957    if (RT_UNLIKELY(rc == VINF_VMX_DOUBLE_FAULT))
    79557958        return VINF_SUCCESS;
     
    79857988            GCPhys &= PAGE_BASE_GC_MASK;
    79867989            GCPhys += VMX_EXIT_QUALIFICATION_APIC_ACCESS_OFFSET(pVmxTransient->uExitQualification);
    7987             VBOXSTRICTRC rc2 = IOMMMIOPhysHandler(pVM, pVCpu, (uAccessType == VMX_APIC_ACCESS_TYPE_LINEAR_READ) ? 0 : X86_TRAP_PF_RW,
     7990            PVM pVM = pVCpu->CTX_SUFF(pVM);
     7991            VBOXSTRICTRC rc2 = IOMMMIOPhysHandler(pVM, pVCpu,
     7992                                                  (uAccessType == VMX_APIC_ACCESS_TYPE_LINEAR_READ) ? 0 : X86_TRAP_PF_RW,
    79887993                                                  CPUMCTX2CORE(pMixedCtx), GCPhys);
    79897994            rc = VBOXSTRICTRC_VAL(rc2);
     
    80158020 * VM-exit.
    80168021 */
    8017 static DECLCALLBACK(int) hmR0VmxExitMovDRx(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
     8022static DECLCALLBACK(int) hmR0VmxExitMovDRx(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
    80188023{
    80198024    VMX_VALIDATE_EXIT_HANDLER_PARAMS();
     
    80228027    if (CPUMIsGuestDebugStateActive(pVCpu))
    80238028    {
    8024         AssertMsgFailed(("Unexpected MOV DRx exit. pVM=%p pVCpu=%p pMixedCtx=%p\n", pVM, pVCpu, pMixedCtx));
     8029        AssertMsgFailed(("Unexpected MOV DRx exit. pVCpu=%p pMixedCtx=%p\n", pVCpu, pMixedCtx));
    80258030        return VERR_VMX_UNEXPECTED_EXIT_CODE;
    80268031    }
     
    80388043
    80398044        /* Save the host & load the guest debug state, restart execution of the MOV DRx instruction. */
     8045        PVM pVM = pVCpu->CTX_SUFF(pVM);
    80408046        rc = CPUMR0LoadGuestDebugState(pVM, pVCpu, pMixedCtx, true /* include DR6 */);
    80418047        AssertRC(rc);
     
    80648070    AssertRCReturn(rc, rc);
    80658071
     8072    PVM pVM = pVCpu->CTX_SUFF(pVM);
    80668073    if (VMX_EXIT_QUALIFICATION_DRX_DIRECTION(pVmxTransient->uExitQualification) == VMX_EXIT_QUALIFICATION_DRX_DIRECTION_WRITE)
    80678074    {
     
    80958102 * Conditional VM-exit.
    80968103 */
    8097 static DECLCALLBACK(int) hmR0VmxExitEptMisconfig(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
     8104static DECLCALLBACK(int) hmR0VmxExitEptMisconfig(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
    80988105{
    80998106    VMX_VALIDATE_EXIT_HANDLER_PARAMS();
    8100     Assert(pVM->hm.s.fNestedPaging);
     8107    Assert(pVCpu->CTX_SUFF(pVM)->hm.s.fNestedPaging);
    81018108
    81028109    /* If this VM-exit occurred while delivering an event through the guest IDT, handle it accordingly. */
    8103     int rc = hmR0VmxCheckExitDueToEventDelivery(pVM, pVCpu, pMixedCtx, pVmxTransient);
     8110    int rc = hmR0VmxCheckExitDueToEventDelivery(pVCpu, pMixedCtx, pVmxTransient);
    81048111    if (RT_UNLIKELY(rc == VINF_VMX_DOUBLE_FAULT))
    81058112        return VINF_SUCCESS;
     
    81278134     * weird case. See @bugref{6043}.
    81288135     */
     8136    PVM pVM = pVCpu->CTX_SUFF(pVM);
    81298137    VBOXSTRICTRC rc2 = PGMR0Trap0eHandlerNPMisconfig(pVM, pVCpu, PGMMODE_EPT, CPUMCTX2CORE(pMixedCtx), GCPhys, UINT32_MAX);
    81308138    Log(("EPT misconfig at %#RX64 RIP=%#RX64 rc=%d\n", GCPhys, pMixedCtx->rip, rc));
     
    81468154 * VM-exit.
    81478155 */
    8148 static DECLCALLBACK(int) hmR0VmxExitEptViolation(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
     8156static DECLCALLBACK(int) hmR0VmxExitEptViolation(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
    81498157{
    81508158    VMX_VALIDATE_EXIT_HANDLER_PARAMS();
    8151     Assert(pVM->hm.s.fNestedPaging);
     8159    Assert(pVCpu->CTX_SUFF(pVM)->hm.s.fNestedPaging);
    81528160
    81538161    /* If this VM-exit occurred while delivering an event through the guest IDT, handle it accordingly. */
    8154     int rc = hmR0VmxCheckExitDueToEventDelivery(pVM, pVCpu, pMixedCtx, pVmxTransient);
     8162    int rc = hmR0VmxCheckExitDueToEventDelivery(pVCpu, pMixedCtx, pVmxTransient);
    81558163    if (RT_UNLIKELY(rc == VINF_VMX_DOUBLE_FAULT))
    81568164        return VINF_SUCCESS;
     
    81908198
    81918199    /* Handle the pagefault trap for the nested shadow table. */
     8200    PVM pVM = pVCpu->CTX_SUFF(pVM);
    81928201    rc = PGMR0Trap0eHandlerNestedPaging(pVM, pVCpu, PGMMODE_EPT, uErrorCode, CPUMCTX2CORE(pMixedCtx), GCPhys);
    81938202    TRPMResetTrap(pVCpu);
     
    82168225 * VM-exit exception handler for #MF (Math Fault: floating point exception).
    82178226 */
    8218 static DECLCALLBACK(int) hmR0VmxExitXcptMF(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
     8227static DECLCALLBACK(int) hmR0VmxExitXcptMF(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
    82198228{
    82208229    VMX_VALIDATE_EXIT_XCPT_HANDLER_PARAMS();
     
    82308239        return VERR_EM_INTERPRETER;
    82318240    }
    8232     rc = hmR0VmxInjectEventVmcs(pVM, pVCpu, pMixedCtx,
     8241    rc = hmR0VmxInjectEventVmcs(pVCpu, pMixedCtx,
    82338242                                 VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(pVmxTransient->uExitIntrInfo),
    82348243                                 pVmxTransient->cbInstr, pVmxTransient->uExitIntrErrorCode);
     
    82418250 * VM-exit exception handler for #BP (Breakpoint exception).
    82428251 */
    8243 static DECLCALLBACK(int) hmR0VmxExitXcptBP(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
     8252static DECLCALLBACK(int) hmR0VmxExitXcptBP(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
    82448253{
    82458254    VMX_VALIDATE_EXIT_XCPT_HANDLER_PARAMS();
     
    82518260    STAM_COUNTER_INC(&pVCpu->hm.s.StatExitGuestBP);
    82528261
     8262    PVM pVM = pVCpu->CTX_SUFF(pVM);
    82538263    rc = DBGFRZTrap03Handler(pVM, pVCpu, CPUMCTX2CORE(pMixedCtx));
    82548264    if (rc == VINF_EM_RAW_GUEST_TRAP)
     
    82598269        AssertRCReturn(rc, rc);
    82608270
    8261         rc = hmR0VmxInjectEventVmcs(pVM, pVCpu, pMixedCtx,
     8271        rc = hmR0VmxInjectEventVmcs(pVCpu, pMixedCtx,
    82628272                                    VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(pVmxTransient->uExitIntrInfo),
    82638273                                    pVmxTransient->cbInstr, pVmxTransient->uExitIntrErrorCode);
     
    82738283 * VM-exit exception handler for #DB (Debug exception).
    82748284 */
    8275 static DECLCALLBACK(int) hmR0VmxExitXcptDB(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
     8285static DECLCALLBACK(int) hmR0VmxExitXcptDB(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
    82768286{
    82778287    VMX_VALIDATE_EXIT_XCPT_HANDLER_PARAMS();
     
    82868296    uDR6         |= (pVmxTransient->uExitQualification
    82878297                     & (X86_DR6_B0 | X86_DR6_B1 | X86_DR6_B2 | X86_DR6_B3 | X86_DR6_BD | X86_DR6_BS));
     8298    PVM pVM = pVCpu->CTX_SUFF(pVM);
    82888299    rc = DBGFRZTrap01Handler(pVM, pVCpu, CPUMCTX2CORE(pMixedCtx), uDR6);
    82898300    STAM_COUNTER_INC(&pVCpu->hm.s.StatExitGuestDB);
     
    83108321        rc |= hmR0VmxReadExitInstrLenVmcs(pVCpu, pVmxTransient);
    83118322        rc |= hmR0VmxReadExitIntrErrorCodeVmcs(pVCpu, pVmxTransient);
    8312         rc |= hmR0VmxInjectEventVmcs(pVM, pVCpu, pMixedCtx,
    8313                                  VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(pVmxTransient->uExitIntrInfo),
    8314                                  pVmxTransient->cbInstr, pVmxTransient->uExitIntrErrorCode);
     8323        rc |= hmR0VmxInjectEventVmcs(pVCpu, pMixedCtx,
     8324                                     VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(pVmxTransient->uExitIntrInfo),
     8325                                     pVmxTransient->cbInstr, pVmxTransient->uExitIntrErrorCode);
    83158326        AssertRCReturn(rc,rc);
    83168327        return rc;
     
    83258336 * point exception).
    83268337 */
    8327 static DECLCALLBACK(int) hmR0VmxExitXcptNM(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
     8338static DECLCALLBACK(int) hmR0VmxExitXcptNM(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
    83288339{
    83298340    VMX_VALIDATE_EXIT_XCPT_HANDLER_PARAMS();
     
    83388349
    83398350    /* Lazy FPU loading; Load the guest-FPU state transparently and continue execution of the guest. */
     8351    PVM pVM = pVCpu->CTX_SUFF(pVM);
    83408352    rc = CPUMR0LoadGuestFPU(pVM, pVCpu, pMixedCtx);
    83418353    if (rc == VINF_SUCCESS)
     
    83518363    rc = hmR0VmxReadExitIntrInfoVmcs(pVCpu, pVmxTransient);
    83528364    AssertRCReturn(rc, rc);
    8353     rc = hmR0VmxInjectEventVmcs(pVM, pVCpu, pMixedCtx,
    8354                                  VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(pVmxTransient->uExitIntrInfo),
    8355                                  pVmxTransient->cbInstr, 0 /* error code */);
     8365    rc = hmR0VmxInjectEventVmcs(pVCpu, pMixedCtx,
     8366                                VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(pVmxTransient->uExitIntrInfo),
     8367                                pVmxTransient->cbInstr, 0 /* error code */);
    83568368    AssertRCReturn(rc, rc);
    83578369    STAM_COUNTER_INC(&pVCpu->hm.s.StatExitGuestNM);
     
    83658377 * @remarks Requires pVmxTransient->uExitIntrInfo to be up-to-date.
    83668378 */
    8367 static DECLCALLBACK(int) hmR0VmxExitXcptGP(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
     8379static DECLCALLBACK(int) hmR0VmxExitXcptGP(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
    83688380{
    83698381    VMX_VALIDATE_EXIT_XCPT_HANDLER_PARAMS();
     
    83808392        rc |= hmR0VmxSaveGuestRip(pVCpu, pMixedCtx);
    83818393        Log(("#GP Gst: RIP %#RX64\n", pMixedCtx->rip));
    8382         rc |= hmR0VmxInjectEventVmcs(pVM, pVCpu, pMixedCtx,
    8383                                         VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(pVmxTransient->uExitIntrInfo),
    8384                                         pVmxTransient->cbInstr, pVmxTransient->uExitIntrErrorCode);
     8394        rc |= hmR0VmxInjectEventVmcs(pVCpu, pMixedCtx,
     8395                                     VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(pVmxTransient->uExitIntrInfo),
     8396                                     pVmxTransient->cbInstr, pVmxTransient->uExitIntrErrorCode);
    83858397        AssertRCReturn(rc, rc);
    83868398        return rc;
     
    83938405
    83948406    Assert(CPUMIsGuestInRealModeEx(pMixedCtx));
    8395     Assert(!pVM->hm.s.vmx.fUnrestrictedGuest);
     8407    Assert(!pVCpu->CTX_SUFF(pVM)->hm.s.vmx.fUnrestrictedGuest);
    83968408
    83978409    /* EMInterpretDisasCurrent() requires a lot of the state, save the entire state. */
     
    84018413    PDISCPUSTATE pDis = &pVCpu->hm.s.DisState;
    84028414    unsigned int cbOp = 0;
     8415    PVM pVM           = pVCpu->CTX_SUFF(pVM);
    84038416    rc = EMInterpretDisasCurrent(pVM, pVCpu, pDis, &cbOp);
    84048417    if (RT_SUCCESS(rc))
     
    85618574            {
    85628575                uint16_t uVector = pDis->Param1.uValue & 0xff;
    8563                 rc = hmR0VmxInjectIntN(pVM, pVCpu, pMixedCtx, uVector, pDis->cbInstr);
     8576                rc = hmR0VmxInjectIntN(pVCpu, pMixedCtx, uVector, pDis->cbInstr);
    85648577                AssertRCReturn(rc, rc);
    85658578                STAM_COUNTER_INC(&pVCpu->hm.s.StatExitInt);
     
    85718584                if (pMixedCtx->eflags.Bits.u1OF)
    85728585                {
    8573                     rc = hmR0VmxInjectXcptOF(pVM, pVCpu, pMixedCtx, pDis->cbInstr);
     8586                    rc = hmR0VmxInjectXcptOF(pVCpu, pMixedCtx, pDis->cbInstr);
    85748587                    STAM_COUNTER_INC(&pVCpu->hm.s.StatExitInt);
    85758588                }
     
    86058618 *          VMX transient structure to be up-to-date.
    86068619 */
    8607 static DECLCALLBACK(int) hmR0VmxExitXcptGeneric(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
     8620static DECLCALLBACK(int) hmR0VmxExitXcptGeneric(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
    86088621{
    86098622    VMX_VALIDATE_EXIT_XCPT_HANDLER_PARAMS();
     
    86118624    /* Re-inject the exception into the guest. This cannot be a double-fault condition which would have been handled in
    86128625       hmR0VmxCheckExitDueToEventDelivery(). */
    8613     int rc = hmR0VmxInjectEventVmcs(pVM, pVCpu, pMixedCtx,
     8626    int rc = hmR0VmxInjectEventVmcs(pVCpu, pMixedCtx,
    86148627                                    VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(pVmxTransient->uExitIntrInfo),
    86158628                                    pVmxTransient->cbInstr, pVmxTransient->uExitIntrErrorCode);
     
    86228635 * VM-exit exception handler for #PF (Page-fault exception).
    86238636 */
    8624 static DECLCALLBACK(int) hmR0VmxExitXcptPF(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
     8637static DECLCALLBACK(int) hmR0VmxExitXcptPF(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
    86258638{
    86268639    VMX_VALIDATE_EXIT_XCPT_HANDLER_PARAMS();
    8627 
     8640    PVM pVM = pVCpu->CTX_SUFF(pVM);
    86288641    int rc = hmR0VmxReadExitQualificationVmcs(pVCpu, pVmxTransient);
    86298642    rc    |= hmR0VmxReadExitIntrInfoVmcs(pVCpu, pVmxTransient);
     
    86388651        {
    86398652            pMixedCtx->cr2 = pVmxTransient->uExitQualification;
    8640             rc = hmR0VmxInjectEventVmcs(pVM, pVCpu, pMixedCtx,
     8653            rc = hmR0VmxInjectEventVmcs(pVCpu, pMixedCtx,
    86418654                                        VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(pVmxTransient->uExitIntrInfo),
    86428655                                        pVmxTransient->cbInstr, pVmxTransient->uExitIntrErrorCode);
     
    86478660            /* A guest page-fault occurred during delivery of a page-fault. Inject #DF. */
    86488661            Assert(!pVCpu->hm.s.Event.fPending);
    8649             rc = hmR0VmxInjectXcptDF(pVM, pVCpu, pMixedCtx);
     8662            rc = hmR0VmxInjectXcptDF(pVCpu, pMixedCtx);
    86508663        }
    86518664        STAM_COUNTER_INC(&pVCpu->hm.s.StatExitGuestPF);
     
    87208733            TRPMResetTrap(pVCpu);
    87218734            pMixedCtx->cr2 = pVmxTransient->uExitQualification;
    8722             rc = hmR0VmxInjectEventVmcs(pVM, pVCpu, pMixedCtx,
     8735            rc = hmR0VmxInjectEventVmcs(pVCpu, pMixedCtx,
    87238736                                        VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(pVmxTransient->uExitIntrInfo),
    87248737                                        pVmxTransient->cbInstr, uGstErrorCode);
     
    87318744            TRPMResetTrap(pVCpu);
    87328745            Log(("#PF: Injecting #DF\n"));
    8733             rc = hmR0VmxInjectXcptDF(pVM, pVCpu, pMixedCtx);
     8746            rc = hmR0VmxInjectXcptDF(pVCpu, pMixedCtx);
    87348747        }
    87358748        STAM_COUNTER_INC(&pVCpu->hm.s.StatExitGuestPF);
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