VirtualBox

Changeset 57479 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Aug 20, 2015 3:02:39 PM (9 years ago)
Author:
vboxsync
Message:

VMM/HM: Validate CFGM keys.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR3/HM.cpp

    r57478 r57479  
    359359     * Read configuration.
    360360     */
    361     PCFGMNODE pCfgHM = CFGMR3GetChild(CFGMR3GetRoot(pVM), "HM/");
     361    PCFGMNODE pCfgHm = CFGMR3GetChild(CFGMR3GetRoot(pVM), "HM/");
     362
     363    /*
     364     * Validate the HM settings.
     365     */
     366    rc = CFGMR3ValidateConfig(pCfgHm, "/HM/",
     367                              "HMForced"
     368                              "|EnableNestedPaging"
     369                              "|EnableUX"
     370                              "|EnableLargePages"
     371                              "|EnableVPID"
     372                              "|TPRPatchingEnabled"
     373                              "|64bitEnabled"
     374                              "|VmxPleGap"
     375                              "|VmxPleWindow"
     376                              "|SvmPauseFilter"
     377                              "|SvmPauseFilterThreshold"
     378                              "|Exclusive"
     379                              "|MaxResumeLoops"
     380                              "|UseVmxPreemptTimer",
     381                              "" /* pszValidNodes */, "HM" /* pszWho */, 0 /* uInstance */);
     382    if (RT_FAILURE(rc))
     383        return rc;
    362384
    363385    /** @cfgm{/HM/HMForced, bool, false}
     
    366388    bool fHMForced;
    367389#ifdef VBOX_WITH_RAW_MODE
    368     rc = CFGMR3QueryBoolDef(pCfgHM, "HMForced", &fHMForced, false);
     390    rc = CFGMR3QueryBoolDef(pCfgHm, "HMForced", &fHMForced, false);
    369391    AssertRCReturn(rc, rc);
    370392    AssertLogRelMsgReturn(!fHMForced || pVM->fHMEnabled, ("Configuration error: HM forced but not enabled!\n"),
     
    385407    /** @cfgm{/HM/EnableNestedPaging, bool, false}
    386408     * Enables nested paging (aka extended page tables). */
    387     rc = CFGMR3QueryBoolDef(pCfgHM, "EnableNestedPaging", &pVM->hm.s.fAllowNestedPaging, false);
     409    rc = CFGMR3QueryBoolDef(pCfgHm, "EnableNestedPaging", &pVM->hm.s.fAllowNestedPaging, false);
    388410    AssertRCReturn(rc, rc);
    389411
    390412    /** @cfgm{/HM/EnableUX, bool, true}
    391413     * Enables the VT-x unrestricted execution feature. */
    392     rc = CFGMR3QueryBoolDef(pCfgHM, "EnableUX", &pVM->hm.s.vmx.fAllowUnrestricted, true);
     414    rc = CFGMR3QueryBoolDef(pCfgHm, "EnableUX", &pVM->hm.s.vmx.fAllowUnrestricted, true);
    393415    AssertRCReturn(rc, rc);
    394416
     
    396418     * Enables using large pages (2 MB) for guest memory, thus saving on (nested)
    397419     * page table walking and maybe better TLB hit rate in some cases. */
    398     rc = CFGMR3QueryBoolDef(pCfgHM, "EnableLargePages", &pVM->hm.s.fLargePages, false);
     420    rc = CFGMR3QueryBoolDef(pCfgHm, "EnableLargePages", &pVM->hm.s.fLargePages, false);
    399421    AssertRCReturn(rc, rc);
    400422
    401423    /** @cfgm{/HM/EnableVPID, bool, false}
    402424     * Enables the VT-x VPID feature. */
    403     rc = CFGMR3QueryBoolDef(pCfgHM, "EnableVPID", &pVM->hm.s.vmx.fAllowVpid, false);
     425    rc = CFGMR3QueryBoolDef(pCfgHm, "EnableVPID", &pVM->hm.s.vmx.fAllowVpid, false);
    404426    AssertRCReturn(rc, rc);
    405427
    406428    /** @cfgm{/HM/TPRPatchingEnabled, bool, false}
    407429     * Enables TPR patching for 32-bit windows guests with IO-APIC. */
    408     rc = CFGMR3QueryBoolDef(pCfgHM, "TPRPatchingEnabled", &pVM->hm.s.fTprPatchingAllowed, false);
     430    rc = CFGMR3QueryBoolDef(pCfgHm, "TPRPatchingEnabled", &pVM->hm.s.fTprPatchingAllowed, false);
    409431    AssertRCReturn(rc, rc);
    410432
     
    414436     * already have the support. */
    415437#ifdef VBOX_ENABLE_64_BITS_GUESTS
    416     rc = CFGMR3QueryBoolDef(pCfgHM, "64bitEnabled", &pVM->hm.s.fAllow64BitGuests, HC_ARCH_BITS == 64);
     438    rc = CFGMR3QueryBoolDef(pCfgHm, "64bitEnabled", &pVM->hm.s.fAllow64BitGuests, HC_ARCH_BITS == 64);
    417439    AssertLogRelRCReturn(rc, rc);
    418440#else
     
    425447     * latest PAUSE instruction to be start of a new PAUSE loop.
    426448     */
    427     rc = CFGMR3QueryU32Def(pCfgHM, "VmxPleGap", &pVM->hm.s.vmx.cPleGapTicks, 0);
     449    rc = CFGMR3QueryU32Def(pCfgHm, "VmxPleGap", &pVM->hm.s.vmx.cPleGapTicks, 0);
    428450    AssertRCReturn(rc, rc);
    429451
     
    435457     * Setting VmxPleGap and VmxPleGap to 0 disables pause-filter exiting.
    436458     */
    437     rc = CFGMR3QueryU32Def(pCfgHM, "VmxPleWindow", &pVM->hm.s.vmx.cPleWindowTicks, 0);
     459    rc = CFGMR3QueryU32Def(pCfgHm, "VmxPleWindow", &pVM->hm.s.vmx.cPleWindowTicks, 0);
    438460    AssertRCReturn(rc, rc);
    439461
     
    442464     * guest. When the counter is 0, a #VMEXIT is triggered.
    443465     */
    444     rc = CFGMR3QueryU16Def(pCfgHM, "SvmPauseFilterCount", &pVM->hm.s.svm.cPauseFilter, 0);
     466    rc = CFGMR3QueryU16Def(pCfgHm, "SvmPauseFilter", &pVM->hm.s.svm.cPauseFilter, 0);
    445467    AssertRCReturn(rc, rc);
    446468
     
    454476     * pause-filter exiting.
    455477     */
    456     rc = CFGMR3QueryU16Def(pCfgHM, "SvmPauseFilterTreshold", &pVM->hm.s.svm.cPauseFilterThresholdTicks, 0);
     478    rc = CFGMR3QueryU16Def(pCfgHm, "SvmPauseFilterThreshold", &pVM->hm.s.svm.cPauseFilterThresholdTicks, 0);
    457479    AssertRCReturn(rc, rc);
    458480
     
    471493    pVM->hm.s.fGlobalInit = true;
    472494#else
    473     rc = CFGMR3QueryBoolDef(pCfgHM, "Exclusive", &pVM->hm.s.fGlobalInit,
     495    rc = CFGMR3QueryBoolDef(pCfgHm, "Exclusive", &pVM->hm.s.fGlobalInit,
    474496# if defined(RT_OS_WINDOWS)
    475497                            false
     
    485507     * ring-3.  The return value of RTThreadPreemptIsPendingTrusty in ring-0
    486508     * determines the default value. */
    487     rc = CFGMR3QueryU32Def(pCfgHM, "MaxResumeLoops", &pVM->hm.s.cMaxResumeLoops, 0 /* set by R0 later */);
     509    rc = CFGMR3QueryU32Def(pCfgHm, "MaxResumeLoops", &pVM->hm.s.cMaxResumeLoops, 0 /* set by R0 later */);
    488510    AssertLogRelRCReturn(rc, rc);
    489511
     
    491513     * Whether to make use of the VMX-preemption timer feature of the CPU if it's
    492514     * available. */
    493     rc = CFGMR3QueryBoolDef(pCfgHM, "UseVmxPreemptTimer", &pVM->hm.s.vmx.fUsePreemptTimer, true);
     515    rc = CFGMR3QueryBoolDef(pCfgHm, "UseVmxPreemptTimer", &pVM->hm.s.vmx.fUsePreemptTimer, true);
    494516    AssertLogRelRCReturn(rc, rc);
    495517
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