VirtualBox

Changeset 92747 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Dec 5, 2021 7:16:31 PM (3 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
148658
Message:

DevFDC: Added a basic debug info handler.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Storage/DevFdc.cpp

    r87773 r92747  
    684684    uint8_t data_dir;
    685685    uint8_t eot; /* last wanted sector */
     686    /* Debugging only */
     687    uint8_t cur_cmd;
     688    uint8_t prev_cmd;
    686689    /* States kept only to be returned back */
    687690    /* Timers state */
     
    10681071    fdctrl->data_pos = 0;
    10691072    fdctrl->msr &= ~(FD_MSR_CMDBUSY | FD_MSR_DIO);
     1073    fdctrl->prev_cmd = fdctrl->cur_cmd;
     1074    fdctrl->cur_cmd = 0;
    10701075}
    10711076
     
    21892194        fdctrl->data_len = handlers[pos].parameters + 1;
    21902195        fdctrl->msr |= FD_MSR_CMDBUSY;
     2196        fdctrl->cur_cmd = value & 0xff;
    21912197    }
    21922198
     
    23652371    }
    23662372    return VERR_IOM_IOPORT_UNUSED;
     2373}
     2374
     2375
     2376/* -=-=-=-=-=-=-=-=- Debugger callback -=-=-=-=-=-=-=-=- */
     2377
     2378/**
     2379 * FDC debugger info callback.
     2380 *
     2381 * @param   pDevIns     The device instance.
     2382 * @param   pHlp        The output helpers.
     2383 * @param   pszArgs     The arguments.
     2384 */
     2385static DECLCALLBACK(void) fdcInfo(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)
     2386{
     2387    fdctrl_t    *pThis = PDMDEVINS_2_DATA(pDevIns, fdctrl_t *);
     2388    unsigned    i;
     2389    bool        fVerbose = false;
     2390
     2391    /* Parse arguments. */
     2392    if (pszArgs)
     2393        fVerbose = strstr(pszArgs, "verbose") != NULL;
     2394
     2395    /* Show basic information. */
     2396    pHlp->pfnPrintf(pHlp, "%s#%d: ",
     2397                    pDevIns->pReg->szName,
     2398                    pDevIns->iInstance);
     2399    pHlp->pfnPrintf(pHlp, "I/O=%X IRQ=%u DMA=%u ",
     2400                    pThis->io_base,
     2401                    pThis->irq_lvl,
     2402                    pThis->dma_chann);
     2403    pHlp->pfnPrintf(pHlp, "RC=%RTbool R0=%RTbool\n", pDevIns->fRCEnabled, pDevIns->fR0Enabled);
     2404
     2405    /* Print register contents. */
     2406    pHlp->pfnPrintf(pHlp, "Registers: MSR=%02X DSR=%02X DOR=%02X\n",
     2407                    pThis->msr, pThis->dsr, pThis->dor);
     2408    pHlp->pfnPrintf(pHlp, "           DIR=%02X\n",
     2409                    fdctrl_read_dir(pThis));
     2410
     2411    /* Print the current command, if any. */
     2412    if (pThis->cur_cmd)
     2413        pHlp->pfnPrintf(pHlp, "Curr cmd: %02X (%s)\n",
     2414                        pThis->cur_cmd,
     2415                        handlers[command_to_handler[pThis->cur_cmd]].name);
     2416        pHlp->pfnPrintf(pHlp, "Prev cmd: %02X (%s)\n",
     2417                        pThis->prev_cmd,
     2418                        handlers[command_to_handler[pThis->prev_cmd]].name);
     2419
     2420
     2421    for (i = 0; i < pThis->num_floppies; ++i)
     2422    {
     2423        fdrive_t  *drv = &pThis->drives[i];
     2424        pHlp->pfnPrintf(pHlp, "  Drive %u state:\n", i);
     2425        pHlp->pfnPrintf(pHlp, "    Medium : %u tracks, %u sectors\n",
     2426                        drv->max_track,
     2427                        drv->last_sect);
     2428        pHlp->pfnPrintf(pHlp, "    Current: track %u, head %u, sector %u\n",
     2429                        drv->track,
     2430                        drv->head,
     2431                        drv->sect);
     2432    }
    23672433}
    23682434
     
    30023068    rc = PDMDevHlpSSMRegister(pDevIns, FDC_SAVESTATE_CURRENT, sizeof(*pThis), fdcSaveExec, fdcLoadExec);
    30033069    AssertRCReturn(rc, rc);
     3070
     3071    /*
     3072     * Register the debugger info callback.
     3073     */
     3074    PDMDevHlpDBGFInfoRegister(pDevIns, "fdc", "FDC info", fdcInfo);
    30043075
    30053076    /*
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette