Changeset 13045 in vbox
- Timestamp:
- Oct 7, 2008 1:04:43 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 37500
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/pgm.h
r13042 r13045 183 183 184 184 /** 185 * \#PF Handler callback for virtual access handler ranges .185 * \#PF Handler callback for virtual access handler ranges, RC. 186 186 * 187 187 * Important to realize that a physical page in a range can have aliases, and … … 197 197 * (If it's a EIP range this's the EIP, if not it's pvFault.) 198 198 */ 199 typedef DECLCALLBACK(int) FNPGM GCVIRTHANDLER(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPTR pvRange, uintptr_t offRange);199 typedef DECLCALLBACK(int) FNPGMRCVIRTHANDLER(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPTR pvRange, uintptr_t offRange); 200 200 /** Pointer to PGM access callback. */ 201 typedef FNPGM GCVIRTHANDLER *PFNPGMGCVIRTHANDLER;202 203 /** 204 * \#PF Handler callback for virtual access handler ranges .201 typedef FNPGMRCVIRTHANDLER *PFNPGMRCVIRTHANDLER; 202 203 /** 204 * \#PF Handler callback for virtual access handler ranges, R3. 205 205 * 206 206 * Important to realize that a physical page in a range can have aliases, and … … 217 217 * @param pvUser User argument. 218 218 */ 219 typedef DECLCALLBACK(int) FNPGM HCVIRTHANDLER(PVM pVM, RTGCPTR GCPtr, void *pvPtr, void *pvBuf, size_t cbBuf, PGMACCESSTYPE enmAccessType, void *pvUser);219 typedef DECLCALLBACK(int) FNPGMR3VIRTHANDLER(PVM pVM, RTGCPTR GCPtr, void *pvPtr, void *pvBuf, size_t cbBuf, PGMACCESSTYPE enmAccessType, void *pvUser); 220 220 /** Pointer to PGM access callback. */ 221 typedef FNPGM HCVIRTHANDLER *PFNPGMHCVIRTHANDLER;221 typedef FNPGMR3VIRTHANDLER *PFNPGMR3VIRTHANDLER; 222 222 223 223 … … 228 228 * @param GCPtr The virtual address the guest has changed. 229 229 */ 230 typedef DECLCALLBACK(int) FNPGM HCVIRTINVALIDATE(PVM pVM, RTGCPTR GCPtr);230 typedef DECLCALLBACK(int) FNPGMR3VIRTINVALIDATE(PVM pVM, RTGCPTR GCPtr); 231 231 /** Pointer to PGM invalidation callback. */ 232 typedef FNPGM HCVIRTINVALIDATE *PFNPGMHCVIRTINVALIDATE;232 typedef FNPGMR3VIRTINVALIDATE *PFNPGMR3VIRTINVALIDATE; 233 233 234 234 /** … … 532 532 const char *pszModRC, const char *pszHandlerRC, RTRCPTR pvUserRC, const char *pszDesc); 533 533 VMMDECL(int) PGMHandlerVirtualRegisterEx(PVM pVM, PGMVIRTHANDLERTYPE enmType, RTGCPTR GCPtr, RTGCPTR GCPtrLast, 534 PFNPGMHCVIRTINVALIDATE pfnInvalidateHC, 535 PFNPGMHCVIRTHANDLER pfnHandlerHC, RTGCPTR pfnHandlerGC, 534 R3PTRTYPE(PFNPGMR3VIRTINVALIDATE) pfnInvalidateR3, 535 R3PTRTYPE(PFNPGMR3VIRTHANDLER) pfnHandlerR3, 536 RCPTRTYPE(PFNPGMRCVIRTHANDLER) pfnHandlerRC, 536 537 R3PTRTYPE(const char *) pszDesc); 537 538 VMMR3DECL(int) PGMR3HandlerVirtualRegister(PVM pVM, PGMVIRTHANDLERTYPE enmType, RTGCPTR GCPtr, RTGCPTR GCPtrLast, 538 PFNPGM HCVIRTINVALIDATE pfnInvalidateHC,539 PFNPGM HCVIRTHANDLER pfnHandlerHC,540 const char *pszHandler GC, const char *pszModGC, const char *pszDesc);541 VMMDECL(int) PGMHandlerVirtualChangeInvalidateCallback(PVM pVM, RTGCPTR GCPtr, PFNPGMHCVIRTINVALIDATE pfnInvalidateHC);539 PFNPGMR3VIRTINVALIDATE pfnInvalidateR3, 540 PFNPGMR3VIRTHANDLER pfnHandlerR3, 541 const char *pszHandlerRC, const char *pszModRC, const char *pszDesc); 542 VMMDECL(int) PGMHandlerVirtualChangeInvalidateCallback(PVM pVM, RTGCPTR GCPtr, R3PTRTYPE(PFNPGMR3VIRTINVALIDATE) pfnInvalidateR3); 542 543 VMMDECL(int) PGMHandlerVirtualDeregister(PVM pVM, RTGCPTR GCPtr); 543 544 VMMR3DECL(int) PGMR3PoolGrow(PVM pVM); -
trunk/src/VBox/VMM/PGM.cpp
r13042 r13045 1955 1955 Assert( pHandler->enmType == PGMVIRTHANDLERTYPE_ALL 1956 1956 || pHandler->enmType == PGMVIRTHANDLERTYPE_WRITE); 1957 Assert(pHandler->pfnHandler GC);1958 pHandler->pfnHandler GC+= offDelta;1957 Assert(pHandler->pfnHandlerRC); 1958 pHandler->pfnHandlerRC += offDelta; 1959 1959 return 0; 1960 1960 } … … 1974 1974 RTGCINTPTR offDelta = *(PRTGCINTPTR)pvUser; 1975 1975 Assert(pHandler->enmType == PGMVIRTHANDLERTYPE_HYPERVISOR); 1976 Assert(pHandler->pfnHandler GC);1977 pHandler->pfnHandler GC += offDelta;1976 Assert(pHandler->pfnHandlerRC); 1977 pHandler->pfnHandlerRC += offDelta; 1978 1978 return 0; 1979 1979 } -
trunk/src/VBox/VMM/PGMHandler.cpp
r13042 r13045 229 229 /** @todo rename this function to PGMR3HandlerVirtualRegister */ 230 230 VMMR3DECL(int) PGMR3HandlerVirtualRegister(PVM pVM, PGMVIRTHANDLERTYPE enmType, RTGCPTR GCPtr, RTGCPTR GCPtrLast, 231 PFNPGM HCVIRTINVALIDATE pfnInvalidateHC,232 PFNPGM HCVIRTHANDLER pfnHandlerHC,231 PFNPGMR3VIRTINVALIDATE pfnInvalidateHC, 232 PFNPGMR3VIRTHANDLER pfnHandlerHC, 233 233 const char *pszHandlerGC, const char *pszModGC, 234 234 const char *pszDesc) … … 269 269 * @param GCPtr Start address. 270 270 * @param GCPtrLast Last address (inclusive). 271 * @param pfnInvalidate HC The HCinvalidate callback (can be 0)272 * @param pfnHandler HC The HChandler.273 * @param pfnHandler GC The GC handler.271 * @param pfnInvalidateR3 The R3 invalidate callback (can be 0) 272 * @param pfnHandlerR3 The R3 handler. 273 * @param pfnHandlerRC The RC handler. 274 274 * @param pszDesc Pointer to description string. This must not be freed. 275 275 * @thread EMT … … 279 279 * duplicating the function pointers now. (Or we will once we add the missing callbacks.) */ 280 280 VMMDECL(int) PGMHandlerVirtualRegisterEx(PVM pVM, PGMVIRTHANDLERTYPE enmType, RTGCPTR GCPtr, RTGCPTR GCPtrLast, 281 PFNPGMHCVIRTINVALIDATE pfnInvalidateHC, 282 PFNPGMHCVIRTHANDLER pfnHandlerHC, RTGCPTR pfnHandlerGC, 281 R3PTRTYPE(PFNPGMR3VIRTINVALIDATE) pfnInvalidateR3, 282 R3PTRTYPE(PFNPGMR3VIRTHANDLER) pfnHandlerR3, 283 RCPTRTYPE(PFNPGMRCVIRTHANDLER) pfnHandlerRC, 283 284 R3PTRTYPE(const char *) pszDesc) 284 285 { 285 Log(("PGMR3HandlerVirtualRegister: enmType=%d GCPtr=%RGv GCPtrLast=%RGv pfnHandlerGC=%RGv pszDesc=%s\n", enmType, GCPtr, GCPtrLast, pfnHandlerGC, pszDesc)); 286 Log(("PGMR3HandlerVirtualRegister: enmType=%d GCPtr=%RGv GCPtrLast=%RGv pfnInvalidateR3=%RHv pfnHandlerR3=%RHv pfnHandlerRC=%RGv pszDesc=%s\n", 287 enmType, GCPtr, GCPtrLast, pfnInvalidateR3, pfnHandlerR3, pfnHandlerRC, pszDesc)); 286 288 287 289 /* … … 292 294 case PGMVIRTHANDLERTYPE_ALL: 293 295 case PGMVIRTHANDLERTYPE_WRITE: 294 if (!pfnHandler HC)296 if (!pfnHandlerR3) 295 297 { 296 298 AssertMsgFailed(("No HC handler specified!!\n")); … … 300 302 301 303 case PGMVIRTHANDLERTYPE_HYPERVISOR: 302 if (pfnHandler HC)304 if (pfnHandlerR3) 303 305 { 304 AssertMsgFailed((" HChandler specified for hypervisor range!?!\n"));306 AssertMsgFailed(("R3 handler specified for hypervisor range!?!\n")); 305 307 return VERR_INVALID_PARAMETER; 306 308 } … … 315 317 return VERR_INVALID_PARAMETER; 316 318 } 317 if (!pfnHandler GC)318 { 319 AssertMsgFailed(("pfnHandler GC is missing\n"));319 if (!pfnHandlerRC) 320 { 321 AssertMsgFailed(("pfnHandlerRC is missing\n")); 320 322 return VERR_INVALID_PARAMETER; 321 323 } … … 334 336 335 337 pNew->enmType = enmType; 336 pNew->pfnInvalidate HC = pfnInvalidateHC;337 pNew->pfnHandler GC = pfnHandlerGC;338 pNew->pfnHandler HC = pfnHandlerHC;338 pNew->pfnInvalidateR3 = pfnInvalidateR3; 339 pNew->pfnHandlerRC = pfnHandlerRC; 340 pNew->pfnHandlerR3 = pfnHandlerR3; 339 341 pNew->pszDesc = pszDesc; 340 342 pNew->GCPtr = GCPtr; … … 416 418 * @param pVM VM handle. 417 419 * @param GCPtr Start address. 418 * @param pfnInvalidate HC The HCinvalidate callback (can be 0)420 * @param pfnInvalidateR3 The R3 invalidate callback (can be 0) 419 421 * @remarks Doesn't work with the hypervisor access handler type. 420 422 */ 421 VMMDECL(int) PGMHandlerVirtualChangeInvalidateCallback(PVM pVM, RTGCPTR GCPtr, PFNPGM HCVIRTINVALIDATE pfnInvalidateHC)423 VMMDECL(int) PGMHandlerVirtualChangeInvalidateCallback(PVM pVM, RTGCPTR GCPtr, PFNPGMR3VIRTINVALIDATE pfnInvalidateR3) 422 424 { 423 425 pgmLock(pVM); … … 425 427 if (pCur) 426 428 { 427 pCur->pfnInvalidate HC = pfnInvalidateHC;429 pCur->pfnInvalidateR3 = pfnInvalidateR3; 428 430 pgmUnlock(pVM); 429 431 return VINF_SUCCESS; … … 616 618 default: pszType = "????"; break; 617 619 } 618 pHlp->pfnPrintf(pHlp, "% VGv - %VGv %VHv %VRv %s %s\n",619 pCur->GCPtr, pCur->GCPtrLast, pCur->pfnHandler HC, pCur->pfnHandlerGC, pszType, pCur->pszDesc);620 pHlp->pfnPrintf(pHlp, "%RGv - %RGv %RHv %RRv %s %s\n", 621 pCur->GCPtr, pCur->GCPtrLast, pCur->pfnHandlerR3, pCur->pfnHandlerRC, pszType, pCur->pszDesc); 620 622 #ifdef VBOX_WITH_STATISTICS 621 623 if (pArgs->fStats) -
trunk/src/VBox/VMM/PGMInternal.h
r13042 r13045 444 444 /** Core node for the tree based on virtual ranges. */ 445 445 AVLROGCPTRNODECORE Core; 446 /** Number of cache pages. */ 446 #if GC_ARCH_BITS == 32 447 /** Alignment padding. */ 447 448 uint32_t u32Padding; 449 #endif 448 450 /** Access type. */ 449 451 PGMVIRTHANDLERTYPE enmType; 450 452 /** Number of cache pages. */ 451 453 uint32_t cPages; 452 #if GC_ARCH_BITS == 64 453 uint32_t padding0; 454 #endif 454 455 455 /** @todo The next two members are redundant. It adds some readability though. */ 456 456 /** Start of the range. */ … … 458 458 /** End of the range (exclusive). */ 459 459 RTGCPTR GCPtrLast; 460 460 461 /** Size of the range (in bytes). */ 461 462 RTGCUINTPTR cb; 462 /** Pointer to the GC callback function. */463 RCPTRTYPE(PFNPGM GCVIRTHANDLER) pfnHandlerGC;463 /** Pointer to the RC callback function. */ 464 RCPTRTYPE(PFNPGMRCVIRTHANDLER) pfnHandlerRC; 464 465 #if GC_ARCH_BITS == 64 465 466 RTRCPTR padding1; 466 467 #endif 467 /** Pointer to the HCcallback function for invalidation. */468 R3PTRTYPE(PFNPGM HCVIRTINVALIDATE) pfnInvalidateHC;469 /** Pointer to the HCcallback function. */470 R3PTRTYPE(PFNPGM HCVIRTHANDLER) pfnHandlerHC;468 /** Pointer to the R3 callback function for invalidation. */ 469 R3PTRTYPE(PFNPGMR3VIRTINVALIDATE) pfnInvalidateR3; 470 /** Pointer to the R3 callback function. */ 471 R3PTRTYPE(PFNPGMR3VIRTHANDLER) pfnHandlerR3; 471 472 /** Description / Name. For easing debugging. */ 472 473 R3PTRTYPE(const char *) pszDesc; -
trunk/src/VBox/VMM/VMMAll/PGMAllBth.h
r13042 r13045 280 280 # ifdef IN_GC 281 281 STAM_PROFILE_START(&pCur->Stat, h); 282 rc = CTXSUFF(pCur->pfnHandler)(pVM, uErr, pRegFrame, pvFault, pCur->GCPtr, (RTGCUINTPTR)pvFault - (RTGCUINTPTR)pCur->GCPtr);282 rc = pCur->CTX_SUFF(pfnHandler)(pVM, uErr, pRegFrame, pvFault, pCur->GCPtr, (RTGCUINTPTR)pvFault - (RTGCUINTPTR)pCur->GCPtr); 283 283 STAM_PROFILE_STOP(&pCur->Stat, h); 284 284 # else … … 460 460 # ifdef IN_GC 461 461 STAM_PROFILE_START(&pCur->Stat, h); 462 rc = CTXSUFF(pCur->pfnHandler)(pVM, uErr, pRegFrame, pvFault, pCur->GCPtr, (RTGCUINTPTR)pvFault - (RTGCUINTPTR)pCur->GCPtr);462 rc = pCur->CTX_SUFF(pfnHandler)(pVM, uErr, pRegFrame, pvFault, pCur->GCPtr, (RTGCUINTPTR)pvFault - (RTGCUINTPTR)pCur->GCPtr); 463 463 STAM_PROFILE_STOP(&pCur->Stat, h); 464 464 # else … … 489 489 Assert(off < pCur->cb); 490 490 STAM_PROFILE_START(&pCur->Stat, h); 491 rc = CTXSUFF(pCur->pfnHandler)(pVM, uErr, pRegFrame, pvFault, pCur->GCPtr, off);491 rc = pCur->CTX_SUFF(pfnHandler)(pVM, uErr, pRegFrame, pvFault, pCur->GCPtr, off); 492 492 STAM_PROFILE_STOP(&pCur->Stat, h); 493 493 # else … … 567 567 # ifdef IN_GC 568 568 STAM_PROFILE_START(&pCur->Stat, h); 569 rc = CTXSUFF(pCur->pfnHandler)(pVM, uErr, pRegFrame, pvFault, pCur->GCPtr, (RTGCUINTPTR)pvFault - (RTGCUINTPTR)pCur->GCPtr);569 rc = pCur->CTX_SUFF(pfnHandler)(pVM, uErr, pRegFrame, pvFault, pCur->GCPtr, (RTGCUINTPTR)pvFault - (RTGCUINTPTR)pCur->GCPtr); 570 570 STAM_PROFILE_STOP(&pCur->Stat, h); 571 571 # else -
trunk/src/VBox/VMM/VMMAll/PGMAllPhys.cpp
r13040 r13045 1250 1250 unsigned iPage; 1251 1251 int rc2 = pgmHandlerVirtualFindByPhysAddr(pVM, GCPhys, &pNode, &iPage); 1252 if (VBOX_SUCCESS(rc2) && pNode->pfnHandler HC)1252 if (VBOX_SUCCESS(rc2) && pNode->pfnHandlerR3) 1253 1253 { 1254 1254 size_t cbRange = pNode->Core.KeyLast - GCPhys + 1; … … 1262 1262 void *pvSrc = PGMRAMRANGE_GETHCPTR(pRam, off) 1263 1263 1264 /* * @noteDangerous assumption that HC handlers don't do anything that really requires an EMT lock! */1265 rc = pNode->pfnHandler HC(pVM, (RTGCPTR)GCPtr, pvSrc, pvBuf, cb, PGMACCESSTYPE_READ, 0);1264 /* Note: Dangerous assumption that HC handlers don't do anything that really requires an EMT lock! */ 1265 rc = pNode->pfnHandlerR3(pVM, (RTGCPTR)GCPtr, pvSrc, pvBuf, cb, PGMACCESSTYPE_READ, 0); 1266 1266 } 1267 1267 #endif /* IN_RING3 */ … … 1491 1491 void *pvDst = PGMRAMRANGE_GETHCPTR(pRam, off) 1492 1492 1493 /* * @note Dangerous assumption that HChandlers don't do anything that really requires an EMT lock! */1493 /* Note! Dangerous assumption that R3 handlers don't do anything that really requires an EMT lock! */ 1494 1494 rc = pPhysNode->pfnHandlerR3(pVM, GCPhys, pvDst, (void *)pvBuf, cb, PGMACCESSTYPE_WRITE, pPhysNode->pvUserR3); 1495 1495 } … … 1499 1499 unsigned iPage; 1500 1500 int rc2 = pgmHandlerVirtualFindByPhysAddr(pVM, GCPhys, &pVirtNode, &iPage); 1501 if (VBOX_SUCCESS(rc2) && pVirtNode->pfnHandler HC)1501 if (VBOX_SUCCESS(rc2) && pVirtNode->pfnHandlerR3) 1502 1502 { 1503 1503 size_t cbRange = pVirtNode->Core.KeyLast - GCPhys + 1; … … 1511 1511 void *pvDst = PGMRAMRANGE_GETHCPTR(pRam, off) 1512 1512 1513 /* * @note Dangerous assumption that HChandlers don't do anything that really requires an EMT lock! */1514 rc2 = pVirtNode->pfnHandler HC(pVM, (RTGCPTR)GCPtr, pvDst, (void *)pvBuf, cb, PGMACCESSTYPE_WRITE, 0);1513 /* Note! Dangerous assumption that R3 handlers don't do anything that really requires an EMT lock! */ 1514 rc2 = pVirtNode->pfnHandlerR3(pVM, (RTGCPTR)GCPtr, pvDst, (void *)pvBuf, cb, PGMACCESSTYPE_WRITE, 0); 1515 1515 if ( ( rc2 != VINF_PGM_HANDLER_DO_DEFAULT 1516 1516 && rc == VINF_PGM_HANDLER_DO_DEFAULT) … … 1549 1549 unsigned iPage; 1550 1550 int rc2 = pgmHandlerVirtualFindByPhysAddr(pVM, GCPhys, &pNode, &iPage); 1551 if (VBOX_SUCCESS(rc2) && pNode->pfnHandler HC)1551 if (VBOX_SUCCESS(rc2) && pNode->pfnHandlerR3) 1552 1552 { 1553 1553 size_t cbRange = pNode->Core.KeyLast - GCPhys + 1; … … 1561 1561 void *pvDst = PGMRAMRANGE_GETHCPTR(pRam, off) 1562 1562 1563 /* * @tode Dangerous assumption that HChandlers don't do anything that really requires an EMT lock! */1564 rc = pNode->pfnHandler HC(pVM, (RTGCPTR)GCPtr, pvDst, (void *)pvBuf, cb, PGMACCESSTYPE_WRITE, 0);1563 /* Note! Dangerous assumption that R3 handlers don't do anything that really requires an EMT lock! */ 1564 rc = pNode->pfnHandlerR3(pVM, (RTGCPTR)GCPtr, pvDst, (void *)pvBuf, cb, PGMACCESSTYPE_WRITE, 0); 1565 1565 } 1566 1566 #endif /* IN_RING3 */ -
trunk/src/VBox/VMM/testcase/tstVMStructGC.cpp
r13042 r13045 558 558 GEN_CHECK_OFF(PGMVIRTHANDLER, GCPtrLast); 559 559 GEN_CHECK_OFF(PGMVIRTHANDLER, cb); 560 GEN_CHECK_OFF(PGMVIRTHANDLER, pfnHandler HC);561 GEN_CHECK_OFF(PGMVIRTHANDLER, pfnHandler GC);560 GEN_CHECK_OFF(PGMVIRTHANDLER, pfnHandlerR3); 561 GEN_CHECK_OFF(PGMVIRTHANDLER, pfnHandlerRC); 562 562 GEN_CHECK_OFF(PGMVIRTHANDLER, pszDesc); 563 563 GEN_CHECK_OFF(PGMVIRTHANDLER, cPages);
Note:
See TracChangeset
for help on using the changeset viewer.