- Timestamp:
- Aug 7, 2019 11:17:11 AM (5 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/PGMAllHandler.cpp
r80181 r80182 179 179 pNew->pvUserR3 = pvUserR3; 180 180 pNew->pvUserR0 = pvUserR0; 181 pNew->pvUserRC = pvUserRC;182 181 pNew->hType = hType; 183 182 pNew->pszDesc = pszDesc != NIL_RTR3PTR ? pszDesc : pType->pszDesc; … … 208 207 pPhysHandlerSrc->pvUserR3, 209 208 pPhysHandlerSrc->pvUserR0, 210 pPhysHandlerSrc->pvUserRC,209 NIL_RTR0PTR, 211 210 pPhysHandlerSrc->pszDesc, 212 211 ppPhysHandler); … … 951 950 952 951 /** 953 * Changes the user callback arguments associated with a physical access 954 * handler. 952 * Changes the user callback arguments associated with a physical access handler. 955 953 * 956 954 * @returns VBox status code. … … 959 957 * @param pvUserR3 User argument to the R3 handler. 960 958 * @param pvUserR0 User argument to the R0 handler. 961 * @param pvUserRC User argument to the RC handler. Values larger or 962 * equal to 0x10000 will be relocated automatically. 963 */ 964 VMMDECL(int) PGMHandlerPhysicalChangeUserArgs(PVM pVM, RTGCPHYS GCPhys, RTR3PTR pvUserR3, RTR0PTR pvUserR0, RTRCPTR pvUserRC) 959 */ 960 VMMDECL(int) PGMHandlerPhysicalChangeUserArgs(PVM pVM, RTGCPHYS GCPhys, RTR3PTR pvUserR3, RTR0PTR pvUserR0) 965 961 { 966 962 /* … … 977 973 pCur->pvUserR3 = pvUserR3; 978 974 pCur->pvUserR0 = pvUserR0; 979 pCur->pvUserRC = pvUserRC;980 975 } 981 976 else -
trunk/src/VBox/VMM/VMMAll/PGMAllPool.cpp
r80177 r80182 2590 2590 PPGMPOOLPAGE pNewHead = &pPool->aPages[pPage->iMonitoredNext]; 2591 2591 pNewHead->iMonitoredPrev = NIL_PGMPOOL_IDX; 2592 rc = PGMHandlerPhysicalChangeUserArgs(pVM, pPage->GCPhys & ~(RTGCPHYS)PAGE_OFFSET_MASK, MMHyperCCToR3(pVM, pNewHead),2593 MMHyperCCToR 0(pVM, pNewHead), MMHyperCCToRC(pVM, pNewHead));2592 rc = PGMHandlerPhysicalChangeUserArgs(pVM, pPage->GCPhys & ~(RTGCPHYS)PAGE_OFFSET_MASK, 2593 MMHyperCCToR3(pVM, pNewHead), MMHyperCCToR0(pVM, pNewHead)); 2594 2594 2595 2595 AssertFatalRCSuccess(rc); -
trunk/src/VBox/VMM/VMMR3/PGM.cpp
r80181 r80182 673 673 static DECLCALLBACK(void) pgmR3InfoMode(PVM pVM, PCDBGFINFOHLP pHlp, const char *pszArgs); 674 674 static DECLCALLBACK(void) pgmR3InfoCr3(PVM pVM, PCDBGFINFOHLP pHlp, const char *pszArgs); 675 static DECLCALLBACK(int) pgmR3RelocatePhysHandler(PAVLROGCPHYSNODECORE pNode, void *pvUser);676 675 #ifdef VBOX_STRICT 677 676 static FNVMATSTATE pgmR3ResetNoMorePhysWritesFlag; … … 1868 1867 */ 1869 1868 if (pVM->pgm.s.pRamRangesXR3) 1870 {1871 /* Update the pSelfRC pointers and relink them. */1872 for (PPGMRAMRANGE pCur = pVM->pgm.s.pRamRangesXR3; pCur; pCur = pCur->pNextR3)1873 if (!(pCur->fFlags & PGM_RAM_RANGE_FLAGS_FLOATING))1874 pCur->pSelfRC = MMHyperCCToRC(pVM, pCur);1875 1869 pgmR3PhysRelinkRamRanges(pVM); 1876 }1877 1878 /*1879 * Update the pSelfRC pointer of the MMIO2 ram ranges since they might not1880 * be mapped and thus not included in the above exercise.1881 */1882 for (PPGMREGMMIORANGE pCur = pVM->pgm.s.pRegMmioRangesR3; pCur; pCur = pCur->pNextR3)1883 if (!(pCur->RamRange.fFlags & PGM_RAM_RANGE_FLAGS_FLOATING))1884 pCur->RamRange.pSelfRC = MMHyperCCToRC(pVM, &pCur->RamRange);1885 1870 1886 1871 #ifndef PGM_WITHOUT_MAPPINGS … … 1936 1921 1937 1922 /* 1938 * Physical and virtual handlers.1939 */1940 PGMRELOCHANDLERARGS Args = { offDelta, pVM };1941 RTAvlroGCPhysDoWithAll(&pVM->pgm.s.pTreesR3->PhysHandlers, true, pgmR3RelocatePhysHandler, &Args);1942 1943 PPGMPHYSHANDLERTYPEINT pCurPhysType;1944 RTListOff32ForEach(&pVM->pgm.s.pTreesR3->HeadPhysHandlerTypes, pCurPhysType, PGMPHYSHANDLERTYPEINT, ListNode)1945 {1946 if (pCurPhysType->pfnHandlerRC != NIL_RTRCPTR)1947 pCurPhysType->pfnHandlerRC += offDelta;1948 if (pCurPhysType->pfnPfHandlerRC != NIL_RTRCPTR)1949 pCurPhysType->pfnPfHandlerRC += offDelta;1950 }1951 1952 /*1953 1923 * The page pool. 1954 1924 */ 1955 1925 pgmR3PoolRelocate(pVM); 1956 }1957 1958 1959 /**1960 * Callback function for relocating a physical access handler.1961 *1962 * @returns 0 (continue enum)1963 * @param pNode Pointer to a PGMPHYSHANDLER node.1964 * @param pvUser Pointer to a PGMRELOCHANDLERARGS.1965 */1966 static DECLCALLBACK(int) pgmR3RelocatePhysHandler(PAVLROGCPHYSNODECORE pNode, void *pvUser)1967 {1968 PPGMPHYSHANDLER pHandler = (PPGMPHYSHANDLER)pNode;1969 PCPGMRELOCHANDLERARGS pArgs = (PCPGMRELOCHANDLERARGS)pvUser;1970 if (pHandler->pvUserRC >= 0x10000)1971 pHandler->pvUserRC += pArgs->offDelta;1972 return 0;1973 1926 } 1974 1927 -
trunk/src/VBox/VMM/VMMR3/PGMHandler.cpp
r80166 r80182 84 84 R0PTRTYPE(PFNPGMPHYSHANDLER) pfnHandlerR0, 85 85 R0PTRTYPE(PFNPGMRZPHYSPFHANDLER) pfnPfHandlerR0, 86 RCPTRTYPE(PFNPGMPHYSHANDLER) pfnHandlerRC,87 RCPTRTYPE(PFNPGMRZPHYSPFHANDLER) pfnPfHandlerRC,88 86 const char *pszDesc, PPGMPHYSHANDLERTYPE phType) 89 87 { … … 91 89 AssertReturn(pfnHandlerR0 != NIL_RTR0PTR, VERR_INVALID_POINTER); 92 90 AssertReturn(pfnPfHandlerR0 != NIL_RTR0PTR, VERR_INVALID_POINTER); 93 AssertReturn(pfnHandlerRC != NIL_RTRCPTR || !VM_IS_RAW_MODE_ENABLED(pVM), VERR_INVALID_POINTER);94 AssertReturn(pfnPfHandlerRC != NIL_RTRCPTR || !VM_IS_RAW_MODE_ENABLED(pVM), VERR_INVALID_POINTER);95 91 AssertPtrReturn(pszDesc, VERR_INVALID_POINTER); 96 92 AssertReturn( enmKind == PGMPHYSHANDLERKIND_WRITE … … 111 107 pType->pfnHandlerR0 = pfnHandlerR0; 112 108 pType->pfnPfHandlerR0 = pfnPfHandlerR0; 113 pType->pfnHandlerRC = pfnHandlerRC;114 pType->pfnPfHandlerRC = pfnPfHandlerRC;115 109 pType->pszDesc = pszDesc; 116 110 … … 120 114 121 115 *phType = MMHyperHeapPtrToOffset(pVM, pType); 122 LogFlow(("PGMR3HandlerPhysicalTypeRegisterEx: %p/%#x: enmKind=%d pfnHandlerR3=%RHv pfnHandlerR0=%RHv p fnHandlerRC=%RRv pszDesc=%s\n",123 pType, *phType, enmKind, pfnHandlerR3, pfnPfHandlerR0, p fnPfHandlerRC, pszDesc));116 LogFlow(("PGMR3HandlerPhysicalTypeRegisterEx: %p/%#x: enmKind=%d pfnHandlerR3=%RHv pfnHandlerR0=%RHv pszDesc=%s\n", 117 pType, *phType, enmKind, pfnHandlerR3, pfnPfHandlerR0, pszDesc)); 124 118 return VINF_SUCCESS; 125 119 } … … 208 202 if (RT_SUCCESS(rc)) 209 203 return PGMR3HandlerPhysicalTypeRegisterEx(pVM, enmKind, pfnHandlerR3, 210 pfnHandlerR0, pfnPfHandlerR0, 211 pfnHandlerRC, pfnPfHandlerRC, 212 pszDesc, phType); 204 pfnHandlerR0, pfnPfHandlerR0, pszDesc, phType); 213 205 } 214 206 else … … 397 389 } 398 390 pHlp->pfnPrintf(pHlp, 399 "%RGp - %RGp %RHv %RHv %RRv %RRv %s %s\n",400 pCur->Core.Key, pCur->Core.KeyLast, pCurType->pfnHandlerR3, pCur->pvUserR3, pCurType->pfnPfHandlerRC, pCur->pvUserRC,401 p szType, pCur->pszDesc);391 "%RGp - %RGp %RHv %RHv %RHv %RHv %s %s\n", 392 pCur->Core.Key, pCur->Core.KeyLast, pCurType->pfnHandlerR3, pCur->pvUserR3, 393 pCurType->pfnPfHandlerR0, pCur->pvUserR0, pszType, pCur->pszDesc); 402 394 #ifdef VBOX_WITH_STATISTICS 403 395 if (pArgs->fStats) -
trunk/src/VBox/VMM/VMMR3/PGMPhys.cpp
r80181 r80182 884 884 (a_pNode)->pLeftR0 = NIL_RTR0PTR; \ 885 885 (a_pNode)->pRightR0 = NIL_RTR0PTR; \ 886 (a_pNode)->pLeftRC = NIL_RTRCPTR; \887 (a_pNode)->pRightRC = NIL_RTRCPTR; \888 886 } while (0) 889 887 … … 892 890 (a_pParent)->pLeftR3 = (a_pNode); \ 893 891 (a_pParent)->pLeftR0 = (a_pNode)->pSelfR0; \ 894 (a_pParent)->pLeftRC = (a_pNode)->pSelfRC; \895 892 } while (0) 896 893 #define INSERT_RIGHT(a_pParent, a_pNode) \ … … 898 895 (a_pParent)->pRightR3 = (a_pNode); \ 899 896 (a_pParent)->pRightR0 = (a_pNode)->pSelfR0; \ 900 (a_pParent)->pRightRC = (a_pNode)->pSelfRC; \901 897 } while (0) 902 898 … … 1032 1028 { 1033 1029 Assert((pCur->fFlags & PGM_RAM_RANGE_FLAGS_FLOATING) || pCur->pSelfR0 == MMHyperCCToR0(pVM, pCur)); 1034 Assert((pCur->fFlags & PGM_RAM_RANGE_FLAGS_FLOATING) || pCur->pSelfRC == MMHyperCCToRC(pVM, pCur));1035 1030 Assert((pCur->GCPhys & PAGE_OFFSET_MASK) == 0); 1036 1031 Assert((pCur->GCPhysLast & PAGE_OFFSET_MASK) == PAGE_OFFSET_MASK); … … 1049 1044 1050 1045 for (; pCur->pNextR3; pCur = pCur->pNextR3) 1051 {1052 1046 pCur->pNextR0 = pCur->pNextR3->pSelfR0; 1053 pCur->pNextRC = pCur->pNextR3->pSelfRC;1054 }1055 1047 1056 1048 Assert(pCur->pNextR0 == NIL_RTR0PTR); 1057 Assert(pCur->pNextRC == NIL_RTRCPTR);1058 1049 } 1059 1050 else … … 1078 1069 AssertMsg(pNew->pszDesc, ("%RGp-%RGp\n", pNew->GCPhys, pNew->GCPhysLast)); 1079 1070 Assert((pNew->fFlags & PGM_RAM_RANGE_FLAGS_FLOATING) || pNew->pSelfR0 == MMHyperCCToR0(pVM, pNew)); 1080 Assert((pNew->fFlags & PGM_RAM_RANGE_FLAGS_FLOATING) || pNew->pSelfRC == MMHyperCCToRC(pVM, pNew));1081 1071 1082 1072 pgmLock(pVM); … … 1085 1075 pNew->pNextR3 = pRam; 1086 1076 pNew->pNextR0 = pRam ? pRam->pSelfR0 : NIL_RTR0PTR; 1087 pNew->pNextRC = pRam ? pRam->pSelfRC : NIL_RTRCPTR;1088 1077 1089 1078 if (pPrev) … … 1091 1080 pPrev->pNextR3 = pNew; 1092 1081 pPrev->pNextR0 = pNew->pSelfR0; 1093 pPrev->pNextRC = pNew->pSelfRC;1094 1082 } 1095 1083 else … … 1116 1104 Assert(pPrev ? pPrev->pNextR3 == pRam : pVM->pgm.s.pRamRangesXR3 == pRam); 1117 1105 Assert((pRam->fFlags & PGM_RAM_RANGE_FLAGS_FLOATING) || pRam->pSelfR0 == MMHyperCCToR0(pVM, pRam)); 1118 Assert((pRam->fFlags & PGM_RAM_RANGE_FLAGS_FLOATING) || pRam->pSelfRC == MMHyperCCToRC(pVM, pRam));1119 1106 1120 1107 pgmLock(pVM); … … 1125 1112 pPrev->pNextR3 = pNext; 1126 1113 pPrev->pNextR0 = pNext ? pNext->pSelfR0 : NIL_RTR0PTR; 1127 pPrev->pNextRC = pNext ? pNext->pSelfRC : NIL_RTRCPTR;1128 1114 } 1129 1115 else … … 1666 1652 */ 1667 1653 pNew->pSelfR0 = R0PtrNew != NIL_RTR0PTR ? R0PtrNew : MMHyperCCToR0(pVM, pNew); 1668 pNew->pSelfRC = RCPtrNew != NIL_RTRCPTR ? RCPtrNew : MMHyperCCToRC(pVM, pNew);1669 1654 pNew->GCPhys = GCPhys; 1670 1655 pNew->GCPhysLast = GCPhysLast; … … 2446 2431 /* Initialize the range. */ 2447 2432 pNew->pSelfR0 = MMHyperCCToR0(pVM, pNew); 2448 pNew->pSelfRC = MMHyperCCToRC(pVM, pNew);2449 2433 pNew->GCPhys = GCPhys; 2450 2434 pNew->GCPhysLast = GCPhysLast; … … 2789 2773 pNew->RamRange.pSelfR0 = R0PtrChunk + RT_UOFFSETOF(PGMREGMMIORANGE, RamRange); 2790 2774 2791 /*2792 * If we might end up in raw-mode, make a HMA mapping of the range,2793 * just like we do for memory above 4GB.2794 */2795 if (!VM_IS_RAW_MODE_ENABLED(pVM))2796 pNew->RamRange.pSelfRC = NIL_RTRCPTR;2797 else2798 {2799 RTGCPTR GCPtrChunkMap = pVM->pgm.s.GCPtrPrevRamRangeMapping - RT_ALIGN_Z(cbChunk, _4M);2800 RTGCPTR const GCPtrChunk = GCPtrChunkMap + PAGE_SIZE;2801 #ifndef PGM_WITHOUT_MAPPINGS2802 rc = PGMR3MapPT(pVM, GCPtrChunkMap, (uint32_t)cbChunk, 0 /*fFlags*/, pgmR3PhysMMIOExRangeRelocate, pNew, pszDesc);2803 if (RT_SUCCESS(rc))2804 {2805 #endif /* !PGM_WITHOUT_MAPPINGS */2806 pVM->pgm.s.GCPtrPrevRamRangeMapping = GCPtrChunkMap;2807 #ifndef PGM_WITHOUT_MAPPINGS2808 RTGCPTR GCPtrPage = GCPtrChunk;2809 for (uint32_t iPage = 0; iPage < cChunkPages && RT_SUCCESS(rc); iPage++, GCPtrPage += PAGE_SIZE)2810 rc = PGMMap(pVM, GCPtrPage, paChunkPages[iPage].Phys, PAGE_SIZE, 0);2811 }2812 if (RT_FAILURE(rc))2813 {2814 SUPR3PageFreeEx(pvChunk, cChunkPages);2815 RTMemTmpFree(paChunkPages);2816 break;2817 }2818 #endif /* !PGM_WITHOUT_MAPPINGS */2819 pNew->RamRange.pSelfRC = GCPtrChunk + RT_UOFFSETOF(PGMREGMMIORANGE, RamRange);2820 }2821 2775 RTMemTmpFree(paChunkPages); 2822 2776 } … … 2834 2788 //pNew->RamRange.fFlags = 0; 2835 2789 pNew->RamRange.pSelfR0 = MMHyperCCToR0(pVM, &pNew->RamRange); 2836 pNew->RamRange.pSelfRC = MMHyperCCToRC(pVM, &pNew->RamRange);2837 2790 } 2838 2791 … … 4242 4195 { 4243 4196 pRamNew->pSelfR0 = MMHyperCCToR0(pVM, pRamNew); 4244 pRamNew->pSelfRC = MMHyperCCToRC(pVM, pRamNew);4245 4197 pRamNew->GCPhys = GCPhys; 4246 4198 pRamNew->GCPhysLast = GCPhysLast; … … 4394 4346 pRomNew->pNextR3 = pRom; 4395 4347 pRomNew->pNextR0 = pRom ? MMHyperCCToR0(pVM, pRom) : NIL_RTR0PTR; 4396 pRomNew->pNextRC = pRom ? MMHyperCCToRC(pVM, pRom) : NIL_RTRCPTR;4397 4348 4398 4349 if (pRomPrev) … … 4400 4351 pRomPrev->pNextR3 = pRomNew; 4401 4352 pRomPrev->pNextR0 = MMHyperCCToR0(pVM, pRomNew); 4402 pRomPrev->pNextRC = MMHyperCCToRC(pVM, pRomNew);4403 4353 } 4404 4354 else -
trunk/src/VBox/VMM/include/PGMInternal.h
r80181 r80182 535 535 /** Pointer to next entry. */ 536 536 R0PTRTYPE(struct PGMMAPPING *) pNextR0; 537 /** Pointer to next entry. */538 RCPTRTYPE(struct PGMMAPPING *) pNextRC;539 537 /** Indicate whether this entry is finalized. */ 540 538 bool fFinalized; 539 bool afPadding[7]; 541 540 /** Start Virtual address. */ 542 541 RTGCPTR GCPtr; … … 574 573 /** The HC virtual address of the two PAE page table. (i.e 1024 entries instead of 512) */ 575 574 R3PTRTYPE(PPGMSHWPTPAE) paPaePTsR3; 576 /** The RC virtual address of the 32-bit page table. */577 RCPTRTYPE(PX86PT) pPTRC;578 /** The RC virtual address of the two PAE page table. */579 RCPTRTYPE(PPGMSHWPTPAE) paPaePTsRC;580 575 /** The R0 virtual address of the 32-bit page table. */ 581 576 R0PTRTYPE(PX86PT) pPTR0; … … 605 600 /** The PGM_PAGE_HNDL_PHYS_STATE_XXX value corresponding to enmKind. */ 606 601 uint32_t uState; 607 /** Pointer to RC callback function. */608 RCPTRTYPE(PFNPGMPHYSHANDLER) pfnHandlerRC;609 /** Pointer to RC callback function for \#PFs. */610 RCPTRTYPE(PFNPGMRZPHYSPFHANDLER) pfnPfHandlerRC;611 602 /** Pointer to R3 callback function. */ 612 603 R3PTRTYPE(PFNPGMPHYSHANDLER) pfnHandlerR3; … … 651 642 /** Registered handler type handle (heap offset). */ 652 643 PGMPHYSHANDLERTYPE hType; 653 /** User argument for RC handlers. */654 RCPTRTYPE(void *) pvUserRC;655 #if HC_ARCH_BITS == 64656 RTRCPTR Padding0; /**< Explicit alignment padding. */657 #endif658 644 /** User argument for R3 handlers. */ 659 645 R3PTRTYPE(void *) pvUserR3; … … 1298 1284 /** Pointer to the next RAM range - for R0. */ 1299 1285 R0PTRTYPE(struct PGMRAMRANGE *) pNextR0; 1300 /** Pointer to the next RAM range - for RC. */1301 RCPTRTYPE(struct PGMRAMRANGE *) pNextRC;1302 1286 /** PGM_RAM_RANGE_FLAGS_* flags. */ 1303 1287 uint32_t fFlags; 1288 uint32_t fPadding1; 1304 1289 /** Last address in the range (inclusive). Page aligned (-1). */ 1305 1290 RTGCPHYS GCPhysLast; … … 1312 1297 /** Pointer to self - R0 pointer. */ 1313 1298 R0PTRTYPE(struct PGMRAMRANGE *) pSelfR0; 1314 /** Pointer to self - RC pointer. */ 1315 RCPTRTYPE(struct PGMRAMRANGE *) pSelfRC; 1316 1317 /** Alignment padding. */ 1318 RTRCPTR Alignment0; 1299 1319 1300 /** Pointer to the left search three node - ring-3 context. */ 1320 1301 R3PTRTYPE(struct PGMRAMRANGE *) pLeftR3; … … 1325 1306 /** Pointer to the right search three node - ring-0 context. */ 1326 1307 R0PTRTYPE(struct PGMRAMRANGE *) pRightR0; 1327 /** Pointer to the left search three node - raw-mode context. */1328 RCPTRTYPE(struct PGMRAMRANGE *) pLeftRC;1329 /** Pointer to the right search three node - raw-mode context. */1330 RCPTRTYPE(struct PGMRAMRANGE *) pRightRC;1331 1308 1332 1309 /** Padding to make aPage aligned on sizeof(PGMPAGE). */ … … 1424 1401 /** Pointer to the next range - R0. */ 1425 1402 R0PTRTYPE(struct PGMROMRANGE *) pNextR0; 1426 /** Pointer to the next range - RC. */1427 RCPTRTYPE(struct PGMROMRANGE *) pNextRC;1428 /** Pointer alignment */1429 RTRCPTR RCPtrAlignment;1430 1403 /** Address of the range. */ 1431 1404 RTGCPHYS GCPhys;
Note:
See TracChangeset
for help on using the changeset viewer.