VirtualBox

Ignore:
Timestamp:
Aug 11, 2010 1:41:52 PM (14 years ago)
Author:
vboxsync
Message:

HWACCM: burn fix / VBOXSTRICTRC cleanup - a bit risky...

File:
1 edited

Legend:

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

    r31565 r31569  
    7070*   Local Functions                                                            *
    7171*******************************************************************************/
    72 static void VMXR0ReportWorldSwitchError(PVM pVM, PVMCPU pVCpu, int rc, PCPUMCTX pCtx);
     72static void VMXR0ReportWorldSwitchError(PVM pVM, PVMCPU pVCpu, VBOXSTRICTRC rc, PCPUMCTX pCtx);
    7373static void vmxR0SetupTLBEPT(PVM pVM, PVMCPU pVCpu);
    7474static void vmxR0SetupTLBVPID(PVM pVM, PVMCPU pVCpu);
     
    726726 * Injects an event (trap or external interrupt)
    727727 *
    728  * @returns VBox status code.
     728 * @returns VBox status code.  Note that it may return VINF_EM_RESET to
     729 *          indicate a triple fault when injecting X86_XCPT_DF.
     730 *
    729731 * @param   pVM         The VM to operate on.
    730732 * @param   pVCpu       The VMCPU to operate on.
     
    22632265
    22642266    VBOXSTRICTRC rc = VINF_SUCCESS;
     2267    int         rc2;
    22652268    RTGCUINTREG val;
    22662269    RTGCUINTREG exitReason = (RTGCUINTREG)VMX_EXIT_INVALID;
     
    22992302        RTCCUINTREG val2;
    23002303
    2301         rc = VMXReadVMCS(VMX_VMCS_CTRL_PIN_EXEC_CONTROLS, &val2);
    2302         AssertRC(rc);
     2304        rc2 = VMXReadVMCS(VMX_VMCS_CTRL_PIN_EXEC_CONTROLS, &val2);
     2305        AssertRC(rc2);
    23032306        Log2(("VMX_VMCS_CTRL_PIN_EXEC_CONTROLS = %08x\n", val2));
    23042307
     
    23112314            Log(("Invalid VMX_VMCS_CTRL_PIN_EXEC_CONTROLS: one\n"));
    23122315
    2313         rc = VMXReadVMCS(VMX_VMCS_CTRL_PROC_EXEC_CONTROLS, &val2);
    2314         AssertRC(rc);
     2316        rc2 = VMXReadVMCS(VMX_VMCS_CTRL_PROC_EXEC_CONTROLS, &val2);
     2317        AssertRC(rc2);
    23152318        Log2(("VMX_VMCS_CTRL_PROC_EXEC_CONTROLS = %08x\n", val2));
    23162319
     
    23292332            Log(("Invalid VMX_VMCS_CTRL_PROC_EXEC_CONTROLS: one\n"));
    23302333
    2331         rc = VMXReadVMCS(VMX_VMCS_CTRL_ENTRY_CONTROLS, &val2);
    2332         AssertRC(rc);
     2334        rc2 = VMXReadVMCS(VMX_VMCS_CTRL_ENTRY_CONTROLS, &val2);
     2335        AssertRC(rc2);
    23332336        Log2(("VMX_VMCS_CTRL_ENTRY_CONTROLS = %08x\n", val2));
    23342337
     
    23412344            Log(("Invalid VMX_VMCS_CTRL_ENTRY_CONTROLS: one\n"));
    23422345
    2343         rc = VMXReadVMCS(VMX_VMCS_CTRL_EXIT_CONTROLS, &val2);
    2344         AssertRC(rc);
     2346        rc2 = VMXReadVMCS(VMX_VMCS_CTRL_EXIT_CONTROLS, &val2);
     2347        AssertRC(rc2);
    23452348        Log2(("VMX_VMCS_CTRL_EXIT_CONTROLS = %08x\n", val2));
    23462349
     
    23932396            VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS);
    23942397            /* Irq inhibition is no longer active; clear the corresponding VMX state. */
    2395             rc = VMXWriteVMCS(VMX_VMCS32_GUEST_INTERRUPTIBILITY_STATE,   0);
    2396             AssertRC(rc);
     2398            rc2 = VMXWriteVMCS(VMX_VMCS32_GUEST_INTERRUPTIBILITY_STATE,   0);
     2399            AssertRC(rc2);
    23972400        }
    23982401    }
     
    24002403    {
    24012404        /* Irq inhibition is no longer active; clear the corresponding VMX state. */
    2402         rc = VMXWriteVMCS(VMX_VMCS32_GUEST_INTERRUPTIBILITY_STATE,   0);
    2403         AssertRC(rc);
     2405        rc2 = VMXWriteVMCS(VMX_VMCS32_GUEST_INTERRUPTIBILITY_STATE,   0);
     2406        AssertRC(rc2);
    24042407    }
    24052408
     
    24252428        {
    24262429            rc = PGMSyncCR3(pVCpu, pCtx->cr0, pCtx->cr3, pCtx->cr4, VMCPU_FF_ISSET(pVCpu, VMCPU_FF_PGM_SYNC_CR3));
    2427             AssertRC(rc);
    24282430            if (rc != VINF_SUCCESS)
    24292431            {
    2430                 Log(("Pending pool sync is forcing us back to ring 3; rc=%d\n", rc));
     2432                AssertRC(VBOXSTRICTRC_VAL(rc));
     2433                Log(("Pending pool sync is forcing us back to ring 3; rc=%d\n", VBOXSTRICTRC_VAL(rc)));
    24312434                goto end;
    24322435            }
     
    25042507        bool    fPending;
    25052508
    2506         int rc2 = PDMApicGetTPR(pVCpu, &u8LastTPR, &fPending);
     2509        rc2 = PDMApicGetTPR(pVCpu, &u8LastTPR, &fPending);
    25072510        AssertRC(rc2);
    25082511        /* The TPR can be found at offset 0x80 in the APIC mmio page. */
     
    25162519         */
    25172520        rc  = VMXWriteVMCS(VMX_VMCS_CTRL_TPR_THRESHOLD, (fPending) ? (u8LastTPR >> 4) : 0);     /* cr8 bits 3-0 correspond to bits 7-4 of the task priority mmio register. */
    2518         AssertRC(rc);
     2521        AssertRC(VBOXSTRICTRC_VAL(rc));
    25192522
    25202523        if (pVM->hwaccm.s.fTPRPatchingActive)
     
    26162619    /* Non-register state Guest Context */
    26172620    /** @todo change me according to cpu state */
    2618     rc = VMXWriteVMCS(VMX_VMCS32_GUEST_ACTIVITY_STATE,           VMX_CMS_GUEST_ACTIVITY_ACTIVE);
    2619     AssertRC(rc);
     2621    rc2 = VMXWriteVMCS(VMX_VMCS32_GUEST_ACTIVITY_STATE,           VMX_CMS_GUEST_ACTIVITY_ACTIVE);
     2622    AssertRC(rc2);
    26202623
    26212624    /** Set TLB flush state as checked until we return from the world switch. */
     
    27052708
    27062709    /* Investigate why there was a VM-exit. */
    2707     rc  = VMXReadCachedVMCS(VMX_VMCS32_RO_EXIT_REASON, &exitReason);
     2710    rc2  = VMXReadCachedVMCS(VMX_VMCS32_RO_EXIT_REASON, &exitReason);
    27082711    STAM_COUNTER_INC(&pVCpu->hwaccm.s.paStatExitReasonR0[exitReason & MASK_EXITREASON_STAT]);
    27092712
    27102713    exitReason &= 0xffff;   /* bit 0-15 contain the exit code. */
    2711     rc |= VMXReadCachedVMCS(VMX_VMCS32_RO_VM_INSTR_ERROR, &instrError);
    2712     rc |= VMXReadCachedVMCS(VMX_VMCS32_RO_EXIT_INSTR_LENGTH, &cbInstr);
    2713     rc |= VMXReadCachedVMCS(VMX_VMCS32_RO_EXIT_INTERRUPTION_INFO, &intInfo);
     2714    rc2 |= VMXReadCachedVMCS(VMX_VMCS32_RO_VM_INSTR_ERROR, &instrError);
     2715    rc2 |= VMXReadCachedVMCS(VMX_VMCS32_RO_EXIT_INSTR_LENGTH, &cbInstr);
     2716    rc2 |= VMXReadCachedVMCS(VMX_VMCS32_RO_EXIT_INTERRUPTION_INFO, &intInfo);
    27142717    /* might not be valid; depends on VMX_EXIT_INTERRUPTION_INFO_ERROR_CODE_IS_VALID. */
    2715     rc |= VMXReadCachedVMCS(VMX_VMCS32_RO_EXIT_INTERRUPTION_ERRCODE, &errCode);
    2716     rc |= VMXReadCachedVMCS(VMX_VMCS32_RO_EXIT_INSTR_INFO, &instrInfo);
    2717     rc |= VMXReadCachedVMCS(VMX_VMCS_RO_EXIT_QUALIFICATION, &exitQualification);
    2718     AssertRC(rc);
     2718    rc2 |= VMXReadCachedVMCS(VMX_VMCS32_RO_EXIT_INTERRUPTION_ERRCODE, &errCode);
     2719    rc2 |= VMXReadCachedVMCS(VMX_VMCS32_RO_EXIT_INSTR_INFO, &instrInfo);
     2720    rc2 |= VMXReadCachedVMCS(VMX_VMCS_RO_EXIT_QUALIFICATION, &exitQualification);
     2721    AssertRC(rc2);
    27192722
    27202723    /* Sync back the guest state */
    2721     rc = VMXR0SaveGuestState(pVM, pVCpu, pCtx);
    2722     AssertRC(rc);
     2724    rc2 = VMXR0SaveGuestState(pVM, pVCpu, pCtx);
     2725    AssertRC(rc2);
    27232726
    27242727    /* Note! NOW IT'S SAFE FOR LOGGING! */
     
    27272730
    27282731    /* Check if an injected event was interrupted prematurely. */
    2729     rc = VMXReadCachedVMCS(VMX_VMCS32_RO_IDT_INFO,            &val);
    2730     AssertRC(rc);
     2732    rc2 = VMXReadCachedVMCS(VMX_VMCS32_RO_IDT_INFO,            &val);
     2733    AssertRC(rc2);
    27312734    pVCpu->hwaccm.s.Event.intInfo = VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(val);
    27322735    if (    VMX_EXIT_INTERRUPTION_INFO_VALID(pVCpu->hwaccm.s.Event.intInfo)
     
    27412744        if (VMX_EXIT_INTERRUPTION_INFO_ERROR_CODE_IS_VALID(pVCpu->hwaccm.s.Event.intInfo))
    27422745        {
    2743             rc = VMXReadCachedVMCS(VMX_VMCS32_RO_IDT_ERRCODE, &val);
    2744             AssertRC(rc);
     2746            rc2 = VMXReadCachedVMCS(VMX_VMCS32_RO_IDT_ERRCODE, &val);
     2747            AssertRC(rc2);
    27452748            pVCpu->hwaccm.s.Event.errCode  = val;
    27462749            Log(("Pending inject %RX64 at %RGv exit=%08x intInfo=%08x exitQualification=%RGv pending error=%RX64\n", pVCpu->hwaccm.s.Event.intInfo, (RTGCPTR)pCtx->rip, exitReason, intInfo, exitQualification, val));
     
    27752778        &&  u8LastTPR != pVCpu->hwaccm.s.vmx.pVAPIC[0x80])
    27762779    {
    2777         rc = PDMApicSetTPR(pVCpu, pVCpu->hwaccm.s.vmx.pVAPIC[0x80]);
    2778         AssertRC(rc);
     2780        rc2 = PDMApicSetTPR(pVCpu, pVCpu->hwaccm.s.vmx.pVAPIC[0x80]);
     2781        AssertRC(rc2);
    27792782    }
    27802783
     
    27822785
    27832786    /* Some cases don't need a complete resync of the guest CPU state; handle them here. */
     2787    Assert(rc == VINF_SUCCESS); /* might consider VERR_IPE_UNINITIALIZED_STATUS here later... */
    27842788    switch (exitReason)
    27852789    {
     
    28432847                Log(("Forward #NM fault to the guest\n"));
    28442848                STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitGuestNM);
    2845                 rc = VMXR0InjectEvent(pVM, pVCpu, pCtx, VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(intInfo), cbInstr, 0);
    2846                 AssertRC(rc);
     2849                rc2 = VMXR0InjectEvent(pVM, pVCpu, pCtx, VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(intInfo), cbInstr, 0);
     2850                AssertRC(rc2);
    28472851                STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit2Sub3, y3);
    28482852                goto ResumeExecution;
     
    28642868                    /* Now we must update CR2. */
    28652869                    pCtx->cr2 = exitQualification;
    2866                     rc = VMXR0InjectEvent(pVM, pVCpu, pCtx, VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(intInfo), cbInstr, errCode);
    2867                     AssertRC(rc);
     2870                    rc2 = VMXR0InjectEvent(pVM, pVCpu, pCtx, VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(intInfo), cbInstr, errCode);
     2871                    AssertRC(rc2);
    28682872
    28692873                    STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit2Sub3, y3);
     
    29232927                    {
    29242928                        Log(("Enable VT-x virtual APIC access filtering\n"));
    2925                         rc = IOMMMIOMapMMIOHCPage(pVM, GCPhysApicBase, pVM->hwaccm.s.vmx.pAPICPhys, X86_PTE_RW | X86_PTE_P);
    2926                         AssertRC(rc);
     2929                        rc2 = IOMMMIOMapMMIOHCPage(pVM, GCPhysApicBase, pVM->hwaccm.s.vmx.pAPICPhys, X86_PTE_RW | X86_PTE_P);
     2930                        AssertRC(rc2);
    29272931                    }
    29282932                }
     
    29302934                /* Forward it to our trap handler first, in case our shadow pages are out of sync. */
    29312935                rc = PGMTrap0eHandler(pVCpu, errCode, CPUMCTX2CORE(pCtx), (RTGCPTR)exitQualification);
    2932                 Log2(("PGMTrap0eHandler %RGv returned %Rrc\n", (RTGCPTR)pCtx->rip, rc));
     2936                Log2(("PGMTrap0eHandler %RGv returned %Rrc\n", (RTGCPTR)pCtx->rip, VBOXSTRICTRC_VAL(rc)));
    29332937
    29342938                if (rc == VINF_SUCCESS)
     
    29562960                    /* Now we must update CR2. */
    29572961                    pCtx->cr2 = exitQualification;
    2958                     rc = VMXR0InjectEvent(pVM, pVCpu, pCtx, VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(intInfo), cbInstr, errCode);
    2959                     AssertRC(rc);
     2962                    rc2 = VMXR0InjectEvent(pVM, pVCpu, pCtx, VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(intInfo), cbInstr, errCode);
     2963                    AssertRC(rc2);
    29602964
    29612965                    STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit2Sub3, y3);
     
    29642968#ifdef VBOX_STRICT
    29652969                if (rc != VINF_EM_RAW_EMULATE_INSTR && rc != VINF_EM_RAW_EMULATE_IO_BLOCK)
    2966                     Log2(("PGMTrap0eHandler failed with %d\n", rc));
     2970                    Log2(("PGMTrap0eHandler failed with %d\n", VBOXSTRICTRC_VAL(rc)));
    29672971#endif
    29682972                /* Need to go back to the recompiler to emulate the instruction. */
     
    29822986                }
    29832987                Log(("Trap %x at %04X:%RGv\n", vector, pCtx->cs, (RTGCPTR)pCtx->rip));
    2984                 rc = VMXR0InjectEvent(pVM, pVCpu, pCtx, VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(intInfo), cbInstr, errCode);
    2985                 AssertRC(rc);
     2988                rc2 = VMXR0InjectEvent(pVM, pVCpu, pCtx, VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(intInfo), cbInstr, errCode);
     2989                AssertRC(rc2);
    29862990
    29872991                STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit2Sub3, y3);
     
    30273031
    30283032                    /* Resync DR7 */
    3029                     rc = VMXWriteVMCS64(VMX_VMCS64_GUEST_DR7, pCtx->dr[7]);
    3030                     AssertRC(rc);
     3033                    rc2 = VMXWriteVMCS64(VMX_VMCS64_GUEST_DR7, pCtx->dr[7]);
     3034                    AssertRC(rc2);
    30313035
    30323036                    Log(("Trap %x (debug) at %RGv exit qualification %RX64 dr6=%x dr7=%x\n", vector, (RTGCPTR)pCtx->rip, exitQualification, (uint32_t)pCtx->dr[6], (uint32_t)pCtx->dr[7]));
    3033                     rc = VMXR0InjectEvent(pVM, pVCpu, pCtx, VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(intInfo), cbInstr, errCode);
    3034                     AssertRC(rc);
     3037                    rc2 = VMXR0InjectEvent(pVM, pVCpu, pCtx, VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(intInfo), cbInstr, errCode);
     3038                    AssertRC(rc2);
    30353039
    30363040                    STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit2Sub3, y3);
     
    30383042                }
    30393043                /* Return to ring 3 to deal with the debug exit code. */
    3040                 Log(("Debugger hardware BP at %04x:%RGv (rc=%Rrc)\n", pCtx->cs, pCtx->rip, rc));
     3044                Log(("Debugger hardware BP at %04x:%RGv (rc=%Rrc)\n", pCtx->cs, pCtx->rip, VBOXSTRICTRC_VAL(rc)));
    30413045                break;
    30423046            }
     
    30483052                {
    30493053                    Log(("Guest #BP at %04x:%RGv\n", pCtx->cs, pCtx->rip));
    3050                     rc = VMXR0InjectEvent(pVM, pVCpu, pCtx, VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(intInfo), cbInstr, errCode);
    3051                     AssertRC(rc);
     3054                    rc2 = VMXR0InjectEvent(pVM, pVCpu, pCtx, VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(intInfo), cbInstr, errCode);
     3055                    AssertRC(rc2);
    30523056                    STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit2Sub3, y3);
    30533057                    goto ResumeExecution;
     
    30583062                    goto ResumeExecution;
    30593063                }
    3060                 Log(("Debugger BP at %04x:%RGv (rc=%Rrc)\n", pCtx->cs, pCtx->rip, rc));
     3064                Log(("Debugger BP at %04x:%RGv (rc=%Rrc)\n", pCtx->cs, pCtx->rip, VBOXSTRICTRC_VAL(rc)));
    30613065                break;
    30623066            }
     
    30743078                {
    30753079                    Log(("Trap %x at %04X:%RGv errorCode=%RGv\n", vector, pCtx->cs, (RTGCPTR)pCtx->rip, errCode));
    3076                     rc = VMXR0InjectEvent(pVM, pVCpu, pCtx, VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(intInfo), cbInstr, errCode);
    3077                     AssertRC(rc);
     3080                    rc2 = VMXR0InjectEvent(pVM, pVCpu, pCtx, VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(intInfo), cbInstr, errCode);
     3081                    AssertRC(rc2);
    30783082                    STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit2Sub3, y3);
    30793083                    goto ResumeExecution;
     
    30843088                LogFlow(("Real mode X86_XCPT_GP instruction emulation at %x:%RGv\n", pCtx->cs, (RTGCPTR)pCtx->rip));
    30853089
    3086                 rc = EMInterpretDisasOne(pVM, pVCpu, CPUMCTX2CORE(pCtx), pDis, &cbOp);
    3087                 if (RT_SUCCESS(rc))
     3090                rc2 = EMInterpretDisasOne(pVM, pVCpu, CPUMCTX2CORE(pCtx), pDis, &cbOp);
     3091                if (RT_SUCCESS(rc2))
    30883092                {
    30893093                    bool fUpdateRIP = true;
    30903094
     3095                    rc = VINF_SUCCESS;
    30913096                    Assert(cbOp == pDis->opsize);
    30923097                    switch (pDis->pCurInstr->opcode)
     
    31013106                        EMSetInhibitInterruptsPC(pVCpu, pCtx->rip + pDis->opsize);
    31023107                        Assert(VMCPU_FF_ISSET(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS));
    3103                         rc = VMXWriteVMCS(VMX_VMCS32_GUEST_INTERRUPTIBILITY_STATE, VMX_VMCS_GUEST_INTERRUPTIBILITY_STATE_BLOCK_STI);
    3104                         AssertRC(rc);
     3108                        rc2 = VMXWriteVMCS(VMX_VMCS32_GUEST_INTERRUPTIBILITY_STATE, VMX_VMCS_GUEST_INTERRUPTIBILITY_STATE_BLOCK_STI);
     3109                        AssertRC(rc2);
    31053110                        STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitSti);
    31063111                        break;
     
    31313136                        }
    31323137
    3133                         rc = SELMToFlatEx(pVM, DIS_SELREG_SS, CPUMCTX2CORE(pCtx), pCtx->esp & uMask, 0, &GCPtrStack);
    3134                         if (RT_FAILURE(rc))
     3138                        rc2 = SELMToFlatEx(pVM, DIS_SELREG_SS, CPUMCTX2CORE(pCtx), pCtx->esp & uMask, 0, &GCPtrStack);
     3139                        if (RT_FAILURE(rc2))
    31353140                        {
    31363141                            rc = VERR_EM_INTERPRETER;
     
    31383143                        }
    31393144                        eflags.u = 0;
    3140                         rc = PGMPhysRead(pVM, (RTGCPHYS)GCPtrStack, &eflags.u, cbParm);
    3141                         if (RT_FAILURE(rc))
     3145                        rc2 = PGMPhysRead(pVM, (RTGCPHYS)GCPtrStack, &eflags.u, cbParm);
     3146                        if (RT_FAILURE(rc2))
    31423147                        {
    31433148                            rc = VERR_EM_INTERPRETER;
     
    31733178                        }
    31743179
    3175                         rc = SELMToFlatEx(pVM, DIS_SELREG_SS, CPUMCTX2CORE(pCtx), (pCtx->esp - cbParm) & uMask, 0, &GCPtrStack);
    3176                         if (RT_FAILURE(rc))
     3180                        rc2 = SELMToFlatEx(pVM, DIS_SELREG_SS, CPUMCTX2CORE(pCtx), (pCtx->esp - cbParm) & uMask, 0, &GCPtrStack);
     3181                        if (RT_FAILURE(rc2))
    31773182                        {
    31783183                            rc = VERR_EM_INTERPRETER;
     
    31843189                        eflags.Bits.u1VM = 0;
    31853190
    3186                         rc = PGMPhysWrite(pVM, (RTGCPHYS)GCPtrStack, &eflags.u, cbParm);
    3187                         if (RT_FAILURE(rc))
     3191                        rc2 = PGMPhysWrite(pVM, (RTGCPHYS)GCPtrStack, &eflags.u, cbParm);
     3192                        if (RT_FAILURE(rc2))
    31883193                        {
    31893194                            rc = VERR_EM_INTERPRETER;
     
    32093214                        }
    32103215
    3211                         rc = SELMToFlatEx(pVM, DIS_SELREG_SS, CPUMCTX2CORE(pCtx), pCtx->esp & uMask, 0, &GCPtrStack);
    3212                         if (RT_FAILURE(rc))
     3216                        rc2 = SELMToFlatEx(pVM, DIS_SELREG_SS, CPUMCTX2CORE(pCtx), pCtx->esp & uMask, 0, &GCPtrStack);
     3217                        if (RT_FAILURE(rc2))
    32133218                        {
    32143219                            rc = VERR_EM_INTERPRETER;
    32153220                            break;
    32163221                        }
    3217                         rc = PGMPhysRead(pVM, (RTGCPHYS)GCPtrStack, &aIretFrame[0], sizeof(aIretFrame));
    3218                         if (RT_FAILURE(rc))
     3222                        rc2 = PGMPhysRead(pVM, (RTGCPHYS)GCPtrStack, &aIretFrame[0], sizeof(aIretFrame));
     3223                        if (RT_FAILURE(rc2))
    32193224                        {
    32203225                            rc = VERR_EM_INTERPRETER;
     
    32433248
    32443249                        rc = VMXR0InjectEvent(pVM, pVCpu, pCtx, intInfo2, cbOp, 0);
    3245                         AssertRC(rc);
     3250                        AssertRC(VBOXSTRICTRC_VAL(rc));
    32463251                        fUpdateRIP = false;
    32473252                        STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitInt);
     
    32613266
    32623267                            rc = VMXR0InjectEvent(pVM, pVCpu, pCtx, intInfo2, cbOp, 0);
    3263                             AssertRC(rc);
     3268                            AssertRC(VBOXSTRICTRC_VAL(rc));
    32643269                            fUpdateRIP = false;
    32653270                            STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitInt);
     
    32783283
    32793284                        rc = VMXR0InjectEvent(pVM, pVCpu, pCtx, intInfo2, cbOp, 0);
    3280                         AssertRC(rc);
     3285                        AssertRC(VBOXSTRICTRC_VAL(rc));
    32813286                        fUpdateRIP = false;
    32823287                        STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitInt);
     
    33053310                    rc = VERR_EM_INTERPRETER;
    33063311
    3307                 AssertMsg(rc == VERR_EM_INTERPRETER || rc == VINF_PGM_CHANGE_MODE || rc == VINF_EM_HALT, ("Unexpected rc=%Rrc\n", rc));
     3312                AssertMsg(rc == VERR_EM_INTERPRETER || rc == VINF_PGM_CHANGE_MODE || rc == VINF_EM_HALT, ("Unexpected rc=%Rrc\n", VBOXSTRICTRC_VAL(rc)));
    33083313                break;
    33093314            }
     
    33333338
    33343339                Log(("Trap %x at %04X:%RGv\n", vector, pCtx->cs, (RTGCPTR)pCtx->rip));
    3335                 rc = VMXR0InjectEvent(pVM, pVCpu, pCtx, VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(intInfo), cbInstr, errCode);
    3336                 AssertRC(rc);
     3340                rc2 = VMXR0InjectEvent(pVM, pVCpu, pCtx, VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(intInfo), cbInstr, errCode);
     3341                AssertRC(rc2);
    33373342
    33383343                STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit2Sub3, y3);
     
    33463351                    Log(("Real Mode Trap %x at %04x:%04X error code %x\n", vector, pCtx->cs, pCtx->eip, errCode));
    33473352                    rc = VMXR0InjectEvent(pVM, pVCpu, pCtx, VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(intInfo), cbInstr, errCode);
    3348                     AssertRC(rc);
     3353                    AssertRC(VBOXSTRICTRC_VAL(rc)); /* Strict RC check below. */
    33493354
    33503355                    /* Go back to ring 3 in case of a triple fault. */
     
    33793384        Assert(pVM->hwaccm.s.fNestedPaging);
    33803385
    3381         rc = VMXReadVMCS64(VMX_VMCS_EXIT_PHYS_ADDR_FULL, &GCPhys);
    3382         AssertRC(rc);
     3386        rc2 = VMXReadVMCS64(VMX_VMCS_EXIT_PHYS_ADDR_FULL, &GCPhys);
     3387        AssertRC(rc2);
    33833388        Assert(((exitQualification >> 7) & 3) != 2);
    33843389
     
    34103415                {
    34113416                    Log(("Enable VT-x virtual APIC access filtering\n"));
    3412                     rc = IOMMMIOMapMMIOHCPage(pVM, GCPhysApicBase, pVM->hwaccm.s.vmx.pAPICPhys, X86_PTE_RW | X86_PTE_P);
    3413                     AssertRC(rc);
     3417                    rc2 = IOMMMIOMapMMIOHCPage(pVM, GCPhysApicBase, pVM->hwaccm.s.vmx.pAPICPhys, X86_PTE_RW | X86_PTE_P);
     3418                    AssertRC(rc2);
    34143419                }
    34153420            }
     
    34243429        /* Handle the pagefault trap for the nested shadow table. */
    34253430        rc = PGMR0Trap0eHandlerNestedPaging(pVM, pVCpu, PGMMODE_EPT, errCode, CPUMCTX2CORE(pCtx), GCPhys);
    3426         Log2(("PGMR0Trap0eHandlerNestedPaging %RGv returned %Rrc\n", (RTGCPTR)pCtx->rip, rc));
     3431        Log2(("PGMR0Trap0eHandlerNestedPaging %RGv returned %Rrc\n", (RTGCPTR)pCtx->rip, VBOXSTRICTRC_VAL(rc)));
    34273432        if (rc == VINF_SUCCESS)
    34283433        {   /* We've successfully synced our shadow pages, so let's just continue execution. */
     
    34363441#ifdef VBOX_STRICT
    34373442        if (rc != VINF_EM_RAW_EMULATE_INSTR)
    3438             LogFlow(("PGMTrap0eHandlerNestedPaging failed with %d\n", rc));
     3443            LogFlow(("PGMTrap0eHandlerNestedPaging failed with %d\n", VBOXSTRICTRC_VAL(rc)));
    34393444#endif
    34403445        /* Need to go back to the recompiler to emulate the instruction. */
     
    34493454        Assert(pVM->hwaccm.s.fNestedPaging);
    34503455
    3451         rc = VMXReadVMCS64(VMX_VMCS_EXIT_PHYS_ADDR_FULL, &GCPhys);
    3452         AssertRC(rc);
     3456        rc2 = VMXReadVMCS64(VMX_VMCS_EXIT_PHYS_ADDR_FULL, &GCPhys);
     3457        AssertRC(rc2);
    34533458        Log(("VMX_EXIT_EPT_MISCONFIG for %RGp\n", GCPhys));
    34543459
     
    34603465        }
    34613466
    3462         Log2(("PGMR0Trap0eHandlerNPMisconfig(,,,%RGp) at %RGv -> %Rrc\n", GCPhys, (RTGCPTR)pCtx->rip, rc));
     3467        Log2(("PGMR0Trap0eHandlerNPMisconfig(,,,%RGp) at %RGv -> %Rrc\n", GCPhys, (RTGCPTR)pCtx->rip, VBOXSTRICTRC_VAL(rc)));
    34633468        break;
    34643469    }
     
    34683473        LogFlow(("VMX_EXIT_IRQ_WINDOW %RGv pending=%d IF=%d\n", (RTGCPTR)pCtx->rip, VMCPU_FF_ISPENDING(pVCpu, (VMCPU_FF_INTERRUPT_APIC|VMCPU_FF_INTERRUPT_PIC)), pCtx->eflags.Bits.u1IF));
    34693474        pVCpu->hwaccm.s.vmx.proc_ctls &= ~VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_IRQ_WINDOW_EXIT;
    3470         rc = VMXWriteVMCS(VMX_VMCS_CTRL_PROC_EXEC_CONTROLS, pVCpu->hwaccm.s.vmx.proc_ctls);
    3471         AssertRC(rc);
     3475        rc2 = VMXWriteVMCS(VMX_VMCS_CTRL_PROC_EXEC_CONTROLS, pVCpu->hwaccm.s.vmx.proc_ctls);
     3476        AssertRC(rc2);
    34723477        STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitIrqWindow);
    34733478        goto ResumeExecution;   /* we check for pending guest interrupts there */
     
    34933498            goto ResumeExecution;
    34943499        }
    3495         AssertMsgFailed(("EMU: cpuid failed with %Rrc\n", rc));
     3500        AssertMsgFailed(("EMU: cpuid failed with %Rrc\n", VBOXSTRICTRC_VAL(rc)));
    34963501        rc = VINF_EM_RAW_EMULATE_INSTR;
    34973502        break;
     
    35433548            goto ResumeExecution;
    35443549        }
    3545         AssertMsg(rc == VERR_EM_INTERPRETER, ("EMU: invlpg %RGv failed with %Rrc\n", exitQualification, rc));
     3550        AssertMsg(rc == VERR_EM_INTERPRETER, ("EMU: invlpg %RGv failed with %Rrc\n", exitQualification, VBOXSTRICTRC_VAL(rc)));
    35463551        break;
    35473552    }
     
    35593564            goto ResumeExecution;
    35603565        }
    3561         AssertMsg(rc == VERR_EM_INTERPRETER, ("EMU: monitor failed with %Rrc\n", rc));
     3566        AssertMsg(rc == VERR_EM_INTERPRETER, ("EMU: monitor failed with %Rrc\n", VBOXSTRICTRC_VAL(rc)));
    35623567        break;
    35633568    }
     
    35743579
    35753580                /* Our patch code uses LSTAR for TPR caching. */
    3576                 rc = PDMApicSetTPR(pVCpu, pCtx->eax & 0xff);
    3577                 AssertRC(rc);
     3581                rc2 = PDMApicSetTPR(pVCpu, pCtx->eax & 0xff);
     3582                AssertRC(rc2);
    35783583            }
    35793584
     
    36013606            goto ResumeExecution;
    36023607        }
    3603         AssertMsg(rc == VERR_EM_INTERPRETER, ("EMU: %s failed with %Rrc\n", (exitReason == VMX_EXIT_RDMSR) ? "rdmsr" : "wrmsr", rc));
     3608        AssertMsg(rc == VERR_EM_INTERPRETER, ("EMU: %s failed with %Rrc\n", (exitReason == VMX_EXIT_RDMSR) ? "rdmsr" : "wrmsr", VBOXSTRICTRC_VAL(rc)));
    36043609        break;
    36053610    }
     
    36943699            /* Disable drx move intercepts. */
    36953700            pVCpu->hwaccm.s.vmx.proc_ctls &= ~VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_MOV_DR_EXIT;
    3696             rc = VMXWriteVMCS(VMX_VMCS_CTRL_PROC_EXEC_CONTROLS, pVCpu->hwaccm.s.vmx.proc_ctls);
    3697             AssertRC(rc);
     3701            rc2 = VMXWriteVMCS(VMX_VMCS_CTRL_PROC_EXEC_CONTROLS, pVCpu->hwaccm.s.vmx.proc_ctls);
     3702            AssertRC(rc2);
    36983703
    36993704            /* Save the host and load the guest debug state. */
    3700             rc = CPUMR0LoadGuestDebugState(pVM, pVCpu, pCtx, true /* include DR6 */);
    3701             AssertRC(rc);
     3705            rc2 = CPUMR0LoadGuestDebugState(pVM, pVCpu, pCtx, true /* include DR6 */);
     3706            AssertRC(rc2);
    37023707
    37033708#ifdef LOG_ENABLED
     
    37853790            /** @todo VMX_VMCS_EXIT_GUEST_LINEAR_ADDR contains the flat pointer operand of the instruction. */
    37863791            /** @todo VMX_VMCS32_RO_EXIT_INSTR_INFO also contains segment prefix info. */
    3787             rc = EMInterpretDisasOne(pVM, pVCpu, CPUMCTX2CORE(pCtx), pDis, NULL);
    3788             if (rc == VINF_SUCCESS)
     3792            rc2 = EMInterpretDisasOne(pVM, pVCpu, CPUMCTX2CORE(pCtx), pDis, NULL);
     3793            if (RT_SUCCESS(rc))
    37893794            {
    37903795                if (fIOWrite)
     
    38813886
    38823887                            /* Resync DR7 */
    3883                             rc = VMXWriteVMCS64(VMX_VMCS64_GUEST_DR7, pCtx->dr[7]);
    3884                             AssertRC(rc);
     3888                            rc2 = VMXWriteVMCS64(VMX_VMCS64_GUEST_DR7, pCtx->dr[7]);
     3889                            AssertRC(rc2);
    38853890
    38863891                            /* Construct inject info. */
     
    38903895
    38913896                            Log(("Inject IO debug trap at %RGv\n", (RTGCPTR)pCtx->rip));
    3892                             rc = VMXR0InjectEvent(pVM, pVCpu, pCtx, VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(intInfo), 0, 0);
    3893                             AssertRC(rc);
     3897                            rc2 = VMXR0InjectEvent(pVM, pVCpu, pCtx, VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(intInfo), 0, 0);
     3898                            AssertRC(rc2);
    38943899
    38953900                            STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit2Sub1, y1);
     
    39113916            Assert(fIOWrite);
    39123917        else
    3913             AssertMsg(RT_FAILURE(rc) || rc == VINF_EM_RAW_EMULATE_INSTR || rc == VINF_EM_RAW_GUEST_TRAP || rc == VINF_TRPM_XCPT_DISPATCHED, ("%Rrc\n", rc));
     3918            AssertMsg(RT_FAILURE(rc) || rc == VINF_EM_RAW_EMULATE_INSTR || rc == VINF_EM_RAW_GUEST_TRAP || rc == VINF_TRPM_XCPT_DISPATCHED, ("%Rrc\n", VBOXSTRICTRC_VAL(rc)));
    39143919#endif
    39153920        STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit2Sub1, y1);
     
    39974002            Log(("VMX_EXIT_TASK_SWITCH: reassert trap %d\n", VMX_EXIT_INTERRUPTION_INFO_VECTOR(pVCpu->hwaccm.s.Event.intInfo)));
    39984003            Assert(!VMX_EXIT_INTERRUPTION_INFO_ERROR_CODE_IS_VALID(pVCpu->hwaccm.s.Event.intInfo));
    3999             rc = TRPMAssertTrap(pVCpu, VMX_EXIT_INTERRUPTION_INFO_VECTOR(pVCpu->hwaccm.s.Event.intInfo), TRPM_HARDWARE_INT);
    4000             AssertRC(rc);
     4004            rc2 = TRPMAssertTrap(pVCpu, VMX_EXIT_INTERRUPTION_INFO_VECTOR(pVCpu->hwaccm.s.Event.intInfo), TRPM_HARDWARE_INT);
     4005            AssertRC(rc2);
    40014006        }
    40024007        /* else Exceptions and software interrupts can just be restarted. */
     
    40314036                goto ResumeExecution;
    40324037        }
    4033         AssertMsg(rc == VERR_EM_INTERPRETER || rc == VINF_EM_HALT, ("EMU: mwait failed with %Rrc\n", rc));
     4038        AssertMsg(rc == VERR_EM_INTERPRETER || rc == VINF_EM_HALT, ("EMU: mwait failed with %Rrc\n", VBOXSTRICTRC_VAL(rc)));
    40344039        break;
    40354040
     
    40714076                  || rc == VINF_TRPM_XCPT_DISPATCHED
    40724077                  || rc == VINF_EM_RESCHEDULE_REM,
    4073                   ("rc = %d\n", rc));
     4078                  ("rc = %d\n", VBOXSTRICTRC_VAL(rc)));
    40744079        break;
    40754080
     
    41834188    STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatEntry, x);
    41844189    Log2(("X"));
    4185     return rc;
     4190    return VBOXSTRICTRC_TODO(rc);
    41864191}
    41874192
     
    43744379 * @param   pCtx        Current CPU context (not updated)
    43754380 */
    4376 static void VMXR0ReportWorldSwitchError(PVM pVM, PVMCPU pVCpu, int rc, PCPUMCTX pCtx)
     4381static void VMXR0ReportWorldSwitchError(PVM pVM, PVMCPU pVCpu, VBOXSTRICTRC rc, PCPUMCTX pCtx)
    43774382{
    4378     switch (rc)
     4383    switch (VBOXSTRICTRC_VAL(rc))
    43794384    {
    43804385    case VERR_VMX_INVALID_VMXON_PTR:
     
    45254530    default:
    45264531        /* impossible */
    4527         AssertMsgFailed(("%Rrc (%#x)\n", rc, rc));
     4532        AssertMsgFailed(("%Rrc (%#x)\n", VBOXSTRICTRC_VAL(rc), VBOXSTRICTRC_VAL(rc)));
    45284533        break;
    45294534    }
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