VirtualBox

Changeset 12564 in vbox for trunk/src


Ignore:
Timestamp:
Sep 18, 2008 12:13:15 PM (16 years ago)
Author:
vboxsync
Message:

VMM: Don't need to make complicated 16-bit CFGM read here, but you must check that the value is sane afterwards!

File:
1 edited

Legend:

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

    r12555 r12564  
    375375    pVM->vmm.s.fSwitcherDisabled = false;
    376376
    377     /* we use 32-bit for CPU count internally for alignment purposes,
    378      * but config counter is 16-bit */
    379     uint16_t cpus;
    380     rc = CFGMR3QueryU16Def(CFGMR3GetRoot(pVM), "NumCPUs", &cpus, 1);
    381     if (RT_FAILURE(rc))
    382         AssertMsgRCReturn(rc, ("Configuration error: Querying \"NumCPUs\" as integer failed, rc=%Vrc\n", rc), rc);
    383     pVM->cCPUs = cpus;
     377    /* Get the CPU count.*/
     378    rc = CFGMR3QueryU32Def(CFGMR3GetRoot(pVM), "NumCPUs", &pVM->cCPUs, 1);
     379    AssertLogRelMsgRCReturn(rc, ("Configuration error: Querying \"NumCPUs\" as integer failed, rc=%Vrc\n", rc), rc);
    384380#ifdef VBOX_WITH_SMP_GUESTS
    385     LogRel(("[SMP] VMM with %d CPUs\n", pVM->cCPUs));
    386 #endif
    387 
    388     /** Current CPU id; @todo move to per CPU structure. */
     381    AssertLogRelMsgReturn(pVM->cCPUs > 0 && pVM->cCPUs <= 256,
     382                          ("Configuration error: \"NumCPUs\"=%RU32 is out of range [1..256]\n", pVM->cCPUs), VERR_INVALID_PARAMETER);
     383#else
     384    AssertLogRelMsgReturn(pVM->cCPUs != 0,
     385                          ("Configuration error: \"NumCPUs\"=%RU32, expected 1\n", pVM->cCPUs), VERR_INVALID_PARAMETER);
     386#endif
     387
     388#ifdef VBOX_WITH_SMP_GUESTS
     389    LogRel(("[SMP] VMM with %RU32 CPUs\n", pVM->cCPUs));
     390#endif
     391
     392    /* Current CPU id */ /** @todo move to per CPU structure. */
    389393    pVM->idCPU = 0;
    390394
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