- Timestamp:
- Mar 3, 2009 6:19:29 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/pgm.h
r17251 r17305 284 284 || (enmProt) == PGMROMPROT_READ_ROM_WRITE_RAM ) 285 285 286 286 VMMDECL(int) PGMRegisterStringFormatTypes(void); 287 VMMDECL(void) PGMDeregisterStringFormatTypes(void); 287 288 VMMDECL(RTHCPHYS) PGMGetHyperCR3(PVM pVM); 288 289 VMMDECL(RTHCPHYS) PGMGetNestedCR3(PVM pVM, PGMMODE enmShadowMode); -
trunk/src/VBox/VMM/PGM.cpp
r17215 r17305 1199 1199 VMR3AtStateRegister(pVM, pgmR3ResetNoMorePhysWritesFlag, NULL); 1200 1200 #endif 1201 PGMRegisterStringFormatTypes(); 1201 1202 1202 1203 /* … … 2254 2255 VMMR3DECL(int) PGMR3Term(PVM pVM) 2255 2256 { 2257 PGMDeregisterStringFormatTypes(); 2256 2258 return PDMR3CritSectDelete(&pVM->pgm.s.CritSect); 2257 2259 } … … 2282 2284 static DECLCALLBACK(int) pgmR3Save(PVM pVM, PSSMHANDLE pSSM) 2283 2285 { 2286 #ifdef VBOX_WITH_NEW_PHYS_CODE 2287 AssertReleaseFailed(); /** @todo */ 2288 #else 2284 2289 PPGM pPGM = &pVM->pgm.s; 2285 2290 … … 2361 2366 } 2362 2367 } 2368 #endif /* !VBOX_WITH_NEW_PHYS_CODE */ 2363 2369 return SSMR3PutU32(pSSM, ~0); /* terminator. */ 2364 2370 } … … 2375 2381 static DECLCALLBACK(int) pgmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t u32Version) 2376 2382 { 2383 #ifdef VBOX_WITH_NEW_PHYS_CODE 2384 AssertReleaseFailed(); /** @todo */ 2385 #else 2377 2386 /* 2378 2387 * Validate version. … … 2623 2632 2624 2633 return rc; 2634 #endif /* !VBOX_WITH_NEW_PHYS_CODE */ 2625 2635 } 2626 2636 -
trunk/src/VBox/VMM/PGMInternal.h
r17294 r17305 545 545 /** MMIO2 page. (RWX) */ 546 546 PGMPAGETYPE_MMIO2, 547 /** MMIO2 page aliased over an MMIO page. (RWX) 548 * See PGMHandlerPhysicalPageAlias(). */ 549 PGMPAGETYPE_MMIO2_ALIAS_MMIO, 547 550 /** Shadowed ROM. (RWX) */ 548 551 PGMPAGETYPE_ROM_SHADOW, … … 554 557 PGMPAGETYPE_END 555 558 } PGMPAGETYPE; 556 AssertCompile(PGMPAGETYPE_END < 7);559 AssertCompile(PGMPAGETYPE_END <= 7); 557 560 558 561 /** @name Page type predicates. … … 578 581 { 579 582 /** The physical address and a whole lot of other stuff. All bits are used! */ 583 #ifdef VBOX_WITH_NEW_PHYS_CODE 584 RTHCPHYS HCPhysX; 585 #else 580 586 RTHCPHYS HCPhys; 581 587 #define HCPhysX HCPhys /**< Temporary while in the process of eliminating direct access to PGMPAGE::HCPhys. */ 588 #endif 582 589 /** The page state. */ 583 590 uint32_t u2StateX : 2; -
trunk/src/VBox/VMM/VMMAll/PGMAll.cpp
r17259 r17305 982 982 } 983 983 984 984 985 /** 985 986 * Gets the pointer to the shadow page directory entry for an address, PAE. … … 1008 1009 return VINF_SUCCESS; 1009 1010 } 1010 #endif 1011 1011 1012 #endif /* VBOX_WITH_PGMPOOL_PAGING_ONLY */ 1012 1013 #ifndef IN_RC 1013 1014 … … 1546 1547 return pVM->pgm.s.HCPhysShwCR3; 1547 1548 } 1549 1548 1550 1549 1551 /** … … 2196 2198 } 2197 2199 2198 2199 2200 # ifdef IN_RC 2201 2200 2202 /** 2201 2203 * Temporarily maps one host page specified by HC physical address. … … 2287 2289 } 2288 2290 2291 2289 2292 /** 2290 2293 * Temporarily lock a dynamic page to prevent it from being reused. … … 2305 2308 } 2306 2309 2310 2307 2311 /** 2308 2312 * Unlock a dynamic page … … 2323 2327 } 2324 2328 2325 # ifdef VBOX_STRICT 2329 2330 # ifdef VBOX_STRICT 2326 2331 /** 2327 2332 * Check for lock leaks. … … 2334 2339 Assert(!(pVM->pgm.s.paDynPageMap32BitPTEsGC[i].u & PGM_PTFLAGS_DYN_LOCKED)); 2335 2340 } 2341 # endif /* VBOX_STRICT */ 2342 2343 # endif /* IN_RC */ 2344 #endif /* IN_RC || VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0 */ 2345 2346 #ifdef LOG_ENABLED 2347 2348 /** Format handler for PGMPAGE. 2349 * @copydoc FNRTSTRFORMATTYPE */ 2350 static DECLCALLBACK(size_t) pgmFormatTypeHandlerPage(PFNRTSTROUTPUT pfnOutput, void *pvArgOutput, 2351 const char *pszType, void const *pvValue, 2352 int cchWidth, int cchPrecision, unsigned fFlags, 2353 void *pvUser) 2354 { 2355 size_t cch; 2356 PCPGMPAGE pPage = (PCPGMPAGE)pvValue; 2357 if (VALID_PTR(pPage)) 2358 { 2359 char szTmp[80]; 2360 switch (PGM_PAGE_GET_TYPE(pPage)) 2361 { 2362 case PGMPAGETYPE_RAM: 2363 cch = RTStrPrintf(szTmp, sizeof(szTmp), "%RHp-RAM", PGM_PAGE_GET_HCPHYS(pPage)); 2364 break; 2365 case PGMPAGETYPE_MMIO2: 2366 cch = RTStrPrintf(szTmp, sizeof(szTmp), "%RHp-MMIO2", PGM_PAGE_GET_HCPHYS(pPage)); 2367 break; 2368 case PGMPAGETYPE_MMIO2_ALIAS_MMIO: 2369 cch = RTStrPrintf(szTmp, sizeof(szTmp), "%RHp-M2ALI", PGM_PAGE_GET_HCPHYS(pPage)); 2370 break; 2371 case PGMPAGETYPE_ROM_SHADOW: 2372 cch = RTStrPrintf(szTmp, sizeof(szTmp), "%RHp-ROMSH", PGM_PAGE_GET_HCPHYS(pPage)); 2373 break; 2374 case PGMPAGETYPE_ROM: 2375 cch = RTStrPrintf(szTmp, sizeof(szTmp), "%RHp-ROM", PGM_PAGE_GET_HCPHYS(pPage)); 2376 break; 2377 case PGMPAGETYPE_MMIO: 2378 cch = RTStrPrintf(szTmp, sizeof(szTmp), "%RHp-MMIO", PGM_PAGE_GET_HCPHYS(pPage)); 2379 break; 2380 default: 2381 cch = RTStrPrintf(szTmp, sizeof(szTmp), "%RHp-%d", PGM_PAGE_GET_HCPHYS(pPage), PGM_PAGE_GET_TYPE(pPage)); 2382 break; 2383 } 2384 cch = pfnOutput(pvArgOutput, szTmp, cch); 2385 } 2386 else 2387 cch = pfnOutput(pvArgOutput, "<bad-pgmpage-ptr>", sizeof("<bad-pgmpage-ptr>") - 1); 2388 return cch; 2389 } 2390 2391 2392 /** Format handler for PGMRAMRANGE. 2393 * @copydoc FNRTSTRFORMATTYPE */ 2394 static DECLCALLBACK(size_t) pgmFormatTypeHandlerRamRange(PFNRTSTROUTPUT pfnOutput, void *pvArgOutput, 2395 const char *pszType, void const *pvValue, 2396 int cchWidth, int cchPrecision, unsigned fFlags, 2397 void *pvUser) 2398 { 2399 size_t cch; 2400 PGMRAMRANGE const *pRam = (PGMRAMRANGE const *)pvValue; 2401 if (VALID_PTR(pRam)) 2402 { 2403 char szTmp[80]; 2404 cch = RTStrPrintf(szTmp, sizeof(szTmp), "%RGp-%RGp", pRam->GCPhys, pRam->GCPhysLast); 2405 cch = pfnOutput(pvArgOutput, szTmp, cch); 2406 } 2407 else 2408 cch = pfnOutput(pvArgOutput, "<bad-pgmramrange-ptr>", sizeof("<bad-pgmramrange-ptr>") - 1); 2409 return cch; 2410 } 2411 2412 /** Format type andlers to be registered/deregistered. */ 2413 static const struct 2414 { 2415 char szType[24]; 2416 PFNRTSTRFORMATTYPE pfnHandler; 2417 } g_aPgmFormatTypes[] = 2418 { 2419 { "pgmpage", pgmFormatTypeHandlerPage }, 2420 { "pgmramrange", pgmFormatTypeHandlerRamRange } 2421 }; 2422 2423 #endif /* LOG_ENABLED */ 2424 2425 2426 /** 2427 * Registers the global string format types. 2428 * 2429 * This should be called at module load time or in some other manner that ensure 2430 * that it's called exactly one time. 2431 * 2432 * @returns IPRT status code on RTStrFormatTypeRegister failure. 2433 */ 2434 VMMDECL(int) PGMRegisterStringFormatTypes(void) 2435 { 2436 #ifdef LOG_ENABLED 2437 int rc = VINF_SUCCESS; 2438 unsigned i; 2439 for (i = 0; RT_SUCCESS(rc) && i < RT_ELEMENTS(g_aPgmFormatTypes); i++) 2440 { 2441 rc = RTStrFormatTypeRegister(g_aPgmFormatTypes[i].szType, g_aPgmFormatTypes[i].pfnHandler, NULL); 2442 # ifdef IN_RING0 2443 if (rc == VERR_ALREADY_EXISTS) 2444 { 2445 /* in case of cleanup failure in ring-0 */ 2446 RTStrFormatTypeDeregister(g_aPgmFormatTypes[i].szType); 2447 rc = RTStrFormatTypeRegister(g_aPgmFormatTypes[i].szType, g_aPgmFormatTypes[i].pfnHandler, NULL); 2448 } 2336 2449 # endif 2337 # endif /* IN_RC */ 2338 2339 #endif /* IN_RC || VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0 */ 2450 } 2451 if (RT_FAILURE(rc)) 2452 while (i-- > 0) 2453 RTStrFormatTypeDeregister(g_aPgmFormatTypes[i].szType); 2454 2455 return rc; 2456 #else 2457 return VINF_SUCCESS; 2458 #endif 2459 } 2460 2461 2462 /** 2463 * Deregisters the global string format types. 2464 * 2465 * This should be called at module unload time or in some other manner that 2466 * ensure that it's called exactly one time. 2467 */ 2468 VMMDECL(void) PGMDeregisterStringFormatTypes(void) 2469 { 2470 #ifdef LOG_ENABLED 2471 for (unsigned i = 0; i < RT_ELEMENTS(g_aPgmFormatTypes); i++) 2472 RTStrFormatTypeDeregister(g_aPgmFormatTypes[i].szType); 2473 #endif 2474 } 2475 2340 2476 #ifdef VBOX_STRICT 2341 2477 -
trunk/src/VBox/VMM/VMMGC/VMMGC.cpp
r17146 r17305 27 27 #include <VBox/vmm.h> 28 28 #include <VBox/trpm.h> 29 #include <VBox/pgm.h> 29 30 #include "VMMInternal.h" 30 31 #include <VBox/vm.h> … … 89 90 int rc = RTRCInit(u64TS); 90 91 Log(("VMMGCEntry: VMMGC_DO_VMMGC_INIT - uArg=%u (svn revision) u64TS=%RX64; rc=%Rrc\n", uArg, u64TS, rc)); 92 AssertRCReturn(rc, rc); 93 94 rc = PGMRegisterStringFormatTypes(); 91 95 AssertRCReturn(rc, rc); 92 96 -
trunk/src/VBox/VMM/VMMR0/VMMR0.cpp
r17284 r17305 91 91 if (RT_SUCCESS(rc)) 92 92 { 93 #ifdef VBOX_WITH_2X_4GB_ADDR_SPACE 94 rc = PGMR0DynMapInit(); 95 #endif 93 rc = PGMRegisterStringFormatTypes(); 96 94 if (RT_SUCCESS(rc)) 97 95 { 98 LogFlow(("ModuleInit: g_pIntNet=%p\n", g_pIntNet)); 99 g_pIntNet = NULL; 100 LogFlow(("ModuleInit: g_pIntNet=%p should be NULL now...\n", g_pIntNet)); 101 rc = INTNETR0Create(&g_pIntNet); 96 #ifdef VBOX_WITH_2X_4GB_ADDR_SPACE 97 rc = PGMR0DynMapInit(); 98 #endif 102 99 if (RT_SUCCESS(rc)) 103 100 { 104 LogFlow(("ModuleInit: returns success. g_pIntNet=%p\n", g_pIntNet)); 105 return VINF_SUCCESS; 101 LogFlow(("ModuleInit: g_pIntNet=%p\n", g_pIntNet)); 102 g_pIntNet = NULL; 103 LogFlow(("ModuleInit: g_pIntNet=%p should be NULL now...\n", g_pIntNet)); 104 rc = INTNETR0Create(&g_pIntNet); 105 if (RT_SUCCESS(rc)) 106 { 107 LogFlow(("ModuleInit: returns success. g_pIntNet=%p\n", g_pIntNet)); 108 return VINF_SUCCESS; 109 } 110 111 /* bail out */ 112 g_pIntNet = NULL; 113 LogFlow(("ModuleTerm: returns %Rrc\n", rc)); 114 #ifdef VBOX_WITH_2X_4GB_ADDR_SPACE 115 PGMR0DynMapTerm(); 116 #endif 106 117 } 107 108 /* bail out */ 109 g_pIntNet = NULL; 110 LogFlow(("ModuleTerm: returns %Rrc\n", rc)); 111 #ifdef VBOX_WITH_2X_4GB_ADDR_SPACE 112 PGMR0DynMapTerm(); 113 #endif 118 PGMDeregisterStringFormatTypes(); 114 119 } 115 120 HWACCMR0Term(); … … 149 154 PGMR0DynMapTerm(); 150 155 #endif 156 PGMDeregisterStringFormatTypes(); 151 157 HWACCMR0Term(); 152 158
Note:
See TracChangeset
for help on using the changeset viewer.