VirtualBox

Changeset 72463 in vbox


Ignore:
Timestamp:
Jun 6, 2018 2:45:54 PM (6 years ago)
Author:
vboxsync
Message:

NEM: More hypercall work. bugref:9044

Location:
trunk/src/VBox/VMM
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/NEMAllNativeTemplate-win.cpp.h

    r72452 r72463  
    26602660           || pMsg->Header.InterceptAccessType == HV_INTERCEPT_ACCESS_WRITE
    26612661           || pMsg->Header.InterceptAccessType == HV_INTERCEPT_ACCESS_EXECUTE);
    2662     Assert(pMsg->Header.ExecutionState.InterruptionPending);
     2662
     2663    /*
     2664     * Get most of the register state since we'll end up making IEM inject the
     2665     * event.  The exception isn't normally flaged as a pending event, so duh.
     2666     *
     2667     * Note! We can optimize this later with event injection.
     2668     */
     2669    Log4(("XcptExit/%u: %04x:%08RX64/%s: %x errcd=%#x parm=%RX64\n",
     2670          pVCpu->idCpu, pMsg->Header.CsSegment.Selector, pMsg->Header.Rip, nemHCWinExecStateToLogStr(&pMsg->Header),
     2671          pMsg->ExceptionVector, pMsg->ErrorCode, pMsg->ExceptionParameter));
     2672    nemHCWinCopyStateFromExceptionMessage(pVCpu, pMsg, pCtx, true /*fClearXcpt*/);
     2673    VBOXSTRICTRC rcStrict = nemHCWinImportStateIfNeededStrict(pVCpu, pGVCpu, pCtx, NEM_WIN_CPUMCTX_EXTRN_MASK_FOR_IEM, "Xcpt");
     2674    if (rcStrict != VINF_SUCCESS)
     2675        return rcStrict;
    26632676
    26642677    /*
     
    26722685         */
    26732686        case X86_XCPT_UD:
     2687            STAM_REL_COUNTER_INC(&pVCpu->nem.s.StatExitExceptionUd);
     2688            /** @todo Call GIMXcptUD if required. */
    26742689            if (nemHcWinIsInterestingUndefinedOpcode(pMsg->InstructionByteCount, pMsg->InstructionBytes,
    26752690                                                     pMsg->Header.ExecutionState.EferLma && pMsg->Header.CsSegment.Long ))
    26762691            {
    2677                 nemHCWinCopyStateFromExceptionMessage(pVCpu, pMsg, pCtx, true /*fClearXcpt*/);
    2678                 VBOXSTRICTRC rcStrict = nemHCWinImportStateIfNeededStrict(pVCpu, pGVCpu, pCtx,
    2679                                                                           NEM_WIN_CPUMCTX_EXTRN_MASK_FOR_IEM, "#UD");
    2680                 if (rcStrict == VINF_SUCCESS)
    2681                 {
    2682                     rcStrict = IEMExecOneWithPrefetchedByPC(pVCpu, CPUMCTX2CORE(pCtx), pMsg->Header.Rip, pMsg->InstructionBytes,
    2683                                                             pMsg->InstructionByteCount);
    2684                     Log4(("XcptExit/%u: %04x:%08RX64/%s: #UD -> emulated -> %Rrc\n", pVCpu->idCpu, pMsg->Header.CsSegment.Selector,
    2685                           pMsg->Header.Rip, nemHCWinExecStateToLogStr(&pMsg->Header), VBOXSTRICTRC_VAL(rcStrict) ));
    2686                 }
    2687                 else
    2688                     Log4(("XcptExit/%u: %04x:%08RX64/%s: #UD -> state import (emulate) -> %Rrc\n",
    2689                           pVCpu->idCpu, pMsg->Header.CsSegment.Selector, pMsg->Header.Rip,
    2690                           nemHCWinExecStateToLogStr(&pMsg->Header), VBOXSTRICTRC_VAL(rcStrict) ));
     2692                rcStrict = IEMExecOneWithPrefetchedByPC(pVCpu, CPUMCTX2CORE(pCtx), pMsg->Header.Rip, pMsg->InstructionBytes,
     2693                                                        pMsg->InstructionByteCount);
     2694                Log4(("XcptExit/%u: %04x:%08RX64/%s: #UD -> emulated -> %Rrc\n",
     2695                      pVCpu->idCpu, pMsg->Header.CsSegment.Selector, pMsg->Header.Rip,
     2696                      nemHCWinExecStateToLogStr(&pMsg->Header), VBOXSTRICTRC_VAL(rcStrict) ));
     2697                STAM_REL_COUNTER_INC(&pVCpu->nem.s.StatExitExceptionUdHandled);
    26912698                return rcStrict;
    26922699            }
     
    26992706         */
    27002707        case X86_XCPT_DB:
     2708            STAM_REL_COUNTER_INC(&pVCpu->nem.s.StatExitExceptionDb);
     2709            Log4(("XcptExit/%u: %04x:%08RX64/%s: #DB - TODO\n",
     2710                  pVCpu->idCpu, pMsg->Header.CsSegment.Selector, pMsg->Header.Rip, nemHCWinExecStateToLogStr(&pMsg->Header) ));
    27012711            break;
    27022712
    27032713        case X86_XCPT_BP:
     2714            STAM_REL_COUNTER_INC(&pVCpu->nem.s.StatExitExceptionBp);
     2715            Log4(("XcptExit/%u: %04x:%08RX64/%s: #BP - TODO\n",
     2716                  pVCpu->idCpu, pMsg->Header.CsSegment.Selector, pMsg->Header.Rip, nemHCWinExecStateToLogStr(&pMsg->Header) ));
    27042717            break;
    27052718
     
    27092722    }
    27102723
    2711     return VINF_SUCCESS;
     2724    /*
     2725     * Inject it.
     2726     */
     2727    rcStrict = IEMInjectTrap(pVCpu, pMsg->ExceptionVector, TRPM_TRAP, pMsg->ErrorCode,
     2728                             pMsg->ExceptionParameter /*??*/, pMsg->Header.InstructionLength);
     2729    Log4(("XcptExit/%u: %04x:%08RX64/%s: %#u -> injected -> %Rrc\n",
     2730          pVCpu->idCpu, pMsg->Header.CsSegment.Selector, pMsg->Header.Rip,
     2731          nemHCWinExecStateToLogStr(&pMsg->Header), pMsg->ExceptionVector, VBOXSTRICTRC_VAL(rcStrict) ));
     2732    return rcStrict;
    27122733}
    27132734#elif defined(IN_RING3)
     
    27542775         */
    27552776        case X86_XCPT_UD:
     2777            STAM_REL_COUNTER_INC(&pVCpu->nem.s.StatExitExceptionUd);
    27562778            /** @todo Call GIMXcptUD if required. */
    27572779            if (nemHcWinIsInterestingUndefinedOpcode(pExit->VpException.InstructionByteCount, pExit->VpException.InstructionBytes,
     
    27642786                      pVCpu->idCpu, pExit->VpContext.Cs.Selector, pExit->VpContext.Rip,
    27652787                      nemR3WinExecStateToLogStr(&pExit->VpContext), VBOXSTRICTRC_VAL(rcStrict) ));
     2788                STAM_REL_COUNTER_INC(&pVCpu->nem.s.StatExitExceptionUdHandled);
    27662789                return rcStrict;
    27672790            }
     
    27762799         */
    27772800        case X86_XCPT_DB:
     2801            STAM_REL_COUNTER_INC(&pVCpu->nem.s.StatExitExceptionDb);
    27782802            Log4(("XcptExit/%u: %04x:%08RX64/%s: #DB - TODO\n",
    27792803                  pVCpu->idCpu, pExit->VpContext.Cs.Selector, pExit->VpContext.Rip, nemR3WinExecStateToLogStr(&pExit->VpContext) ));
     
    27812805
    27822806        case X86_XCPT_BP:
     2807            STAM_REL_COUNTER_INC(&pVCpu->nem.s.StatExitExceptionBp);
    27832808            Log4(("XcptExit/%u: %04x:%08RX64/%s: #BP - TODO\n",
    27842809                  pVCpu->idCpu, pExit->VpContext.Cs.Selector, pExit->VpContext.Rip, nemR3WinExecStateToLogStr(&pExit->VpContext) ));
  • trunk/src/VBox/VMM/VMMR3/NEMR3Native-win.cpp

    r72446 r72463  
    12161216                            STAMR3RegisterF(pVM, &pNemCpu->StatExitCpuId,           STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, "Number of CPUID exits",                  "/NEM/CPU%u/ExitCpuId", iCpu);
    12171217                            STAMR3RegisterF(pVM, &pNemCpu->StatExitMsr,             STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, "Number of MSR access exits",             "/NEM/CPU%u/ExitMsr", iCpu);
    1218                             STAMR3RegisterF(pVM, &pNemCpu->StatExitException,       STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, "Number of exception exits",           "/NEM/CPU%u/ExitException", iCpu);
     1218                            STAMR3RegisterF(pVM, &pNemCpu->StatExitException,       STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, "Number of exception exits",              "/NEM/CPU%u/ExitException", iCpu);
     1219                            STAMR3RegisterF(pVM, &pNemCpu->StatExitExceptionBp,     STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, "Number of #BP exits",                    "/NEM/CPU%u/ExitExceptionBp", iCpu);
     1220                            STAMR3RegisterF(pVM, &pNemCpu->StatExitExceptionDb,     STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, "Number of #DB exits",                    "/NEM/CPU%u/ExitExceptionDb", iCpu);
     1221                            STAMR3RegisterF(pVM, &pNemCpu->StatExitExceptionUd,     STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, "Number of #UD exits",                    "/NEM/CPU%u/ExitExceptionUd", iCpu);
     1222                            STAMR3RegisterF(pVM, &pNemCpu->StatExitExceptionUdHandled, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, "Number of handled #UD exits",         "/NEM/CPU%u/ExitExceptionUdHandled", iCpu);
    12191223                            STAMR3RegisterF(pVM, &pNemCpu->StatExitUnrecoverable,   STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, "Number of unrecoverable exits",          "/NEM/CPU%u/ExitUnrecoverable", iCpu);
    12201224                            STAMR3RegisterF(pVM, &pNemCpu->StatGetMsgTimeout,       STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, "Number of get message timeouts/alerts",  "/NEM/CPU%u/GetMsgTimeout", iCpu);
  • trunk/src/VBox/VMM/include/NEMInternal.h

    r72446 r72463  
    252252    STAMCOUNTER                 StatExitMsr;
    253253    STAMCOUNTER                 StatExitException;
     254    STAMCOUNTER                 StatExitExceptionBp;
     255    STAMCOUNTER                 StatExitExceptionDb;
     256    STAMCOUNTER                 StatExitExceptionUd;
     257    STAMCOUNTER                 StatExitExceptionUdHandled;
    254258    STAMCOUNTER                 StatExitUnrecoverable;
    255259    STAMCOUNTER                 StatGetMsgTimeout;
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