VirtualBox

Changeset 61628 in vbox for trunk/src/VBox/VMM/VMMR3/EM.cpp


Ignore:
Timestamp:
Jun 9, 2016 5:52:51 PM (9 years ago)
Author:
vboxsync
Message:

DBGF: Added bsod_msr event, stubbed bsod_efi event. Since we cannot return VINF_EM_DBG_EVENT from an MSR handler, VMCPU_FF_DBGF was introduced as an alternative.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR3/EM.cpp

    r61027 r61628  
    895895         * Process the result.
    896896         */
    897         do
    898         {
    899             switch (VBOXSTRICTRC_VAL(rc))
    900             {
    901                 /*
    902                  * Continue the debugging loop.
    903                  */
    904                 case VINF_EM_DBG_STEP:
    905                 case VINF_EM_DBG_STOP:
    906                 case VINF_EM_DBG_EVENT:
    907                 case VINF_EM_DBG_STEPPED:
    908                 case VINF_EM_DBG_BREAKPOINT:
    909                 case VINF_EM_DBG_HYPER_STEPPED:
    910                 case VINF_EM_DBG_HYPER_BREAKPOINT:
    911                 case VINF_EM_DBG_HYPER_ASSERTION:
    912                     break;
    913 
    914                 /*
    915                  * Resuming execution (in some form) has to be done here if we got
    916                  * a hypervisor debug event.
    917                  */
    918                 case VINF_SUCCESS:
    919                 case VINF_EM_RESUME:
    920                 case VINF_EM_SUSPEND:
    921                 case VINF_EM_RESCHEDULE:
    922                 case VINF_EM_RESCHEDULE_RAW:
    923                 case VINF_EM_RESCHEDULE_REM:
    924                 case VINF_EM_HALT:
    925                     if (pVCpu->em.s.enmState == EMSTATE_DEBUG_HYPER)
    926                     {
     897        switch (VBOXSTRICTRC_VAL(rc))
     898        {
     899            /*
     900             * Continue the debugging loop.
     901             */
     902            case VINF_EM_DBG_STEP:
     903            case VINF_EM_DBG_STOP:
     904            case VINF_EM_DBG_EVENT:
     905            case VINF_EM_DBG_STEPPED:
     906            case VINF_EM_DBG_BREAKPOINT:
     907            case VINF_EM_DBG_HYPER_STEPPED:
     908            case VINF_EM_DBG_HYPER_BREAKPOINT:
     909            case VINF_EM_DBG_HYPER_ASSERTION:
     910                break;
     911
     912            /*
     913             * Resuming execution (in some form) has to be done here if we got
     914             * a hypervisor debug event.
     915             */
     916            case VINF_SUCCESS:
     917            case VINF_EM_RESUME:
     918            case VINF_EM_SUSPEND:
     919            case VINF_EM_RESCHEDULE:
     920            case VINF_EM_RESCHEDULE_RAW:
     921            case VINF_EM_RESCHEDULE_REM:
     922            case VINF_EM_HALT:
     923                if (pVCpu->em.s.enmState == EMSTATE_DEBUG_HYPER)
     924                {
    927925#ifdef VBOX_WITH_RAW_MODE
    928                         rc = emR3RawResumeHyper(pVM, pVCpu);
    929                         if (rc != VINF_SUCCESS && RT_SUCCESS(rc))
    930                             continue;
     926                    rc = emR3RawResumeHyper(pVM, pVCpu);
     927                    if (rc != VINF_SUCCESS && RT_SUCCESS(rc))
     928                        continue;
    931929#else
    932                         AssertLogRelMsgFailedReturn(("Not implemented\n"), VERR_EM_INTERNAL_ERROR);
    933 #endif
    934                     }
    935                     if (rc == VINF_SUCCESS)
    936                         rc = VINF_EM_RESCHEDULE;
    937                     return rc;
    938 
    939                 /*
    940                  * The debugger isn't attached.
    941                  * We'll simply turn the thing off since that's the easiest thing to do.
    942                  */
    943                 case VERR_DBGF_NOT_ATTACHED:
    944                     switch (VBOXSTRICTRC_VAL(rcLast))
    945                     {
    946                         case VINF_EM_DBG_HYPER_STEPPED:
    947                         case VINF_EM_DBG_HYPER_BREAKPOINT:
    948                         case VINF_EM_DBG_HYPER_ASSERTION:
    949                         case VERR_TRPM_PANIC:
    950                         case VERR_TRPM_DONT_PANIC:
    951                         case VERR_VMM_RING0_ASSERTION:
    952                         case VERR_VMM_HYPER_CR3_MISMATCH:
    953                         case VERR_VMM_RING3_CALL_DISABLED:
    954                             return rcLast;
    955                     }
    956                     return VINF_EM_OFF;
    957 
    958                 /*
    959                  * Status codes terminating the VM in one or another sense.
    960                  */
    961                 case VINF_EM_TERMINATE:
    962                 case VINF_EM_OFF:
    963                 case VINF_EM_RESET:
    964                 case VINF_EM_NO_MEMORY:
    965                 case VINF_EM_RAW_STALE_SELECTOR:
    966                 case VINF_EM_RAW_IRET_TRAP:
    967                 case VERR_TRPM_PANIC:
    968                 case VERR_TRPM_DONT_PANIC:
    969                 case VERR_IEM_INSTR_NOT_IMPLEMENTED:
    970                 case VERR_IEM_ASPECT_NOT_IMPLEMENTED:
    971                 case VERR_VMM_RING0_ASSERTION:
    972                 case VERR_VMM_HYPER_CR3_MISMATCH:
    973                 case VERR_VMM_RING3_CALL_DISABLED:
    974                 case VERR_INTERNAL_ERROR:
    975                 case VERR_INTERNAL_ERROR_2:
    976                 case VERR_INTERNAL_ERROR_3:
    977                 case VERR_INTERNAL_ERROR_4:
    978                 case VERR_INTERNAL_ERROR_5:
    979                 case VERR_IPE_UNEXPECTED_STATUS:
    980                 case VERR_IPE_UNEXPECTED_INFO_STATUS:
    981                 case VERR_IPE_UNEXPECTED_ERROR_STATUS:
    982                     return rc;
    983 
    984                 /*
    985                  * The rest is unexpected, and will keep us here.
    986                  */
    987                 default:
    988                     AssertMsgFailed(("Unexpected rc %Rrc!\n", VBOXSTRICTRC_VAL(rc)));
    989                     break;
    990             }
    991         } while (false);
     930                    AssertLogRelMsgFailedReturn(("Not implemented\n"), VERR_EM_INTERNAL_ERROR);
     931#endif
     932                }
     933                if (rc == VINF_SUCCESS)
     934                    rc = VINF_EM_RESCHEDULE;
     935                return rc;
     936
     937            /*
     938             * The debugger isn't attached.
     939             * We'll simply turn the thing off since that's the easiest thing to do.
     940             */
     941            case VERR_DBGF_NOT_ATTACHED:
     942                switch (VBOXSTRICTRC_VAL(rcLast))
     943                {
     944                    case VINF_EM_DBG_HYPER_STEPPED:
     945                    case VINF_EM_DBG_HYPER_BREAKPOINT:
     946                    case VINF_EM_DBG_HYPER_ASSERTION:
     947                    case VERR_TRPM_PANIC:
     948                    case VERR_TRPM_DONT_PANIC:
     949                    case VERR_VMM_RING0_ASSERTION:
     950                    case VERR_VMM_HYPER_CR3_MISMATCH:
     951                    case VERR_VMM_RING3_CALL_DISABLED:
     952                        return rcLast;
     953                }
     954                return VINF_EM_OFF;
     955
     956            /*
     957             * Status codes terminating the VM in one or another sense.
     958             */
     959            case VINF_EM_TERMINATE:
     960            case VINF_EM_OFF:
     961            case VINF_EM_RESET:
     962            case VINF_EM_NO_MEMORY:
     963            case VINF_EM_RAW_STALE_SELECTOR:
     964            case VINF_EM_RAW_IRET_TRAP:
     965            case VERR_TRPM_PANIC:
     966            case VERR_TRPM_DONT_PANIC:
     967            case VERR_IEM_INSTR_NOT_IMPLEMENTED:
     968            case VERR_IEM_ASPECT_NOT_IMPLEMENTED:
     969            case VERR_VMM_RING0_ASSERTION:
     970            case VERR_VMM_HYPER_CR3_MISMATCH:
     971            case VERR_VMM_RING3_CALL_DISABLED:
     972            case VERR_INTERNAL_ERROR:
     973            case VERR_INTERNAL_ERROR_2:
     974            case VERR_INTERNAL_ERROR_3:
     975            case VERR_INTERNAL_ERROR_4:
     976            case VERR_INTERNAL_ERROR_5:
     977            case VERR_IPE_UNEXPECTED_STATUS:
     978            case VERR_IPE_UNEXPECTED_INFO_STATUS:
     979            case VERR_IPE_UNEXPECTED_ERROR_STATUS:
     980                return rc;
     981
     982            /*
     983             * The rest is unexpected, and will keep us here.
     984             */
     985            default:
     986                AssertMsgFailed(("Unexpected rc %Rrc!\n", VBOXSTRICTRC_VAL(rc)));
     987                break;
     988        }
    992989    } /* debug for ever */
    993990}
     
    17151712         * Debugger Facility polling.
    17161713         */
    1717         if (VM_FF_IS_PENDING(pVM, VM_FF_DBGF))
    1718         {
    1719             rc2 = DBGFR3VMMForcedAction(pVM);
     1714        if (   VM_FF_IS_PENDING(pVM, VM_FF_DBGF)
     1715            || VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_DBGF) )
     1716        {
     1717            rc2 = DBGFR3VMMForcedAction(pVM, pVCpu);
    17201718            UPDATE_RC();
    17211719        }
     
    17601758        /* check that we got them all  */
    17611759        AssertCompile(VM_FF_NORMAL_PRIORITY_POST_MASK == (VM_FF_CHECK_VM_STATE | VM_FF_DBGF | VM_FF_RESET | VM_FF_PGM_NO_MEMORY | VM_FF_EMT_RENDEZVOUS));
    1762         AssertCompile(VMCPU_FF_NORMAL_PRIORITY_POST_MASK == VM_WHEN_RAW_MODE(VMCPU_FF_CSAM_SCAN_PAGE, 0));
     1760        AssertCompile(VMCPU_FF_NORMAL_PRIORITY_POST_MASK == (VM_WHEN_RAW_MODE(VMCPU_FF_CSAM_SCAN_PAGE, 0) | VMCPU_FF_DBGF));
    17631761    }
    17641762
     
    19991997         * Debugger Facility request.
    20001998         */
    2001         if (VM_FF_IS_PENDING_EXCEPT(pVM, VM_FF_DBGF, VM_FF_PGM_NO_MEMORY))
    2002         {
    2003             rc2 = DBGFR3VMMForcedAction(pVM);
     1999        if (   (   VM_FF_IS_PENDING(pVM, VM_FF_DBGF)
     2000                || VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_DBGF) )
     2001            && !VM_FF_IS_PENDING(pVM, VM_FF_PGM_NO_MEMORY) )
     2002        {
     2003            rc2 = DBGFR3VMMForcedAction(pVM, pVCpu);
    20042004            UPDATE_RC();
    20052005        }
     
    20842084        /* check that we got them all  */
    20852085        AssertCompile(VM_FF_HIGH_PRIORITY_PRE_MASK == (VM_FF_TM_VIRTUAL_SYNC | VM_FF_DBGF | VM_FF_CHECK_VM_STATE | VM_FF_DEBUG_SUSPEND | VM_FF_PGM_NEED_HANDY_PAGES | VM_FF_PGM_NO_MEMORY | VM_FF_EMT_RENDEZVOUS));
    2086         AssertCompile(VMCPU_FF_HIGH_PRIORITY_PRE_MASK == (VMCPU_FF_TIMER | VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_UPDATE_APIC | VMCPU_FF_INTERRUPT_PIC | VMCPU_FF_PGM_SYNC_CR3 | VMCPU_FF_PGM_SYNC_CR3_NON_GLOBAL | VMCPU_FF_INHIBIT_INTERRUPTS | VM_WHEN_RAW_MODE(VMCPU_FF_SELM_SYNC_TSS | VMCPU_FF_TRPM_SYNC_IDT | VMCPU_FF_SELM_SYNC_GDT | VMCPU_FF_SELM_SYNC_LDT, 0)));
     2086        AssertCompile(VMCPU_FF_HIGH_PRIORITY_PRE_MASK == (VMCPU_FF_TIMER | VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_UPDATE_APIC | VMCPU_FF_INTERRUPT_PIC | VMCPU_FF_PGM_SYNC_CR3 | VMCPU_FF_PGM_SYNC_CR3_NON_GLOBAL | VMCPU_FF_INHIBIT_INTERRUPTS | VM_WHEN_RAW_MODE(VMCPU_FF_SELM_SYNC_TSS | VMCPU_FF_TRPM_SYNC_IDT | VMCPU_FF_SELM_SYNC_GDT | VMCPU_FF_SELM_SYNC_LDT | VMCPU_FF_DBGF, 0)));
    20872087    }
    20882088
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