Changeset 36891 in vbox for trunk/src/VBox/VMM/include
- Timestamp:
- Apr 29, 2011 1:22:57 PM (14 years ago)
- Location:
- trunk/src/VBox/VMM/include
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/include/PGMGstDefs.h
r35333 r36891 140 140 # define GST_GET_PTE_GCPHYS(Pte) ((Pte).u & GST_PDE_PG_MASK) 141 141 # define GST_GET_PDE_GCPHYS(Pde) ((Pde).u & GST_PDE_PG_MASK) 142 # define GST_GET_BIG_PDE_GCPHYS(pVM, Pde) pgmGstGet4MBPhysPage( &(pVM)->pgm.s, Pde)142 # define GST_GET_BIG_PDE_GCPHYS(pVM, Pde) pgmGstGet4MBPhysPage((pVM), Pde) 143 143 # define GST_GET_PDE_SHW_FLAGS(pVCpu, Pde) ((Pde).u & (X86_PDE_P | X86_PDE_RW | X86_PDE_US | X86_PDE_A)) 144 144 # define GST_GET_BIG_PDE_SHW_FLAGS(pVCpu, Pde) \ -
trunk/src/VBox/VMM/include/PGMInline.h
r36009 r36891 46 46 */ 47 47 48 /** @todo Split out all the inline stuff into a separate file. Then we can49 * include it later when VM and VMCPU are defined and so avoid all that50 * &pVM->pgm.s and &pVCpu->pgm.s stuff. It also chops ~1600 lines off51 * this file and will make it somewhat easier to navigate... */52 53 48 /** 54 49 * Gets the PGMRAMRANGE structure for a guest page. … … 57 52 * @returns NULL on a VERR_PGM_INVALID_GC_PHYSICAL_ADDRESS condition. 58 53 * 59 * @param p PGM PGM handle.54 * @param pVM The VM handle. 60 55 * @param GCPhys The GC physical address. 61 56 */ 62 DECLINLINE(PPGMRAMRANGE) pgmPhysGetRange(PPGM pPGM, RTGCPHYS GCPhys) 63 { 57 DECLINLINE(PPGMRAMRANGE) pgmPhysGetRange(PVM pVM, RTGCPHYS GCPhys) 58 { 59 #ifdef PGM_USE_RAMRANGE_TLB 60 PPGMRAMRANGE pRam = pVM->pgm.s.CTX_SUFF(apRamRangesTlb)[PGM_RAMRANGE_TLB_IDX(GCPhys)]; 61 if (!pRam || GCPhys - pRam->GCPhys >= pRam->cb) 62 pRam = pgmPhysGetRangeSlow(pVM, GCPhys); 63 STAM_COUNTER_INC(&pVM->pgm.s.CTX_SUFF(pStats)->CTX_MID_Z(Stat,RamRangeTlbHits)); 64 return pRam; 65 66 #else 64 67 /* 65 68 * Optimize for the first range. 66 69 */ 67 PPGMRAMRANGE pRam = p PGM->CTX_SUFF(pRamRanges);70 PPGMRAMRANGE pRam = pVM->pgm.s.CTX_SUFF(pRamRangesX); 68 71 RTGCPHYS off = GCPhys - pRam->GCPhys; 69 72 if (RT_UNLIKELY(off >= pRam->cb)) … … 78 81 } 79 82 return pRam; 80 } 83 #endif 84 } 85 86 87 /** 88 * Gets the PGMRAMRANGE structure for a guest page, if unassigned get the ram 89 * range above it. 90 * 91 * @returns Pointer to the RAM range on success. 92 * @returns NULL if the address is located after the last range. 93 * 94 * @param pVM The VM handle. 95 * @param GCPhys The GC physical address. 96 */ 97 DECLINLINE(PPGMRAMRANGE) pgmPhysGetRangeAtOrAbove(PVM pVM, RTGCPHYS GCPhys) 98 { 99 #ifdef PGM_USE_RAMRANGE_TLB 100 PPGMRAMRANGE pRam = pVM->pgm.s.CTX_SUFF(apRamRangesTlb)[PGM_RAMRANGE_TLB_IDX(GCPhys)]; 101 if ( !pRam 102 || (GCPhys - pRam->GCPhys) >= pRam->cb) 103 return pgmPhysGetRangeAtOrAboveSlow(pVM, GCPhys); 104 STAM_COUNTER_INC(&pVM->pgm.s.CTX_SUFF(pStats)->CTX_MID_Z(Stat,RamRangeTlbHits)); 105 return pRam; 106 107 #else 108 PPGMRAMRANGE pRam = pVM->pgm.s.CTX_SUFF(pRamRangesX); 109 while (pRam && GCPhys > pRam->GCPhysLast) 110 pRam = pRam->CTX_SUFF(pNext); 111 return pRam; 112 #endif 113 } 114 81 115 82 116 … … 87 121 * @returns NULL on a VERR_PGM_INVALID_GC_PHYSICAL_ADDRESS condition. 88 122 * 89 * @param p PGM PGM handle.123 * @param pVM The VM handle. 90 124 * @param GCPhys The GC physical address. 91 125 */ 92 DECLINLINE(PPGMPAGE) pgmPhysGetPage(PPGM pPGM, RTGCPHYS GCPhys) 93 { 126 DECLINLINE(PPGMPAGE) pgmPhysGetPage(PVM pVM, RTGCPHYS GCPhys) 127 { 128 #ifdef PGM_USE_RAMRANGE_TLB 129 PPGMRAMRANGE pRam = pVM->pgm.s.CTX_SUFF(apRamRangesTlb)[PGM_RAMRANGE_TLB_IDX(GCPhys)]; 130 RTGCPHYS off; 131 if ( !pRam 132 || (off = GCPhys - pRam->GCPhys) >= pRam->cb) 133 return pgmPhysGetPageSlow(pVM, GCPhys); 134 STAM_COUNTER_INC(&pVM->pgm.s.CTX_SUFF(pStats)->CTX_MID_Z(Stat,RamRangeTlbHits)); 135 return &pRam->aPages[off >> PAGE_SHIFT]; 136 137 #else 94 138 /* 95 139 * Optimize for the first range. 96 140 */ 97 PPGMRAMRANGE pRam = p PGM->CTX_SUFF(pRamRanges);141 PPGMRAMRANGE pRam = pVM->pgm.s.CTX_SUFF(pRamRangesX); 98 142 RTGCPHYS off = GCPhys - pRam->GCPhys; 99 143 if (RT_UNLIKELY(off >= pRam->cb)) … … 108 152 } 109 153 return &pRam->aPages[off >> PAGE_SHIFT]; 154 #endif 110 155 } 111 156 … … 120 165 * @retval VERR_PGM_INVALID_GC_PHYSICAL_ADDRESS if the address isn't valid. 121 166 * 122 * @param p PGM PGM handle.167 * @param pVM The VM handle. 123 168 * @param GCPhys The GC physical address. 124 169 * @param ppPage Where to store the page pointer on success. 125 170 */ 126 DECLINLINE(int) pgmPhysGetPageEx(PPGM pPGM, RTGCPHYS GCPhys, PPPGMPAGE ppPage) 127 { 171 DECLINLINE(int) pgmPhysGetPageEx(PVM pVM, RTGCPHYS GCPhys, PPPGMPAGE ppPage) 172 { 173 #ifdef PGM_USE_RAMRANGE_TLB 174 PPGMRAMRANGE pRam = pVM->pgm.s.CTX_SUFF(apRamRangesTlb)[PGM_RAMRANGE_TLB_IDX(GCPhys)]; 175 RTGCPHYS off; 176 if ( !pRam 177 || (off = GCPhys - pRam->GCPhys) >= pRam->cb) 178 return pgmPhysGetPageExSlow(pVM, GCPhys, ppPage); 179 *ppPage = &pRam->aPages[(GCPhys - pRam->GCPhys) >> PAGE_SHIFT]; 180 STAM_COUNTER_INC(&pVM->pgm.s.CTX_SUFF(pStats)->CTX_MID_Z(Stat,RamRangeTlbHits)); 181 return VINF_SUCCESS; 182 183 #else 128 184 /* 129 185 * Optimize for the first range. 130 186 */ 131 PPGMRAMRANGE pRam = p PGM->CTX_SUFF(pRamRanges);187 PPGMRAMRANGE pRam = pVM->pgm.s.CTX_SUFF(pRamRangesX); 132 188 RTGCPHYS off = GCPhys - pRam->GCPhys; 133 189 if (RT_UNLIKELY(off >= pRam->cb)) … … 146 202 *ppPage = &pRam->aPages[off >> PAGE_SHIFT]; 147 203 return VINF_SUCCESS; 204 #endif 148 205 } 149 206 … … 160 217 * @retval VERR_PGM_INVALID_GC_PHYSICAL_ADDRESS if the address isn't valid. 161 218 * 162 * @param p PGM PGM handle.219 * @param pVM The VM handle. 163 220 * @param GCPhys The GC physical address. 164 221 * @param ppPage Where to store the page pointer on success. … … 166 223 * The caller initializes this to NULL before the call. 167 224 */ 168 DECLINLINE(int) pgmPhysGetPageWithHintEx(P PGM pPGM, RTGCPHYS GCPhys, PPPGMPAGE ppPage, PPGMRAMRANGE *ppRamHint)225 DECLINLINE(int) pgmPhysGetPageWithHintEx(PVM pVM, RTGCPHYS GCPhys, PPPGMPAGE ppPage, PPGMRAMRANGE *ppRamHint) 169 226 { 170 227 RTGCPHYS off; … … 173 230 || RT_UNLIKELY((off = GCPhys - pRam->GCPhys) >= pRam->cb)) 174 231 { 175 pRam = pPGM->CTX_SUFF(pRamRanges); 232 #ifdef PGM_USE_RAMRANGE_TLB 233 pRam = pVM->pgm.s.CTX_SUFF(apRamRangesTlb)[PGM_RAMRANGE_TLB_IDX(GCPhys)]; 234 if ( !pRam 235 || (off = GCPhys - pRam->GCPhys) >= pRam->cb) 236 return pgmPhysGetPageAndRangeExSlow(pVM, GCPhys, ppPage, ppRamHint); 237 STAM_COUNTER_INC(&pVM->pgm.s.CTX_SUFF(pStats)->CTX_MID_Z(Stat,RamRangeTlbHits)); 238 239 #else 240 pRam = pVM->pgm.s.CTX_SUFF(pRamRangesX); 176 241 off = GCPhys - pRam->GCPhys; 177 242 if (RT_UNLIKELY(off >= pRam->cb)) … … 188 253 } while (off >= pRam->cb); 189 254 } 255 #endif 190 256 *ppRamHint = pRam; 191 257 } … … 201 267 * @returns NULL on a VERR_PGM_INVALID_GC_PHYSICAL_ADDRESS condition. 202 268 * 203 * @param p PGM PGM handle.269 * @param pVM The VM handle. 204 270 * @param GCPhys The GC physical address. 205 * @param ppRam Where to store the pointer to the PGMRAMRANGE. 206 */ 207 DECLINLINE(PPGMPAGE) pgmPhysGetPageAndRange(PPGM pPGM, RTGCPHYS GCPhys, PPGMRAMRANGE *ppRam) 208 { 271 * @param ppPage Where to store the pointer to the PGMPAGE structure. 272 * @param ppRam Where to store the pointer to the PGMRAMRANGE structure. 273 */ 274 DECLINLINE(int) pgmPhysGetPageAndRangeEx(PVM pVM, RTGCPHYS GCPhys, PPPGMPAGE ppPage, PPGMRAMRANGE *ppRam) 275 { 276 #ifdef PGM_USE_RAMRANGE_TLB 277 PPGMRAMRANGE pRam = pVM->pgm.s.CTX_SUFF(apRamRangesTlb)[PGM_RAMRANGE_TLB_IDX(GCPhys)]; 278 RTGCPHYS off; 279 if ( !pRam 280 || (off = GCPhys - pRam->GCPhys) >= pRam->cb) 281 return pgmPhysGetPageAndRangeExSlow(pVM, GCPhys, ppPage, ppRam); 282 STAM_COUNTER_INC(&pVM->pgm.s.CTX_SUFF(pStats)->CTX_MID_Z(Stat,RamRangeTlbHits)); 283 284 #else 209 285 /* 210 286 * Optimize for the first range. 211 287 */ 212 PPGMRAMRANGE pRam = pPGM->CTX_SUFF(pRamRanges); 213 RTGCPHYS off = GCPhys - pRam->GCPhys; 214 if (RT_UNLIKELY(off >= pRam->cb)) 215 { 216 do 217 { 218 pRam = pRam->CTX_SUFF(pNext); 219 if (RT_UNLIKELY(!pRam)) 220 return NULL; 221 off = GCPhys - pRam->GCPhys; 222 } while (off >= pRam->cb); 223 } 224 *ppRam = pRam; 225 return &pRam->aPages[off >> PAGE_SHIFT]; 226 } 227 228 229 /** 230 * Gets the PGMPAGE structure for a guest page together with the PGMRAMRANGE. 231 * 232 * @returns Pointer to the page on success. 233 * @returns NULL on a VERR_PGM_INVALID_GC_PHYSICAL_ADDRESS condition. 234 * 235 * @param pPGM PGM handle. 236 * @param GCPhys The GC physical address. 237 * @param ppPage Where to store the pointer to the PGMPAGE structure. 238 * @param ppRam Where to store the pointer to the PGMRAMRANGE structure. 239 */ 240 DECLINLINE(int) pgmPhysGetPageAndRangeEx(PPGM pPGM, RTGCPHYS GCPhys, PPPGMPAGE ppPage, PPGMRAMRANGE *ppRam) 241 { 242 /* 243 * Optimize for the first range. 244 */ 245 PPGMRAMRANGE pRam = pPGM->CTX_SUFF(pRamRanges); 288 PPGMRAMRANGE pRam = pVM->pgm.s.CTX_SUFF(pRamRangesX); 246 289 RTGCPHYS off = GCPhys - pRam->GCPhys; 247 290 if (RT_UNLIKELY(off >= pRam->cb)) … … 259 302 } while (off >= pRam->cb); 260 303 } 304 #endif 261 305 *ppRam = pRam; 262 306 *ppPage = &pRam->aPages[off >> PAGE_SHIFT]; … … 269 313 * 270 314 * @returns VBox status. 271 * @param p PGM PGM handle.315 * @param pVM The VM handle. 272 316 * @param GCPhys The GC physical address. 273 317 * @param pHCPhys Where to store the corresponding HC physical address. … … 276 320 * Avoid when writing new code! 277 321 */ 278 DECLINLINE(int) pgmRamGCPhys2HCPhys(P PGM pPGM, RTGCPHYS GCPhys, PRTHCPHYS pHCPhys)322 DECLINLINE(int) pgmRamGCPhys2HCPhys(PVM pVM, RTGCPHYS GCPhys, PRTHCPHYS pHCPhys) 279 323 { 280 324 PPGMPAGE pPage; 281 int rc = pgmPhysGetPageEx(p PGM, GCPhys, &pPage);325 int rc = pgmPhysGetPageEx(pVM, GCPhys, &pPage); 282 326 if (RT_FAILURE(rc)) 283 327 return rc; … … 344 388 * Get the ram range. 345 389 */ 346 PPGMRAMRANGE pRam = pVM->pgm.s.CTX_SUFF(pRamRanges); 390 #ifdef PGM_USE_RAMRANGE_TLB 391 PPGMRAMRANGE pRam = pVM->pgm.s.CTX_SUFF(apRamRangesTlb)[PGM_RAMRANGE_TLB_IDX(GCPhys)]; 392 RTGCPHYS off; 393 if ( !pRam 394 || (off = GCPhys - pRam->GCPhys) >= pRam->cb 395 /** @todo || page state stuff */ 396 ) 397 #else 398 PPGMRAMRANGE pRam = pVM->pgm.s.CTX_SUFF(pRamRangesX); 347 399 RTGCPHYS off = GCPhys - pRam->GCPhys; 348 400 if (RT_UNLIKELY(off >= pRam->cb 349 401 /** @todo || page state stuff */)) 402 #endif 350 403 { 351 404 /* This case is not counted into StatRZDynMapGCPageInl. */ … … 418 471 */ 419 472 PVM pVM = pVCpu->CTX_SUFF(pVM); 420 PPGMRAMRANGE pRam = pVM->pgm.s.CTX_SUFF(pRamRanges); 473 #ifdef PGM_USE_RAMRANGE_TLB 474 PPGMRAMRANGE pRam = pVM->pgm.s.CTX_SUFF(apRamRangesTlb)[PGM_RAMRANGE_TLB_IDX(GCPhys)]; 475 RTGCPHYS off; 476 if ( !pRam 477 || (off = GCPhys - pRam->GCPhys) >= pRam->cb 478 /** @todo || page state stuff */ 479 ) 480 #else 481 PPGMRAMRANGE pRam = pVM->pgm.s.CTX_SUFF(pRamRangesX); 421 482 RTGCPHYS off = GCPhys - pRam->GCPhys; 422 483 if (RT_UNLIKELY(off >= pRam->cb 423 484 /** @todo || page state stuff */)) 485 #endif 424 486 { 425 487 /* This case is not counted into StatRZDynMapGCPageInl. */ … … 513 575 * @retval VERR_PGM_INVALID_GC_PHYSICAL_ADDRESS if it's not a valid physical address. 514 576 * 515 * @param p PGM The PGM instancehandle.577 * @param pVM The VM handle. 516 578 * @param GCPhys The address of the guest page. 517 579 * @param ppTlbe Where to store the pointer to the TLB entry. 518 580 */ 519 DECLINLINE(int) pgmPhysPageQueryTlbe(P PGM pPGM, RTGCPHYS GCPhys, PPPGMPAGEMAPTLBE ppTlbe)581 DECLINLINE(int) pgmPhysPageQueryTlbe(PVM pVM, RTGCPHYS GCPhys, PPPGMPAGEMAPTLBE ppTlbe) 520 582 { 521 583 int rc; 522 PPGMPAGEMAPTLBE pTlbe = &p PGM->CTXSUFF(PhysTlb).aEntries[PGM_PAGEMAPTLB_IDX(GCPhys)];584 PPGMPAGEMAPTLBE pTlbe = &pVM->pgm.s.CTXSUFF(PhysTlb).aEntries[PGM_PAGEMAPTLB_IDX(GCPhys)]; 523 585 if (pTlbe->GCPhys == (GCPhys & X86_PTE_PAE_PG_MASK)) 524 586 { 525 STAM_COUNTER_INC(&p PGM->CTX_SUFF(pStats)->CTX_MID_Z(Stat,PageMapTlbHits));587 STAM_COUNTER_INC(&pVM->pgm.s.CTX_SUFF(pStats)->CTX_MID_Z(Stat,PageMapTlbHits)); 526 588 rc = VINF_SUCCESS; 527 589 } 528 590 else 529 rc = pgmPhysPageLoadIntoTlb(p PGM, GCPhys);591 rc = pgmPhysPageLoadIntoTlb(pVM, GCPhys); 530 592 *ppTlbe = pTlbe; 531 593 return rc; … … 541 603 * @retval VERR_PGM_INVALID_GC_PHYSICAL_ADDRESS if it's not a valid physical address. 542 604 * 543 * @param p PGM The PGM instancehandle.605 * @param pVM The VM handle. 544 606 * @param pPage Pointer to the PGMPAGE structure corresponding to 545 607 * GCPhys. … … 547 609 * @param ppTlbe Where to store the pointer to the TLB entry. 548 610 */ 549 DECLINLINE(int) pgmPhysPageQueryTlbeWithPage(P PGM pPGM, PPGMPAGE pPage, RTGCPHYS GCPhys, PPPGMPAGEMAPTLBE ppTlbe)611 DECLINLINE(int) pgmPhysPageQueryTlbeWithPage(PVM pVM, PPGMPAGE pPage, RTGCPHYS GCPhys, PPPGMPAGEMAPTLBE ppTlbe) 550 612 { 551 613 int rc; 552 PPGMPAGEMAPTLBE pTlbe = &p PGM->CTXSUFF(PhysTlb).aEntries[PGM_PAGEMAPTLB_IDX(GCPhys)];614 PPGMPAGEMAPTLBE pTlbe = &pVM->pgm.s.CTXSUFF(PhysTlb).aEntries[PGM_PAGEMAPTLB_IDX(GCPhys)]; 553 615 if (pTlbe->GCPhys == (GCPhys & X86_PTE_PAE_PG_MASK)) 554 616 { 555 STAM_COUNTER_INC(&p PGM->CTX_SUFF(pStats)->CTX_MID_Z(Stat,PageMapTlbHits));617 STAM_COUNTER_INC(&pVM->pgm.s.CTX_SUFF(pStats)->CTX_MID_Z(Stat,PageMapTlbHits)); 556 618 rc = VINF_SUCCESS; 557 619 } 558 620 else 559 rc = pgmPhysPageLoadIntoTlbWithPage(p PGM, pPage, GCPhys);621 rc = pgmPhysPageLoadIntoTlbWithPage(pVM, pPage, GCPhys); 560 622 *ppTlbe = pTlbe; 561 623 return rc; … … 567 629 /** 568 630 * Enables write monitoring for an allocated page. 569 * 570 * The caller is responsible for updating the shadow page tables. 571 * 631 * 632 * The caller is responsible for updating the shadow page tables. 633 * 572 634 * @param pVM The VM handle. 573 * @param pPage The page to write monitor. 635 * @param pPage The page to write monitor. 574 636 * @param GCPhysPage The address of the page. 575 637 */ … … 585 647 if (PGM_PAGE_GET_PDE_TYPE(pPage) == PGM_PAGE_PDE_TYPE_PDE) 586 648 { 587 PPGMPAGE pFirstPage = pgmPhysGetPage( &pVM->pgm.s, GCPhysPage & X86_PDE2M_PAE_PG_MASK);649 PPGMPAGE pFirstPage = pgmPhysGetPage(pVM, GCPhysPage & X86_PDE2M_PAE_PG_MASK); 588 650 AssertFatal(pFirstPage); 589 651 if (PGM_PAGE_GET_PDE_TYPE(pFirstPage) == PGM_PAGE_PDE_TYPE_PDE) … … 638 700 * 639 701 * @returns guest physical address 640 * @param p PGM Pointer to the PGM instance data.702 * @param pVM The VM handle. 641 703 * @param Pde Guest Pde 642 704 */ 643 DECLINLINE(RTGCPHYS) pgmGstGet4MBPhysPage(P PGM pPGM, X86PDE Pde)705 DECLINLINE(RTGCPHYS) pgmGstGet4MBPhysPage(PVM pVM, X86PDE Pde) 644 706 { 645 707 RTGCPHYS GCPhys = Pde.u & X86_PDE4M_PG_MASK; 646 708 GCPhys |= (RTGCPHYS)Pde.b.u8PageNoHigh << 32; 647 709 648 return GCPhys & p PGM->GCPhys4MBPSEMask;710 return GCPhys & pVM->pgm.s.GCPhys4MBPSEMask; 649 711 } 650 712 … … 1307 1369 1308 1370 /** 1309 * Clears one physical page of a virtual handler 1310 * 1311 * @param p PGM Pointer to the PGM instance.1312 * @param pCur Virtual handler structure1313 * @param iPage Physical page index1371 * Clears one physical page of a virtual handler. 1372 * 1373 * @param pVM The VM handle. 1374 * @param pCur Virtual handler structure. 1375 * @param iPage Physical page index. 1314 1376 * 1315 1377 * @remark Only used when PGM_SYNC_UPDATE_PAGE_BIT_VIRTUAL is being set, so no 1316 1378 * need to care about other handlers in the same page. 1317 1379 */ 1318 DECLINLINE(void) pgmHandlerVirtualClearPage(P PGM pPGM, PPGMVIRTHANDLER pCur, unsigned iPage)1380 DECLINLINE(void) pgmHandlerVirtualClearPage(PVM pVM, PPGMVIRTHANDLER pCur, unsigned iPage) 1319 1381 { 1320 1382 const PPGMPHYS2VIRTHANDLER pPhys2Virt = &pCur->aPhysToVirt[iPage]; … … 1331 1393 { 1332 1394 /* We're the head of the alias chain. */ 1333 PPGMPHYS2VIRTHANDLER pRemove = (PPGMPHYS2VIRTHANDLER)RTAvlroGCPhysRemove(&p PGM->CTX_SUFF(pTrees)->PhysToVirtHandlers, pPhys2Virt->Core.Key); NOREF(pRemove);1395 PPGMPHYS2VIRTHANDLER pRemove = (PPGMPHYS2VIRTHANDLER)RTAvlroGCPhysRemove(&pVM->pgm.s.CTX_SUFF(pTrees)->PhysToVirtHandlers, pPhys2Virt->Core.Key); NOREF(pRemove); 1334 1396 #ifdef VBOX_STRICT_PGM_HANDLER_VIRTUAL 1335 1397 AssertReleaseMsg(pRemove != NULL, … … 1352 1414 #endif 1353 1415 pNext->offNextAlias |= PGMPHYS2VIRTHANDLER_IS_HEAD; 1354 bool fRc = RTAvlroGCPhysInsert(&p PGM->CTX_SUFF(pTrees)->PhysToVirtHandlers, &pNext->Core);1416 bool fRc = RTAvlroGCPhysInsert(&pVM->pgm.s.CTX_SUFF(pTrees)->PhysToVirtHandlers, &pNext->Core); 1355 1417 AssertRelease(fRc); 1356 1418 } … … 1359 1421 { 1360 1422 /* Locate the previous node in the alias chain. */ 1361 PPGMPHYS2VIRTHANDLER pPrev = (PPGMPHYS2VIRTHANDLER)RTAvlroGCPhysGet(&p PGM->CTX_SUFF(pTrees)->PhysToVirtHandlers, pPhys2Virt->Core.Key);1423 PPGMPHYS2VIRTHANDLER pPrev = (PPGMPHYS2VIRTHANDLER)RTAvlroGCPhysGet(&pVM->pgm.s.CTX_SUFF(pTrees)->PhysToVirtHandlers, pPhys2Virt->Core.Key); 1362 1424 #ifdef VBOX_STRICT_PGM_HANDLER_VIRTUAL 1363 1425 AssertReleaseMsg(pPrev != pPhys2Virt, … … 1405 1467 * Clear the ram flags for this page. 1406 1468 */ 1407 PPGMPAGE pPage = pgmPhysGetPage(p PGM, pPhys2Virt->Core.Key);1469 PPGMPAGE pPage = pgmPhysGetPage(pVM, pPhys2Virt->Core.Key); 1408 1470 AssertReturnVoid(pPage); 1409 1471 PGM_PAGE_SET_HNDL_VIRT_STATE(pPage, PGM_PAGE_HNDL_VIRT_STATE_NONE); … … 1521 1583 * @param pPage PGM pool page 1522 1584 */ 1523 DECLINLINE(bool) pgmPoolIsPageLocked(PPGM pPGM, PPGMPOOLPAGE pPage)1585 DECLINLINE(bool) pgmPoolIsPageLocked(PPGMPOOLPAGE pPage) 1524 1586 { 1525 1587 if (pPage->cLocked) … … 1540 1602 * @param pVM VM handle. 1541 1603 */ 1542 DECL_FORCE_INLINE(bool) pgmMapAreMappingsEnabled(P PGM pPGM)1604 DECL_FORCE_INLINE(bool) pgmMapAreMappingsEnabled(PVM pVM) 1543 1605 { 1544 1606 #ifdef PGM_WITHOUT_MAPPINGS 1545 1607 /* There are no mappings in VT-x and AMD-V mode. */ 1546 Assert(p PGM->fMappingsDisabled);1608 Assert(pVM->pgm.s.fMappingsDisabled); 1547 1609 return false; 1548 1610 #else 1549 return !p PGM->fMappingsDisabled;1611 return !pVM->pgm.s.fMappingsDisabled; 1550 1612 #endif 1551 1613 } … … 1558 1620 * @param pVM The VM handle. 1559 1621 */ 1560 DECL_FORCE_INLINE(bool) pgmMapAreMappingsFloating(P PGM pPGM)1622 DECL_FORCE_INLINE(bool) pgmMapAreMappingsFloating(PVM pVM) 1561 1623 { 1562 1624 #ifdef PGM_WITHOUT_MAPPINGS 1563 1625 /* There are no mappings in VT-x and AMD-V mode. */ 1564 Assert(p PGM->fMappingsDisabled);1626 Assert(pVM->pgm.s.fMappingsDisabled); 1565 1627 return false; 1566 1628 #else 1567 return !p PGM->fMappingsDisabled1568 && !p PGM->fMappingsFixed;1629 return !pVM->pgm.s.fMappingsDisabled 1630 && !pVM->pgm.s.fMappingsFixed; 1569 1631 #endif 1570 1632 } -
trunk/src/VBox/VMM/include/PGMInternal.h
r36629 r36891 1326 1326 #define PGM_RAM_RANGE_IS_AD_HOC(pRam) \ 1327 1327 (!!( (pRam)->fFlags & (PGM_RAM_RANGE_FLAGS_AD_HOC_ROM | PGM_RAM_RANGE_FLAGS_AD_HOC_MMIO | PGM_RAM_RANGE_FLAGS_AD_HOC_MMIO2) ) ) 1328 1329 /* enable the tlbs. */ 1330 //#define PGM_USE_RAMRANGE_TLB 1331 /** The number of entries in the RAM range TLBs (there is one for each 1332 * context). Must be a power of two. */ 1333 #define PGM_RAMRANGE_TLB_ENTRIES 8 1334 1335 /** 1336 * Calculates the RAM range TLB index for the physical address. 1337 * 1338 * @returns RAM range TLB index. 1339 * @param GCPhys The guest physical address. 1340 */ 1341 #define PGM_RAMRANGE_TLB_IDX(a_GCPhys) ( ((a_GCPhys) >> 20) & (PGM_RAMRANGE_TLB_ENTRIES - 1) ) 1342 1328 1343 1329 1344 … … 2792 2807 STAMCOUNTER StatR3PageMapTlbHits; /**< R3: Ring-3/0 page mapper TLB hits. */ 2793 2808 STAMCOUNTER StatR3PageMapTlbMisses; /**< R3: Ring-3/0 page mapper TLB misses. */ 2809 STAMCOUNTER StatRZRamRangeTlbHits; /**< RC/R0: RAM range TLB hits. */ 2810 STAMCOUNTER StatRZRamRangeTlbMisses; /**< RC/R0: RAM range TLB misses. */ 2811 STAMCOUNTER StatR3RamRangeTlbHits; /**< R3: RAM range TLB hits. */ 2812 STAMCOUNTER StatR3RamRangeTlbMisses; /**< R3: RAM range TLB misses. */ 2794 2813 STAMPROFILE StatRZSyncCR3HandlerVirtualReset; /**< RC/R0: Profiling of the virtual handler resets. */ 2795 2814 STAMPROFILE StatRZSyncCR3HandlerVirtualUpdate; /**< RC/R0: Profiling of the virtual handler updates. */ … … 2946 2965 /** Pointer to the list of RAM ranges (Phys GC -> Phys HC conversion) - for R3. 2947 2966 * This is sorted by physical address and contains no overlapping ranges. */ 2948 R3PTRTYPE(PPGMRAMRANGE) pRamRangesR3; 2967 R3PTRTYPE(PPGMRAMRANGE) pRamRangesXR3; 2968 #ifdef PGM_USE_RAMRANGE_TLB 2969 /** Ram range TLB for R3. */ 2970 R3PTRTYPE(PPGMRAMRANGE) apRamRangesTlbR3[PGM_RAMRANGE_TLB_ENTRIES]; 2971 #endif 2949 2972 /** PGM offset based trees - R3 Ptr. */ 2950 2973 R3PTRTYPE(PPGMTREES) pTreesR3; … … 2967 2990 /*RTR3PTR R3PtrAlignment0;*/ 2968 2991 2969 2970 /** R0 pointer corresponding to PGM::pRamRangesR3. */ 2971 R0PTRTYPE(PPGMRAMRANGE) pRamRangesR0; 2992 /** R0 pointer corresponding to PGM::pRamRangesXR3. */ 2993 R0PTRTYPE(PPGMRAMRANGE) pRamRangesXR0; 2994 #ifdef PGM_USE_RAMRANGE_TLB 2995 /** Ram range TLB for R0. */ 2996 R0PTRTYPE(PPGMRAMRANGE) apRamRangesTlbR0[PGM_RAMRANGE_TLB_ENTRIES]; 2997 #endif 2972 2998 /** PGM offset based trees - R0 Ptr. */ 2973 2999 R0PTRTYPE(PPGMTREES) pTreesR0; … … 2984 3010 2985 3011 2986 /** RC pointer corresponding to PGM::pRamRangesR3. */ 2987 RCPTRTYPE(PPGMRAMRANGE) pRamRangesRC; 3012 /** RC pointer corresponding to PGM::pRamRangesXR3. */ 3013 RCPTRTYPE(PPGMRAMRANGE) pRamRangesXRC; 3014 #ifdef PGM_USE_RAMRANGE_TLB 3015 /** Ram range TLB for RC. */ 3016 RCPTRTYPE(PPGMRAMRANGE) apRamRangesTlbRC[PGM_RAMRANGE_TLB_ENTRIES]; 3017 #endif 2988 3018 /** PGM offset based trees - RC Ptr. */ 2989 3019 RCPTRTYPE(PPGMTREES) pTreesRC; … … 3771 3801 int pgmPhysAllocLargePage(PVM pVM, RTGCPHYS GCPhys); 3772 3802 int pgmPhysRecheckLargePage(PVM pVM, RTGCPHYS GCPhys, PPGMPAGE pLargePage); 3773 int pgmPhysPageLoadIntoTlb(P PGM pPGM, RTGCPHYS GCPhys);3774 int pgmPhysPageLoadIntoTlbWithPage(P PGM pPGM, PPGMPAGE pPage, RTGCPHYS GCPhys);3803 int pgmPhysPageLoadIntoTlb(PVM pVM, RTGCPHYS GCPhys); 3804 int pgmPhysPageLoadIntoTlbWithPage(PVM pVM, PPGMPAGE pPage, RTGCPHYS GCPhys); 3775 3805 void pgmPhysPageMakeWriteMonitoredWritable(PVM pVM, PPGMPAGE pPage); 3776 3806 int pgmPhysPageMakeWritable(PVM pVM, PPGMPAGE pPage, RTGCPHYS GCPhys); … … 3784 3814 VMMDECL(int) pgmPhysRomWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPHYS GCPhysFault, void *pvUser); 3785 3815 int pgmPhysFreePage(PVM pVM, PGMMFREEPAGESREQ pReq, uint32_t *pcPendingPages, PPGMPAGE pPage, RTGCPHYS GCPhys); 3816 void pgmPhysInvalidRamRangeTlbs(PVM pVM); 3817 PPGMRAMRANGE pgmPhysGetRangeSlow(PVM pVM, RTGCPHYS GCPhys); 3818 PPGMRAMRANGE pgmPhysGetRangeAtOrAboveSlow(PVM pVM, RTGCPHYS GCPhys); 3819 PPGMPAGE pgmPhysGetPageSlow(PVM pVM, RTGCPHYS GCPhys); 3820 int pgmPhysGetPageExSlow(PVM pVM, RTGCPHYS GCPhys, PPPGMPAGE ppPage); 3821 int pgmPhysGetPageAndRangeExSlow(PVM pVM, RTGCPHYS GCPhys, PPPGMPAGE ppPage, PPGMRAMRANGE *ppRam); 3786 3822 3787 3823 #ifdef IN_RING3
Note:
See TracChangeset
for help on using the changeset viewer.