Changeset 16162 in vbox
- Timestamp:
- Jan 22, 2009 1:18:12 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/testcase/tstSSM.cpp
r13818 r16162 25 25 *******************************************************************************/ 26 26 #include <VBox/ssm.h> 27 #include "../VMInternal.h" /* createFakeVM */ 27 28 #include <VBox/vm.h> 28 29 #include <VBox/uvm.h> … … 40 41 #include <iprt/string.h> 41 42 #include <iprt/time.h> 43 #include <iprt/thread.h> 44 #include <iprt/path.h> 42 45 43 46 … … 563 566 * @returns 0 on success, 1 on failure. 564 567 * @param ppVM Where to store the VM handle. 568 * 569 * @todo Move this to VMM/VM since it's stuff done by several testcases. 565 570 */ 566 571 static int createFakeVM(PVM *ppVM) … … 572 577 AssertReturn(pUVM, 1); 573 578 pUVM->u32Magic = UVM_MAGIC; 574 575 int rc = STAMR3InitUVM(pUVM);579 pUVM->vm.s.idxTLS = RTTlsAlloc(); 580 int rc = RTTlsSet(pUVM->vm.s.idxTLS, &pUVM->aCpus[0]); 576 581 if (RT_SUCCESS(rc)) 577 582 { 578 rc = MMR3InitUVM(pUVM); 583 pUVM->aCpus[0].pUVM = pUVM; 584 pUVM->aCpus[0].vm.s.NativeThreadEMT = RTThreadNativeSelf(); 585 586 rc = STAMR3InitUVM(pUVM); 579 587 if (RT_SUCCESS(rc)) 580 588 { 581 /* 582 * Allocate and init the VM structure. 583 */ 584 PVM pVM; 585 rc = SUPPageAlloc((sizeof(*pVM) + PAGE_SIZE - 1) >> PAGE_SHIFT, (void **)&pVM); 589 rc = MMR3InitUVM(pUVM); 586 590 if (RT_SUCCESS(rc)) 587 591 { 588 pVM->enmVMState = VMSTATE_CREATED; 589 pVM->pVMR3 = pVM; 590 pVM->pUVM = pUVM; 591 592 pUVM->pVM = pVM; 593 *ppVM = pVM; 594 return 0; 592 /* 593 * Allocate and init the VM structure. 594 */ 595 PVM pVM; 596 rc = SUPPageAlloc((sizeof(*pVM) + PAGE_SIZE - 1) >> PAGE_SHIFT, (void **)&pVM); 597 if (RT_SUCCESS(rc)) 598 { 599 pVM->enmVMState = VMSTATE_CREATED; 600 pVM->pVMR3 = pVM; 601 pVM->pUVM = pUVM; 602 pVM->cCPUs = 1; 603 pVM->aCpus[0].pVMR3 = pVM; 604 pVM->aCpus[0].hNativeThread = RTThreadNativeSelf(); 605 606 pUVM->pVM = pVM; 607 *ppVM = pVM; 608 return 0; 609 } 610 611 RTPrintf("Fatal error: failed to allocated pages for the VM structure, rc=%Rrc\n", rc); 595 612 } 596 597 RTPrintf("Fatal error: failed to allocated pages for the VM structure, rc=%Rrc\n", rc);613 else 614 RTPrintf("Fatal error: MMR3InitUVM failed, rc=%Rrc\n", rc); 598 615 } 599 616 else 600 RTPrintf("Fatal error: MMR3InitUVM failed, rc=%Rrc\n", rc);617 RTPrintf("Fatal error: SSMR3InitUVM failed, rc=%Rrc\n", rc); 601 618 } 602 619 else 603 RTPrintf("Fatal error: SSMR3InitUVMfailed, rc=%Rrc\n", rc);620 RTPrintf("Fatal error: RTTlsSet failed, rc=%Rrc\n", rc); 604 621 605 622 *ppVM = NULL; … … 683 700 RTPrintf("tstSSM: Saved in %RI64 ns\n", u64Elapsed); 684 701 702 RTFSOBJINFO Info; 703 rc = RTPathQueryInfo(pszFilename, &Info, RTFSOBJATTRADD_NOTHING); 704 if (RT_FAILURE(rc)) 705 { 706 RTPrintf("tstSSM: failed to query file size: %Rrc\n", rc); 707 return 1; 708 } 709 RTPrintf("tstSSM: file size %RI64 bytes\n", Info.cbObject); 710 685 711 /* 686 712 * Attempt a load.
Note:
See TracChangeset
for help on using the changeset viewer.