VirtualBox

Changeset 61566 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jun 8, 2016 9:39:35 AM (9 years ago)
Author:
vboxsync
Message:

VMM/APIC: Fix DBGF info callbacks to run on EMT and use separate callbacks rather than arguments so
we can dump them in an automated fashion while collecting crash diagnostics.

File:
1 edited

Legend:

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

    r61556 r61566  
    405405 * Dumps basic APIC state.
    406406 *
    407  * @param   pVCpu   The cross context virtual CPU structure.
    408  * @param   pHlp    The debug output helper.
    409  */
    410 static void apicR3DbgInfoBasic(PVMCPU pVCpu, PCDBGFINFOHLP pHlp)
    411 {
     407 * @param   pVCpu       The cross context virtual CPU structure.
     408 * @param   pHlp        The info helpers.
     409 * @param   pszArgs     Arguments, ignored.
     410 */
     411static DECLCALLBACK(void) apicR3Info(PVM pVM, PCDBGFINFOHLP pHlp, const char *pszArgs)
     412{
     413    NOREF(pszArgs);
     414    PVMCPU       pVCpu       = VMMGetCpu(pVM); AssertFatalMsg(pVCpu, ("Invalid EMT thread. pVCpu=%p\n", pVCpu));
    412415    PCAPICCPU    pApicCpu    = VMCPU_TO_APICCPU(pVCpu);
    413416    PCXAPICPAGE  pXApicPage  = VMCPU_TO_CXAPICPAGE(pVCpu);
     
    499502 * @param   pHlp    The debug output helper.
    500503 */
    501 static void apicR3DbgInfoLvtTimer(PVMCPU pVCpu, PCDBGFINFOHLP pHlp)
     504static void apicR3InfoLvtTimer(PVMCPU pVCpu, PCDBGFINFOHLP pHlp)
    502505{
    503506    PCXAPICPAGE pXApicPage = VMCPU_TO_CXAPICPAGE(pVCpu);
     
    514517
    515518/**
    516  * Dumps APIC Local Vector Table (LVT) state.
    517  *
    518  * @param   pVCpu   The cross context virtual CPU structure.
    519  * @param   pHlp    The debug output helper.
    520  */
    521 static void apicR3DbgInfoLvt(PVMCPU pVCpu, PCDBGFINFOHLP pHlp)
    522 {
     519 * Dumps APIC Local Vector Table (LVT) information.
     520 *
     521 * @param   pVCpu       The cross context virtual CPU structure.
     522 * @param   pHlp        The info helpers.
     523 * @param   pszArgs     Arguments, ignored.
     524 */
     525static DECLCALLBACK(void) apicR3InfoLvt(PVM pVM, PCDBGFINFOHLP pHlp, const char *pszArgs)
     526{
     527    NOREF(pszArgs);
     528    PVMCPU      pVCpu      = VMMGetCpu(pVM); AssertFatalMsg(pVCpu, ("Invalid EMT thread. pVCpu=%p\n", pVCpu));
    523529    PCXAPICPAGE pXApicPage = VMCPU_TO_CXAPICPAGE(pVCpu);
    524530
    525     apicR3DbgInfoLvtTimer(pVCpu, pHlp);
     531    apicR3InfoLvtTimer(pVCpu, pHlp);
    526532
    527533#if XAPIC_HARDWARE_VERSION == XAPIC_HARDWARE_VERSION_P4
     
    582588
    583589/**
    584  * Dumps APIC Timer state.
    585  *
    586  * @param   pVCpu   The cross context virtual CPU structure.
    587  * @param   pHlp    The debug output helper.
    588  */
    589 static void apicR3DbgInfoTimer(PVMCPU pVCpu, PCDBGFINFOHLP pHlp)
    590 {
     590 * Dumps the APIC timer information.
     591 *
     592 * @param   pVCpu       The cross context virtual CPU structure.
     593 * @param   pHlp        The info helpers.
     594 * @param   pszArgs     Arguments, ignored.
     595 */
     596static DECLCALLBACK(void) apicR3InfoTimer(PVM pVM, PCDBGFINFOHLP pHlp, const char *pszArgs)
     597{
     598    NOREF(pszArgs);
     599    PVMCPU      pVCpu      = VMMGetCpu(pVM); AssertFatalMsg(pVCpu, ("Invalid EMT thread. pVCpu=%p\n", pVCpu));
    591600    PCXAPICPAGE pXApicPage = VMCPU_TO_CXAPICPAGE(pVCpu);
    592601    PCAPICCPU   pApicCpu   = VMCPU_TO_APICCPU(pVCpu);
     
    600609    pHlp->pfnPrintf(pHlp, "\n");
    601610
    602     apicR3DbgInfoLvtTimer(pVCpu, pHlp);
    603 }
    604 
    605 
    606 /**
    607  * @callback_method_impl{FNDBGFHANDLERDEV,
    608  *      Dumps the APIC state according to given argument for debugging purposes.}
    609  */
    610 static DECLCALLBACK(void) apicR3DbgInfo(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)
    611 {
    612     PVM       pVM   = PDMDevHlpGetVM(pDevIns);
    613     PVMCPU    pVCpu = VMMGetCpu(pVM);
    614     Assert(pVCpu);
    615 
    616     if (pszArgs == NULL || !*pszArgs || !strcmp(pszArgs, "basic"))
    617         apicR3DbgInfoBasic(pVCpu, pHlp);
    618     else if (!strcmp(pszArgs, "lvt"))
    619         apicR3DbgInfoLvt(pVCpu, pHlp);
    620     else if (!strcmp(pszArgs, "timer"))
    621         apicR3DbgInfoTimer(pVCpu, pHlp);
    622     else
    623         pHlp->pfnPrintf(pHlp, "Invalid argument. Recognized arguments are 'basic', 'lvt', 'timer'\n");
     611    apicR3InfoLvtTimer(pVCpu, pHlp);
    624612}
    625613
     
    16441632
    16451633    /*
    1646      * Register debugger info callback.
    1647      */
    1648     rc = PDMDevHlpDBGFInfoRegister(pDevIns, "apic", "Display local APIC state for current CPU. Recognizes "
    1649                                                     "'basic', 'lvt', 'timer' as arguments, defaults to 'basic'.", apicR3DbgInfo);
     1634     * Register debugger info callbacks.
     1635     *
     1636     * We use separate callbacks rather than arguments so they can also be
     1637     * dumped in an automated fashion while collecting crash diagnostics and
     1638     * not just used during live debugging via the VM debugger.
     1639     */
     1640    rc  = DBGFR3InfoRegisterInternalEx(pVM, "apic",      "Dumps APIC basic information.", apicR3Info,      DBGFINFO_FLAGS_RUN_ON_EMT);
     1641    rc |= DBGFR3InfoRegisterInternalEx(pVM, "apiclvt",   "Dumps APIC LVT information.",   apicR3InfoLvt,   DBGFINFO_FLAGS_RUN_ON_EMT);
     1642    rc |= DBGFR3InfoRegisterInternalEx(pVM, "apictimer", "Dumps APIC timer information.", apicR3InfoTimer, DBGFINFO_FLAGS_RUN_ON_EMT);
    16501643    AssertRCReturn(rc, rc);
    16511644
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