Changeset 15346 in vbox for trunk/src/VBox/VMM/VMMR0/PGMR0DynMap.cpp
- Timestamp:
- Dec 12, 2008 1:23:23 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR0/PGMR0DynMap.cpp
r15344 r15346 367 367 } 368 368 pSet->cEntries = PGMMAPSET_CLOSED; 369 pSet->iCpu = -1; 369 370 memset(&pSet->aiHashTable[0], 0xff, sizeof(pSet->aiHashTable)); 370 371 } … … 465 466 } 466 467 pSet->cEntries = PGMMAPSET_CLOSED; 468 pSet->iCpu = -1; 467 469 } 468 470 else … … 1272 1274 * @param pThis The dynamic mapping cache instance. 1273 1275 * @param HCPhys The address of the page to be mapped. 1276 * @param iRealCpu The real cpu set index. (optimization) 1274 1277 * @param pVM The shared VM structure, for statistics only. 1275 1278 * @param ppvPage Where to the page address. 1276 1279 */ 1277 DECLINLINE(uint32_t) pgmR0DynMapPage(PPGMR0DYNMAP pThis, RTHCPHYS HCPhys, PVM pVM, void **ppvPage)1280 DECLINLINE(uint32_t) pgmR0DynMapPage(PPGMR0DYNMAP pThis, RTHCPHYS HCPhys, int32_t iRealCpu, PVM pVM, void **ppvPage) 1278 1281 { 1279 1282 RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER; … … 1345 1348 * Invalidate the entry? 1346 1349 */ 1347 RTCPUID idRealCpu = RTMpCpuId(); 1348 bool fInvalidateIt = RTCpuSetIsMember(&paPages[iPage].PendingSet, idRealCpu); 1350 bool fInvalidateIt = RTCpuSetIsMemberByIndex(&paPages[iPage].PendingSet, iRealCpu); 1349 1351 if (RT_UNLIKELY(fInvalidateIt)) 1350 RTCpuSetDel (&paPages[iPage].PendingSet, idRealCpu);1352 RTCpuSetDelByIndex(&paPages[iPage].PendingSet, iRealCpu); 1351 1353 1352 1354 RTSpinlockRelease(pThis->hSpinlock, &Tmp); … … 1497 1499 Assert(pVCpu->pgm.s.AutoSet.cEntries == PGMMAPSET_CLOSED); 1498 1500 pVCpu->pgm.s.AutoSet.cEntries = 0; 1501 pVCpu->pgm.s.AutoSet.iCpu = RTMpCpuIdToSetIndex(RTMpCpuId()); 1499 1502 } 1500 1503 … … 1554 1557 AssertMsg(cEntries <= RT_ELEMENTS(pSet->aEntries), ("%#x (%u)\n", cEntries, cEntries)); 1555 1558 pSet->cEntries = PGMMAPSET_CLOSED; 1559 pSet->iCpu = -1; 1556 1560 1557 1561 pgmDynMapFlushAutoSetWorker(pSet, cEntries); … … 1580 1584 pgmDynMapFlushAutoSetWorker(pSet, cEntries); 1581 1585 } 1586 Assert(pSet->iCpu == RTMpCpuIdToSetIndex(RTMpCpuId())); 1582 1587 } 1583 1588 … … 1607 1612 { 1608 1613 PPGMR0DYNMAP pThis = g_pPGMR0DynMap; 1609 RTCPUID idRealCpu = RTMpCpuId(); 1610 1611 while (i-- > 0) 1612 { 1613 Assert(pSet->aEntries[i].cRefs > 0); 1614 uint32_t iPage = pSet->aEntries[i].iPage; 1615 Assert(iPage < pThis->cPages); 1616 if (RTCpuSetIsMember(&pThis->paPages[iPage].PendingSet, idRealCpu)) 1614 int32_t iRealCpu = RTMpCpuIdToSetIndex(RTMpCpuId()); 1615 if (pSet->iCpu != iRealCpu) 1616 { 1617 while (i-- > 0) 1617 1618 { 1618 RTCpuSetDel(&pThis->paPages[iPage].PendingSet, idRealCpu); 1619 ASMInvalidatePage(pThis->paPages[iPage].pvPage); 1620 STAM_COUNTER_INC(&pVCpu->pVMR0->pgm.s.StatR0DynMapMigrateInvlPg); 1619 Assert(pSet->aEntries[i].cRefs > 0); 1620 uint32_t iPage = pSet->aEntries[i].iPage; 1621 Assert(iPage < pThis->cPages); 1622 if (RTCpuSetIsMemberByIndex(&pThis->paPages[iPage].PendingSet, iRealCpu)) 1623 { 1624 RTCpuSetDelByIndex(&pThis->paPages[iPage].PendingSet, iRealCpu); 1625 ASMInvalidatePage(pThis->paPages[iPage].pvPage); 1626 STAM_COUNTER_INC(&pVCpu->pVMR0->pgm.s.StatR0DynMapMigrateInvlPg); 1627 } 1621 1628 } 1629 1630 pSet->iCpu = iRealCpu; 1622 1631 } 1623 1632 } … … 1684 1693 int pgmR0DynMapHCPageCommon(PVM pVM, PPGMMAPSET pSet, RTHCPHYS HCPhys, void **ppv) 1685 1694 { 1695 Assert(pSet->iCpu == RTMpCpuIdToSetIndex(RTMpCpuId())); 1696 1686 1697 /* 1687 1698 * Map it. 1688 1699 */ 1689 1700 void *pvPage; 1690 uint32_t const iPage = pgmR0DynMapPage(g_pPGMR0DynMap, HCPhys, p VM, &pvPage);1701 uint32_t const iPage = pgmR0DynMapPage(g_pPGMR0DynMap, HCPhys, pSet->iCpu, pVM, &pvPage); 1691 1702 if (RT_UNLIKELY(iPage == UINT32_MAX)) 1692 1703 {
Note:
See TracChangeset
for help on using the changeset viewer.