VirtualBox

Changeset 22264 in vbox


Ignore:
Timestamp:
Aug 14, 2009 3:23:54 PM (15 years ago)
Author:
vboxsync
Message:

Move the TPR patching decision logic to Main.

Location:
trunk/src/VBox
Files:
2 edited

Legend:

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

    r22238 r22264  
    211211    hrc = pMachine->COMGETTER(OSTypeId)(osTypeId.asOutParam());                     H();
    212212
     213    BOOL fIOAPIC;
     214    hrc = biosSettings->COMGETTER(IOAPICEnabled)(&fIOAPIC);                          H();
     215
    213216    /*
    214217     * Get root node first.
     
    227230    rc = CFGMR3InsertInteger(pRoot, "RamHoleSize",          cbRamHole);             RC_CHECK();
    228231    rc = CFGMR3InsertInteger(pRoot, "NumCPUs",              cCpus);                 RC_CHECK();
    229     rc = CFGMR3InsertString (pRoot, "OSType",               Utf8Str(osTypeId).c_str()); RC_CHECK();
    230232    rc = CFGMR3InsertInteger(pRoot, "TimerMillies",         10);                    RC_CHECK();
    231233    rc = CFGMR3InsertInteger(pRoot, "RawR3Enabled",         1);     /* boolean */   RC_CHECK();
     
    235237    rc = CFGMR3InsertInteger(pRoot, "CSAMEnabled",          1);     /* boolean */   RC_CHECK();
    236238
    237     if (osTypeId == "WindowsNT4")
     239    if (osTypeId == "WindowsNT")
    238240    {
    239241        /*
     
    300302        }
    301303#endif
     304
     305        /* @todo Not exactly pretty to check strings; VBOXOSTYPE would be better, but that requires quite a bit of API change in Main. */
     306        if (    !fIs64BitGuest
     307            &&  fIOAPIC
     308            &&  (   osTypeId == "WindowsNT"
     309                 || osTypeId == "Windows"
     310                 || osTypeId == "Windows 2000"
     311                 || osTypeId == "WindowsXP"
     312                 || osTypeId == "Windows 2003"))
     313        {
     314            /* Only allow TPR patching for NT, Win2k, XP and Windows Server 2003. (32 bits mode)
     315             * We may want to consider adding more guest OSes (Solaris) later on.
     316             */
     317            rc = CFGMR3InsertInteger(pHWVirtExt, "TPRPatchingEnabled", 1);          RC_CHECK();
     318        }
    302319    }
    303320
     
    316333    hrc = pMachine->COMGETTER(PAEEnabled)(&fEnablePAE);                             H();
    317334    rc = CFGMR3InsertInteger(pRoot, "EnablePAE", fEnablePAE);                       RC_CHECK();
    318 
    319     BOOL fIOAPIC;
    320     hrc = biosSettings->COMGETTER(IOAPICEnabled)(&fIOAPIC);                          H();
    321335
    322336    BOOL fPXEDebug;
  • trunk/src/VBox/VMM/HWACCM.cpp

    r22263 r22264  
    327327     * Check CFGM options.
    328328     */
    329     PCFGMNODE pRoot      = CFGMR3GetRoot(pVM);
    330 
    331     char *pszOSType = NULL;
    332     rc = CFGMR3QueryStringAlloc(pRoot, "OSType", &pszOSType);
    333     AssertRC(rc);
    334    
    335     pVM->hwaccm.s.fTRPPatchingAllowed = false;
    336     if (pszOSType)
    337     {
    338         /* @todo Not exactly pretty to check strings; VBOXOSTYPE would be better, but that requires quite a bit of API change in Main. */
    339         if (    !RTStrCmp(pszOSType, "WindowsNT4")
    340             ||  !RTStrCmp(pszOSType, "WindowsNT")
    341             ||  !RTStrCmp(pszOSType, "Windows 2000")
    342             ||  !RTStrCmp(pszOSType, "WindowsXP")
    343             ||  !RTStrCmp(pszOSType, "Windows 2003"))
    344         {
    345             /* Only allow TPR patching for NT, Win2k, XP and Windows Server 2003. (32 bits mode)
    346              * (IO-APIC presence is checked later on in HWACCMR3InitFinalizeR0)
    347              *
    348              * We may want to consider adding more guest OSes (Solaris) later on.
    349              */
    350             pVM->hwaccm.s.fTRPPatchingAllowed = true;
    351         }
    352         MMR3HeapFree(pszOSType);
    353     }
    354 
     329    PCFGMNODE pRoot      = CFGMR3GetRoot(pVM);
    355330    PCFGMNODE pHWVirtExt = CFGMR3GetChild(pRoot, "HWVirtExt/");
    356331    /* Nested paging: disabled by default. */
     
    364339    /* HWACCM support must be explicitely enabled in the configuration file. */
    365340    rc = CFGMR3QueryBoolDef(pHWVirtExt, "Enabled", &pVM->hwaccm.s.fAllowed, false);
     341    AssertRC(rc);
     342
     343    /* TPR patching for 32 bits (Windows) guests with IO-APIC: disabled by default. */
     344    rc = CFGMR3QueryBoolDef(pRoot, "TPRPatchingEnabled", &pVM->hwaccm.s.fTRPPatchingAllowed, false);
    366345    AssertRC(rc);
    367346
     
    671650
    672651    pVM->hwaccm.s.fHasIoApic = PDMHasIoApic(pVM);
    673     /* No TPR patching is required when the IO-APIC is not enabled for this VM. */
     652    /* No TPR patching is required when the IO-APIC is not enabled for this VM. (Main should have taken care of this already) */
    674653    if (!pVM->hwaccm.s.fHasIoApic)
     654    {
     655        Assert(pVM->hwaccm.s.fTRPPatchingAllowed); /* paranoia */
    675656        pVM->hwaccm.s.fTRPPatchingAllowed = false;
     657    }
    676658
    677659    if (pVM->hwaccm.s.vmx.fSupported)
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