Changeset 13789 in vbox
- Timestamp:
- Nov 4, 2008 3:42:49 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 38775
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VM.cpp
r13785 r13789 207 207 fGlobalInitDone = true; 208 208 } 209 210 /* 211 * Validate input. 212 */ 213 #ifdef VBOX_WITH_SMP_GUESTS 214 AssertLogRelMsgReturn(cCPUs > 0 && cCPUs <= VMCPU_MAX_CPU_COUNT, ("%RU32\n", cCPUs), VERR_INVALID_PARAMETER); 215 #else 216 AssertLogRelMsgReturn(cCPUs == 1, ("%RU32\n", cCPUs), VERR_INVALID_PARAMETER); 217 #endif 209 218 210 219 /* … … 483 492 AssertRelease(pVM->pVMR0 == CreateVMReq.pVMR0); 484 493 AssertRelease(pVM->pSession == pUVM->vm.s.pSession); 485 486 Log(("VMR3Create: Created pUVM=%p pVM=%p pVMR0=%p hSelf=%#x \n", pUVM, pVM, pVM->pVMR0, pVM->hSelf)); 494 AssertRelease(pVM->cCPUs == cCPUs); 495 496 Log(("VMR3Create: Created pUVM=%p pVM=%p pVMR0=%p hSelf=%#x cCPUs=%RU32\n", 497 pUVM, pVM, pVM->pVMR0, pVM->hSelf, pVM->cCPUs)); 487 498 488 499 /* … … 491 502 pVM->pUVM = pUVM; 492 503 pVM->NativeThreadEMT = pUVM->aCpu[0].vm.s.NativeThreadEMT; 493 494 for (unsigned i=0;i<pVM->cCPUs;i++) 504 pVM->offVMCPU = RT_OFFSETOF(VM, aCpu); 505 506 for (uint32_t i = 0; i < pVM->cCPUs; i++) 495 507 { 496 508 pVM->aCpu[i].hNativeThread = pUVM->aCpu[i].vm.s.NativeThreadEMT; 497 Assert(pVM->aCpu[i].hNativeThread != NIL_RTNATIVETHREAD);509 Assert(pVM->aCpu[i].hNativeThread != NIL_RTNATIVETHREAD); 498 510 } 511 499 512 500 513 /* … … 516 529 } 517 530 518 /* Calculate the offset to the VMCPU array. */ 519 pVM->offVMCPU = RT_OFFSETOF(VM, aCpu); 520 521 /* Make sure the CPU count in the config data matches. */ 522 rc = CFGMR3QueryU32Def(CFGMR3GetRoot(pVM), "NumCPUs", &pVM->cCPUs, 1); 523 AssertMsgRC(rc, ("Configuration error: Querying \"NumCPUs\" as integer failed, rc=%Vrc\n", rc)); 524 Assert(pVM->cCPUs == cCPUs); 525 526 #ifdef VBOX_WITH_SMP_GUESTS 527 AssertMsg(pVM->cCPUs > 0 && pVM->cCPUs <= VMCPU_MAX_CPU_COUNT, 528 ("Configuration error: \"NumCPUs\"=%RU32 is out of range [1..255]\n", pVM->cCPUs)); 529 #else 530 AssertMsg(pVM->cCPUs != 0, 531 ("Configuration error: \"NumCPUs\"=%RU32, expected 1\n", pVM->cCPUs)); 532 #endif 533 if (pVM->cCPUs != cCPUs) 531 /* 532 * Make sure the CPU count in the config data matches. 533 */ 534 uint32_t cCPUsCfg; 535 rc = CFGMR3QueryU32Def(CFGMR3GetRoot(pVM), "NumCPUs", &cCPUsCfg, 1); 536 AssertLogRelMsgRC(rc, ("Configuration error: Querying \"NumCPUs\" as integer failed, rc=%Rrc\n", rc)); 537 if (RT_SUCCESS(rc) && cCPUsCfg != cCPUs) 538 { 539 AssertLogRelMsgFailed(("Configuration error: \"NumCPUs\"=%RU32 and VMR3CreateVM::cCPUs=%RU32 does not match!\n", 540 cCPUsCfg, cCPUs)); 534 541 rc = VERR_INVALID_PARAMETER; 535 else 536 #ifdef VBOX_WITH_SMP_GUESTS 537 if (pVM->cCPUs == 0 || pVM->cCPUs > VMCPU_MAX_CPU_COUNT) 538 rc = VERR_INVALID_PARAMETER; 539 #else 540 if (pVM->cCPUs != 1) 541 rc = VERR_INVALID_PARAMETER; 542 #endif 542 } 543 543 if (VBOX_SUCCESS(rc)) 544 544 { -
trunk/src/VBox/VMM/VMMR0/GVMMR0.cpp
r13751 r13789 587 587 pVM->hSelf = iHandle; 588 588 pVM->cbSelf = cbVM; 589 pVM->cCPUs = cCPUs; 589 590 590 591 rc = RTR0MemObjAllocPage(&pGVM->gvmm.s.VMPagesMemObj, cPages * sizeof(SUPPAGE), false /* fExecutable */); … … 609 610 AssertPtr((void *)pVM->pVMR3); 610 611 611 /* *Initialize all the VM pointers. */612 for (u nsigned i=0;i<cCPUs;i++)612 /* Initialize all the VM pointers. */ 613 for (uint32_t i = 0; i < cCPUs; i++) 613 614 { 614 615 pVM->aCpu[i].pVMR0 = pVM;
Note:
See TracChangeset
for help on using the changeset viewer.