VirtualBox

Changeset 94931 in vbox for trunk/include/VBox/vmm


Ignore:
Timestamp:
May 9, 2022 8:24:47 AM (3 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
151339
Message:

VMM/CPUM: Introduced a global variable g_CpumHostFeatures for keeping the host CPU features. This is safer than keeping this info in the shared part of the VM structure. bugref:10093

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/vmm/cpum.h

    r94909 r94931  
    14071407typedef CPUMFEATURES const *PCCPUMFEATURES;
    14081408
     1409/**
     1410 * Chameleon wrapper structure for the host CPU features.
     1411 *
     1412 * This is used for the globally readable g_CpumHostFeatures variable, which is
     1413 * initialized once during VMMR0 load for ring-0 and during CPUMR3Init in
     1414 * ring-3.  To reflect this immutability after load/init, we use this wrapper
     1415 * structure to switch it between const and non-const depending on the context.
     1416 * Only two files sees it as non-const (CPUMR0.cpp and CPUM.cpp).
     1417 */
     1418typedef struct CPUHOSTFEATURES
     1419{
     1420    CPUMFEATURES
     1421#ifndef CPUM_WITH_NONCONST_HOST_FEATURES
     1422    const
     1423#endif
     1424                    s;
     1425} CPUHOSTFEATURES;
     1426/** Pointer to a const host CPU feature structure. */
     1427typedef CPUHOSTFEATURES const *PCCPUHOSTFEATURES;
     1428
     1429/** Host CPU features.
     1430 * @note In ring-3, only valid after CPUMR3Init.  In ring-0, valid after
     1431 *       module init. */
     1432extern CPUHOSTFEATURES g_CpumHostFeatures;
     1433
    14091434
    14101435/**
     
    14671492
    14681493#ifndef VBOX_FOR_DTRACE_LIB
     1494
     1495#if defined(RT_ARCH_X86) || defined(RT_ARCH_AMD64)
     1496VMMDECL(int)                CPUMCpuIdCollectLeavesX86(PCPUMCPUIDLEAF *ppaLeaves, uint32_t *pcLeaves);
     1497VMMDECL(CPUMCPUVENDOR)      CPUMCpuIdDetectX86VendorEx(uint32_t uEAX, uint32_t uEBX, uint32_t uECX, uint32_t uEDX);
     1498#endif
    14691499
    14701500/** @name Guest Register Getters.
     
    27252755VMMR3DECL(int)              CPUMR3CpuIdGetLeaf(PVM pVM, PCPUMCPUIDLEAF pLeaf, uint32_t uLeaf, uint32_t uSubLeaf);
    27262756VMMR3_INT_DECL(PCCPUMCPUIDLEAF) CPUMR3CpuIdGetPtr(PVM pVM, uint32_t *pcLeaves);
    2727 VMMR3DECL(CPUMMICROARCH)    CPUMR3CpuIdDetermineMicroarchEx(CPUMCPUVENDOR enmVendor, uint8_t bFamily,
    2728                                                             uint8_t bModel, uint8_t bStepping);
    2729 VMMR3DECL(const char *)     CPUMR3MicroarchName(CPUMMICROARCH enmMicroarch);
    2730 VMMR3DECL(int)              CPUMR3CpuIdCollectLeaves(PCPUMCPUIDLEAF *ppaLeaves, uint32_t *pcLeaves);
     2757VMMDECL(CPUMMICROARCH)      CPUMCpuIdDetermineX86MicroarchEx(CPUMCPUVENDOR enmVendor, uint8_t bFamily,
     2758                                                             uint8_t bModel, uint8_t bStepping);
     2759VMMDECL(const char *)       CPUMMicroarchName(CPUMMICROARCH enmMicroarch);
    27312760VMMR3DECL(int)              CPUMR3CpuIdDetectUnknownLeafMethod(PCPUMUNKNOWNCPUID penmUnknownMethod, PCPUMCPUID pDefUnknown);
    27322761VMMR3DECL(const char *)     CPUMR3CpuIdUnknownLeafMethodName(CPUMUNKNOWNCPUID enmUnknownMethod);
    2733 VMMR3DECL(CPUMCPUVENDOR)    CPUMR3CpuIdDetectVendorEx(uint32_t uEAX, uint32_t uEBX, uint32_t uECX, uint32_t uEDX);
    2734 VMMR3DECL(const char *)     CPUMR3CpuVendorName(CPUMCPUVENDOR enmVendor);
     2762VMMR3DECL(const char *)     CPUMCpuVendorName(CPUMCPUVENDOR enmVendor);
     2763#if defined(RT_ARCH_X86) || defined(RT_ARCH_AMD64)
    27352764VMMR3DECL(uint32_t)         CPUMR3DeterminHostMxCsrMask(void);
     2765#endif
    27362766
    27372767VMMR3DECL(int)              CPUMR3MsrRangesInsert(PVM pVM, PCCPUMMSRRANGE pNewRange);
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