Changeset 6796 in vbox for trunk/src/VBox/VMM/MM.cpp
- Timestamp:
- Feb 4, 2008 6:19:58 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/MM.cpp
r6634 r6796 88 88 #include "MMInternal.h" 89 89 #include <VBox/vm.h> 90 #include <VBox/uvm.h> 90 91 #include <VBox/err.h> 91 92 #include <VBox/param.h> … … 107 108 * Internal Functions * 108 109 *******************************************************************************/ 109 static int mmR3Term(PVM pVM, bool fKeepTheHeap);110 110 static DECLCALLBACK(int) mmR3Save(PVM pVM, PSSMHANDLE pSSM); 111 111 static DECLCALLBACK(int) mmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t u32Version); 112 112 113 114 /** 115 * Initializes the MM members of the UVM. 116 * 117 * This is currently only the ring-3 heap. 118 * 119 * @returns VBox status code. 120 * @param pUVM Pointer to the user mode VM structure. 121 */ 122 MMR3DECL(int) MMR3InitUVM(PUVM pUVM) 123 { 124 /* 125 * Assert sizes and order. 126 */ 127 AssertCompile(sizeof(pUVM->mm.s) <= sizeof(pUVM->mm.padding)); 128 AssertRelease(sizeof(pUVM->mm.s) <= sizeof(pUVM->mm.padding)); 129 Assert(!pUVM->mm.s.pHeap); 130 131 /* 132 * Init the heap. 133 */ 134 return mmR3HeapCreateU(pUVM, &pUVM->mm.s.pHeap); 135 } 113 136 114 137 … … 147 170 pVM->mm.s.offVM = RT_OFFSETOF(VM, mm); 148 171 pVM->mm.s.offLookupHyper = NIL_OFFSET; 149 150 /*151 * Init the heap (may already be initialized already if someone used it).152 */153 if (!pVM->mm.s.pHeap)154 {155 int rc = mmR3HeapCreate(pVM, &pVM->mm.s.pHeap);156 if (!VBOX_SUCCESS(rc))157 return rc;158 }159 172 160 173 /* … … 182 195 } 183 196 } 184 mmR3Term(pVM, true /* keep the heap */);197 MMR3Term(pVM); 185 198 return rc; 186 199 } … … 346 359 */ 347 360 MMR3DECL(int) MMR3Term(PVM pVM) 348 {349 return mmR3Term(pVM, false /* free the heap */);350 }351 352 353 /**354 * Worker for MMR3Term and MMR3Init.355 *356 * The tricky bit here is that we must not destroy the heap if we're357 * called from MMR3Init, otherwise we'll get into trouble when358 * CFGMR3Term is called later in the bailout process.359 *360 * @returns VBox status code.361 * @param pVM The VM to operate on.362 * @param fKeepTheHeap Whether or not to keep the heap.363 */364 static int mmR3Term(PVM pVM, bool fKeepTheHeap)365 361 { 366 362 /* … … 395 391 396 392 /* 397 * Destroy the heap if requested.398 */399 if (!fKeepTheHeap)400 {401 mmR3HeapDestroy(pVM->mm.s.pHeap);402 pVM->mm.s.pHeap = NULL;403 }404 405 /*406 393 * Zero stuff to detect after termination use of the MM interface 407 394 */ … … 413 400 414 401 return 0; 402 } 403 404 405 /** 406 * Terminates the UVM part of MM. 407 * 408 * Termination means cleaning up and freeing all resources, 409 * the VM it self is at this point powered off or suspended. 410 * 411 * @returns VBox status code. 412 * @param pUVM Pointer to the user mode VM structure. 413 */ 414 MMR3DECL(void) MMR3TermUVM(PUVM pUVM) 415 { 416 /* 417 * Destroy the heap. 418 */ 419 mmR3HeapDestroy(pUVM->mm.s.pHeap); 420 pUVM->mm.s.pHeap = NULL; 415 421 } 416 422
Note:
See TracChangeset
for help on using the changeset viewer.