VirtualBox

Changeset 76548 in vbox


Ignore:
Timestamp:
Dec 31, 2018 4:05:16 AM (6 years ago)
Author:
vboxsync
Message:

VMM/CPUM: Add functions for getting guest CR0, CR4 valid bits mask, in preparation for upcoming changes to nested VMX code.

Location:
trunk
Files:
2 edited

Legend:

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

    r76507 r76548  
    14141414VMM_INT_DECL(void)     CPUMSetGuestSpecCtrl(PVMCPU pVCpu, uint64_t uValue);
    14151415VMM_INT_DECL(uint64_t) CPUMGetGuestSpecCtrl(PVMCPU pVCpu);
     1416VMM_INT_DECL(uint64_t) CPUMGetGuestCR4ValidMask(PVM pVM);
    14161417/** @} */
    14171418
     
    15141515
    15151516#ifndef IPRT_WITHOUT_NAMED_UNIONS_AND_STRUCTS
     1517
     1518/**
     1519 * Gets valid CR0 bits for the guest.
     1520 *
     1521 * @returns Valid CR0 bits.
     1522 */
     1523DECLINLINE(uint64_t) CPUMGetGuestCR0ValidMask(void)
     1524{
     1525    return (  X86_CR0_PE | X86_CR0_MP | X86_CR0_EM | X86_CR0_TS
     1526            | X86_CR0_ET | X86_CR0_NE | X86_CR0_WP | X86_CR0_AM
     1527            | X86_CR0_NW | X86_CR0_CD | X86_CR0_PG);
     1528}
    15161529
    15171530/**
  • trunk/src/VBox/VMM/VMMAll/CPUMAllRegs.cpp

    r75831 r76548  
    30613061}
    30623062
     3063
     3064/**
     3065 * Gets valid CR4 bits for the guest.
     3066 *
     3067 * @returns Valid CR4 bits.
     3068 * @param   pVM     The cross context VM structure.
     3069 */
     3070VMM_INT_DECL(uint64_t) CPUMGetGuestCR4ValidMask(PVM pVM)
     3071{
     3072    PCCPUMFEATURES pGuestFeatures = &pVM->cpum.s.GuestFeatures;
     3073    uint64_t fMask = X86_CR4_VME | X86_CR4_PVI
     3074                   | X86_CR4_TSD | X86_CR4_DE
     3075                   | X86_CR4_PSE | X86_CR4_PAE
     3076                   | X86_CR4_MCE | X86_CR4_PGE
     3077                   | X86_CR4_PCE
     3078                   | X86_CR4_OSXMMEEXCPT;  /** @todo r=ramshankar: Introduced in Pentium III along with SSE. Check fSse here? */
     3079    if (pGuestFeatures->fFxSaveRstor)
     3080        fMask |= X86_CR4_OSFXSR;
     3081    if (pGuestFeatures->fVmx)
     3082        fMask |= X86_CR4_VMXE;
     3083    if (pGuestFeatures->fXSaveRstor)
     3084        fMask |= X86_CR4_OSXSAVE;
     3085    if (pGuestFeatures->fPcid)
     3086        fMask |= X86_CR4_PCIDE;
     3087    if (pGuestFeatures->fFsGsBase)
     3088        fMask |= X86_CR4_FSGSBASE;
     3089    return fMask;
     3090}
     3091
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