VirtualBox

Changeset 1056 in vbox


Ignore:
Timestamp:
Feb 23, 2007 8:34:40 PM (18 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
18932
Message:

CPUMR3SetCR4Feature

Location:
trunk
Files:
2 edited

Legend:

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

    r770 r1056  
    743743#endif
    744744
     745/**
     746 * API for controlling a few of the CPU features found in CR4.
     747 *
     748 * Currently only X86_CR4_TSD is accepted as input.
     749 *
     750 * @returns VBox status code.
     751 *
     752 * @param   pVM     The VM handle.
     753 * @param   fOr     The CR4 OR mask.
     754 * @param   fAnd    The CR4 AND mask.
     755 */
     756CPUMR3DECL(int) CPUMR3SetCR4Feature(PVM pVM, RTHCUINTREG fOr, RTHCUINTREG fAnd);
     757
    745758/** @} */
    746759#endif
  • trunk/src/VBox/VMM/CPUM.cpp

    r773 r1056  
    133133        pVM->cpum.s.CR4.OrMask  = X86_CR4_OSFSXR;
    134134    }
    135 
    136 #ifdef CPUM_TRAP_RDTSC
    137     pVM->cpum.s.CR4.OrMask |= X86_CR4_TSD;
    138 #endif
    139135
    140136    if (!pVM->cpum.s.CPUFeatures.edx.u1MMX)
     
    815811    pHlp->pfnPrintf(pHlp, "Hypervisor CPUM state: %s\n", pszComment);
    816812    cpumR3InfoOne(&pVM->cpum.s.Hyper, pVM->cpum.s.pHyperCoreHC, pHlp, enmType, ".");
     813    pHlp->pfnPrintf(pHlp, "CR4OrMask=%#x CR4AndMask=%#x\n", pVM->cpum.s.CR4.OrMask, pVM->cpum.s.CR4.AndMask);
    817814}
    818815
     
    16741671}
    16751672#endif
     1673
     1674
     1675/**
     1676 * API for controlling a few of the CPU features found in CR4.
     1677 *
     1678 * Currently only X86_CR4_TSD is accepted as input.
     1679 *
     1680 * @returns VBox status code.
     1681 *
     1682 * @param   pVM     The VM handle.
     1683 * @param   fOr     The CR4 OR mask.
     1684 * @param   fAnd    The CR4 AND mask.
     1685 */
     1686CPUMR3DECL(int) CPUMR3SetCR4Feature(PVM pVM, RTHCUINTREG fOr, RTHCUINTREG fAnd)
     1687{
     1688    AssertMsgReturn(!(fOr & ~(X86_CR4_TSD)), ("%#x\n", fOr), VERR_INVALID_PARAMETER);
     1689    AssertMsgReturn((fAnd & ~(X86_CR4_TSD)) == ~(X86_CR4_TSD), ("%#x\n", fAnd), VERR_INVALID_PARAMETER);
     1690
     1691    pVM->cpum.s.CR4.OrMask &= fAnd;
     1692    pVM->cpum.s.CR4.OrMask |= fOr;
     1693
     1694    return VINF_SUCCESS;
     1695}
     1696
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