VirtualBox

Changeset 10903 in vbox for trunk/src/VBox/VMM


Ignore:
Timestamp:
Jul 28, 2008 11:10:18 AM (17 years ago)
Author:
vboxsync
Message:

tstSSM: Fixed bustage caused by the UVM change.

File:
1 edited

Legend:

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

    r8155 r10903  
    2626#include <VBox/ssm.h>
    2727#include <VBox/vm.h>
     28#include <VBox/uvm.h>
     29#include <VBox/mm.h>
     30#include <VBox/stam.h>
    2831
    2932#include <VBox/log.h>
     
    3134#include <VBox/err.h>
    3235#include <VBox/param.h>
    33 #include <iprt/runtime.h>
    3436#include <iprt/assert.h>
     37#include <iprt/initterm.h>
     38#include <iprt/mem.h>
    3539#include <iprt/stream.h>
    3640#include <iprt/string.h>
     
    554558
    555559
     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 */
     566static 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
    556610int main(int argc, char **argv)
    557611{
     
    565619
    566620    /*
    567      * Create empty VM structure and init SSM.
    568      */
    569     PVM         pVM;
     621     * Create an fake VM structure and init SSM.
     622     */
    570623    int rc = SUPInit(NULL);
    571     if (VBOX_SUCCESS(rc))
    572         rc = SUPPageAlloc((sizeof(*pVM) + PAGE_SIZE - 1) >> PAGE_SHIFT, (void **)&pVM);
    573624    if (VBOX_FAILURE(rc))
    574625    {
     
    576627        return 1;
    577628    }
    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;
    594632
    595633    /*
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