VirtualBox

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


Ignore:
Timestamp:
Jul 31, 2020 12:41:14 PM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
139645
Message:

VMM: Added method for getting at the CPU database.

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

Legend:

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

    r85354 r85573  
    3333
    3434/*********************************************************************************************************************************
    35 *   Structures and Typedefs                                                                                                      *
    36 *********************************************************************************************************************************/
    37 typedef struct CPUMDBENTRY
    38 {
    39     /** The CPU name. */
    40     const char     *pszName;
    41     /** The full CPU name. */
    42     const char     *pszFullName;
    43     /** The CPU vendor (CPUMCPUVENDOR). */
    44     uint8_t         enmVendor;
    45     /** The CPU family. */
    46     uint8_t         uFamily;
    47     /** The CPU model. */
    48     uint8_t         uModel;
    49     /** The CPU stepping. */
    50     uint8_t         uStepping;
    51     /** The microarchitecture. */
    52     CPUMMICROARCH   enmMicroarch;
    53     /** Scalable bus frequency used for reporting other frequencies. */
    54     uint64_t        uScalableBusFreq;
    55     /** Flags - CPUDB_F_XXX. */
    56     uint32_t        fFlags;
    57     /** The maximum physical address with of the CPU.  This should correspond to
    58      * the value in CPUID leaf 0x80000008 when present. */
    59     uint8_t         cMaxPhysAddrWidth;
    60     /** The MXCSR mask. */
    61     uint32_t        fMxCsrMask;
    62     /** Pointer to an array of CPUID leaves.  */
    63     PCCPUMCPUIDLEAF paCpuIdLeaves;
    64     /** The number of CPUID leaves in the array paCpuIdLeaves points to. */
    65     uint32_t        cCpuIdLeaves;
    66     /** The method used to deal with unknown CPUID leaves. */
    67     CPUMUNKNOWNCPUID enmUnknownCpuId;
    68     /** The default unknown CPUID value. */
    69     CPUMCPUID       DefUnknownCpuId;
    70 
    71     /** MSR mask.  Several microarchitectures ignore the higher bits of ECX in
    72      *  the RDMSR and WRMSR instructions. */
    73     uint32_t        fMsrMask;
    74 
    75     /** The number of ranges in the table pointed to b paMsrRanges. */
    76     uint32_t        cMsrRanges;
    77     /** MSR ranges for this CPU. */
    78     PCCPUMMSRRANGE  paMsrRanges;
    79 } CPUMDBENTRY;
    80 
    81 
    82 /*********************************************************************************************************************************
    8335*   Defined Constants And Macros                                                                                                 *
    8436*********************************************************************************************************************************/
    85 /** @name CPUDB_F_XXX - CPUDBENTRY::fFlags
    86  * @{ */
    87 /** Should execute all in IEM.
    88  * @todo Implement this - currently done in Main...  */
    89 #define CPUDB_F_EXECUTE_ALL_IN_IEM          RT_BIT_32(0)
    90 /** @} */
    91 
    92 
    9337/** @def NULL_ALONE
    9438 * For eliminating an unnecessary data dependency in standalone builds (for
     
    331275
    332276
     277/**
     278 * Returns the number of entries in the CPU database.
     279 *
     280 * @returns Number of entries.
     281 * @sa      PFNCPUMDBGETENTRIES
     282 */
     283VMMR3DECL(uint32_t)         CPUMR3DbGetEntries(void)
     284{
     285    return RT_ELEMENTS(g_apCpumDbEntries);
     286}
     287
     288
     289/**
     290 * Returns CPU database entry for the given index.
     291 *
     292 * @returns Pointer the CPU database entry, NULL if index is out of bounds.
     293 * @param   idxCpuDb            The index (0..CPUMR3DbGetEntries).
     294 * @sa      PFNCPUMDBGETENTRYBYINDEX
     295 */
     296VMMR3DECL(PCCPUMDBENTRY)    CPUMR3DbGetEntryByIndex(uint32_t idxCpuDb)
     297{
     298    AssertReturn(idxCpuDb <= RT_ELEMENTS(g_apCpumDbEntries), NULL);
     299    return g_apCpumDbEntries[idxCpuDb];
     300}
     301
     302
     303/**
     304 * Returns CPU database entry with the given name.
     305 *
     306 * @returns Pointer the CPU database entry, NULL if not found.
     307 * @param   idxCpuDb            The name of the profile to return.
     308 * @sa      PFNCPUMDBGETENTRYBYNAME
     309 */
     310VMMR3DECL(PCCPUMDBENTRY)    CPUMR3DbGetEntryByName(const char *pszName)
     311{
     312    AssertPtrReturn(pszName, NULL);
     313    AssertReturn(*pszName, NULL);
     314    for (size_t i = 0; i < RT_ELEMENTS(g_apCpumDbEntries); i++)
     315        if (strcmp(g_apCpumDbEntries[i]->pszName, pszName) == 0)
     316            return g_apCpumDbEntries[i];
     317    return NULL;
     318}
     319
     320
    333321
    334322/**
  • trunk/src/VBox/VMM/VMMR3/cpus/Intel_80186.h

    r82968 r85573  
    6060    /*.enmMicroarch     = */ kCpumMicroarch_Intel_80186,
    6161    /*.uScalableBusFreq = */ CPUM_SBUSFREQ_UNKNOWN,
    62     /*.fFlags           = */ CPUDB_F_EXECUTE_ALL_IN_IEM,
     62    /*.fFlags           = */ CPUMDB_F_EXECUTE_ALL_IN_IEM,
    6363    /*.cMaxPhysAddrWidth= */ 20,
    6464    /*.fMxCsrMask       = */ 0,
  • trunk/src/VBox/VMM/VMMR3/cpus/Intel_80286.h

    r82968 r85573  
    6060    /*.enmMicroarch     = */ kCpumMicroarch_Intel_80286,
    6161    /*.uScalableBusFreq = */ CPUM_SBUSFREQ_UNKNOWN,
    62     /*.fFlags           = */ CPUDB_F_EXECUTE_ALL_IN_IEM,
     62    /*.fFlags           = */ CPUMDB_F_EXECUTE_ALL_IN_IEM,
    6363    /*.cMaxPhysAddrWidth= */ 24,
    6464    /*.fMxCsrMask       = */ 0,
  • trunk/src/VBox/VMM/VMMR3/cpus/Intel_80386.h

    r82968 r85573  
    6060    /*.enmMicroarch     = */ kCpumMicroarch_Intel_80386,
    6161    /*.uScalableBusFreq = */ CPUM_SBUSFREQ_UNKNOWN,
    62     /*.fFlags           = */ CPUDB_F_EXECUTE_ALL_IN_IEM,
     62    /*.fFlags           = */ CPUMDB_F_EXECUTE_ALL_IN_IEM,
    6363    /*.cMaxPhysAddrWidth= */ 24,
    6464    /*.fMxCsrMask       = */ 0,
  • trunk/src/VBox/VMM/VMMR3/cpus/Intel_8086.h

    r82968 r85573  
    6060    /*.enmMicroarch     = */ kCpumMicroarch_Intel_8086,
    6161    /*.uScalableBusFreq = */ CPUM_SBUSFREQ_UNKNOWN,
    62     /*.fFlags           = */ CPUDB_F_EXECUTE_ALL_IN_IEM,
     62    /*.fFlags           = */ CPUMDB_F_EXECUTE_ALL_IN_IEM,
    6363    /*.cMaxPhysAddrWidth= */ 20,
    6464    /*.fMxCsrMask       = */ 0,
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