Changeset 13936 in vbox
- Timestamp:
- Nov 6, 2008 8:44:09 PM (16 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/PGM.cpp
r13933 r13936 1815 1815 } 1816 1816 /* A bit of paranoia is justified. */ 1817 AssertRelease( (RTGCUINTPTR)pVM->pgm.s.apGCPaePDs[0] + PAGE_SIZE == (RTGCUINTPTR)pVM->pgm.s.apGCPaePDs[1]);1818 AssertRelease( (RTGCUINTPTR)pVM->pgm.s.apGCPaePDs[1] + PAGE_SIZE == (RTGCUINTPTR)pVM->pgm.s.apGCPaePDs[2]);1819 AssertRelease( (RTGCUINTPTR)pVM->pgm.s.apGCPaePDs[2] + PAGE_SIZE == (RTGCUINTPTR)pVM->pgm.s.apGCPaePDs[3]);1817 AssertRelease(pVM->pgm.s.apGCPaePDs[0] + PAGE_SIZE == pVM->pgm.s.apGCPaePDs[1]); 1818 AssertRelease(pVM->pgm.s.apGCPaePDs[1] + PAGE_SIZE == pVM->pgm.s.apGCPaePDs[2]); 1819 AssertRelease(pVM->pgm.s.apGCPaePDs[2] + PAGE_SIZE == pVM->pgm.s.apGCPaePDs[3]); 1820 1820 GCPtr += PAGE_SIZE; /* reserved page */ 1821 1821 -
trunk/src/VBox/VMM/PGMBth.h
r13818 r13936 35 35 PGM_BTH_DECL(int, InvalidatePage)(PVM pVM, RTGCPTR GCPtrPage); 36 36 PGM_BTH_DECL(int, PrefetchPage)(PVM pVM, RTGCUINTPTR GCPtrPage); 37 PGM_BTH_DECL(unsigned, AssertCR3)(PVM pVM, uint64_t cr3, uint64_t cr4, RTGC UINTPTR GCPtr = 0, RTGCUINTPTR cb = ~(RTGCUINTPTR)0);37 PGM_BTH_DECL(unsigned, AssertCR3)(PVM pVM, uint64_t cr3, uint64_t cr4, RTGCPTR GCPtr = 0, RTGCPTR cb = ~(RTGCPTR)0); 38 38 __END_DECLS 39 39 -
trunk/src/VBox/VMM/PGMDbg.cpp
r13040 r13936 459 459 const RTGCUINTPTR GCPtrLast = GCPtr + cbRange - 1 >= GCPtr 460 460 ? GCPtr + cbRange - 1 461 : ~(RTGC UINTPTR)0;461 : ~(RTGCPTR)0; 462 462 RTGCUINTPTR cPages = (((GCPtrLast - GCPtr) + (GCPtr & PAGE_OFFSET_MASK)) >> PAGE_SHIFT) + 1; 463 463 while (cPages-- > 0) … … 474 474 void const *pvPage; 475 475 PGMPAGEMAPLOCK Lock; 476 rc = PGMPhysGCPhys2CCPtrReadOnly(pVM, GCPhys & ~(RTGC UINTPTR)PAGE_OFFSET_MASK, &pvPage, &Lock);476 rc = PGMPhysGCPhys2CCPtrReadOnly(pVM, GCPhys & ~(RTGCPTR)PAGE_OFFSET_MASK, &pvPage, &Lock); 477 477 if (RT_SUCCESS(rc)) 478 478 { … … 486 486 if (fRc) 487 487 { 488 *pGCPtrHit = (GCPtr & ~(RTGC UINTPTR)PAGE_OFFSET_MASK) + offPage;488 *pGCPtrHit = (GCPtr & ~(RTGCPTR)PAGE_OFFSET_MASK) + offPage; 489 489 return VINF_SUCCESS; 490 490 } -
trunk/src/VBox/VMM/PGMHandler.cpp
r13823 r13936 323 323 * Allocate and initialize a new entry. 324 324 */ 325 unsigned cPages = (RT_ALIGN( (RTGCUINTPTR)GCPtrLast + 1, PAGE_SIZE) - ((RTGCUINTPTR)GCPtr & PAGE_BASE_GC_MASK)) >> PAGE_SHIFT;325 unsigned cPages = (RT_ALIGN(GCPtrLast + 1, PAGE_SIZE) - (GCPtr & PAGE_BASE_GC_MASK)) >> PAGE_SHIFT; 326 326 PPGMVIRTHANDLER pNew; 327 327 int rc = MMHyperAlloc(pVM, RT_OFFSETOF(PGMVIRTHANDLER, aPhysToVirt[cPages]), 0, MM_TAG_PGM_HANDLERS, (void **)&pNew); /** @todo r=bird: incorrect member name PhysToVirt? */ -
trunk/src/VBox/VMM/PGMInternal.h
r13935 r13936 1912 1912 DECLR3CALLBACKMEMBER(int, pfnR3BthVerifyAccessSyncPage,(PVM pVM, RTGCUINTPTR GCPtrPage, unsigned fFlags, unsigned uError)); 1913 1913 #ifdef VBOX_STRICT 1914 DECLR3CALLBACKMEMBER(unsigned, pfnR3BthAssertCR3,(PVM pVM, uint64_t cr3, uint64_t cr4, RTGC UINTPTR GCPtr, RTGCUINTPTR cb));1914 DECLR3CALLBACKMEMBER(unsigned, pfnR3BthAssertCR3,(PVM pVM, uint64_t cr3, uint64_t cr4, RTGCPTR GCPtr, RTGCPTR cb)); 1915 1915 #endif 1916 1916 … … 1922 1922 DECLRCCALLBACKMEMBER(int, pfnRCBthVerifyAccessSyncPage,(PVM pVM, RTGCUINTPTR GCPtrPage, unsigned fFlags, unsigned uError)); 1923 1923 #ifdef VBOX_STRICT 1924 DECLRCCALLBACKMEMBER(unsigned, pfnRCBthAssertCR3,(PVM pVM, uint64_t cr3, uint64_t cr4, RTGC UINTPTR GCPtr, RTGCUINTPTR cb));1924 DECLRCCALLBACKMEMBER(unsigned, pfnRCBthAssertCR3,(PVM pVM, uint64_t cr3, uint64_t cr4, RTGCPTR GCPtr, RTGCPTR cb)); 1925 1925 #endif 1926 1926 … … 1932 1932 DECLR0CALLBACKMEMBER(int, pfnR0BthVerifyAccessSyncPage,(PVM pVM, RTGCUINTPTR GCPtrPage, unsigned fFlags, unsigned uError)); 1933 1933 #ifdef VBOX_STRICT 1934 DECLR0CALLBACKMEMBER(unsigned, pfnR0BthAssertCR3,(PVM pVM, uint64_t cr3, uint64_t cr4, RTGC UINTPTR GCPtr, RTGCUINTPTR cb));1934 DECLR0CALLBACKMEMBER(unsigned, pfnR0BthAssertCR3,(PVM pVM, uint64_t cr3, uint64_t cr4, RTGCPTR GCPtr, RTGCPTR cb)); 1935 1935 #endif 1936 1936 /** @} */ … … 2182 2182 DECLR3CALLBACKMEMBER(int, pfnR3BthPrefetchPage,(PVM pVM, RTGCUINTPTR GCPtrPage)); 2183 2183 DECLR3CALLBACKMEMBER(int, pfnR3BthVerifyAccessSyncPage,(PVM pVM, RTGCUINTPTR GCPtrPage, unsigned fFlags, unsigned uError)); 2184 DECLR3CALLBACKMEMBER(unsigned, pfnR3BthAssertCR3,(PVM pVM, uint64_t cr3, uint64_t cr4, RTGC UINTPTR GCPtr, RTGCUINTPTR cb));2184 DECLR3CALLBACKMEMBER(unsigned, pfnR3BthAssertCR3,(PVM pVM, uint64_t cr3, uint64_t cr4, RTGCPTR GCPtr, RTGCPTR cb)); 2185 2185 2186 2186 DECLR0CALLBACKMEMBER(int, pfnR0BthTrap0eHandler,(PVM pVM, RTGCUINT uErr, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault)); … … 2190 2190 DECLR0CALLBACKMEMBER(int, pfnR0BthPrefetchPage,(PVM pVM, RTGCUINTPTR GCPtrPage)); 2191 2191 DECLR0CALLBACKMEMBER(int, pfnR0BthVerifyAccessSyncPage,(PVM pVM, RTGCUINTPTR GCPtrPage, unsigned fFlags, unsigned uError)); 2192 DECLR0CALLBACKMEMBER(unsigned, pfnR0BthAssertCR3,(PVM pVM, uint64_t cr3, uint64_t cr4, RTGC UINTPTR GCPtr, RTGCUINTPTR cb));2192 DECLR0CALLBACKMEMBER(unsigned, pfnR0BthAssertCR3,(PVM pVM, uint64_t cr3, uint64_t cr4, RTGCPTR GCPtr, RTGCPTR cb)); 2193 2193 2194 2194 DECLRCCALLBACKMEMBER(int, pfnRCBthTrap0eHandler,(PVM pVM, RTGCUINT uErr, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault)); … … 2198 2198 DECLRCCALLBACKMEMBER(int, pfnRCBthPrefetchPage,(PVM pVM, RTGCUINTPTR GCPtrPage)); 2199 2199 DECLRCCALLBACKMEMBER(int, pfnRCBthVerifyAccessSyncPage,(PVM pVM, RTGCUINTPTR GCPtrPage, unsigned fFlags, unsigned uError)); 2200 DECLRCCALLBACKMEMBER(unsigned, pfnRCBthAssertCR3,(PVM pVM, uint64_t cr3, uint64_t cr4, RTGC UINTPTR GCPtr, RTGCUINTPTR cb));2200 DECLRCCALLBACKMEMBER(unsigned, pfnRCBthAssertCR3,(PVM pVM, uint64_t cr3, uint64_t cr4, RTGCPTR GCPtr, RTGCPTR cb)); 2201 2201 #if HC_ARCH_BITS == 64 2202 2202 RTRCPTR alignment2; /**< structure size alignment. */ -
trunk/src/VBox/VMM/PGMMap.cpp
r13930 r13936 1159 1159 while (pCur) 1160 1160 { 1161 RTGCUINTPTR off = (RTGCUINTPTR)GCPtrSrc - (RTGCUINTPTR)pCur->GCPtr;1161 RTGCUINTPTR off = GCPtrSrc - pCur->GCPtr; 1162 1162 if (off < pCur->cb) 1163 1163 { -
trunk/src/VBox/VMM/PGMShw.h
r13819 r13936 81 81 PGM_SHW_DECL(int, InitData)(PVM pVM, PPGMMODEDATA pModeData, bool fResolveGCAndR0); 82 82 PGM_SHW_DECL(int, Enter)(PVM pVM); 83 PGM_SHW_DECL(int, Relocate)(PVM pVM, RTGC UINTPTR offDelta);83 PGM_SHW_DECL(int, Relocate)(PVM pVM, RTGCPTR offDelta); 84 84 PGM_SHW_DECL(int, Exit)(PVM pVM); 85 85 86 86 /* all */ 87 PGM_SHW_DECL(int, GetPage)(PVM pVM, RTGC UINTPTR GCPtr, uint64_t *pfFlags, PRTHCPHYS pHCPhys);88 PGM_SHW_DECL(int, ModifyPage)(PVM pVM, RTGC UINTPTR GCPtr, size_t cb, uint64_t fFlags, uint64_t fMask);87 PGM_SHW_DECL(int, GetPage)(PVM pVM, RTGCPTR GCPtr, uint64_t *pfFlags, PRTHCPHYS pHCPhys); 88 PGM_SHW_DECL(int, ModifyPage)(PVM pVM, RTGCPTR GCPtr, size_t cb, uint64_t fFlags, uint64_t fMask); 89 89 __END_DECLS 90 90 … … 157 157 * @param offDelta The reloation offset. 158 158 */ 159 PGM_SHW_DECL(int, Relocate)(PVM pVM, RTGC UINTPTR offDelta)159 PGM_SHW_DECL(int, Relocate)(PVM pVM, RTGCPTR offDelta) 160 160 { 161 161 /* nothing special to do here - InitData does the job. */ -
trunk/src/VBox/VMM/VMMAll/PGMAll.cpp
r13935 r13936 435 435 { 436 436 STAM_PROFILE_START(&pVM->pgm.s.CTX_MID_Z(Stat,Prefetch), a); 437 int rc = PGM_BTH_PFN(PrefetchPage, pVM)(pVM, (RTGCUINTPTR)GCPtrPage);437 int rc = PGM_BTH_PFN(PrefetchPage, pVM)(pVM, GCPtrPage); 438 438 STAM_PROFILE_STOP(&pVM->pgm.s.CTX_MID_Z(Stat,Prefetch), a); 439 439 AssertMsg(rc == VINF_SUCCESS || rc == VINF_PGM_SYNC_CR3 || RT_FAILURE(rc), ("rc=%Rrc\n", rc)); … … 745 745 VMMDECL(int) PGMShwGetPage(PVM pVM, RTGCPTR GCPtr, uint64_t *pfFlags, PRTHCPHYS pHCPhys) 746 746 { 747 return PGM_SHW_PFN(GetPage,pVM)(pVM, (RTGCUINTPTR)GCPtr, pfFlags, pHCPhys);747 return PGM_SHW_PFN(GetPage,pVM)(pVM, GCPtr, pfFlags, pHCPhys); 748 748 } 749 749 … … 787 787 * Align the input. 788 788 */ 789 cb += (RTGCUINTPTR)GCPtr & PAGE_OFFSET_MASK;789 cb += GCPtr & PAGE_OFFSET_MASK; 790 790 cb = RT_ALIGN_Z(cb, PAGE_SIZE); 791 GCPtr = ( RTGCPTR)((RTGCUINTPTR)GCPtr & PAGE_BASE_GC_MASK); /** @todo this ain't necessary, right... */791 GCPtr = (GCPtr & PAGE_BASE_GC_MASK); /** @todo this ain't necessary, right... */ 792 792 793 793 /* 794 794 * Call worker. 795 795 */ 796 return PGM_SHW_PFN(ModifyPage, pVM)(pVM, (RTGCUINTPTR)GCPtr, cb, fFlags, fMask);796 return PGM_SHW_PFN(ModifyPage, pVM)(pVM, GCPtr, cb, fFlags, fMask); 797 797 } 798 798 … … 1150 1150 VMMDECL(int) PGMGstGetPage(PVM pVM, RTGCPTR GCPtr, uint64_t *pfFlags, PRTGCPHYS pGCPhys) 1151 1151 { 1152 return PGM_GST_PFN(GetPage,pVM)(pVM, (RTGCUINTPTR)GCPtr, pfFlags, pGCPhys);1152 return PGM_GST_PFN(GetPage,pVM)(pVM, GCPtr, pfFlags, pGCPhys); 1153 1153 } 1154 1154 … … 1212 1212 * Adjust input. 1213 1213 */ 1214 cb += (RTGCUINTPTR)GCPtr & PAGE_OFFSET_MASK;1214 cb += GCPtr & PAGE_OFFSET_MASK; 1215 1215 cb = RT_ALIGN_Z(cb, PAGE_SIZE); 1216 GCPtr = ( RTGCPTR)((RTGCUINTPTR)GCPtr & PAGE_BASE_GC_MASK);1216 GCPtr = (GCPtr & PAGE_BASE_GC_MASK); 1217 1217 1218 1218 /* 1219 1219 * Call worker. 1220 1220 */ 1221 int rc = PGM_GST_PFN(ModifyPage, pVM)(pVM, (RTGCUINTPTR)GCPtr, cb, fFlags, fMask);1221 int rc = PGM_GST_PFN(ModifyPage, pVM)(pVM, GCPtr, cb, fFlags, fMask); 1222 1222 1223 1223 STAM_PROFILE_STOP(&pVM->pgm.s.CTX_MID_Z(Stat,GstModifyPage), a); … … 2009 2009 { 2010 2010 /** @todo This is slow and should be optimized, but since it's just assertions I don't care now. */ 2011 for (RTGCUINTPTR GCPtr = (RTGCUINTPTR)pMapping->GCPtr;2012 GCPtr <= (RTGCUINTPTR)pMapping->GCPtrLast;2011 for (RTGCUINTPTR GCPtr = pMapping->GCPtr; 2012 GCPtr <= pMapping->GCPtrLast; 2013 2013 GCPtr += PAGE_SIZE) 2014 2014 { … … 2042 2042 { 2043 2043 STAM_PROFILE_START(&pVM->pgm.s.CTX_MID_Z(Stat,SyncCR3), a); 2044 unsigned cErrors = PGM_BTH_PFN(AssertCR3, pVM)(pVM, cr3, cr4, 0, ~(RTGC UINTPTR)0);2044 unsigned cErrors = PGM_BTH_PFN(AssertCR3, pVM)(pVM, cr3, cr4, 0, ~(RTGCPTR)0); 2045 2045 STAM_PROFILE_STOP(&pVM->pgm.s.CTX_MID_Z(Stat,SyncCR3), a); 2046 2046 return cErrors; -
trunk/src/VBox/VMM/VMMAll/PGMAllBth.h
r13935 r13936 35 35 PGM_BTH_DECL(int, SyncCR3)(PVM pVM, uint64_t cr0, uint64_t cr3, uint64_t cr4, bool fGlobal); 36 36 #ifdef VBOX_STRICT 37 PGM_BTH_DECL(unsigned, AssertCR3)(PVM pVM, uint64_t cr3, uint64_t cr4, RTGCUINTPTR GCPtr = 0, RTGCUINTPTR cb = ~(RTGC UINTPTR)0);37 PGM_BTH_DECL(unsigned, AssertCR3)(PVM pVM, uint64_t cr3, uint64_t cr4, RTGCUINTPTR GCPtr = 0, RTGCUINTPTR cb = ~(RTGCPTR)0); 38 38 #endif 39 39 #ifdef PGMPOOL_WITH_USER_TRACKING … … 102 102 # if PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE) 103 103 # if PGM_GST_TYPE == PGM_TYPE_32BIT 104 const unsigned iPDSrc = (RTGCUINTPTR)pvFault >> GST_PD_SHIFT;104 const unsigned iPDSrc = pvFault >> GST_PD_SHIFT; 105 105 PGSTPD pPDSrc = pgmGstGet32bitPDPtr(&pVM->pgm.s); 106 106 … … 109 109 # if PGM_GST_TYPE == PGM_TYPE_PAE 110 110 unsigned iPDSrc; 111 PGSTPD pPDSrc = pgmGstGetPaePDPtr(&pVM->pgm.s, (RTGCUINTPTR)pvFault, &iPDSrc, NULL);111 PGSTPD pPDSrc = pgmGstGetPaePDPtr(&pVM->pgm.s, pvFault, &iPDSrc, NULL); 112 112 113 113 # elif PGM_GST_TYPE == PGM_TYPE_AMD64 … … 124 124 { 125 125 # if PGM_GST_TYPE == PGM_TYPE_AMD64 && GC_ARCH_BITS == 64 126 LogFlow(("Trap0eHandler: guest PML4 %d not present CR3=%RGp\n", (int)(( (RTGCUINTPTR)pvFault >> X86_PML4_SHIFT) & X86_PML4_MASK), CPUMGetGuestCR3(pVM) & X86_CR3_PAGE_MASK));126 LogFlow(("Trap0eHandler: guest PML4 %d not present CR3=%RGp\n", (int)((pvFault >> X86_PML4_SHIFT) & X86_PML4_MASK), CPUMGetGuestCR3(pVM) & X86_CR3_PAGE_MASK)); 127 127 # else 128 128 LogFlow(("Trap0eHandler: guest iPDSrc=%u not present CR3=%RGp\n", iPDSrc, CPUMGetGuestCR3(pVM) & X86_CR3_PAGE_MASK)); … … 141 141 142 142 # if PGM_SHW_TYPE == PGM_TYPE_32BIT 143 const unsigned iPDDst = (RTGCUINTPTR)pvFault >> SHW_PD_SHIFT;143 const unsigned iPDDst = pvFault >> SHW_PD_SHIFT; 144 144 PX86PD pPDDst = pVM->pgm.s.CTXMID(p,32BitPD); 145 145 146 146 # elif PGM_SHW_TYPE == PGM_TYPE_PAE 147 const unsigned iPDDst = (RTGCUINTPTR)pvFault >> SHW_PD_SHIFT;147 const unsigned iPDDst = pvFault >> SHW_PD_SHIFT; 148 148 PX86PDPAE pPDDst = pVM->pgm.s.CTXMID(ap,PaePDs)[0]; /* We treat this as a PD with 2048 entries, so no need to and with SHW_PD_MASK to get iPDDst */ 149 149 150 150 # if PGM_GST_TYPE == PGM_TYPE_PAE 151 151 /* Did we mark the PDPT as not present in SyncCR3? */ 152 unsigned iPdpte = ( (RTGCUINTPTR)pvFault >> SHW_PDPT_SHIFT) & SHW_PDPT_MASK;152 unsigned iPdpte = (pvFault >> SHW_PDPT_SHIFT) & SHW_PDPT_MASK; 153 153 if (!pVM->pgm.s.CTXMID(p,PaePDPT)->a[iPdpte].n.u1Present) 154 154 pVM->pgm.s.CTXMID(p,PaePDPT)->a[iPdpte].n.u1Present = 1; … … 157 157 158 158 # elif PGM_SHW_TYPE == PGM_TYPE_AMD64 159 const unsigned iPDDst = (( (RTGCUINTPTR)pvFault >> SHW_PD_SHIFT) & SHW_PD_MASK);159 const unsigned iPDDst = ((pvFault >> SHW_PD_SHIFT) & SHW_PD_MASK); 160 160 PX86PDPAE pPDDst; 161 161 # if PGM_GST_TYPE == PGM_TYPE_PROT … … 170 170 # endif 171 171 172 rc = PGMShwSyncLongModePDPtr(pVM, (RTGCUINTPTR)pvFault, pPml4eSrc, &PdpeSrc, &pPDDst);172 rc = PGMShwSyncLongModePDPtr(pVM, pvFault, pPml4eSrc, &PdpeSrc, &pPDDst); 173 173 if (rc != VINF_SUCCESS) 174 174 { … … 179 179 180 180 # elif PGM_SHW_TYPE == PGM_TYPE_EPT 181 const unsigned iPDDst = (( (RTGCUINTPTR)pvFault >> SHW_PD_SHIFT) & SHW_PD_MASK);181 const unsigned iPDDst = ((pvFault >> SHW_PD_SHIFT) & SHW_PD_MASK); 182 182 PEPTPD pPDDst; 183 183 184 rc = PGMShwGetEPTPDPtr(pVM, (RTGCUINTPTR)pvFault, NULL, &pPDDst);184 rc = PGMShwGetEPTPDPtr(pVM, pvFault, NULL, &pPDDst); 185 185 if (rc != VINF_SUCCESS) 186 186 { … … 197 197 */ 198 198 STAM_PROFILE_START(&pVM->pgm.s.StatRZTrap0eTimeCheckPageFault, e); 199 rc = PGM_BTH_NAME(CheckPageFault)(pVM, uErr, &pPDDst->a[iPDDst], &pPDSrc->a[iPDSrc], (RTGCUINTPTR)pvFault);199 rc = PGM_BTH_NAME(CheckPageFault)(pVM, uErr, &pPDDst->a[iPDDst], &pPDSrc->a[iPDSrc], pvFault); 200 200 STAM_PROFILE_STOP(&pVM->pgm.s.StatRZTrap0eTimeCheckPageFault, e); 201 201 if ( rc == VINF_PGM_HANDLED_DIRTY_BIT_FAULT … … 241 241 STAM_PROFILE_START(&pVM->pgm.s.StatRZTrap0eTimeSyncPT, f); 242 242 LogFlow(("=>SyncPT %04x = %08x\n", iPDSrc, PdeSrc.au32[0])); 243 rc = PGM_BTH_NAME(SyncPT)(pVM, iPDSrc, pPDSrc, (RTGCUINTPTR)pvFault);243 rc = PGM_BTH_NAME(SyncPT)(pVM, iPDSrc, pPDSrc, pvFault); 244 244 if (RT_SUCCESS(rc)) 245 245 { … … 267 267 for ( ; pMapping; pMapping = pMapping->CTX_SUFF(pNext)) 268 268 { 269 if ( (RTGCUINTPTR)pvFault < (RTGCUINTPTR)pMapping->GCPtr)269 if (pvFault < pMapping->GCPtr) 270 270 break; 271 if ( (RTGCUINTPTR)pvFault - (RTGCUINTPTR)pMapping->GCPtr < pMapping->cb)271 if (pvFault - pMapping->GCPtr < pMapping->cb) 272 272 { 273 273 /* … … 293 293 PPGMVIRTHANDLER pCur = (PPGMVIRTHANDLER)RTAvlroGCPtrRangeGet(&pVM->pgm.s.CTX_SUFF(pTrees)->HyperVirtHandlers, pvFault); 294 294 if ( pCur 295 && (RTGCUINTPTR)pvFault - (RTGCUINTPTR)pCur->Core.Key < pCur->cb295 && pvFault - pCur->Core.Key < pCur->cb 296 296 && uErr & X86_TRAP_PF_RW) 297 297 { 298 298 # ifdef IN_RC 299 299 STAM_PROFILE_START(&pCur->Stat, h); 300 rc = pCur->CTX_SUFF(pfnHandler)(pVM, uErr, pRegFrame, pvFault, pCur->Core.Key, (RTGCUINTPTR)pvFault - (RTGCUINTPTR)pCur->Core.Key);300 rc = pCur->CTX_SUFF(pfnHandler)(pVM, uErr, pRegFrame, pvFault, pCur->Core.Key, pvFault - pCur->Core.Key); 301 301 STAM_PROFILE_STOP(&pCur->Stat, h); 302 302 # else … … 351 351 if (RT_SUCCESS(rc)) 352 352 { 353 unsigned iPTESrc = ( (RTGCUINTPTR)pvFault >> GST_PT_SHIFT) & GST_PT_MASK;353 unsigned iPTESrc = (pvFault >> GST_PT_SHIFT) & GST_PT_MASK; 354 354 if (pPTSrc->a[iPTESrc].n.u1Present) 355 355 GCPhys = pPTSrc->a[iPTESrc].u & GST_PTE_PG_MASK; … … 358 358 # else 359 359 /* No paging so the fault address is the physical address */ 360 GCPhys = (RTGCPHYS)( (RTGCUINTPTR)pvFault & ~PAGE_OFFSET_MASK);360 GCPhys = (RTGCPHYS)(pvFault & ~PAGE_OFFSET_MASK); 361 361 # endif /* PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE) */ 362 362 … … 380 380 * Physical page access handler. 381 381 */ 382 const RTGCPHYS GCPhysFault = GCPhys | ( (RTGCUINTPTR)pvFault & PAGE_OFFSET_MASK);382 const RTGCPHYS GCPhysFault = GCPhys | (pvFault & PAGE_OFFSET_MASK); 383 383 PPGMPHYSHANDLER pCur = (PPGMPHYSHANDLER)RTAvlroGCPhysRangeGet(&pVM->pgm.s.CTX_SUFF(pTrees)->PhysHandlers, GCPhysFault); 384 384 if (pCur) … … 395 395 && !(uErr & X86_TRAP_PF_P)) 396 396 { 397 rc = PGM_BTH_NAME(SyncPage)(pVM, PdeSrc, (RTGCUINTPTR)pvFault, PGM_SYNC_NR_PAGES, uErr);397 rc = PGM_BTH_NAME(SyncPage)(pVM, PdeSrc, pvFault, PGM_SYNC_NR_PAGES, uErr); 398 398 if ( RT_FAILURE(rc) 399 399 || !(uErr & X86_TRAP_PF_RW) … … 441 441 && !(uErr & X86_TRAP_PF_P)) 442 442 { 443 rc = PGM_BTH_NAME(SyncPage)(pVM, PdeSrc, (RTGCUINTPTR)pvFault, PGM_SYNC_NR_PAGES, uErr);443 rc = PGM_BTH_NAME(SyncPage)(pVM, PdeSrc, pvFault, PGM_SYNC_NR_PAGES, uErr); 444 444 if ( RT_FAILURE(rc) 445 445 || rc == VINF_PGM_SYNCPAGE_MODIFIED_PDE … … 467 467 if (pCur) 468 468 { 469 AssertMsg(!( (RTGCUINTPTR)pvFault - (RTGCUINTPTR)pCur->Core.Key < pCur->cb)469 AssertMsg(!(pvFault - pCur->Core.Key < pCur->cb) 470 470 || ( pCur->enmType != PGMVIRTHANDLERTYPE_WRITE 471 471 || !(uErr & X86_TRAP_PF_P) … … 473 473 ("Unexpected trap for virtual handler: %RGv (phys=%RGp) HCPhys=%HGp uErr=%X, enum=%d\n", pvFault, GCPhys, pPage->HCPhys, uErr, pCur->enmType)); 474 474 475 if ( (RTGCUINTPTR)pvFault - (RTGCUINTPTR)pCur->Core.Key < pCur->cb475 if ( pvFault - pCur->Core.Key < pCur->cb 476 476 && ( uErr & X86_TRAP_PF_RW 477 477 || pCur->enmType != PGMVIRTHANDLERTYPE_WRITE ) ) … … 479 479 # ifdef IN_RC 480 480 STAM_PROFILE_START(&pCur->Stat, h); 481 rc = pCur->CTX_SUFF(pfnHandler)(pVM, uErr, pRegFrame, pvFault, pCur->Core.Key, (RTGCUINTPTR)pvFault - (RTGCUINTPTR)pCur->Core.Key);481 rc = pCur->CTX_SUFF(pfnHandler)(pVM, uErr, pRegFrame, pvFault, pCur->Core.Key, pvFault - pCur->Core.Key); 482 482 STAM_PROFILE_STOP(&pCur->Stat, h); 483 483 # else … … 496 496 PPGMVIRTHANDLER pCur; 497 497 unsigned iPage; 498 rc = pgmHandlerVirtualFindByPhysAddr(pVM, GCPhys + ( (RTGCUINTPTR)pvFault & PAGE_OFFSET_MASK),498 rc = pgmHandlerVirtualFindByPhysAddr(pVM, GCPhys + (pvFault & PAGE_OFFSET_MASK), 499 499 &pCur, &iPage); 500 500 Assert(RT_SUCCESS(rc) || !pCur); … … 505 505 Assert((pCur->aPhysToVirt[iPage].Core.Key & X86_PTE_PAE_PG_MASK) == GCPhys); 506 506 # ifdef IN_RC 507 RTGCUINTPTR off = (iPage << PAGE_SHIFT) + ( (RTGCUINTPTR)pvFault & PAGE_OFFSET_MASK) - ((RTGCUINTPTR)pCur->Core.Key & PAGE_OFFSET_MASK);507 RTGCUINTPTR off = (iPage << PAGE_SHIFT) + (pvFault & PAGE_OFFSET_MASK) - (pCur->Core.Key & PAGE_OFFSET_MASK); 508 508 Assert(off < pCur->cb); 509 509 STAM_PROFILE_START(&pCur->Stat, h); … … 535 535 && !(uErr & X86_TRAP_PF_P)) 536 536 { 537 rc = PGM_BTH_NAME(SyncPage)(pVM, PdeSrc, (RTGCUINTPTR)pvFault, PGM_SYNC_NR_PAGES, uErr);537 rc = PGM_BTH_NAME(SyncPage)(pVM, PdeSrc, pvFault, PGM_SYNC_NR_PAGES, uErr); 538 538 if ( RT_FAILURE(rc) 539 539 || rc == VINF_PGM_SYNCPAGE_MODIFIED_PDE … … 574 574 if (pCur) 575 575 { 576 AssertMsg( !( (RTGCUINTPTR)pvFault - (RTGCUINTPTR)pCur->Core.Key < pCur->cb)576 AssertMsg( !(pvFault - pCur->Core.Key < pCur->cb) 577 577 || ( pCur->enmType != PGMVIRTHANDLERTYPE_WRITE 578 578 || !(uErr & X86_TRAP_PF_P) … … 580 580 ("Unexpected trap for virtual handler: %08X (phys=%08x) HCPhys=%X uErr=%X, enum=%d\n", pvFault, GCPhys, pPage->HCPhys, uErr, pCur->enmType)); 581 581 582 if ( (RTGCUINTPTR)pvFault - (RTGCUINTPTR)pCur->Core.Key < pCur->cb582 if ( pvFault - pCur->Core.Key < pCur->cb 583 583 && ( uErr & X86_TRAP_PF_RW 584 584 || pCur->enmType != PGMVIRTHANDLERTYPE_WRITE ) ) … … 586 586 # ifdef IN_RC 587 587 STAM_PROFILE_START(&pCur->Stat, h); 588 rc = pCur->CTX_SUFF(pfnHandler)(pVM, uErr, pRegFrame, pvFault, pCur->Core.Key, (RTGCUINTPTR)pvFault - (RTGCUINTPTR)pCur->Core.Key);588 rc = pCur->CTX_SUFF(pfnHandler)(pVM, uErr, pRegFrame, pvFault, pCur->Core.Key, pvFault - pCur->Core.Key); 589 589 STAM_PROFILE_STOP(&pCur->Stat, h); 590 590 # else … … 651 651 /* Note: can't check for X86_TRAP_ID bit, because that requires execute disable support on the CPU */ 652 652 if ( pvFault == (RTGCPTR)pRegFrame->eip 653 || (RTGCUINTPTR)pvFault - pRegFrame->eip < 8 /* instruction crossing a page boundary */653 || pvFault - pRegFrame->eip < 8 /* instruction crossing a page boundary */ 654 654 # ifdef CSAM_DETECT_NEW_CODE_PAGES 655 655 || ( !PATMIsPatchGCAddr(pVM, (RTGCPTR)pRegFrame->eip) … … 669 669 */ 670 670 LogFlow(("CSAM ring 3 job\n")); 671 int rc2 = PGM_BTH_NAME(SyncPage)(pVM, PdeSrc, (RTGCUINTPTR)pvFault, 1, uErr);671 int rc2 = PGM_BTH_NAME(SyncPage)(pVM, PdeSrc, pvFault, 1, uErr); 672 672 AssertRC(rc2); 673 673 … … 695 695 DISCPUSTATE Cpu; 696 696 uint32_t cbOp; 697 rc = EMInterpretDisasOneEx(pVM, (RTGCUINTPTR)PC, pRegFrame, &Cpu, &cbOp);697 rc = EMInterpretDisasOneEx(pVM, PC, pRegFrame, &Cpu, &cbOp); 698 698 699 699 /* For now we'll restrict this to rep movsw/d instructions */ … … 717 717 } 718 718 # endif /* PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE) && !defined(IN_RING0) */ 719 rc = PGM_BTH_NAME(SyncPage)(pVM, PdeSrc, (RTGCUINTPTR)pvFault, PGM_SYNC_NR_PAGES, uErr);719 rc = PGM_BTH_NAME(SyncPage)(pVM, PdeSrc, pvFault, PGM_SYNC_NR_PAGES, uErr); 720 720 if (RT_SUCCESS(rc)) 721 721 { … … 744 744 * Note: Do NOT use PGM_SYNC_NR_PAGES here. That only works if the page is not present, which is not true in this case. 745 745 */ 746 rc = PGM_BTH_NAME(SyncPage)(pVM, PdeSrc, (RTGCUINTPTR)pvFault, 1, uErr);746 rc = PGM_BTH_NAME(SyncPage)(pVM, PdeSrc, pvFault, 1, uErr); 747 747 if (RT_SUCCESS(rc)) 748 748 { … … 1695 1695 { 1696 1696 GSTPTE PteSrc = pPTSrc->a[offPTSrc + iPTDst]; 1697 RTGC UINTPTR GCPtrCurPage = ((RTGCUINTPTR)GCPtrPage & ~(RTGCUINTPTR)(GST_PT_MASK << GST_PT_SHIFT)) | ((offPTSrc + iPTDst) << PAGE_SHIFT);1697 RTGCPTR GCPtrCurPage = (GCPtrPage & ~(RTGCPTR)(GST_PT_MASK << GST_PT_SHIFT)) | ((offPTSrc + iPTDst) << PAGE_SHIFT); 1698 1698 NOREF(GCPtrCurPage); 1699 1699 #ifndef IN_RING0 … … 1750 1750 */ 1751 1751 /* Calculate the GC physical address of this 4KB shadow page. */ 1752 RTGCPHYS GCPhys = GST_GET_PDE_BIG_PG_GCPHYS(PdeSrc) | ( (RTGCUINTPTR)GCPtrPage & GST_BIG_PAGE_OFFSET_MASK);1752 RTGCPHYS GCPhys = GST_GET_PDE_BIG_PG_GCPHYS(PdeSrc) | (GCPtrPage & GST_BIG_PAGE_OFFSET_MASK); 1753 1753 /* Find ram range. */ 1754 1754 PPGMPAGE pPage; … … 1911 1911 GSTPTE PteSrc; 1912 1912 1913 RTGCUINTPTR GCPtrCurPage = ( (RTGCUINTPTR)GCPtrPage & ~(RTGCUINTPTR)(SHW_PT_MASK << SHW_PT_SHIFT)) | (iPTDst << PAGE_SHIFT);1913 RTGCUINTPTR GCPtrCurPage = (GCPtrPage & ~(RTGCPTR)(SHW_PT_MASK << SHW_PT_SHIFT)) | (iPTDst << PAGE_SHIFT); 1914 1914 1915 1915 /* Fake the page table entry */ … … 1932 1932 } 1933 1933 else 1934 Log4(("%RGv iPTDst=%x pPTDst->a[iPTDst] %RX64\n", ( (RTGCUINTPTR)GCPtrPage & ~(RTGCUINTPTR)(SHW_PT_MASK << SHW_PT_SHIFT)) | (iPTDst << PAGE_SHIFT), iPTDst, pPTDst->a[iPTDst].u));1934 Log4(("%RGv iPTDst=%x pPTDst->a[iPTDst] %RX64\n", (GCPtrPage & ~(RTGCPTR)(SHW_PT_MASK << SHW_PT_SHIFT)) | (iPTDst << PAGE_SHIFT), iPTDst, pPTDst->a[iPTDst].u)); 1935 1935 } 1936 1936 } … … 1940 1940 GSTPTE PteSrc; 1941 1941 const unsigned iPTDst = (GCPtrPage >> SHW_PT_SHIFT) & SHW_PT_MASK; 1942 RTGC UINTPTR GCPtrCurPage = ((RTGCUINTPTR)GCPtrPage & ~(RTGCUINTPTR)(SHW_PT_MASK << SHW_PT_SHIFT)) | (iPTDst << PAGE_SHIFT);1942 RTGCPTR GCPtrCurPage = (GCPtrPage & ~(RTGCPTR)(SHW_PT_MASK << SHW_PT_SHIFT)) | (iPTDst << PAGE_SHIFT); 1943 1943 1944 1944 /* Fake the page table entry */ … … 2779 2779 *pPdeDst = PdeDst; 2780 2780 2781 rc = PGM_BTH_NAME(SyncPage)(pVM, PdeSrc, (RTGCUINTPTR)GCPtrPage, PGM_SYNC_NR_PAGES, 0 /* page not present */);2781 rc = PGM_BTH_NAME(SyncPage)(pVM, PdeSrc, GCPtrPage, PGM_SYNC_NR_PAGES, 0 /* page not present */); 2782 2782 STAM_PROFILE_STOP(&pVM->pgm.s.CTX_MID_Z(Stat,SyncPT), a); 2783 2783 return rc; … … 2813 2813 # if PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE) 2814 2814 # if PGM_GST_TYPE == PGM_TYPE_32BIT 2815 const unsigned iPDSrc = (RTGCUINTPTR)GCPtrPage >> GST_PD_SHIFT;2815 const unsigned iPDSrc = GCPtrPage >> GST_PD_SHIFT; 2816 2816 PGSTPD pPDSrc = pgmGstGet32bitPDPtr(&pVM->pgm.s); 2817 2817 # elif PGM_GST_TYPE == PGM_TYPE_PAE … … 2932 2932 # if PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE) 2933 2933 # if PGM_GST_TYPE == PGM_TYPE_32BIT 2934 const unsigned iPDSrc = (RTGCUINTPTR)GCPtrPage >> GST_PD_SHIFT;2934 const unsigned iPDSrc = GCPtrPage >> GST_PD_SHIFT; 2935 2935 PGSTPD pPDSrc = pgmGstGet32bitPDPtr(&pVM->pgm.s); 2936 2936 # elif PGM_GST_TYPE == PGM_TYPE_PAE … … 3620 3620 * @param cb How much to check. Defaults to everything. 3621 3621 */ 3622 PGM_BTH_DECL(unsigned, AssertCR3)(PVM pVM, uint64_t cr3, uint64_t cr4, RTGC UINTPTR GCPtr, RTGCUINTPTR cb)3622 PGM_BTH_DECL(unsigned, AssertCR3)(PVM pVM, uint64_t cr3, uint64_t cr4, RTGCPTR GCPtr, RTGCPTR cb) 3623 3623 { 3624 3624 #if PGM_SHW_TYPE == PGM_TYPE_NESTED || PGM_SHW_TYPE == PGM_TYPE_EPT … … 3690 3690 unsigned cIncrement = X86_PG_PAE_ENTRIES * PAGE_SIZE; 3691 3691 # endif 3692 if (cb != ~(RTGC UINTPTR)0)3692 if (cb != ~(RTGCPTR)0) 3693 3693 cPDEs = RT_MIN(cb >> SHW_PD_SHIFT, 1); 3694 3694 -
trunk/src/VBox/VMM/VMMAll/PGMAllGst.h
r13935 r13936 126 126 *******************************************************************************/ 127 127 __BEGIN_DECLS 128 PGM_GST_DECL(int, GetPage)(PVM pVM, RTGC UINTPTR GCPtr, uint64_t *pfFlags, PRTGCPHYS pGCPhys);129 PGM_GST_DECL(int, ModifyPage)(PVM pVM, RTGC UINTPTR GCPtr, size_t cb, uint64_t fFlags, uint64_t fMask);130 PGM_GST_DECL(int, GetPDE)(PVM pVM, RTGC UINTPTR GCPtr, PX86PDEPAE pPDE);128 PGM_GST_DECL(int, GetPage)(PVM pVM, RTGCPTR GCPtr, uint64_t *pfFlags, PRTGCPHYS pGCPhys); 129 PGM_GST_DECL(int, ModifyPage)(PVM pVM, RTGCPTR GCPtr, size_t cb, uint64_t fFlags, uint64_t fMask); 130 PGM_GST_DECL(int, GetPDE)(PVM pVM, RTGCPTR GCPtr, PX86PDEPAE pPDE); 131 131 PGM_GST_DECL(int, MapCR3)(PVM pVM, RTGCPHYS GCPhysCR3); 132 132 PGM_GST_DECL(int, UnmapCR3)(PVM pVM); … … 160 160 * This is page aligned. The fact that the 161 161 */ 162 PGM_GST_DECL(int, GetPage)(PVM pVM, RTGC UINTPTR GCPtr, uint64_t *pfFlags, PRTGCPHYS pGCPhys)162 PGM_GST_DECL(int, GetPage)(PVM pVM, RTGCPTR GCPtr, uint64_t *pfFlags, PRTGCPHYS pGCPhys) 163 163 { 164 164 #if PGM_GST_TYPE == PGM_TYPE_REAL \ … … 290 290 * @param fMask The AND mask - page flags X86_PTE_*. 291 291 */ 292 PGM_GST_DECL(int, ModifyPage)(PVM pVM, RTGC UINTPTR GCPtr, size_t cb, uint64_t fFlags, uint64_t fMask)292 PGM_GST_DECL(int, ModifyPage)(PVM pVM, RTGCPTR GCPtr, size_t cb, uint64_t fFlags, uint64_t fMask) 293 293 { 294 294 #if PGM_GST_TYPE == PGM_TYPE_32BIT \ … … 394 394 * @param pPDE Pointer to guest PDE structure 395 395 */ 396 PGM_GST_DECL(int, GetPDE)(PVM pVM, RTGC UINTPTR GCPtr, PX86PDEPAE pPDE)396 PGM_GST_DECL(int, GetPDE)(PVM pVM, RTGCPTR GCPtr, PX86PDEPAE pPDE) 397 397 { 398 398 #if PGM_GST_TYPE == PGM_TYPE_32BIT \ … … 447 447 if (RT_SUCCESS(rc)) 448 448 { 449 rc = PGMMap(pVM, (RTGC UINTPTR)pVM->pgm.s.GCPtrCR3Mapping, HCPhysGuestCR3, PAGE_SIZE, 0);449 rc = PGMMap(pVM, (RTGCPTR)pVM->pgm.s.GCPtrCR3Mapping, HCPhysGuestCR3, PAGE_SIZE, 0); 450 450 if (RT_SUCCESS(rc)) 451 451 { … … 471 471 */ 472 472 PX86PDPT pGuestPDPT = pgmGstGetPaePDPTPtr(&pVM->pgm.s); 473 RTGC UINTPTR GCPtr = (RTGCUINTPTR)pVM->pgm.s.GCPtrCR3Mapping + PAGE_SIZE;473 RTGCPTR GCPtr = pVM->pgm.s.GCPtrCR3Mapping + PAGE_SIZE; 474 474 for (unsigned i = 0; i < X86_PG_PAE_PDPE_ENTRIES; i++, GCPtr += PAGE_SIZE) 475 475 {
Note:
See TracChangeset
for help on using the changeset viewer.