VirtualBox

Changeset 13778

Show
Ignore:
Timestamp:
11/04/08 10:45:27 (2 months ago)
Author:
vboxsync
Message:

Per VCPU init/term.

Files:

Legend:

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

    r13532 r13778  
    961961 
    962962VMMR3DECL(int)          CPUMR3Init(PVM pVM); 
     963VMMR3DECL(int)          CPUMR3InitCPU(PVM pVM); 
    963964VMMR3DECL(void)         CPUMR3Relocate(PVM pVM); 
    964965VMMR3DECL(int)          CPUMR3Term(PVM pVM); 
     966VMMR3DECL(int)          CPUMR3TermCPU(PVM pVM); 
    965967VMMR3DECL(void)         CPUMR3Reset(PVM pVM); 
    966968VMMR3DECL(int)          CPUMR3QueryGuestCtxGCPtr(PVM pVM, RCPTRTYPE(PCPUMCTX) *ppCtx); 
  • trunk/include/VBox/em.h

    r13565 r13778  
    166166 */ 
    167167VMMR3DECL(int)      EMR3Init(PVM pVM); 
     168VMMR3DECL(int)      EMR3InitCPU(PVM pVM); 
    168169VMMR3DECL(void)     EMR3Relocate(PVM pVM); 
    169170VMMR3DECL(void)     EMR3Reset(PVM pVM); 
    170171VMMR3DECL(int)      EMR3Term(PVM pVM); 
     172VMMR3DECL(int)      EMR3TermCPU(PVM pVM); 
    171173VMMR3DECL(DECLNORETURN(void)) EMR3FatalError(PVM pVM, int rc); 
    172174VMMR3DECL(int)      EMR3ExecuteVM(PVM pVM); 
  • trunk/include/VBox/hwaccm.h

    r13517 r13778  
    101101VMMR3DECL(bool) HWACCMR3IsEventPending(PVM pVM); 
    102102VMMR3DECL(int)  HWACCMR3Init(PVM pVM); 
     103VMMR3DECL(int)  HWACCMR3InitCPU(PVM pVM); 
    103104VMMR3DECL(int)  HWACCMR3InitFinalizeR0(PVM pVM); 
    104105VMMR3DECL(void) HWACCMR3Relocate(PVM pVM); 
    105106VMMR3DECL(int)  HWACCMR3Term(PVM pVM); 
     107VMMR3DECL(int)  HWACCMR3TermCPU(PVM pVM); 
    106108VMMR3DECL(void) HWACCMR3Reset(PVM pVM); 
    107109VMMR3DECL(void) HWACCMR3CheckError(PVM pVM, int iStatusCode); 
  • trunk/include/VBox/pgm.h

    r13387 r13778  
    477477 */ 
    478478VMMR3DECL(int)      PGMR3Init(PVM pVM); 
     479VMMR3DECL(int)      PGMR3InitCPU(PVM pVM); 
    479480VMMR3DECL(int)      PGMR3InitDynMap(PVM pVM); 
    480481VMMR3DECL(int)      PGMR3InitFinalize(PVM pVM); 
     
    482483VMMR3DECL(void)     PGMR3Reset(PVM pVM); 
    483484VMMR3DECL(int)      PGMR3Term(PVM pVM); 
     485VMMR3DECL(int)      PGMR3TermCPU(PVM pVM); 
    484486VMMR3DECL(int)      PGMR3LockCall(PVM pVM); 
    485487VMMR3DECL(int)      PGMR3ChangeShwPDMappings(PVM pVM, bool fEnable); 
  • trunk/include/VBox/tm.h

    r13633 r13778  
    209209 */ 
    210210VMMR3DECL(int)    TMR3Init(PVM pVM); 
     211VMMR3DECL(int)    TMR3InitCPU(PVM pVM); 
    211212VMMR3DECL(int)    TMR3InitFinalize(PVM pVM); 
    212213VMMR3DECL(void)   TMR3Relocate(PVM pVM, RTGCINTPTR offDelta); 
    213214VMMR3DECL(int)    TMR3Term(PVM pVM); 
     215VMMR3DECL(int)    TMR3TermCPU(PVM pVM); 
    214216VMMR3DECL(void)   TMR3Reset(PVM pVM); 
    215217VMMR3DECL(int)    TMR3GetImportRC(PVM pVM, const char *pszSymbol, PRTRCPTR pRCPtrValue); 
  • trunk/include/VBox/vmm.h

    r13714 r13778  
    121121 */ 
    122122VMMR3DECL(int)      VMMR3Init(PVM pVM); 
     123VMMR3DECL(int)      VMMR3InitCPU(PVM pVM); 
    123124VMMR3DECL(int)      VMMR3InitFinalize(PVM pVM); 
    124125VMMR3DECL(int)      VMMR3InitR0(PVM pVM); 
    125126VMMR3DECL(int)      VMMR3InitRC(PVM pVM); 
    126127VMMR3DECL(int)      VMMR3Term(PVM pVM); 
     128VMMR3DECL(int)      VMMR3TermCPU(PVM pVM); 
    127129VMMR3DECL(void)     VMMR3Relocate(PVM pVM, RTGCINTPTR offDelta); 
    128130VMMR3DECL(int)      VMMR3UpdateLoggers(PVM pVM); 
  • trunk/src/VBox/VMM/CPUM.cpp

    r13005 r13778  
    218218} 
    219219 
     220/** 
     221 * Initializes the per-VCPU CPUM. 
     222 * 
     223 * @returns VBox status code. 
     224 * @param   pVM         The VM to operate on. 
     225 */ 
     226VMMR3DECL(int) CPUMR3InitCPU(PVM pVM) 
     227{ 
     228    LogFlow(("CPUMR3InitCPU\n")); 
     229    return VINF_SUCCESS; 
     230} 
    220231 
    221232/** 
     
    646657} 
    647658 
     659/** 
     660 * Terminates the per-VCPU CPUM. 
     661 * 
     662 * Termination means cleaning up and freeing all resources, 
     663 * the VM it self is at this point powered off or suspended. 
     664 * 
     665 * @returns VBox status code. 
     666 * @param   pVM         The VM to operate on. 
     667 */ 
     668VMMR3DECL(int) CPUMR3TermCPU(PVM pVM) 
     669{ 
     670    return 0; 
     671} 
    648672 
    649673/** 
  • trunk/src/VBox/VMM/EM.cpp

    r13765 r13778  
    374374} 
    375375 
     376/** 
     377 * Initializes the per-VCPU EM. 
     378 * 
     379 * @returns VBox status code. 
     380 * @param   pVM         The VM to operate on. 
     381 */ 
     382VMMR3DECL(int) EMR3InitCPU(PVM pVM) 
     383{ 
     384    LogFlow(("EMR3InitCPU\n")); 
     385    return VINF_SUCCESS; 
     386} 
    376387 
    377388/** 
     
    418429} 
    419430 
     431/** 
     432 * Terminates the per-VCPU EM. 
     433 * 
     434 * Termination means cleaning up and freeing all resources, 
     435 * the VM it self is at this point powered off or suspended. 
     436 * 
     437 * @returns VBox status code. 
     438 * @param   pVM         The VM to operate on. 
     439 */ 
     440VMMR3DECL(int) EMR3TermCPU(PVM pVM) 
     441{ 
     442    return 0; 
     443} 
    420444 
    421445/** 
  • trunk/src/VBox/VMM/HWACCM.cpp

    r13646 r13778  
    207207    AssertRC(rc); 
    208208 
     209    return VINF_SUCCESS; 
     210} 
     211 
     212/** 
     213 * Initializes the per-VCPU HWACCM. 
     214 * 
     215 * @returns VBox status code. 
     216 * @param   pVM         The VM to operate on. 
     217 */ 
     218VMMR3DECL(int) HWACCMR3InitCPU(PVM pVM) 
     219{ 
     220    LogFlow(("HWACCMR3InitCPU\n")); 
    209221    return VINF_SUCCESS; 
    210222} 
     
    835847 
    836848/** 
     849 * Terminates the per-VCPU HWACCM. 
     850 * 
     851 * Termination means cleaning up and freeing all resources, 
     852 * the VM it self is at this point powered off or suspended. 
     853 * 
     854 * @returns VBox status code. 
     855 * @param   pVM         The VM to operate on. 
     856 */ 
     857VMMR3DECL(int) HWACCMR3TermCPU(PVM pVM) 
     858{ 
     859    return 0; 
     860} 
     861 
     862/** 
    837863 * The VM is being reset. 
    838864 * 
  • trunk/src/VBox/VMM/PGM.cpp

    r13343 r13778  
    12791279} 
    12801280 
     1281/** 
     1282 * Initializes the per-VCPU PGM. 
     1283 * 
     1284 * @returns VBox status code. 
     1285 * @param   pVM         The VM to operate on. 
     1286 */ 
     1287VMMR3DECL(int) PGMR3InitCPU(PVM pVM) 
     1288{ 
     1289    LogFlow(("PGMR3InitCPU\n")); 
     1290    return VINF_SUCCESS; 
     1291} 
    12811292 
    12821293/** 
     
    21072118} 
    21082119 
     2120/** 
     2121 * Terminates the per-VCPU PGM. 
     2122 * 
     2123 * Termination means cleaning up and freeing all resources, 
     2124 * the VM it self is at this point powered off or suspended. 
     2125 * 
     2126 * @returns VBox status code. 
     2127 * @param   pVM         The VM to operate on. 
     2128 */ 
     2129VMMR3DECL(int) PGMR3TermCPU(PVM pVM) 
     2130{ 
     2131    return 0; 
     2132} 
    21092133 
    21102134/** 
  • trunk/src/VBox/VMM/TM.cpp

    r13633 r13778  
    601601} 
    602602 
     603/** 
     604 * Initializes the per-VCPU TM. 
     605 * 
     606 * @returns VBox status code. 
     607 * @param   pVM         The VM to operate on. 
     608 */ 
     609VMMR3DECL(int) TMR3InitCPU(PVM pVM) 
     610{ 
     611    LogFlow(("TMR3InitCPU\n")); 
     612    return VINF_SUCCESS; 
     613} 
    603614 
    604615/** 
     
    873884} 
    874885 
     886/** 
     887 * Terminates the per-VCPU TM. 
     888 * 
     889 * Termination means cleaning up and freeing all resources, 
     890 * the VM it self is at this point powered off or suspended. 
     891 * 
     892 * @returns VBox status code. 
     893 * @param   pVM         The VM to operate on. 
     894 */ 
     895VMMR3DECL(int) TMR3TermCPU(PVM pVM) 
     896{ 
     897    return 0; 
     898} 
    875899 
    876900/** 
  • trunk/src/VBox/VMM/VM.cpp

    r13755 r13778  
    127127static int               vmR3CreateU(PUVM pUVM, uint32_t cCPUs, PFNCFGMCONSTRUCTOR pfnCFGMConstructor, void *pvUserCFGM); 
    128128static int               vmR3InitRing3(PVM pVM, PUVM pUVM); 
     129static int               vmR3InitVMCpu(PVM pVM); 
    129130static int               vmR3InitRing0(PVM pVM); 
    130131static int               vmR3InitGC(PVM pVM); 
     
    521522                    LogFlow(("Ring-3 init succeeded\n")); 
    522523 
    523                     /* 
    524                      * Init the Ring-0 components. 
    525                      */ 
    526                     rc = vmR3InitRing0(pVM); 
     524                    /* Initialize the VM CPU components. */ 
     525                    rc = vmR3InitVMCpu(pVM); 
    527526                    if (VBOX_SUCCESS(rc)) 
    528527                    { 
    529                         /* Relocate again, because some switcher fixups depends on R0 init results. */ 
    530                         VMR3Relocate(pVM, 0); 
     528                        /* 
     529                         * Init the Ring-0 components. 
     530                         */ 
     531                        rc = vmR3InitRing0(pVM); 
     532                        if (VBOX_SUCCESS(rc)) 
     533                        { 
     534                            /* Relocate again, because some switcher fixups depends on R0 init results. */ 
     535                            VMR3Relocate(pVM, 0); 
    531536 
    532537#ifdef VBOX_WITH_DEBUGGER 
    533                         /* 
    534                          * Init the tcp debugger console if we're building 
    535                          * with debugger support. 
    536                          */ 
    537                         void *pvUser = NULL; 
    538                         rc = DBGCTcpCreate(pVM, &pvUser); 
    539                         if (    VBOX_SUCCESS(rc) 
    540                             ||  rc == VERR_NET_ADDRESS_IN_USE) 
    541                        
    542                             pUVM->vm.s.pvDBGC = pvUser; 
     538                            /* 
     539                             * Init the tcp debugger console if we're building 
     540                             * with debugger support. 
     541                             */ 
     542                            void *pvUser = NULL; 
     543                            rc = DBGCTcpCreate(pVM, &pvUser); 
     544                            if (    VBOX_SUCCESS(rc) 
     545                                ||  rc == VERR_NET_ADDRESS_IN_USE) 
     546                           
     547                                pUVM->vm.s.pvDBGC = pvUser; 
    543548#endif 
    544                             /* 
    545                             * Init the Guest Context components. 
    546                             */ 
    547                             rc = vmR3InitGC(pVM); 
    548                             if (VBOX_SUCCESS(rc)) 
    549                             { 
    550549                                /* 
    551                                  * Now we can safely set the VM halt method to default
     550                                 * Init the Guest Context components
    552551                                 */ 
    553                                 rc = vmR3SetHaltMethodU(pUVM, VMHALTMETHOD_DEFAULT); 
    554                                 if (RT_SUCCESS(rc)) 
     552                                rc = vmR3InitGC(pVM); 
     553                                if (VBOX_SUCCESS(rc)) 
    555554                                { 
    556555                                    /* 
    557                                     * Set the state and link into the global list. 
     556                                    * Now we can safely set the VM halt method to default. 
    558557                                    */ 
    559                                     vmR3SetState(pVM, VMSTATE_CREATED); 
    560                                     pUVM->pNext = g_pUVMsHead; 
    561                                     g_pUVMsHead = pUVM; 
    562                                     return VINF_SUCCESS; 
     558                                    rc = vmR3SetHaltMethodU(pUVM, VMHALTMETHOD_DEFAULT); 
     559                                    if (RT_SUCCESS(rc)) 
     560                                    { 
     561                                        /* 
     562                                        * Set the state and link into the global list. 
     563                                        */ 
     564                                        vmR3SetState(pVM, VMSTATE_CREATED); 
     565                                        pUVM->pNext = g_pUVMsHead; 
     566                                        g_pUVMsHead = pUVM; 
     567                                        return VINF_SUCCESS; 
     568                                    } 
    563569                                } 
     570#ifdef VBOX_WITH_DEBUGGER 
     571                                DBGCTcpTerminate(pVM, pUVM->vm.s.pvDBGC); 
     572                                pUVM->vm.s.pvDBGC = NULL; 
    564573                            } 
    565 #ifdef VBOX_WITH_DEBUGGER 
    566                             DBGCTcpTerminate(pVM, pUVM->vm.s.pvDBGC); 
    567                             pUVM->vm.s.pvDBGC = NULL; 
     574#endif 
     575                            //.. 
    568576                        } 
    569 #endif 
    570                         //.. 
    571577                    } 
    572578                    vmR3Destroy(pVM); 
     
    755761} 
    756762 
     763/** 
     764 * Initializes all VM CPU components of the VM 
     765 */ 
     766static int vmR3InitVMCpu(PVM pVM) 
     767{ 
     768    int rc = VINF_SUCCESS; 
     769    int rc2; 
     770 
     771    rc = CPUMR3InitCPU(pVM); 
     772    if (VBOX_SUCCESS(rc)) 
     773    { 
     774        rc = HWACCMR3InitCPU(pVM); 
     775        if (VBOX_SUCCESS(rc)) 
     776        { 
     777            rc = PGMR3InitCPU(pVM); 
     778            if (VBOX_SUCCESS(rc)) 
     779            { 
     780                rc = TMR3InitCPU(pVM); 
     781                if (VBOX_SUCCESS(rc)) 
     782                { 
     783                    rc = VMMR3InitCPU(pVM); 
     784                    if (VBOX_SUCCESS(rc)) 
     785                    { 
     786                        rc = EMR3InitCPU(pVM); 
     787                        if (VBOX_SUCCESS(rc)) 
     788                            return VINF_SUCCESS; 
     789 
     790                        rc2 = VMMR3TermCPU(pVM); 
     791                        AssertRC(rc2); 
     792                    } 
     793                    rc2 = TMR3TermCPU(pVM); 
     794                    AssertRC(rc2); 
     795                } 
     796                rc2 = PGMR3TermCPU(pVM); 
     797                AssertRC(rc2); 
     798            } 
     799            rc2 = HWACCMR3TermCPU(pVM); 
     800            AssertRC(rc2); 
     801        } 
     802        rc2 = CPUMR3TermCPU(pVM); 
     803        AssertRC(rc2); 
     804    } 
     805    LogFlow(("vmR3InitVMCpu: returns %Vrc\n", rc)); 
     806    return rc; 
     807} 
     808 
    757809 
    758810/** 
  • trunk/src/VBox/VMM/VMM.cpp

    r13742 r13778  
    244244} 
    245245 
     246 
     247/** 
     248 * Initializes the per-VCPU VMM. 
     249 * 
     250 * @returns VBox status code. 
     251 * @param   pVM         The VM to operate on. 
     252 */ 
     253VMMR3DECL(int) VMMR3InitCPU(PVM pVM) 
     254{ 
     255    LogFlow(("VMMR3InitCPU\n")); 
     256    return VINF_SUCCESS; 
     257} 
    246258 
    247259/** 
     
    751763#endif 
    752764    return rc; 
     765} 
     766 
     767/** 
     768 * Terminates the per-VCPU VMM. 
     769 * 
     770 * Termination means cleaning up and freeing all resources, 
     771 * the VM it self is at this point powered off or suspended. 
     772 * 
     773 * @returns VBox status code. 
     774 * @param   pVM         The VM to operate on. 
     775 */ 
     776VMMR3DECL(int) VMMR3TermCPU(PVM pVM) 
     777{ 
     778    return 0; 
    753779} 
    754780 

© 2008 Sun Microsystems, Inc.
ContactPrivacy policy