VirtualBox

Changeset 9649 in vbox


Ignore:
Timestamp:
Jun 12, 2008 9:48:30 AM (17 years ago)
Author:
vboxsync
Message:

Added CPUMIsGuestInLongMode.

Location:
trunk
Files:
6 edited

Legend:

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

    r9647 r9649  
    518518
    519519/**
     520 * Tests if the guest is running in long mode or not.
     521 *
     522 * @returns true if in long mode, otherwise false.
     523 * @param   pVM     The VM handle.
     524 */
     525DECLINLINE(bool) CPUMIsGuestInLongMode(PVM pVM)
     526{
     527    return (CPUMGetGuestEFER(pVM) & MSR_K6_EFER_LMA) == MSR_K6_EFER_LMA;
     528}
     529
     530/**
    520531 * Tests if the guest is running in paged protected or not.
    521532 *
  • trunk/src/VBox/VMM/CPUM.cpp

    r9545 r9649  
    790790    {
    791791        case CPUMDUMPTYPE_TERSE:
    792             if (CPUMGetGuestMode(pVM) == CPUMMODE_LONG)
     792            if (CPUMIsGuestInLongMode(pVM))
    793793            {
    794794                pHlp->pfnPrintf(pHlp,
     
    818818
    819819        case CPUMDUMPTYPE_DEFAULT:
    820             if (CPUMGetGuestMode(pVM) == CPUMMODE_LONG)
     820            if (CPUMIsGuestInLongMode(pVM))
    821821            {
    822822                pHlp->pfnPrintf(pHlp,
     
    854854
    855855        case CPUMDUMPTYPE_VERBOSE:
    856             if (CPUMGetGuestMode(pVM) == CPUMMODE_LONG)
     856            if (CPUMIsGuestInLongMode(pVM))
    857857            {
    858858                pHlp->pfnPrintf(pHlp,
  • trunk/src/VBox/VMM/PGM.cpp

    r9606 r9649  
    23832383/** @todo fix this! Convert the PGMR3DumpHierarchyHC functions to do guest stuff. */
    23842384    /* Big pages supported? */
    2385     bool fPSE;
    2386 
    2387     if (CPUMGetGuestMode(pVM) == CPUMMODE_LONG)
    2388         fPSE = true;
    2389     else
    2390         fPSE = !!(CPUMGetGuestCR4(pVM) & X86_CR4_PSE);
     2385    const bool fPSE = CPUMIsGuestInLongMode(pVM) || !!(CPUMGetGuestCR4(pVM) & X86_CR4_PSE);
    23912386
    23922387    /* Global pages supported? */
     
    32623257        return VERR_INVALID_PARAMETER;
    32633258    }
    3264     bool fBigPagesSupported;
    3265 
    3266     if (CPUMGetGuestMode(pVM) == CPUMMODE_LONG)
    3267         fBigPagesSupported = true;
    3268     else
    3269         fBigPagesSupported = !!(cr4 & X86_CR4_PSE);
     3259    const bool fBigPagesSupported = CPUMIsGuestInLongMode(pVM) || !!(cr4 & X86_CR4_PSE);
    32703260
    32713261    int rc = VINF_SUCCESS;
  • trunk/src/VBox/VMM/VMMAll/CPUMAllRegs.cpp

    r9647 r9649  
    397397
    398398    /* Mask away invalid parts of the cpu context. */
    399     if (CPUMGetGuestMode(pVM) != CPUMMODE_LONG)
     399    if (!CPUMIsGuestInLongMode(pVM))
    400400    {
    401401        uint64_t u64Mask = UINT64_C(0xffffffff);
  • trunk/src/VBox/VMM/VMMAll/EMAll.cpp

    r9647 r9649  
    18651865EMDECL(int) EMInterpretDRxWrite(PVM pVM, PCPUMCTXCORE pRegFrame, uint32_t DestRegDrx, uint32_t SrcRegGen)
    18661866{
    1867     uint32_t val32;
    1868 
    1869     int rc = DISFetchReg32(pRegFrame, SrcRegGen, &val32);
     1867    uint64_t val;
     1868    int      rc;
     1869
     1870    if (CPUMIsGuestInLongMode(pVM))
     1871    {
     1872        rc = DISFetchReg64(pRegFrame, SrcRegGen, &val);
     1873    }
     1874    else
     1875    {
     1876        uint32_t val32;
     1877        rc = DISFetchReg32(pRegFrame, SrcRegGen, &val32);
     1878        val = val32;
     1879    }
     1880
    18701881    if (VBOX_SUCCESS(rc))
    18711882    {
    1872         rc = CPUMSetGuestDRx(pVM, DestRegDrx, val32);
     1883        rc = CPUMSetGuestDRx(pVM, DestRegDrx, val);
    18731884        if (VBOX_SUCCESS(rc))
    18741885            return rc;
  • trunk/src/VBox/VMM/VMMAll/PGMAllPhys.cpp

    r9606 r9649  
    988988     * PAE or 32-bit?
    989989     */
    990     Assert(CPUMGetGuestMode(pVM) != CPUMMODE_LONG);
     990    Assert(!CPUMIsGuestInLongMode(pVM));
    991991
    992992    int 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