VirtualBox

Changeset 72472 in vbox for trunk


Ignore:
Timestamp:
Jun 7, 2018 12:39:20 PM (7 years ago)
Author:
vboxsync
Message:

NEM/win: Fixed #BP interception. 2nd try at the nemHCWinStopCpu early VidMessageStopRequestComplete issue. bugref:9044

File:
1 edited

Legend:

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

    r72470 r72472  
    26782678     * Handle the intercept.
    26792679     */
     2680    TRPMEVENT enmEvtType = TRPM_TRAP;
    26802681    switch (pMsg->ExceptionVector)
    26812682    {
     
    27162717        case X86_XCPT_BP:
    27172718            STAM_REL_COUNTER_INC(&pVCpu->nem.s.StatExitExceptionBp);
    2718             Log4(("XcptExit/%u: %04x:%08RX64/%s: #BP - TODO\n",
    2719                   pVCpu->idCpu, pMsg->Header.CsSegment.Selector, pMsg->Header.Rip, nemHCWinExecStateToLogStr(&pMsg->Header) ));
     2719            Log4(("XcptExit/%u: %04x:%08RX64/%s: #BP - TODO - %u\n", pVCpu->idCpu, pMsg->Header.CsSegment.Selector,
     2720                  pMsg->Header.Rip, nemHCWinExecStateToLogStr(&pMsg->Header), pMsg->Header.InstructionLength));
     2721            enmEvtType = TRPM_SOFTWARE_INT; /* We're at the INT3 instruction, not after it. */
    27202722            break;
    27212723
     
    27282730     * Inject it.
    27292731     */
    2730     rcStrict = IEMInjectTrap(pVCpu, pMsg->ExceptionVector, TRPM_TRAP, pMsg->ErrorCode,
     2732    rcStrict = IEMInjectTrap(pVCpu, pMsg->ExceptionVector, enmEvtType, pMsg->ErrorCode,
    27312733                             pMsg->ExceptionParameter /*??*/, pMsg->Header.InstructionLength);
    27322734    Log4(("XcptExit/%u: %04x:%08RX64/%s: %#u -> injected -> %Rrc\n",
     
    27712773     * Handle the intercept.
    27722774     */
     2775    TRPMEVENT enmEvtType = TRPM_TRAP;
    27732776    switch (pExit->VpException.ExceptionType)
    27742777    {
     
    28122815        case X86_XCPT_BP:
    28132816            STAM_REL_COUNTER_INC(&pVCpu->nem.s.StatExitExceptionBp);
    2814             Log4(("XcptExit/%u: %04x:%08RX64/%s: #BP - TODO\n",
    2815                   pVCpu->idCpu, pExit->VpContext.Cs.Selector, pExit->VpContext.Rip, nemR3WinExecStateToLogStr(&pExit->VpContext) ));
     2817            Log4(("XcptExit/%u: %04x:%08RX64/%s: #BP - TODO - %u\n", pVCpu->idCpu, pExit->VpContext.Cs.Selector,
     2818                  pExit->VpContext.Rip, nemR3WinExecStateToLogStr(&pExit->VpContext), pExit->VpContext.InstructionLength));
     2819            enmEvtType = TRPM_SOFTWARE_INT; /* We're at the INT3 instruction, not after it. */
    28162820            break;
    28172821
     
    28242828     * Inject it.
    28252829     */
    2826     rcStrict = IEMInjectTrap(pVCpu, pExit->VpException.ExceptionType, TRPM_TRAP, pExit->VpException.ErrorCode,
     2830    rcStrict = IEMInjectTrap(pVCpu, pExit->VpException.ExceptionType, enmEvtType, pExit->VpException.ErrorCode,
    28272831                             pExit->VpException.ExceptionParameter /*??*/, pExit->VpContext.InstructionLength);
    28282832    Log4(("XcptExit/%u: %04x:%08RX64/%s: %#u -> injected -> %Rrc\n",
     
    32333237                               enmVidMsgType, pMappingHeader->cbMessage),
    32343238                              RT_SUCCESS(rcStrict) ? VERR_NEM_IPE_5 : rcStrict);
     3239
     3240        /*
     3241         * Mark the VidMessageStopRequestComplete message as handled.
     3242         */
     3243# ifdef IN_RING0
     3244        pVCpu->nem.s.uIoCtlBuf.MsgSlotHandleAndGetNext.iCpu     = pGVCpu->idCpu;
     3245        pVCpu->nem.s.uIoCtlBuf.MsgSlotHandleAndGetNext.fFlags   = VID_MSHAGN_F_HANDLE_MESSAGE;
     3246        pVCpu->nem.s.uIoCtlBuf.MsgSlotHandleAndGetNext.cMillies = 30000; /*ms*/
     3247        rcNt = nemR0NtPerformIoControl(pGVM, pGVM->nem.s.IoCtlMessageSlotHandleAndGetNext.uFunction,
     3248                                       &pVCpu->nem.s.uIoCtlBuf.MsgSlotHandleAndGetNext,
     3249                                       sizeof(pVCpu->nem.s.uIoCtlBuf.MsgSlotHandleAndGetNext),
     3250                                       NULL, 0);
     3251        AssertLogRelMsgReturn(NT_SUCCESS(rcNt), ("3rd VidMessageSlotHandleAndGetNext after ERROR_VID_STOP_PENDING failed: %#x\n", rcNt),
     3252                              RT_SUCCESS(rcStrict) ? VERR_NEM_IPE_5 : rcStrict);
     3253# else
     3254        fWait = g_pfnVidMessageSlotHandleAndGetNext(pVM->nem.s.hPartitionDevice, pVCpu->idCpu, VID_MSHAGN_F_HANDLE_MESSAGE, 30000 /*ms*/);
     3255        AssertLogRelMsgReturn(fWait, ("3rd VidMessageSlotHandleAndGetNext after ERROR_VID_STOP_PENDING failed: %u\n", RTNtLastErrorValue()),
     3256                              RT_SUCCESS(rcStrict) ? VERR_NEM_IPE_5 : rcStrict);
     3257# endif
     3258        Log8(("nemHCWinStopCpu: Stopped the CPU (rcStrict=%Rrc)\n", VBOXSTRICTRC_VAL(rcStrict) ));
    32353259    }
    32363260    else
    3237         Log8(("nemHCWinStopCpu: 1st VidMessageSlotHandleAndGetNext got VidMessageStopRequestComplete.\n"));
    3238 
    3239     /*
    3240      * Mark the VidMessageStopRequestComplete message as handled.
    3241      */
    3242 # ifdef IN_RING0
    3243     pVCpu->nem.s.uIoCtlBuf.MsgSlotHandleAndGetNext.iCpu     = pGVCpu->idCpu;
    3244     pVCpu->nem.s.uIoCtlBuf.MsgSlotHandleAndGetNext.fFlags   = VID_MSHAGN_F_HANDLE_MESSAGE;
    3245     pVCpu->nem.s.uIoCtlBuf.MsgSlotHandleAndGetNext.cMillies = 30000; /*ms*/
    3246     rcNt = nemR0NtPerformIoControl(pGVM, pGVM->nem.s.IoCtlMessageSlotHandleAndGetNext.uFunction,
    3247                                    &pVCpu->nem.s.uIoCtlBuf.MsgSlotHandleAndGetNext,
    3248                                    sizeof(pVCpu->nem.s.uIoCtlBuf.MsgSlotHandleAndGetNext),
    3249                                    NULL, 0);
    3250     AssertLogRelMsgReturn(NT_SUCCESS(rcNt), ("3rd VidMessageSlotHandleAndGetNext after ERROR_VID_STOP_PENDING failed: %#x\n", rcNt),
    3251                           RT_SUCCESS(rcStrict) ? VERR_NEM_IPE_5 : rcStrict);
    3252 # else
    3253     fWait = g_pfnVidMessageSlotHandleAndGetNext(pVM->nem.s.hPartitionDevice, pVCpu->idCpu, VID_MSHAGN_F_HANDLE_MESSAGE, 30000 /*ms*/);
    3254     AssertLogRelMsgReturn(fWait, ("3rd VidMessageSlotHandleAndGetNext after ERROR_VID_STOP_PENDING failed: %u\n", RTNtLastErrorValue()),
    3255                           RT_SUCCESS(rcStrict) ? VERR_NEM_IPE_5 : rcStrict);
    3256 # endif
    3257     Log8(("nemHCWinStopCpu: Stopped the CPU (rcStrict=%Rrc)\n", VBOXSTRICTRC_VAL(rcStrict) ));
     3261        Log8(("nemHCWinStopCpu: Stopped the CPU (rcStrict=%Rrc) - 1st VidMessageSlotHandleAndGetNext got VidMessageStopRequestComplete.\n",
     3262              VBOXSTRICTRC_VAL(rcStrict) ));
    32583263    return rcStrict;
    32593264}
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