VirtualBox

Changeset 14543 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Nov 24, 2008 7:36:37 PM (16 years ago)
Author:
vboxsync
Message:

#1865/VT-x: Attacking the heap allocation, introducing VMMIsHwVirtExtForced which will only return true on darwin (for now at least).

Location:
trunk/src/VBox
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/ConsoleImpl2.cpp

    r14525 r14543  
    205205    else
    206206        fHWVirtExEnabled = (hwVirtExEnabled == TSBool_True);
    207 #ifndef RT_OS_DARWIN /** @todo Implement HWVirtExt on darwin. See #1865. */
     207#ifdef RT_OS_DARWIN
     208    rc = CFGMR3InsertInteger(pRoot, "HwVirtExtForced",      fHWVirtExEnabled);      RC_CHECK();
     209#else
     210    rc = CFGMR3InsertInteger(pRoot, "HwVirtExtForced",      0);                     RC_CHECK();
     211#endif
    208212    if (fHWVirtExEnabled)
    209213    {
    210214        PCFGMNODE pHWVirtExt;
    211215        rc = CFGMR3InsertNode(pRoot, "HWVirtExt", &pHWVirtExt);                     RC_CHECK();
    212         rc = CFGMR3InsertInteger(pHWVirtExt, "Enabled", 1);                         RC_CHECK();
    213     }
    214 #endif
     216        rc = CFGMR3InsertInteger(pHWVirtExt, "Enabled",     1);                     RC_CHECK();
     217    }
    215218
    216219    /* Nested paging (VT-x/AMD-V) */
  • trunk/src/VBox/VMM/MMHyper.cpp

    r14071 r14543  
    781781     * Allocate the hypervisor heap.
    782782     */
    783     const uint32_t cbAligned = RT_ALIGN_32(cb, PAGE_SIZE);
     783    const uint32_t  cbAligned = RT_ALIGN_32(cb, PAGE_SIZE);
    784784    AssertReturn(cbAligned >= cb, VERR_INVALID_PARAMETER);
    785     void *pv;
    786     int rc = SUPPageAlloc(cbAligned >> PAGE_SHIFT, &pv); /** @todo #1865: heap allocation must be changed for osx (only). */
     785    int             rc;
     786    void           *pv;
     787    RTR0PTR         pvR0;
     788#if 1
     789    rc = SUPPageAlloc(cbAligned >> PAGE_SHIFT, &pv); /** @todo #1865: heap allocation must be changed for osx (only). */
     790    pvR0 = (uintptr_t)pv;
     791#else /**@todo resume here. */
     792    if (VMMIsHwVirtExtForced(pVM))
     793        rc = SUPPageAllocKernel((cbAligned >> PAGE_SHIFT, &pv, &pvR0, paPages);
     794    else
     795    {
     796        rc = SUPPageAllocLocked((cbAligned >> PAGE_SHIFT, &pv, paPages);
     797        pvR0 = (uintptr_t)pv;
     798    }
     799#endif
    787800    if (RT_SUCCESS(rc))
    788801    {
  • trunk/src/VBox/VMM/VM.cpp

    r13858 r14543  
    526526        if (RT_SUCCESS(rc))
    527527        {
     528            rc = CFGMR3QueryBoolDef(CFGMR3GetRoot(pVM), "fHwVirtExtForced", &pVM->fHwVirtExtForced, false);
     529            if (RT_SUCCESS(rc) && pVM->fHwVirtExtForced)
     530                pVM->fHWACCMEnabled = true;
     531
    528532            /*
    529533             * If executing in fake suplib mode disable RR3 and RR0 in the config.
     
    541545             * Make sure the CPU count in the config data matches.
    542546             */
    543             uint32_t cCPUsCfg;
    544             rc = CFGMR3QueryU32Def(CFGMR3GetRoot(pVM), "NumCPUs", &cCPUsCfg, 1);
    545             AssertLogRelMsgRC(rc, ("Configuration error: Querying \"NumCPUs\" as integer failed, rc=%Rrc\n", rc));
    546             if (RT_SUCCESS(rc) && cCPUsCfg != cCPUs)
     547            if (RT_SUCCESS(rc))
    547548            {
    548                 AssertLogRelMsgFailed(("Configuration error: \"NumCPUs\"=%RU32 and VMR3CreateVM::cCPUs=%RU32 does not match!\n",
    549                                        cCPUsCfg, cCPUs));
    550                 rc = VERR_INVALID_PARAMETER;
     549                uint32_t cCPUsCfg;
     550                rc = CFGMR3QueryU32Def(CFGMR3GetRoot(pVM), "NumCPUs", &cCPUsCfg, 1);
     551                AssertLogRelMsgRC(rc, ("Configuration error: Querying \"NumCPUs\" as integer failed, rc=%Rrc\n", rc));
     552                if (RT_SUCCESS(rc) && cCPUsCfg != cCPUs)
     553                {
     554                    AssertLogRelMsgFailed(("Configuration error: \"NumCPUs\"=%RU32 and VMR3CreateVM::cCPUs=%RU32 does not match!\n",
     555                                           cCPUsCfg, cCPUs));
     556                    rc = VERR_INVALID_PARAMETER;
     557                }
    551558            }
    552559            if (RT_SUCCESS(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