VirtualBox

Changeset 35625 in vbox for trunk/src/VBox/VMM/VMMR3


Ignore:
Timestamp:
Jan 19, 2011 11:17:34 AM (14 years ago)
Author:
vboxsync
Message:

DBGF,CPUM,DBGC: Use DBGFReg in the debugger, stop accessing CPUMCTX structures directly when messing with registers.

Location:
trunk/src/VBox/VMM/VMMR3
Files:
2 edited

Legend:

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

    r35601 r35625  
    11051105    CPU_REG_XMM(15),
    11061106    CPU_REG_RW_AS("gdtr_base",      GDTR_BASE,      U64, gdtr.pGdt,             cpumR3RegGet_Generic,   cpumR3RegSet_Generic,   NULL,                       NULL                    ),
    1107     CPU_REG_RW_AS("gdtr_limit",     GDTR_LIMIT,     U16, gdtr.cbGdt,            cpumR3RegGet_Generic,   cpumR3RegSet_Generic,   NULL,                       NULL                    ),
     1107    CPU_REG_RW_AS("gdtr_lim",       GDTR_LIMIT,     U16, gdtr.cbGdt,            cpumR3RegGet_Generic,   cpumR3RegSet_Generic,   NULL,                       NULL                    ),
    11081108    CPU_REG_RW_AS("idtr_base",      IDTR_BASE,      U64, idtr.pIdt,             cpumR3RegGet_Generic,   cpumR3RegSet_Generic,   NULL,                       NULL                    ),
    1109     CPU_REG_RW_AS("idtr_limit",     IDTR_LIMIT,     U16, idtr.cbIdt,            cpumR3RegGet_Generic,   cpumR3RegSet_Generic,   NULL,                       NULL                    ),
     1109    CPU_REG_RW_AS("idtr_lim",       IDTR_LIMIT,     U16, idtr.cbIdt,            cpumR3RegGet_Generic,   cpumR3RegSet_Generic,   NULL,                       NULL                    ),
    11101110    CPU_REG_SEG(LDTR, ldtr),
    11111111    CPU_REG_SEG(TR, tr),
    1112     CPU_REG_EX_AS("cr0",            CR0,            U32, 0,                     cpumR3RegGstGet_crX,       cpumR3RegGstSet_crX,       g_aCpumRegAliases_cr0,      g_aCpumRegFields_cr0    ),
    1113     CPU_REG_EX_AS("cr2",            CR2,            U64, 2,                     cpumR3RegGstGet_crX,       cpumR3RegGstSet_crX,       NULL,                       NULL                    ),
    1114     CPU_REG_EX_AS("cr3",            CR3,            U64, 3,                     cpumR3RegGstGet_crX,       cpumR3RegGstSet_crX,       NULL,                       g_aCpumRegFields_cr3    ),
    1115     CPU_REG_EX_AS("cr4",            CR4,            U32, 4,                     cpumR3RegGstGet_crX,       cpumR3RegGstSet_crX,       NULL,                       g_aCpumRegFields_cr4    ),
    1116     CPU_REG_EX_AS("cr8",            CR8,            U32, 8,                     cpumR3RegGstGet_crX,       cpumR3RegGstSet_crX,       NULL,                       NULL                    ),
    1117     CPU_REG_EX_AS("dr0",            DR0,            U64, 0,                     cpumR3RegGstGet_drX,       cpumR3RegGstSet_drX,       NULL,                       NULL                    ),
    1118     CPU_REG_EX_AS("dr1",            DR1,            U64, 1,                     cpumR3RegGstGet_drX,       cpumR3RegGstSet_drX,       NULL,                       NULL                    ),
    1119     CPU_REG_EX_AS("dr2",            DR2,            U64, 2,                     cpumR3RegGstGet_drX,       cpumR3RegGstSet_drX,       NULL,                       NULL                    ),
    1120     CPU_REG_EX_AS("dr3",            DR3,            U64, 3,                     cpumR3RegGstGet_drX,       cpumR3RegGstSet_drX,       NULL,                       NULL                    ),
    1121     CPU_REG_EX_AS("dr6",            DR6,            U32, 6,                     cpumR3RegGstGet_drX,       cpumR3RegGstSet_drX,       NULL,                       g_aCpumRegFields_dr6    ),
    1122     CPU_REG_EX_AS("dr7",            DR7,            U32, 7,                     cpumR3RegGstGet_drX,       cpumR3RegGstSet_drX,       NULL,                       g_aCpumRegFields_dr7    ),
     1112    CPU_REG_EX_AS("cr0",            CR0,            U32, 0,                     cpumR3RegGstGet_crX,    cpumR3RegGstSet_crX,    g_aCpumRegAliases_cr0,      g_aCpumRegFields_cr0    ),
     1113    CPU_REG_EX_AS("cr2",            CR2,            U64, 2,                     cpumR3RegGstGet_crX,    cpumR3RegGstSet_crX,    NULL,                       NULL                    ),
     1114    CPU_REG_EX_AS("cr3",            CR3,            U64, 3,                     cpumR3RegGstGet_crX,    cpumR3RegGstSet_crX,    NULL,                       g_aCpumRegFields_cr3    ),
     1115    CPU_REG_EX_AS("cr4",            CR4,            U32, 4,                     cpumR3RegGstGet_crX,    cpumR3RegGstSet_crX,    NULL,                       g_aCpumRegFields_cr4    ),
     1116    CPU_REG_EX_AS("cr8",            CR8,            U32, 8,                     cpumR3RegGstGet_crX,    cpumR3RegGstSet_crX,    NULL,                       NULL                    ),
     1117    CPU_REG_EX_AS("dr0",            DR0,            U64, 0,                     cpumR3RegGstGet_drX,    cpumR3RegGstSet_drX,    NULL,                       NULL                    ),
     1118    CPU_REG_EX_AS("dr1",            DR1,            U64, 1,                     cpumR3RegGstGet_drX,    cpumR3RegGstSet_drX,    NULL,                       NULL                    ),
     1119    CPU_REG_EX_AS("dr2",            DR2,            U64, 2,                     cpumR3RegGstGet_drX,    cpumR3RegGstSet_drX,    NULL,                       NULL                    ),
     1120    CPU_REG_EX_AS("dr3",            DR3,            U64, 3,                     cpumR3RegGstGet_drX,    cpumR3RegGstSet_drX,    NULL,                       NULL                    ),
     1121    CPU_REG_EX_AS("dr6",            DR6,            U32, 6,                     cpumR3RegGstGet_drX,    cpumR3RegGstSet_drX,    NULL,                       g_aCpumRegFields_dr6    ),
     1122    CPU_REG_EX_AS("dr7",            DR7,            U32, 7,                     cpumR3RegGstGet_drX,    cpumR3RegGstSet_drX,    NULL,                       g_aCpumRegFields_dr7    ),
    11231123    CPU_REG_MSR("apic_base",     IA32_APICBASE,     U32, g_aCpumRegFields_apic_base  ),
    11241124    CPU_REG_MSR("pat",           IA32_CR_PAT,       U64, g_aCpumRegFields_cr_pat     ),
     
    12331233    CPU_REG_XMM(15),
    12341234    CPU_REG_RW_AS("gdtr_base",      GDTR_BASE,      U64, gdtr.pGdt,             cpumR3RegGet_Generic,   cpumR3RegSet_Generic,   NULL,                       NULL                    ),
    1235     CPU_REG_RW_AS("gdtr_limit",     GDTR_LIMIT,     U16, gdtr.cbGdt,            cpumR3RegGet_Generic,   cpumR3RegSet_Generic,   NULL,                       NULL                    ),
     1235    CPU_REG_RW_AS("gdtr_lim",       GDTR_LIMIT,     U16, gdtr.cbGdt,            cpumR3RegGet_Generic,   cpumR3RegSet_Generic,   NULL,                       NULL                    ),
    12361236    CPU_REG_RW_AS("idtr_base",      IDTR_BASE,      U64, idtr.pIdt,             cpumR3RegGet_Generic,   cpumR3RegSet_Generic,   NULL,                       NULL                    ),
    1237     CPU_REG_RW_AS("idtr_limit",     IDTR_LIMIT,     U16, idtr.cbIdt,            cpumR3RegGet_Generic,   cpumR3RegSet_Generic,   NULL,                       NULL                    ),
     1237    CPU_REG_RW_AS("idtr_lim",       IDTR_LIMIT,     U16, idtr.cbIdt,            cpumR3RegGet_Generic,   cpumR3RegSet_Generic,   NULL,                       NULL                    ),
    12381238    CPU_REG_SEG(LDTR, ldtr),
    12391239    CPU_REG_SEG(TR, tr),
  • trunk/src/VBox/VMM/VMMR3/DBGFReg.cpp

    r35609 r35625  
    169169
    170170/**
    171  * Argument packet passed by DBGFR3RegNmPrintfV to dbgfR3RegNmPrintfCbOutput
    172  * and dbgfR3RegNmPrintfCbFormat.
    173  */
    174 typedef struct DBGFR3REGNMPRINTFARGS
     171 * Argument packet passed by DBGFR3RegPrintfV to dbgfR3RegPrintfCbOutput and
     172 * dbgfR3RegPrintfCbFormat.
     173 */
     174typedef struct DBGFR3REGPRINTFARGS
    175175{
    176176    /** The VM handle. */
     
    194194     * subsequent ones are suppressed. */
    195195    int         rc;
    196 } DBGFR3REGNMPRINTFARGS;
    197 /** Pointer to a DBGFR3RegNmPrintfV argument packet. */
    198 typedef DBGFR3REGNMPRINTFARGS *PDBGFR3REGNMPRINTFARGS;
     196} DBGFR3REGPRINTFARGS;
     197/** Pointer to a DBGFR3RegPrintfV argument packet. */
     198typedef DBGFR3REGPRINTFARGS *PDBGFR3REGPRINTFARGS;
    199199
    200200
     
    12591259/**
    12601260 * On CPU worker for the register queries, used by dbgfR3RegNmQueryWorker and
    1261  * dbgfR3RegNmPrintfCbFormatNormal.
     1261 * dbgfR3RegPrintfCbFormatNormal.
    12621262 *
    12631263 * @returns VBox status code.
     
    18401840
    18411841
     1842VMMR3DECL(int) DBGFR3RegNmSet(PVM pVM, VMCPUID idDefCpu, const char *pszReg, PCDBGFREGVAL pValue, DBGFREGVALTYPE enmType)
     1843{
     1844    return VERR_NOT_IMPLEMENTED;
     1845}
     1846
     1847
    18421848/**
    18431849 * Internal worker for DBGFR3RegFormatValue, cbTmp is sufficent.
     
    19051911{
    19061912    /*
    1907      * Format to temporary buffer using worker shared with dbgfR3RegNmPrintfCbFormatNormal.
     1913     * Format to temporary buffer using worker shared with dbgfR3RegPrintfCbFormatNormal.
    19081914     */
    19091915    char szTmp[160];
     
    19711977 */
    19721978static size_t
    1973 dbgfR3RegNmPrintfCbFormatField(PDBGFR3REGNMPRINTFARGS pThis, PFNRTSTROUTPUT pfnOutput, void *pvArgOutput,
    1974                                PCDBGFREGLOOKUP pLookupRec, int cchWidth, int cchPrecision, unsigned fFlags)
     1979dbgfR3RegPrintfCbFormatField(PDBGFR3REGPRINTFARGS pThis, PFNRTSTROUTPUT pfnOutput, void *pvArgOutput,
     1980                             PCDBGFREGLOOKUP pLookupRec, int cchWidth, int cchPrecision, unsigned fFlags)
    19751981{
    19761982    char szTmp[160];
     
    20642070 */
    20652071static size_t
    2066 dbgfR3RegNmPrintfCbFormatNormal(PDBGFR3REGNMPRINTFARGS pThis, PFNRTSTROUTPUT pfnOutput, void *pvArgOutput,
    2067                                 PCDBGFREGLOOKUP pLookupRec, unsigned uBase, int cchWidth, int cchPrecision, unsigned fFlags)
     2072dbgfR3RegPrintfCbFormatNormal(PDBGFR3REGPRINTFARGS pThis, PFNRTSTROUTPUT pfnOutput, void *pvArgOutput,
     2073                              PCDBGFREGLOOKUP pLookupRec, unsigned uBase, int cchWidth, int cchPrecision, unsigned fFlags)
    20682074{
    20692075    char szTmp[160];
     
    21002106 */
    21012107static DECLCALLBACK(size_t)
    2102 dbgfR3RegNmPrintfCbFormat(void *pvArg, PFNRTSTROUTPUT pfnOutput, void *pvArgOutput,
    2103                           const char **ppszFormat, va_list *pArgs, int cchWidth,
    2104                           int cchPrecision, unsigned fFlags, char chArgSize)
     2108dbgfR3RegPrintfCbFormat(void *pvArg, PFNRTSTROUTPUT pfnOutput, void *pvArgOutput,
     2109                        const char **ppszFormat, va_list *pArgs, int cchWidth,
     2110                        int cchPrecision, unsigned fFlags, char chArgSize)
    21052111{
    21062112    /*
    21072113     * Parse the format type and hand the job to the appropriate worker.
    21082114     */
    2109     PDBGFR3REGNMPRINTFARGS pThis = (PDBGFR3REGNMPRINTFARGS)pvArg;
     2115    PDBGFR3REGPRINTFARGS pThis = (PDBGFR3REGPRINTFARGS)pvArg;
    21102116    const char *pszFormat = *ppszFormat;
    21112117    if (    pszFormat[0] != 'V'
     
    21732179        case 'R': /* %VR{} */
    21742180        case 'X': /* %VRX{} */
    2175             return dbgfR3RegNmPrintfCbFormatNormal(pThis, pfnOutput, pvArgOutput, pLookupRec,
    2176                                                    16, cchWidth, cchPrecision, fFlags);
     2181            return dbgfR3RegPrintfCbFormatNormal(pThis, pfnOutput, pvArgOutput, pLookupRec,
     2182                                                 16, cchWidth, cchPrecision, fFlags);
    21772183        case 'U':
    2178             return dbgfR3RegNmPrintfCbFormatNormal(pThis, pfnOutput, pvArgOutput, pLookupRec,
    2179                                                    10, cchWidth, cchPrecision, fFlags);
     2184            return dbgfR3RegPrintfCbFormatNormal(pThis, pfnOutput, pvArgOutput, pLookupRec,
     2185                                                 10, cchWidth, cchPrecision, fFlags);
    21802186        case 'O':
    2181             return dbgfR3RegNmPrintfCbFormatNormal(pThis, pfnOutput, pvArgOutput, pLookupRec,
    2182                                                    8, cchWidth, cchPrecision, fFlags);
     2187            return dbgfR3RegPrintfCbFormatNormal(pThis, pfnOutput, pvArgOutput, pLookupRec,
     2188                                                 8, cchWidth, cchPrecision, fFlags);
    21832189        case 'B':
    2184             return dbgfR3RegNmPrintfCbFormatNormal(pThis, pfnOutput, pvArgOutput, pLookupRec,
    2185                                                    2, cchWidth, cchPrecision, fFlags);
     2190            return dbgfR3RegPrintfCbFormatNormal(pThis, pfnOutput, pvArgOutput, pLookupRec,
     2191                                                 2, cchWidth, cchPrecision, fFlags);
    21862192        case 'F':
    2187             return dbgfR3RegNmPrintfCbFormatField(pThis, pfnOutput, pvArgOutput, pLookupRec, cchWidth, cchPrecision, fFlags);
     2193            return dbgfR3RegPrintfCbFormatField(pThis, pfnOutput, pvArgOutput, pLookupRec, cchWidth, cchPrecision, fFlags);
    21882194        default:
    21892195            AssertFailed();
     
    21982204 */
    21992205static DECLCALLBACK(size_t)
    2200 dbgfR3RegNmPrintfCbOutput(void *pvArg, const char *pachChars, size_t cbChars)
    2201 {
    2202     PDBGFR3REGNMPRINTFARGS  pArgs    = (PDBGFR3REGNMPRINTFARGS)pvArg;
     2206dbgfR3RegPrintfCbOutput(void *pvArg, const char *pachChars, size_t cbChars)
     2207{
     2208    PDBGFR3REGPRINTFARGS    pArgs    = (PDBGFR3REGPRINTFARGS)pvArg;
    22032209    size_t                  cbToCopy = cbChars;
    22042210    if (cbToCopy >= pArgs->cchLeftBuf)
     
    22202226
    22212227/**
    2222  * On CPU worker for the register formatting, used by DBGFR3RegNmPrintfV.
     2228 * On CPU worker for the register formatting, used by DBGFR3RegPrintfV.
    22232229 *
    22242230 * @returns VBox status code.
     
    22262232 * @param   pArgs               The argument package and state.
    22272233 */
    2228 static DECLCALLBACK(int) dbgfR3RegNmPrintfWorkerOnCpu(PDBGFR3REGNMPRINTFARGS pArgs)
     2234static DECLCALLBACK(int) dbgfR3RegPrintfWorkerOnCpu(PDBGFR3REGPRINTFARGS pArgs)
    22292235{
    22302236    DBGF_REG_DB_LOCK_READ(pArgs->pVM);
    2231     RTStrFormatV(dbgfR3RegNmPrintfCbOutput, pArgs, dbgfR3RegNmPrintfCbFormat, pArgs, pArgs->pszFormat, pArgs->va);
     2237    RTStrFormatV(dbgfR3RegPrintfCbOutput, pArgs, dbgfR3RegPrintfCbFormat, pArgs, pArgs->pszFormat, pArgs->va);
    22322238    DBGF_REG_DB_UNLOCK_READ(pArgs->pVM);
    22332239    return pArgs->rc;
     
    22642270     * specified CPU.
    22652271     */
    2266     DBGFR3REGNMPRINTFARGS Args;
     2272    DBGFR3REGPRINTFARGS Args;
    22672273    Args.pVM        = pVM;
    22682274    Args.idCpu      = idCpu != VMCPUID_ANY ? idCpu & ~DBGFREG_HYPER_VMCPUID : idCpu;
     
    22742280    Args.cchLeftBuf = cbBuf - 1;
    22752281    Args.rc         = VINF_SUCCESS;
    2276     int rc = VMR3ReqCallWait(pVM, Args.idCpu, (PFNRT)dbgfR3RegNmPrintfWorkerOnCpu, 1, &Args);
     2282    int rc = VMR3ReqCallWait(pVM, Args.idCpu, (PFNRT)dbgfR3RegPrintfWorkerOnCpu, 1, &Args);
    22772283    va_end(Args.va);
    22782284    return rc;
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