VirtualBox

Changeset 14704 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Nov 27, 2008 1:49:48 PM (16 years ago)
Author:
vboxsync
Message:

Some more switcher work

Location:
trunk/src/VBox/VMM
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/HWACCM.cpp

    r14563 r14704  
    778778        }
    779779    }
     780
     781#if (HC_ARCH_BITS == 32) && defined(VBOX_ENABLE_64_BITS_GUESTS)
     782    if (    pVM->fHWACCMEnabled
     783        &&  CPUMGetGuestCpuIdFeature(pVM, CPUMCPUIDFEATURE_LONG_MODE))
     784    {
     785        rc  = VMMR3InitSwitcher3264(pVM);
     786        if (VBOX_FAILURE(rc))
     787        {
     788            LogRel(("WARNING: Unable to map the VM structure into the intermediate page table; disabling long mode support\n"));
     789            CPUMClearGuestCpuIdFeature(pVM, CPUMCPUIDFEATURE_LONG_MODE);
     790            CPUMClearGuestCpuIdFeature(pVM, CPUMCPUIDFEATURE_LAHF);
     791        }
     792    }
     793#endif
    780794    return VINF_SUCCESS;
    781795}
  • trunk/src/VBox/VMM/VMMAll/CPUMAllRegs.cpp

    r14411 r14704  
    15011501        }
    15021502
     1503        case CPUMCPUIDFEATURE_LONG_MODE:
     1504        {
     1505            if (pVM->cpum.s.aGuestCpuIdExt[0].eax >= 0x80000001)
     1506                return !!(pVM->cpum.s.aGuestCpuIdExt[1].edx & X86_CPUID_AMD_FEATURE_EDX_LONG_MODE);
     1507            break;
     1508        }
     1509       
    15031510        default:
    15041511            AssertMsgFailed(("enmFeature=%d\n", enmFeature));
     
    15591566                pVM->cpum.s.aGuestCpuIdExt[1].edx &= ~X86_CPUID_AMD_FEATURE_EDX_PAT;
    15601567            LogRel(("CPUMClearGuestCpuIdFeature: Disabled PAT!\n"));
     1568            break;
     1569        }
     1570
     1571        case CPUMCPUIDFEATURE_LONG_MODE:
     1572        {
     1573            if (pVM->cpum.s.aGuestCpuIdExt[0].eax >= 0x80000001)
     1574                pVM->cpum.s.aGuestCpuIdExt[1].edx &= ~X86_CPUID_AMD_FEATURE_EDX_LONG_MODE;
     1575            break;
     1576        }
     1577
     1578        case CPUMCPUIDFEATURE_LAHF:
     1579        {
     1580            if (pVM->cpum.s.aGuestCpuIdExt[0].eax >= 0x80000001)
     1581                pVM->cpum.s.aGuestCpuIdExt[1].ecx &= ~X86_CPUID_AMD_FEATURE_ECX_LAHF_SAHF;
    15611582            break;
    15621583        }
  • trunk/src/VBox/VMM/VMMSwitcher.cpp

    r14653 r14704  
    213213}
    214214
    215 
    216215/**
    217216 * Relocate the switchers, called by VMMR#Relocate.
     
    635634                break;
    636635            }
    637 
     636#endif
    638637            /*
    639638             * 64-bit HC pointer to the CPUM instance data (no argument).
     
    645644                break;
    646645            }
    647 #endif
    648646
    649647            /*
     
    954952}
    955953
     954/**
     955 * Setup the 32->64 world switcher
     956 *
     957 * @returns VBox status code.
     958 * @param   pVM             VM handle.
     959 */
     960VMMR3DECL(int) VMMR3InitSwitcher3264(PVM pVM)
     961{
     962    int rc;
     963
     964    uint32_t cPages = RT_ALIGN_Z(pVM->cbSelf, PAGE_SIZE) >> PAGE_SHIFT;
     965
     966    /* Map the entire VM structure into the intermediate page tables as we need to have access
     967     * to them in the 32->64 switcher.
     968     */
     969    for (unsigned i=0;i<cPages;i++)
     970    {
     971        rc = PGMR3MapIntermediate(pVM, pVM->pVMR0 + i*PAGE_SIZE, pVM->paVMPagesR3[i].Phys, PAGE_SIZE);
     972        if (VBOX_FAILURE(rc))
     973        {
     974            Log(("PGMR3MapIntermediate %RHv %RHp failed with %Rrc\n", pVM->pVMR0 + i*PAGE_SIZE, pVM->paVMPagesR3[i].Phys, rc));
     975            break;
     976        }
     977    }
     978    return rc;
     979}
     980
    956981
    957982/**
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