VirtualBox

Changeset 13742

Show
Ignore:
Timestamp:
11/03/08 13:19:40 (2 months ago)
Author:
vboxsync
Message:

Some initial VM data restructuring.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/include/VBox/gvmm.h

    r12653 r13742  
    125125GVMMR0DECL(int)     GVMMR0QueryConfig(PSUPDRVSESSION pSession, const char *pszName, uint64_t *pu64Value); 
    126126 
    127 GVMMR0DECL(int)     GVMMR0CreateVM(PSUPDRVSESSION pSession, PVM *ppVM); 
     127GVMMR0DECL(int)     GVMMR0CreateVM(PSUPDRVSESSION pSession, uint32_t cCPUs, PVM *ppVM); 
    128128GVMMR0DECL(int)     GVMMR0InitVM(PVM pVM); 
    129129GVMMR0DECL(int)     GVMMR0DestroyVM(PVM pVM); 
     
    149149    /** The support driver session. (IN) */ 
    150150    PSUPDRVSESSION  pSession; 
     151    /** Number of virtual CPUs for the new VM. (IN) */ 
     152    uint32_t        cCPUs; 
    151153    /** Pointer to the ring-3 mapping of the shared VM structure on return. (OUT) */ 
    152154    PVMR3           pVMR3; 
  • trunk/include/VBox/vm.h

    r13652 r13742  
    4343 */ 
    4444 
     45 
     46#define VMCPU_MAX_CPU_COUNT    255 
    4547 
    4648/** 
     
    8082    /** Per CPU forced action. 
    8183     * See the VMCPU_FF_* \#defines. Updated atomically. */ 
    82     uint32_t volatile   fForcedActions; 
     84    uint32_t volatile       fForcedActions; 
    8385    /** The CPU state. */ 
    84     VMCPUSTATE volatile enmState; 
     86    VMCPUSTATE volatile     enmState; 
    8587 
    8688    /** Ring-3 Host Context VM Pointer. */ 
    87     PVMR3               pVMR3; 
     89    PVMR3                   pVMR3; 
    8890    /** Ring-0 Host Context VM Pointer. */ 
    89     PVMR0               pVMR0; 
     91    PVMR0                   pVMR0; 
    9092    /** Raw-mode Context VM Pointer. */ 
    91     PVMRC               pVMRC; 
     93    PVMRC                   pVMRC; 
    9294    /** The CPU ID. 
    9395     * This is the index into the VM::aCpus array. */ 
    94     VMCPUID             idCpu; 
     96    VMCPUID                 idCpu; 
    9597    /** The ring-3 thread handle of the emulation thread for this CPU. 
    9698     * @todo Use the VM_IS_EMT() macro to check if executing in EMT? */ 
    97     RTTHREAD            hThreadR3; 
     99    RTTHREAD                hThreadR3; 
    98100    /** The native ring-3 handle. */ 
    99     RTNATIVETHREAD      hNativeThreadR3; 
     101    RTNATIVETHREAD          hNativeThreadR3; 
    100102    /** The native ring-0 handle. */ 
    101     RTNATIVETHREAD      hNativeThreadR0; 
    102  
    103     /** Align the next bit on a 64-byte boundrary. */ 
    104     uint32_t            au32Alignment[HC_ARCH_BITS == 32 ? 7 : 2]; 
     103    RTNATIVETHREAD          hNativeThreadR0; 
     104 
     105    /** Align the next bit on a 64-byte boundary. */ 
     106    uint32_t                au32Alignment[HC_ARCH_BITS == 32 ? 7 : 2]; 
    105107 
    106108    /** CPUM part. */ 
    107109    union 
    108110    { 
    109 #if 0 /*def ___CPUMInternal_h */ 
    110         struct VMCPUCPUM    s; 
    111 #endif 
    112         char                padding[64]; 
     111#ifdef ___CPUMInternal_h 
     112        struct CPUMCPU      s; 
     113#endif 
     114        char                padding[4096];      /* multiple of 32 */ 
    113115    } cpum; 
     116    /** VMM part. */ 
     117    union 
     118    { 
     119#ifdef ___VMMInternal_h 
     120        struct VMMCPU       s; 
     121#endif 
     122        char                padding[32];        /* multiple of 32 */ 
     123    } vmm; 
     124 
     125    /** PGM part. */ 
     126    union 
     127    { 
     128#ifdef ___PGMInternal_h 
     129        struct PGMCPU       s; 
     130#endif 
     131        char                padding[32];        /* multiple of 32 */ 
     132    } pgm; 
     133 
     134    /** HWACCM part. */ 
     135    union 
     136    { 
     137#ifdef ___HWACCMInternal_h 
     138        struct HWACCMCPU    s; 
     139#endif 
     140        char                padding[32];        /* multiple of 32 */ 
     141    } hwaccm; 
     142 
     143    /** EM part. */ 
     144    union 
     145    { 
     146#ifdef ___EMInternal_h 
     147        struct EMCPU        s; 
     148#endif 
     149        char                padding[32];        /* multiple of 32 */ 
     150    } em; 
     151 
     152    /** TM part. */ 
     153    union 
     154    { 
     155#ifdef ___TMInternal_h 
     156        struct TMCPU        s; 
     157#endif 
     158        char                padding[32];        /* multiple of 32 */ 
     159    } tm; 
    114160} VMCPU; 
    115161 
     162/** Pointer to a VMCPU. */ 
     163#ifndef ___VBox_types_h 
     164typedef struct VMCPU *PVMCPU; 
     165#endif 
    116166 
    117167/** The name of the Guest Context VMM Core module. */ 
     
    416466    /** Number of virtual CPUs. */ 
    417467    uint32_t                    cCPUs; 
     468 
     469    /** Offset to the VMCPU array starting from beginning of this structure. */ 
     470    uint32_t                    offVMCPU; 
     471 
    418472    /** Reserved; alignment. */ 
    419     uint32_t                    u32Reserved[7]; 
     473    uint32_t                    u32Reserved[6]; 
    420474 
    421475    /** @name Public VMM Switcher APIs 
     
    715769 
    716770    /** Padding for aligning the cpu array on a 64 byte boundrary. */ 
    717     uint32_t u32Reserved2[8]; 
    718  
    719     /** 
    720      * Per virtual CPU state. 
    721      */ 
    722     VMCPU aCpus[1]; 
     771    uint32_t    u32Reserved2[8]; 
     772 
     773    /** VMCPU array for the configured number of virtual CPUs. */ 
     774    VMCPU       aCpus[1]; 
    723775} VM; 
    724776 
  • trunk/include/VBox/vm.mac

    r12794 r13742  
    5858    .hSelf              resd 1 
    5959    .cCPUs              resd 1 
    60     .u32Reserved        resd 7 
     60    .offVMCPU           resd 1 
     61    .u32Reserved        resd 6 
    6162 
    6263    .pfnVMMGCGuestToHostAsmGuestCtx RTGCPTR32_RES 1 
  • trunk/include/VBox/vmapi.h

    r12989 r13742  
    342342 
    343343 
    344 VMMR3DECL(int)  VMR3Create(PFNVMATERROR pfnVMAtError, void *pvUserVM, PFNCFGMCONSTRUCTOR pfnCFGMConstructor, void *pvUserCFGM, PVM *ppVM); 
     344VMMR3DECL(int)  VMR3Create(uint32_t cCPUs, PFNVMATERROR pfnVMAtError, void *pvUserVM, PFNCFGMCONSTRUCTOR pfnCFGMConstructor, void *pvUserCFGM, PVM *ppVM); 
    345345VMMR3DECL(int)  VMR3PowerOn(PVM pVM); 
    346346VMMR3DECL(int)  VMR3Suspend(PVM pVM); 
  • trunk/src/VBox/Frontends/VBoxBFE/VBoxBFE.cpp

    r12320 r13742  
    11671167     * Create empty VM. 
    11681168     */ 
    1169     rc = VMR3Create(setVMErrorCallback, NULL, vboxbfeConfigConstructor, NULL, &pVM); 
     1169    rc = VMR3Create(1, setVMErrorCallback, NULL, vboxbfeConfigConstructor, NULL, &pVM); 
    11701170    if (VBOX_FAILURE(rc)) 
    11711171    { 
  • trunk/src/VBox/Main/ConsoleImpl.cpp

    r13690 r13742  
    66106610#endif /* VBOX_WITH_VRDP */ 
    66116611 
     6612        ULONG cCpus = 1; 
     6613#ifdef VBOX_WITH_SMP_GUESTS 
     6614        pMachine->COMGETTER(CPUCount)(&cCpus); 
     6615#endif 
     6616 
    66126617        /* 
    66136618         * Create the VM 
     
    66206625        alock.leave(); 
    66216626 
    6622         vrc = VMR3Create (task->mSetVMErrorCallback, task.get(), 
     6627        vrc = VMR3Create (cCpus, task->mSetVMErrorCallback, task.get(), 
    66236628                          task->mConfigConstructor, static_cast <Console *> (console), 
    66246629                          &pVM); 
  • trunk/src/VBox/VMM/CPUMInternal.h

    r12989 r13742  
    268268    CPUMCTX                 Guest; 
    269269 
    270  
    271270    /** Pointer to the current hypervisor core context - R3Ptr. */ 
    272271    R3PTRTYPE(PCPUMCTXCORE) pHyperCoreR3; 
    273     /** Pointer to the current hypervisor core context - R3Ptr. */ 
     272    /** Pointer to the current hypervisor core context - R0Ptr. */ 
    274273    R0PTRTYPE(PCPUMCTXCORE) pHyperCoreR0; 
    275274    /** Pointer to the current hypervisor core context - RCPtr. */ 
     
    345344typedef CPUM *PCPUM; 
    346345 
     346/** 
     347 * CPUM Data (part of VMCPU) 
     348 */ 
     349typedef struct CPUMCPU 
     350{ 
     351    /** 
     352     * Guest context. 
     353     * Aligned on a 64-byte boundrary. 
     354     */ 
     355    CPUMCTX                 Guest; 
     356} CPUMCPU; 
     357/** Pointer to the CPUMCPU instance data residing in the shared VMCPU structure. */ 
     358typedef CPUMCPU *PCPUMCPU; 
     359 
    347360__BEGIN_DECLS 
    348361 
  • trunk/src/VBox/VMM/EMInternal.h

    r13565 r13742  
    371371 
    372372 
     373/** 
     374 * EM VMCPU Instance data. 
     375 */ 
     376typedef struct EMCPU 
     377{ 
     378    /** Offset to the VM structure. 
     379     * See EMCPU2VM(). */ 
     380    RTUINT                  offVMCPU; 
     381} EMCPU; 
     382/** Pointer to EM VM instance data. */ 
     383typedef EMCPU *PEMCPU; 
    373384 
    374385/** @} */ 
  • trunk/src/VBox/VMM/HWACCMInternal.h

    r13542 r13742  
    506506typedef HWACCM *PHWACCM; 
    507507 
     508/** 
     509 * HWACCM VMCPU Instance data. 
     510 */ 
     511typedef struct HWACCMCPU 
     512{ 
     513    /** Offset to the VM structure. 
     514     * See HWACCMCPU2VM(). */ 
     515    RTUINT                      offVMCPU; 
     516} HWACCMCPU; 
     517/** Pointer to HWACCM VM instance data. */ 
     518typedef HWACCMCPU *PHWACCMCPU; 
     519 
     520 
    508521#ifdef IN_RING0 
    509522 
  • trunk/src/VBox/VMM/PGMInternal.h

    r13236 r13742  
    26112611 
    26122612 
     2613/** 
     2614 * PGMCPU Data (part of VMCPU) 
     2615 */ 
     2616typedef struct PGMCPU 
     2617{ 
     2618    /** Offset to the VMCPU structure. */ 
     2619    RTINT                           offVMCPU; 
     2620} PGMCPU, *PPGMCPU; 
     2621 
    26132622/** @name PGM::fSyncFlags Flags 
    26142623 * @{ 
  • trunk/src/VBox/VMM/TMInternal.h

    r13633 r13742  
    499499typedef TM *PTM; 
    500500 
     501/** 
     502 * TM VMCPU Instance data. 
     503 * Changes to this must checked against the padding of the tm union in VM! 
     504 */ 
     505typedef struct TMCPU 
     506{ 
     507    /** Offset to the VMCPU structure. 
     508     * See TMCPU2VM(). */ 
     509    RTUINT                      offVMCPU; 
     510} TMCPU; 
     511/** Pointer to TM VMCPU instance data. */ 
     512typedef TMCPU *PTMCPU; 
    501513 
    502514const char             *tmTimerState(TMTIMERSTATE enmState); 
  • trunk/src/VBox/VMM/VM.cpp

    r13697 r13742  
    125125*******************************************************************************/ 
    126126static int               vmR3CreateUVM(PUVM *ppUVM); 
    127 static int               vmR3CreateU(PUVM pUVM, PFNCFGMCONSTRUCTOR pfnCFGMConstructor, void *pvUserCFGM); 
     127static int               vmR3CreateU(PUVM pUVM, uint32_t cCPUs, PFNCFGMCONSTRUCTOR pfnCFGMConstructor, void *pvUserCFGM); 
    128128static int               vmR3InitRing3(PVM pVM, PUVM pUVM); 
    129129static int               vmR3InitRing0(PVM pVM); 
     
    180180 * @returns 0 on success. 
    181181 * @returns VBox error code on failure. 
     182 * @param   cCPUs               Number of virtual CPUs for the new VM. 
    182183 * @param   pfnVMAtError        Pointer to callback function for setting VM errors. 
    183184 *                              This is called in the EM. 
     
    188189 * @param   ppVM                Where to store the 'handle' of the created VM. 
    189190 */ 
    190 VMMR3DECL(int)   VMR3Create(PFNVMATERROR pfnVMAtError, void *pvUserVM, PFNCFGMCONSTRUCTOR pfnCFGMConstructor, void *pvUserCFGM, PVM *ppVM) 
    191 { 
    192     LogFlow(("VMR3Create: pfnVMAtError=%p pvUserVM=%p  pfnCFGMConstructor=%p pvUserCFGM=%p ppVM=%p\n", pfnVMAtError, pvUserVM, pfnCFGMConstructor, pvUserCFGM, ppVM)); 
     191VMMR3DECL(int)   VMR3Create(uint32_t cCPUs, PFNVMATERROR pfnVMAtError, void *pvUserVM, PFNCFGMCONSTRUCTOR pfnCFGMConstructor, void *pvUserCFGM, PVM *ppVM) 
     192{ 
     193    LogFlow(("VMR3Create: cCPUs=%d pfnVMAtError=%p pvUserVM=%p  pfnCFGMConstructor=%p pvUserCFGM=%p ppVM=%p\n", cCPUs, pfnVMAtError, pvUserVM, pfnCFGMConstructor, pvUserCFGM, ppVM)); 
    193194 
    194195    /* 
     
    229230            PVMREQ pReq; 
    230231            rc = VMR3ReqCallU(pUVM, &pReq, RT_INDEFINITE_WAIT, 0, (PFNRT)vmR3CreateU, 
    231                               3, pUVM, pfnCFGMConstructor, pvUserCFGM); 
     232                              4, pUVM, cCPUs, pfnCFGMConstructor, pvUserCFGM); 
    232233            if (RT_SUCCESS(rc)) 
    233234            { 
     
    422423 * @thread EMT 
    423424 */ 
    424 static int vmR3CreateU(PUVM pUVM, PFNCFGMCONSTRUCTOR pfnCFGMConstructor, void *pvUserCFGM) 
     425static int vmR3CreateU(PUVM pUVM, uint32_t cCPUs, PFNCFGMCONSTRUCTOR pfnCFGMConstructor, void *pvUserCFGM) 
    425426{ 
    426427    int rc = VINF_SUCCESS; 
     
    448449    CreateVMReq.pVMR0 = NIL_RTR0PTR; 
    449450    CreateVMReq.pVMR3 = NULL; 
     451    CreateVMReq.cCPUs = cCPUs; 
    450452    rc = SUPCallVMMR0Ex(NIL_RTR0PTR, VMMR0_DO_GVMM_CREATE_VM, 0, &CreateVMReq.Hdr); 
    451453    if (RT_SUCCESS(rc)) 
     
    483485            } 
    484486 
    485             /* 
    486              * Init the Ring-3 components and do a round of relocations with 0 delta. 
    487              */ 
    488             rc = vmR3InitRing3(pVM, pUVM); 
    489             if (VBOX_SUCCESS(rc)) 
     487            /* Calculate the offset to the VMCPU array. */ 
     488            pVM->offVMCPU = RT_OFFSETOF(VM, aCpus); 
     489 
     490            /* Make sure the CPU count in the config data matches. */ 
     491            rc = CFGMR3QueryU32Def(CFGMR3GetRoot(pVM), "NumCPUs", &pVM->cCPUs, 1); 
     492            AssertLogRelMsgRCReturn(rc, ("Configuration error: Querying \"NumCPUs\" as integer failed, rc=%Vrc\n", rc), rc); 
     493            Assert(pVM->cCPUs == cCPUs); 
     494 
     495#ifdef VBOX_WITH_SMP_GUESTS 
     496            AssertLogRelMsgReturn(pVM->cCPUs > 0 && pVM->cCPUs <= VMCPU_MAX_CPU_COUNT, 
     497                                  ("Configuration error: \"NumCPUs\"=%RU32 is out of range [1..255]\n", pVM->cCPUs), VERR_INVALID_PARAMETER); 
     498#else 
     499            AssertLogRelMsgReturn(pVM->cCPUs != 0, 
     500                                  ("Configuration error: \"NumCPUs\"=%RU32, expected 1\n", pVM->cCPUs), VERR_INVALID_PARAMETER); 
     501#endif 
     502            if (pVM->cCPUs == cCPUs) 
    490503            { 
    491                 VMR3Relocate(pVM, 0); 
    492                 LogFlow(("Ring-3 init succeeded\n")); 
    493  
    494504                /* 
    495                  * Init the Ring-0 components
     505                 * Init the Ring-3 components and do a round of relocations with 0 delta
    496506                 */ 
    497                 rc = vmR3InitRing0(pVM); 
     507                rc = vmR3InitRing3(pVM, pUVM); 
    498508                if (VBOX_SUCCESS(rc)) 
    499509                { 
    500                     /* Relocate again, because some switcher fixups depends on R0 init results. */ 
    501510                    VMR3Relocate(pVM, 0); 
     511                    LogFlow(("Ring-3 init succeeded\n")); 
     512 
     513                    /* 
     514                     * Init the Ring-0 components. 
     515                     */ 
     516                    rc = vmR3InitRing0(pVM); 
     517                    if (VBOX_SUCCESS(rc)) 
     518                    { 
     519                        /* Relocate again, because some switcher fixups depends on R0 init results. */ 
     520                        VMR3Relocate(pVM, 0); 
    502521 
    503522#ifdef VBOX_WITH_DEBUGGER 
    504                     /* 
    505                      * Init the tcp debugger console if we're building 
    506                      * with debugger support. 
    507                      */ 
    508                     void *pvUser = NULL; 
    509                     rc = DBGCTcpCreate(pVM, &pvUser); 
    510                     if (    VBOX_SUCCESS(rc) 
    511                         ||  rc == VERR_NET_ADDRESS_IN_USE) 
    512                    
    513                         pUVM->vm.s.pvDBGC = pvUser; 
     523                        /* 
     524                         * Init the tcp debugger console if we're building 
     525                         * with debugger support. 
     526                         */ 
     527                        void *pvUser = NULL; 
     528                        rc = DBGCTcpCreate(pVM, &pvUser); 
     529                        if (    VBOX_SUCCESS(rc) 
     530                            ||  rc == VERR_NET_ADDRESS_IN_USE) 
     531                       
     532                            pUVM->vm.s.pvDBGC = pvUser; 
    514533#endif 
    515                         /* 
    516                          * Init the Guest Context components. 
    517                          */ 
    518                         rc = vmR3InitGC(pVM); 
    519                         if (VBOX_SUCCESS(rc)) 
    520                         { 
    521534                            /* 
    522                             * Now we can safely set the VM halt method to default
    523                             */ 
    524                             rc = vmR3SetHaltMethodU(pUVM, VMHALTMETHOD_DEFAULT); 
    525                             if (RT_SUCCESS(rc)) 
     535                            * Init the Guest Context components
     536                            */ 
     537                            rc = vmR3InitGC(pVM); 
     538                            if (VBOX_SUCCESS(rc)) 
    526539                            { 
    527540                                /* 
    528                                  * Set the state and link into the global list. 
     541                                 * Now we can safely set the VM halt method to default. 
    529542                                 */ 
    530                                 vmR3SetState(pVM, VMSTATE_CREATED); 
    531                                 pUVM->pNext = g_pUVMsHead; 
    532                                 g_pUVMsHead = pUVM; 
    533                                 return VINF_SUCCESS; 
     543                                rc = vmR3SetHaltMethodU(pUVM, VMHALTMETHOD_DEFAULT); 
     544                                if (RT_SUCCESS(rc)) 
     545                                { 
     546                                    /* 
     547                                    * Set the state and link into the global list. 
     548                                    */ 
     549                                    vmR3SetState(pVM, VMSTATE_CREATED); 
     550                                    pUVM->pNext = g_pUVMsHead; 
     551                                    g_pUVMsHead = pUVM; 
     552                                    return VINF_SUCCESS; 
     553                                } 
    534554                            } 
     555#ifdef VBOX_WITH_DEBUGGER 
     556                            DBGCTcpTerminate(pVM, pUVM->vm.s.pvDBGC); 
     557                            pUVM->vm.s.pvDBGC = NULL; 
    535558                        } 
    536 #ifdef VBOX_WITH_DEBUGGER 
    537                         DBGCTcpTerminate(pVM, pUVM->vm.s.pvDBGC); 
    538                         pUVM->vm.s.pvDBGC = NULL; 
     559#endif 
     560                        //.. 
    539561                    } 
    540 #endif 
    541                     //.. 
     562                    vmR3Destroy(pVM); 
    542563                } 
    543                 vmR3Destroy(pVM); 
    544564            } 
    545565            //.. 
  • trunk/src/VBox/VMM/VMM.cpp

    r13717 r13742  
    178178    /* GC switchers are enabled by default. Turned off by HWACCM. */ 
    179179    pVM->vmm.s.fSwitcherDisabled = false; 
    180  
    181     /* Get the CPU count.*/ 
    182     rc = CFGMR3QueryU32Def(CFGMR3GetRoot(pVM), "NumCPUs", &pVM->cCPUs, 1); 
    183     AssertLogRelMsgRCReturn(rc, ("Configuration error: Querying \"NumCPUs\" as integer failed, rc=%Vrc\n", rc), rc); 
    184 #ifdef VBOX_WITH_SMP_GUESTS 
    185     AssertLogRelMsgReturn(pVM->cCPUs > 0 && pVM->cCPUs <= 256, 
    186                           ("Configuration error: \"NumCPUs\"=%RU32 is out of range [1..256]\n", pVM->cCPUs), VERR_INVALID_PARAMETER); 
    187 #else 
    188     AssertLogRelMsgReturn(pVM->cCPUs != 0, 
    189                           ("Configuration error: \"NumCPUs\"=%RU32, expected 1\n", pVM->cCPUs), VERR_INVALID_PARAMETER); 
    190 #endif 
    191  
    192 #ifdef VBOX_WITH_SMP_GUESTS 
    193     LogRel(("[SMP] VMM with %RU32 CPUs\n", pVM->cCPUs)); 
    194 #endif 
    195180 
    196181    /* 
  • trunk/src/VBox/VMM/VMMInternal.h

    r13719 r13742  
    157157 
    158158/** 
    159  * VMM Data (part of VMM
     159 * VMM Data (part of VM
    160160 */ 
    161161typedef struct VMM 
     
    351351typedef VMM *PVMM; 
    352352 
     353/** 
     354 * VMMCPU Data (part of VMCPU) 
     355 */ 
     356typedef struct VMMCPU 
     357{ 
     358    /** Offset to the VMCPU structure. 
     359     * See VMM2VMCPU(). */ 
     360    RTINT                       offVMCPU; 
     361} VMMCPU; 
     362/** Pointer to VMMCPU. */ 
     363typedef VMMCPU *PVMMCPU; 
     364 
    353365 
    354366/** 
  • trunk/src/VBox/VMM/VMMR0/GVMMR0.cpp

    r13001 r13742  
    470470    if (!VALID_PTR(pReq->pSession)) 
    471471        return VERR_INVALID_POINTER; 
     472    if (    pReq->cCPUs == 0 
     473        ||  pReq->cCPUs > VMCPU_MAX_CPU_COUNT) 
     474        return VERR_INVALID_PARAMETER; 
    472475 
    473476    /* 
     
    477480    pReq->pVMR0 = NULL; 
    478481    pReq->pVMR3 = NIL_RTR3PTR; 
    479     int rc = GVMMR0CreateVM(pReq->pSession, &pVM); 
     482    int rc = GVMMR0CreateVM(pReq->pSession, pReq->cCPUs, &pVM); 
    480483    if (RT_SUCCESS(rc)) 
    481484    { 
     
    494497 * @returns VBox status code. 
    495498 * @param   pSession    The support driver session. 
     499 * @param   cCPUs       Number of virtual CPUs for the new VM. 
    496500 * @param   ppVM        Where to store the pointer to the VM structure. 
    497501 * 
    498502 * @thread  EMT. 
    499503 */ 
    500 GVMMR0DECL(int) GVMMR0CreateVM(PSUPDRVSESSION pSession, PVM *ppVM) 
     504GVMMR0DECL(int) GVMMR0CreateVM(PSUPDRVSESSION pSession, uint32_t cCPUs, PVM *ppVM) 
    501505{ 
    502506    LogFlow(("GVMMR0CreateVM: pSession=%p\n", pSession)); 
     
    571575                         * Allocate the shared VM structure and associated page array. 
    572576                         */ 
    573                         const size_t cPages = RT_ALIGN(sizeof(VM), PAGE_SIZE) >> PAGE_SHIFT; 
     577                        const size_t cPages = RT_ALIGN(sizeof(VM) + sizeof(VMCPU) * (cCPUs - 1), PAGE_SIZE) >> PAGE_SHIFT; 
    574578                        rc = RTR0MemObjAllocLow(&pGVM->gvmm.s.VMMemObj, cPages << PAGE_SHIFT, false /* fExecutable */); 
    575579                        if (RT_SUCCESS(rc)) 
  • trunk/src/VBox/VMM/testcase/tstAnimate.cpp

    r11822 r13742  
    828828     */ 
    829829    PVM pVM; 
    830     rc = VMR3Create(NULL, NULL, cfgmR3CreateDefault, &cbMem, &pVM); 
     830    rc = VMR3Create(1, NULL, NULL, cfgmR3CreateDefault, &cbMem, &pVM); 
    831831    if (VBOX_SUCCESS(rc)) 
    832832    { 
  • trunk/src/VBox/VMM/testcase/tstMicro.cpp

    r12975 r13742  
    347347     */ 
    348348    PVM pVM; 
    349     int rc = VMR3Create(NULL, NULL, NULL, NULL, &pVM); 
     349    int rc = VMR3Create(1, NULL, NULL, NULL, NULL, &pVM); 
    350350    if (VBOX_SUCCESS(rc)) 
    351351    { 
  • trunk/src/VBox/VMM/testcase/tstVMM-2.cpp

    r11822 r13742  
    354354     */ 
    355355    PVM pVM; 
    356     int rc = VMR3Create(NULL, NULL, Args.pszFilename ? ConfigConstructor : NULL, &Args, &pVM); 
     356    int rc = VMR3Create(1, NULL, NULL, Args.pszFilename ? ConfigConstructor : NULL, &Args, &pVM); 
    357357    if (VBOX_SUCCESS(rc)) 
    358358    { 
  • trunk/src/VBox/VMM/testcase/tstVMM-HwAccm.cpp

    r11822 r13742  
    8686    RTPrintf(TESTCASE ": Initializing...\n"); 
    8787    PVM pVM; 
    88     int rc = VMR3Create(NULL, NULL, CFGMConstructor, NULL, &pVM); 
     88    int rc = VMR3Create(1, NULL, NULL, CFGMConstructor, NULL, &pVM); 
    8989    if (VBOX_SUCCESS(rc)) 
    9090    { 
  • trunk/src/VBox/VMM/testcase/tstVMM.cpp

    r11822 r13742  
    5454    RTPrintf(TESTCASE ": Initializing...\n"); 
    5555    PVM pVM; 
    56     int rc = VMR3Create(NULL, NULL, NULL, NULL, &pVM); 
     56    int rc = VMR3Create(1, NULL, NULL, NULL, NULL, &pVM); 
    5757    if (VBOX_SUCCESS(rc)) 
    5858    { 
  • trunk/src/VBox/VMM/testcase/tstVMMFork.cpp

    r11822 r13742  
    7171    RTPrintf(TESTCASE ": Initializing...\n"); 
    7272    PVM pVM; 
    73     int rc = VMR3Create(NULL, NULL, NULL, NULL, &pVM); 
     73    int rc = VMR3Create(1, NULL, NULL, NULL, NULL, &pVM); 
    7474    if (VBOX_SUCCESS(rc)) 
    7575    { 
  • trunk/src/VBox/VMM/testcase/tstVMREQ.cpp

    r11822 r13742  
    226226     */ 
    227227    PVM pVM; 
    228     int rc = VMR3Create(NULL, NULL, NULL, NULL, &pVM); 
     228    int rc = VMR3Create(1, NULL, NULL, NULL, NULL, &pVM); 
    229229    if (VBOX_SUCCESS(rc)) 
    230230    { 
  • trunk/src/VBox/VMM/testcase/tstVMStructSize.cpp

    r13701 r13742  
    177177    /* vmcpu */ 
    178178    CHECK_MEMBER_ALIGNMENT(VMCPU, cpum, 64); 
    179     CHECK_SIZE_ALIGNMENT(VMCPU, 64); 
     179    CHECK_MEMBER_ALIGNMENT(VMCPU, vmm, 32); 
     180    CHECK_MEMBER_ALIGNMENT(VMCPU, pgm, 32); 
     181    CHECK_MEMBER_ALIGNMENT(VMCPU, em, 32); 
     182    CHECK_MEMBER_ALIGNMENT(VMCPU, hwaccm, 32); 
     183    CHECK_MEMBER_ALIGNMENT(VMCPU, tm, 32); 
     184    CHECK_SIZE_ALIGNMENT(VMCPU, 32); 
    180185 
    181186    /* cpumctx */ 

© 2008 Sun Microsystems, Inc.
ContactPrivacy policy