Changeset 10903 in vbox for trunk/src/VBox/VMM
- Timestamp:
- Jul 28, 2008 11:10:18 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/testcase/tstSSM.cpp
r8155 r10903 26 26 #include <VBox/ssm.h> 27 27 #include <VBox/vm.h> 28 #include <VBox/uvm.h> 29 #include <VBox/mm.h> 30 #include <VBox/stam.h> 28 31 29 32 #include <VBox/log.h> … … 31 34 #include <VBox/err.h> 32 35 #include <VBox/param.h> 33 #include <iprt/runtime.h>34 36 #include <iprt/assert.h> 37 #include <iprt/initterm.h> 38 #include <iprt/mem.h> 35 39 #include <iprt/stream.h> 36 40 #include <iprt/string.h> … … 554 558 555 559 560 /** 561 * Creates a mockup VM structure for testing SSM. 562 * 563 * @returns 0 on success, 1 on failure. 564 * @param ppVM Where to store the VM handle. 565 */ 566 static int createFakeVM(PVM *ppVM) 567 { 568 /* 569 * Allocate and init the UVM structure. 570 */ 571 PUVM pUVM = (PUVM)RTMemAllocZ(sizeof(*pUVM)); 572 AssertReturn(pUVM, 1); 573 pUVM->u32Magic = UVM_MAGIC; 574 575 int rc = STAMR3InitUVM(pUVM); 576 if (RT_SUCCESS(rc)) 577 { 578 rc = MMR3InitUVM(pUVM); 579 if (RT_SUCCESS(rc)) 580 { 581 /* 582 * Allocate and init the VM structure. 583 */ 584 PVM pVM; 585 rc = SUPPageAlloc((sizeof(*pVM) + PAGE_SIZE - 1) >> PAGE_SHIFT, (void **)&pVM); 586 if (RT_SUCCESS(rc)) 587 { 588 pVM->enmVMState = VMSTATE_CREATED; 589 pVM->pVMR3 = pVM; 590 pVM->pUVM = pUVM; 591 592 pUVM->pVM = pVM; 593 *ppVM = pVM; 594 return 0; 595 } 596 597 RTPrintf("Fatal error: failed to allocated pages for the VM structure, rc=%Rrc\n", rc); 598 } 599 else 600 RTPrintf("Fatal error: MMR3InitUVM failed, rc=%Rrc\n", rc); 601 } 602 else 603 RTPrintf("Fatal error: SSMR3InitUVM failed, rc=%Rrc\n", rc); 604 605 *ppVM = NULL; 606 return 1; 607 } 608 609 556 610 int main(int argc, char **argv) 557 611 { … … 565 619 566 620 /* 567 * Create empty VM structure and init SSM. 568 */ 569 PVM pVM; 621 * Create an fake VM structure and init SSM. 622 */ 570 623 int rc = SUPInit(NULL); 571 if (VBOX_SUCCESS(rc))572 rc = SUPPageAlloc((sizeof(*pVM) + PAGE_SIZE - 1) >> PAGE_SHIFT, (void **)&pVM);573 624 if (VBOX_FAILURE(rc)) 574 625 { … … 576 627 return 1; 577 628 } 578 579 ///@todo rc = STAMR3Init(pVM); 580 if (VBOX_FAILURE(rc)) 581 { 582 RTPrintf("Fatal error: STAMR3Init failed! rc=%Vrc\n", rc); 583 return 1; 584 } 585 586 /* 587 rc = SSMR3Init(pVM); 588 if (VBOX_FAILURE(rc)) 589 { 590 RTPrintf("Fatal error: SSMR3Init failed! rc=%Vrc\n", rc); 591 return 1; 592 } 593 */ 629 PVM pVM; 630 if (createFakeVM(&pVM)) 631 return 1; 594 632 595 633 /*
Note:
See TracChangeset
for help on using the changeset viewer.