Changeset 13067 in vbox for trunk/src/VBox/VMM/VMMAll
- Timestamp:
- Oct 8, 2008 10:11:24 AM (16 years ago)
- Location:
- trunk/src/VBox/VMM/VMMAll
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/PGMAll.cpp
r13060 r13067 337 337 #undef PGM_SHW_NAME 338 338 339 #endif 340 339 #endif /* !IN_GC */ 340 341 342 #ifndef IN_RING3 341 343 /** 342 344 * #PF Handler. … … 352 354 LogFlow(("PGMTrap0eHandler: uErr=%RGu pvFault=%VGv eip=%VGv\n", uErr, pvFault, pRegFrame->rip)); 353 355 STAM_PROFILE_START(&pVM->pgm.s.StatGCTrap0e, a); 354 STAM_STATS({ pVM->pgm.s.CTX SUFF(pStatTrap0eAttribution) = NULL; } );356 STAM_STATS({ pVM->pgm.s.CTX_SUFF(pStatTrap0eAttribution) = NULL; } ); 355 357 356 358 … … 401 403 if (rc == VINF_PGM_SYNCPAGE_MODIFIED_PDE) 402 404 rc = VINF_SUCCESS; 403 STAM_STATS({ if (!pVM->pgm.s.CTX SUFF(pStatTrap0eAttribution))404 pVM->pgm.s.CTX SUFF(pStatTrap0eAttribution) = &pVM->pgm.s.StatTrap0eMisc; });405 STAM_PROFILE_STOP_EX(&pVM->pgm.s.StatGCTrap0e, pVM->pgm.s.CTX SUFF(pStatTrap0eAttribution), a);405 STAM_STATS({ if (!pVM->pgm.s.CTX_SUFF(pStatTrap0eAttribution)) 406 pVM->pgm.s.CTX_SUFF(pStatTrap0eAttribution) = &pVM->pgm.s.StatTrap0eMisc; }); 407 STAM_PROFILE_STOP_EX(&pVM->pgm.s.StatGCTrap0e, pVM->pgm.s.CTX_SUFF(pStatTrap0eAttribution), a); 406 408 return rc; 407 409 } 410 #endif /* !IN_RING3 */ 411 408 412 409 413 /** … … 446 450 break; 447 451 if ((uintptr_t)GCPtr - (uintptr_t)pMapping->GCPtr < pMapping->cb) 448 {449 STAM_COUNTER_INC(&pVM->pgm.s.StatGCSyncPTConflict);450 452 return pMapping; 451 }452 453 pMapping = pMapping->CTX_SUFF(pNext); 453 454 } … … 646 647 #endif 647 648 648 STAM_PROFILE_START(& CTXMID(pVM->pgm.s.Stat,InvalidatePage), a);649 STAM_PROFILE_START(&pVM->pgm.s.CTX_MID_Z(Stat,InvalidatePage), a); 649 650 rc = PGM_BTH_PFN(InvalidatePage, pVM)(pVM, GCPtrPage); 650 STAM_PROFILE_STOP(& CTXMID(pVM->pgm.s.Stat,InvalidatePage), a);651 STAM_PROFILE_STOP(&pVM->pgm.s.CTX_MID_Z(Stat,InvalidatePage), a); 651 652 652 653 #ifndef IN_RING0 … … 1541 1542 * Let the 'Bth' function do the work and we'll just keep track of the flags. 1542 1543 */ 1543 STAM_PROFILE_START(&pVM->pgm.s.CTX MID(Stat,SyncCR3), a);1544 STAM_PROFILE_START(&pVM->pgm.s.CTX_MID_Z(Stat,SyncCR3), a); 1544 1545 int rc = PGM_BTH_PFN(SyncCR3, pVM)(pVM, cr0, cr3, cr4, fGlobal); 1545 STAM_PROFILE_STOP(&pVM->pgm.s.CTX MID(Stat,SyncCR3), a);1546 STAM_PROFILE_STOP(&pVM->pgm.s.CTX_MID_Z(Stat,SyncCR3), a); 1546 1547 AssertMsg(rc == VINF_SUCCESS || rc == VINF_PGM_SYNC_CR3 || VBOX_FAILURE(rc), ("rc=%VRc\n", rc)); 1547 1548 if (rc == VINF_SUCCESS) … … 1972 1973 VMMDECL(unsigned) PGMAssertCR3(PVM pVM, uint64_t cr3, uint64_t cr4) 1973 1974 { 1974 STAM_PROFILE_START(&pVM->pgm.s.CTX MID(Stat,SyncCR3), a);1975 STAM_PROFILE_START(&pVM->pgm.s.CTX_MID_Z(Stat,SyncCR3), a); 1975 1976 unsigned cErrors = PGM_BTH_PFN(AssertCR3, pVM)(pVM, cr3, cr4, 0, ~(RTGCUINTPTR)0); 1976 STAM_PROFILE_STOP(&pVM->pgm.s.CTX MID(Stat,SyncCR3), a);1977 STAM_PROFILE_STOP(&pVM->pgm.s.CTX_MID_Z(Stat,SyncCR3), a); 1977 1978 return cErrors; 1978 1979 return 0; -
trunk/src/VBox/VMM/VMMAll/PGMAllBth.h
r13063 r13067 67 67 #endif 68 68 69 70 #ifndef IN_RING3 69 71 /** 70 72 * #PF Handler for raw-mode guest execution. … … 78 80 PGM_BTH_DECL(int, Trap0eHandler)(PVM pVM, RTGCUINT uErr, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault) 79 81 { 80 # if(PGM_GST_TYPE == PGM_TYPE_32BIT || PGM_GST_TYPE == PGM_TYPE_REAL || PGM_GST_TYPE == PGM_TYPE_PROT || PGM_GST_TYPE == PGM_TYPE_PAE || PGM_GST_TYPE == PGM_TYPE_AMD64) \82 # if (PGM_GST_TYPE == PGM_TYPE_32BIT || PGM_GST_TYPE == PGM_TYPE_REAL || PGM_GST_TYPE == PGM_TYPE_PROT || PGM_GST_TYPE == PGM_TYPE_PAE || PGM_GST_TYPE == PGM_TYPE_AMD64) \ 81 83 && PGM_SHW_TYPE != PGM_TYPE_NESTED \ 82 84 && (PGM_SHW_TYPE != PGM_TYPE_EPT || PGM_GST_TYPE == PGM_TYPE_PROT) 83 85 84 # if PGM_SHW_TYPE == PGM_TYPE_PAE && PGM_GST_TYPE != PGM_TYPE_PAE86 # if PGM_SHW_TYPE == PGM_TYPE_PAE && PGM_GST_TYPE != PGM_TYPE_PAE 85 87 /* 86 88 * Hide the instruction fetch trap indicator for now. … … 92 94 TRPMSetErrorCode(pVM, uErr); 93 95 } 94 # endif96 # endif 95 97 96 98 /* … … 98 100 */ 99 101 int rc; 100 # if PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE)101 # if PGM_GST_TYPE == PGM_TYPE_32BIT102 # if PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE) 103 # if PGM_GST_TYPE == PGM_TYPE_32BIT 102 104 const unsigned iPDSrc = (RTGCUINTPTR)pvFault >> GST_PD_SHIFT; 103 105 PGSTPD pPDSrc = CTXSUFF(pVM->pgm.s.pGuestPD); 104 106 105 # elif PGM_GST_TYPE == PGM_TYPE_PAE || PGM_GST_TYPE == PGM_TYPE_AMD64106 107 # if PGM_GST_TYPE == PGM_TYPE_PAE107 # elif PGM_GST_TYPE == PGM_TYPE_PAE || PGM_GST_TYPE == PGM_TYPE_AMD64 108 109 # if PGM_GST_TYPE == PGM_TYPE_PAE 108 110 unsigned iPDSrc; 109 111 PGSTPD pPDSrc = pgmGstGetPaePDPtr(&pVM->pgm.s, (RTGCUINTPTR)pvFault, &iPDSrc); 110 112 111 # elif PGM_GST_TYPE == PGM_TYPE_AMD64113 # elif PGM_GST_TYPE == PGM_TYPE_AMD64 112 114 unsigned iPDSrc; 113 115 PX86PML4E pPml4eSrc; … … 117 119 pPDSrc = pgmGstGetLongModePDPtr(&pVM->pgm.s, pvFault, &pPml4eSrc, &PdpeSrc, &iPDSrc); 118 120 Assert(pPml4eSrc); 119 # endif121 # endif 120 122 /* Quick check for a valid guest trap. */ 121 123 if (!pPDSrc) 122 124 { 123 # if PGM_GST_TYPE == PGM_TYPE_AMD64 && GC_ARCH_BITS == 64125 # if PGM_GST_TYPE == PGM_TYPE_AMD64 && GC_ARCH_BITS == 64 124 126 LogFlow(("Trap0eHandler: guest PML4 %d not present CR3=%VGp\n", (int)(((RTGCUINTPTR)pvFault >> X86_PML4_SHIFT) & X86_PML4_MASK), CPUMGetGuestCR3(pVM) & X86_CR3_PAGE_MASK)); 125 # else127 # else 126 128 LogFlow(("Trap0eHandler: guest iPDSrc=%u not present CR3=%VGp\n", iPDSrc, CPUMGetGuestCR3(pVM) & X86_CR3_PAGE_MASK)); 127 # endif128 STAM_STATS({ pVM->pgm.s.CTX SUFF(pStatTrap0eAttribution) = &pVM->pgm.s.StatTrap0eGuestTrap; });129 # endif 130 STAM_STATS({ pVM->pgm.s.CTX_SUFF(pStatTrap0eAttribution) = &pVM->pgm.s.StatTrap0eGuestTrap; }); 129 131 TRPMSetErrorCode(pVM, uErr); 130 132 return VINF_EM_RAW_GUEST_TRAP; 131 133 } 132 # endif133 # else134 # endif 135 # else 134 136 PGSTPD pPDSrc = NULL; 135 137 const unsigned iPDSrc = 0; 136 # endif137 138 # if PGM_SHW_TYPE == PGM_TYPE_32BIT138 # endif 139 140 # if PGM_SHW_TYPE == PGM_TYPE_32BIT 139 141 const unsigned iPDDst = (RTGCUINTPTR)pvFault >> SHW_PD_SHIFT; 140 142 PX86PD pPDDst = pVM->pgm.s.CTXMID(p,32BitPD); 141 # elif PGM_SHW_TYPE == PGM_TYPE_PAE143 # elif PGM_SHW_TYPE == PGM_TYPE_PAE 142 144 const unsigned iPDDst = (RTGCUINTPTR)pvFault >> SHW_PD_SHIFT; 143 145 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 */ 144 146 145 # if PGM_GST_TYPE == PGM_TYPE_PAE147 # if PGM_GST_TYPE == PGM_TYPE_PAE 146 148 /* Did we mark the PDPT as not present in SyncCR3? */ 147 149 unsigned iPdpte = ((RTGCUINTPTR)pvFault >> SHW_PDPT_SHIFT) & SHW_PDPT_MASK; … … 149 151 pVM->pgm.s.CTXMID(p,PaePDPT)->a[iPdpte].n.u1Present = 1; 150 152 151 # endif152 153 # elif PGM_SHW_TYPE == PGM_TYPE_AMD64153 # endif 154 155 # elif PGM_SHW_TYPE == PGM_TYPE_AMD64 154 156 const unsigned iPDDst = (((RTGCUINTPTR)pvFault >> SHW_PD_SHIFT) & SHW_PD_MASK); 155 157 PX86PDPAE pPDDst; 156 # if PGM_GST_TYPE == PGM_TYPE_PROT158 # if PGM_GST_TYPE == PGM_TYPE_PROT 157 159 /* AMD-V nested paging */ 158 160 X86PML4E Pml4eSrc; … … 163 165 Pml4eSrc.u = X86_PML4E_P | X86_PML4E_RW | X86_PML4E_US | X86_PML4E_A; 164 166 PdpeSrc.u = X86_PDPE_P | X86_PDPE_RW | X86_PDPE_US | X86_PDPE_A; 165 # endif167 # endif 166 168 167 169 rc = PGMShwSyncLongModePDPtr(pVM, (RTGCUINTPTR)pvFault, pPml4eSrc, &PdpeSrc, &pPDDst); … … 172 174 } 173 175 Assert(pPDDst); 174 # elif PGM_SHW_TYPE == PGM_TYPE_EPT176 # elif PGM_SHW_TYPE == PGM_TYPE_EPT 175 177 const unsigned iPDDst = (((RTGCUINTPTR)pvFault >> SHW_PD_SHIFT) & SHW_PD_MASK); 176 178 PEPTPD pPDDst; … … 179 181 AssertReturn(rc == VINF_SUCCESS /* *must* test for VINF_SUCCESS!! */, rc); 180 182 Assert(pPDDst); 181 # endif182 183 # if PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE)183 # endif 184 185 # if PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE) 184 186 /* 185 187 * If we successfully correct the write protection fault due to dirty bit … … 192 194 || rc == VINF_EM_RAW_GUEST_TRAP) 193 195 { 194 STAM_STATS({ pVM->pgm.s.CTX SUFF(pStatTrap0eAttribution)196 STAM_STATS({ pVM->pgm.s.CTX_SUFF(pStatTrap0eAttribution) 195 197 = rc == VINF_PGM_HANDLED_DIRTY_BIT_FAULT ? &pVM->pgm.s.StatTrap0eDirtyAndAccessedBits : &pVM->pgm.s.StatTrap0eGuestTrap; }); 196 198 LogBird(("Trap0eHandler: returns %s\n", rc == VINF_PGM_HANDLED_DIRTY_BIT_FAULT ? "VINF_SUCCESS" : "VINF_EM_RAW_GUEST_TRAP")); … … 199 201 200 202 STAM_COUNTER_INC(&pVM->pgm.s.StatGCTrap0ePD[iPDSrc]); 201 # endif /* PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE) */203 # endif /* PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE) */ 202 204 203 205 /* … … 212 214 * 213 215 */ 214 # if PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE)216 # if PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE) 215 217 GSTPDE PdeSrc = pPDSrc->a[iPDSrc]; 216 # else218 # else 217 219 GSTPDE PdeSrc; 218 220 PdeSrc.au32[0] = 0; /* faked so we don't have to #ifdef everything */ … … 221 223 PdeSrc.n.u1Accessed = 1; 222 224 PdeSrc.n.u1User = 1; 223 # endif225 # endif 224 226 if ( !(uErr & X86_TRAP_PF_P) /* not set means page not present instead of page protection violation */ 225 227 && !pPDDst->a[iPDDst].n.u1Present … … 228 230 229 231 { 230 STAM_STATS({ pVM->pgm.s.CTX SUFF(pStatTrap0eAttribution) = &pVM->pgm.s.StatTrap0eSyncPT; });232 STAM_STATS({ pVM->pgm.s.CTX_SUFF(pStatTrap0eAttribution) = &pVM->pgm.s.StatTrap0eSyncPT; }); 231 233 STAM_PROFILE_START(&pVM->pgm.s.StatLazySyncPT, f); 232 234 LogFlow(("=>SyncPT %04x = %08x\n", iPDSrc, PdeSrc.au32[0])); … … 243 245 } 244 246 245 # if PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE)247 # if PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE) 246 248 /* 247 249 * Check if this address is within any of our mappings. … … 286 288 && uErr & X86_TRAP_PF_RW) 287 289 { 288 # ifdef IN_GC290 # ifdef IN_GC 289 291 STAM_PROFILE_START(&pCur->Stat, h); 290 292 rc = pCur->CTX_SUFF(pfnHandler)(pVM, uErr, pRegFrame, pvFault, pCur->Core.Key, (RTGCUINTPTR)pvFault - (RTGCUINTPTR)pCur->Core.Key); 291 293 STAM_PROFILE_STOP(&pCur->Stat, h); 292 # else294 # else 293 295 AssertFailed(); 294 296 rc = VINF_EM_RAW_EMULATE_INSTR; /* can't happen with VMX */ 295 # endif297 # endif 296 298 STAM_COUNTER_INC(&pVM->pgm.s.StatTrap0eMapHandler); 297 299 STAM_PROFILE_STOP(&pVM->pgm.s.StatMapping, a); … … 311 313 STAM_PROFILE_STOP(&pVM->pgm.s.StatMapping, a); 312 314 } /* pgmAreMappingsEnabled(&pVM->pgm.s) */ 313 # endif /* PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE) */315 # endif /* PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE) */ 314 316 315 317 /* … … 325 327 RTGCPHYS GCPhys = NIL_RTGCPHYS; 326 328 327 # if PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE)328 # if PGM_GST_TYPE == PGM_TYPE_AMD64329 # if PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE) 330 # if PGM_GST_TYPE == PGM_TYPE_AMD64 329 331 bool fBigPagesSupported = true; 330 # else332 # else 331 333 bool fBigPagesSupported = !!(CPUMGetGuestCR4(pVM) & X86_CR4_PSE); 332 # endif334 # endif 333 335 if ( PdeSrc.b.u1Size 334 336 && fBigPagesSupported) … … 346 348 } 347 349 } 348 # else350 # else 349 351 /* No paging so the fault address is the physical address */ 350 352 GCPhys = (RTGCPHYS)((RTGCUINTPTR)pvFault & ~PAGE_OFFSET_MASK); 351 # endif /* PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE) */353 # endif /* PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE) */ 352 354 353 355 /* … … 373 375 if (pCur) 374 376 { 375 # ifdef PGM_SYNC_N_PAGES377 # ifdef PGM_SYNC_N_PAGES 376 378 /* 377 379 * If the region is write protected and we got a page not present fault, then sync … … 392 394 STAM_COUNTER_INC(&pVM->pgm.s.StatHandlersOutOfSync); 393 395 STAM_PROFILE_STOP(&pVM->pgm.s.StatHandlers, b); 394 STAM_STATS({ pVM->pgm.s.CTX SUFF(pStatTrap0eAttribution) = &pVM->pgm.s.StatTrap0eOutOfSyncHndPhys; });396 STAM_STATS({ pVM->pgm.s.CTX_SUFF(pStatTrap0eAttribution) = &pVM->pgm.s.StatTrap0eOutOfSyncHndPhys; }); 395 397 return rc; 396 398 } 397 399 } 398 # endif400 # endif 399 401 400 402 AssertMsg( pCur->enmType != PGMPHYSHANDLERTYPE_PHYSICAL_WRITE … … 402 404 ("Unexpected trap for physical handler: %08X (phys=%08x) HCPhys=%X uErr=%X, enum=%d\n", pvFault, GCPhys, pPage->HCPhys, uErr, pCur->enmType)); 403 405 404 # if defined(IN_GC) || defined(IN_RING0)406 # if defined(IN_GC) || defined(IN_RING0) 405 407 if (pCur->CTX_SUFF(pfnHandler)) 406 408 { … … 410 412 } 411 413 else 412 # endif414 # endif 413 415 rc = VINF_EM_RAW_EMULATE_INSTR; 414 416 STAM_COUNTER_INC(&pVM->pgm.s.StatHandlersPhysical); 415 417 STAM_PROFILE_STOP(&pVM->pgm.s.StatHandlers, b); 416 STAM_STATS({ pVM->pgm.s.CTX SUFF(pStatTrap0eAttribution) = &pVM->pgm.s.StatTrap0eHndPhys; });418 STAM_STATS({ pVM->pgm.s.CTX_SUFF(pStatTrap0eAttribution) = &pVM->pgm.s.StatTrap0eHndPhys; }); 417 419 return rc; 418 420 } 419 421 } 420 # if PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE)422 # if PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE) 421 423 else 422 424 { 423 # ifdef PGM_SYNC_N_PAGES425 # ifdef PGM_SYNC_N_PAGES 424 426 /* 425 427 * If the region is write protected and we got a page not present fault, then sync … … 438 440 STAM_COUNTER_INC(&pVM->pgm.s.StatHandlersOutOfSync); 439 441 STAM_PROFILE_STOP(&pVM->pgm.s.StatHandlers, b); 440 STAM_STATS({ pVM->pgm.s.CTX SUFF(pStatTrap0eAttribution) = &pVM->pgm.s.StatTrap0eOutOfSyncHndVirt; });442 STAM_STATS({ pVM->pgm.s.CTX_SUFF(pStatTrap0eAttribution) = &pVM->pgm.s.StatTrap0eOutOfSyncHndVirt; }); 441 443 return rc; 442 444 } 443 445 } 444 # endif446 # endif 445 447 /* 446 448 * Ok, it's an virtual page access handler. … … 466 468 || pCur->enmType != PGMVIRTHANDLERTYPE_WRITE ) ) 467 469 { 468 # ifdef IN_GC470 # ifdef IN_GC 469 471 STAM_PROFILE_START(&pCur->Stat, h); 470 472 rc = pCur->CTX_SUFF(pfnHandler)(pVM, uErr, pRegFrame, pvFault, pCur->Core.Key, (RTGCUINTPTR)pvFault - (RTGCUINTPTR)pCur->Core.Key); 471 473 STAM_PROFILE_STOP(&pCur->Stat, h); 472 # else474 # else 473 475 rc = VINF_EM_RAW_EMULATE_INSTR; /** @todo for VMX */ 474 # endif476 # endif 475 477 STAM_COUNTER_INC(&pVM->pgm.s.StatHandlersVirtual); 476 478 STAM_PROFILE_STOP(&pVM->pgm.s.StatHandlers, b); 477 STAM_STATS({ pVM->pgm.s.CTX SUFF(pStatTrap0eAttribution) = &pVM->pgm.s.StatTrap0eHndVirt; });479 STAM_STATS({ pVM->pgm.s.CTX_SUFF(pStatTrap0eAttribution) = &pVM->pgm.s.StatTrap0eHndVirt; }); 478 480 return rc; 479 481 } … … 493 495 { 494 496 Assert((pCur->aPhysToVirt[iPage].Core.Key & X86_PTE_PAE_PG_MASK) == GCPhys); 495 # ifdef IN_GC497 # ifdef IN_GC 496 498 RTGCUINTPTR off = (iPage << PAGE_SHIFT) + ((RTGCUINTPTR)pvFault & PAGE_OFFSET_MASK) - ((RTGCUINTPTR)pCur->Core.Key & PAGE_OFFSET_MASK); 497 499 Assert(off < pCur->cb); … … 499 501 rc = pCur->CTX_SUFF(pfnHandler)(pVM, uErr, pRegFrame, pvFault, pCur->Core.Key, off); 500 502 STAM_PROFILE_STOP(&pCur->Stat, h); 501 # else503 # else 502 504 rc = VINF_EM_RAW_EMULATE_INSTR; /** @todo for VMX */ 503 # endif505 # endif 504 506 STAM_COUNTER_INC(&pVM->pgm.s.StatHandlersVirtualByPhys); 505 507 STAM_PROFILE_STOP(&pVM->pgm.s.StatHandlers, b); 506 STAM_STATS({ pVM->pgm.s.CTX SUFF(pStatTrap0eAttribution) = &pVM->pgm.s.StatTrap0eHndVirt; });508 STAM_STATS({ pVM->pgm.s.CTX_SUFF(pStatTrap0eAttribution) = &pVM->pgm.s.StatTrap0eHndVirt; }); 507 509 return rc; 508 510 } 509 511 } 510 512 } 511 # endif /* PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE) */513 # endif /* PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE) */ 512 514 513 515 /* … … 532 534 STAM_COUNTER_INC(&pVM->pgm.s.StatHandlersOutOfSync); 533 535 STAM_PROFILE_STOP(&pVM->pgm.s.StatHandlers, b); 534 STAM_STATS({ pVM->pgm.s.CTX SUFF(pStatTrap0eAttribution) = &pVM->pgm.s.StatTrap0eOutOfSyncHndPhys; });536 STAM_STATS({ pVM->pgm.s.CTX_SUFF(pStatTrap0eAttribution) = &pVM->pgm.s.StatTrap0eOutOfSyncHndPhys; }); 535 537 return rc; 536 538 } … … 546 548 PGM_PAGE_HAS_ANY_VIRTUAL_HANDLERS(pPage) ? " virt" : "")); 547 549 STAM_PROFILE_STOP(&pVM->pgm.s.StatHandlers, b); 548 STAM_STATS({ pVM->pgm.s.CTX SUFF(pStatTrap0eAttribution) = &pVM->pgm.s.StatTrap0eHndUnhandled; });550 STAM_STATS({ pVM->pgm.s.CTX_SUFF(pStatTrap0eAttribution) = &pVM->pgm.s.StatTrap0eHndUnhandled; }); 549 551 return rc; 550 552 } /* if any kind of handler */ 551 553 552 # if PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE)554 # if PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE) 553 555 if (uErr & X86_TRAP_PF_P) 554 556 { … … 573 575 || pCur->enmType != PGMVIRTHANDLERTYPE_WRITE ) ) 574 576 { 575 # ifdef IN_GC577 # ifdef IN_GC 576 578 STAM_PROFILE_START(&pCur->Stat, h); 577 579 rc = pCur->CTX_SUFF(pfnHandler)(pVM, uErr, pRegFrame, pvFault, pCur->Core.Key, (RTGCUINTPTR)pvFault - (RTGCUINTPTR)pCur->Core.Key); 578 580 STAM_PROFILE_STOP(&pCur->Stat, h); 579 # else581 # else 580 582 rc = VINF_EM_RAW_EMULATE_INSTR; /** @todo for VMX */ 581 # endif583 # endif 582 584 STAM_COUNTER_INC(&pVM->pgm.s.StatHandlersVirtualUnmarked); 583 585 STAM_PROFILE_STOP(&pVM->pgm.s.StatHandlers, b); 584 STAM_STATS({ pVM->pgm.s.CTX SUFF(pStatTrap0eAttribution) = &pVM->pgm.s.StatTrap0eHndVirt; });586 STAM_STATS({ pVM->pgm.s.CTX_SUFF(pStatTrap0eAttribution) = &pVM->pgm.s.StatTrap0eHndVirt; }); 585 587 return rc; 586 588 } 587 589 } 588 590 } 589 # endif /* PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE) */591 # endif /* PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE) */ 590 592 } 591 593 else … … 602 604 STAM_PROFILE_STOP(&pVM->pgm.s.StatHandlers, b); 603 605 604 # ifdef PGM_OUT_OF_SYNC_IN_GC606 # ifdef PGM_OUT_OF_SYNC_IN_GC 605 607 /* 606 608 * We are here only if page is present in Guest page tables and trap is not handled … … 622 624 STAM_COUNTER_INC(&pVM->pgm.s.StatGCPageOutOfSyncSupervisor); 623 625 624 # if defined(LOG_ENABLED) && !defined(IN_RING0)626 # if defined(LOG_ENABLED) && !defined(IN_RING0) 625 627 RTGCPHYS GCPhys; 626 628 uint64_t fPageGst; … … 628 630 Log(("Page out of sync: %VGv eip=%08x PdeSrc.n.u1User=%d fPageGst=%08llx GCPhys=%VGp scan=%d\n", 629 631 pvFault, pRegFrame->eip, PdeSrc.n.u1User, fPageGst, GCPhys, CSAMDoesPageNeedScanning(pVM, (RTRCPTR)pRegFrame->eip))); 630 # endif /* LOG_ENABLED */631 632 # if PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE) && !defined(IN_RING0)632 # endif /* LOG_ENABLED */ 633 634 # if PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE) && !defined(IN_RING0) 633 635 if (CPUMGetGuestCPL(pVM, pRegFrame) == 0) 634 636 { … … 641 643 if ( pvFault == (RTGCPTR)pRegFrame->eip 642 644 || (RTGCUINTPTR)pvFault - pRegFrame->eip < 8 /* instruction crossing a page boundary */ 643 # ifdef CSAM_DETECT_NEW_CODE_PAGES645 # ifdef CSAM_DETECT_NEW_CODE_PAGES 644 646 || ( !PATMIsPatchGCAddr(pVM, (RTGCPTR)pRegFrame->eip) 645 647 && CSAMDoesPageNeedScanning(pVM, (RTRCPTR)pRegFrame->eip)) /* any new code we encounter here */ 646 # endif /* CSAM_DETECT_NEW_CODE_PAGES */648 # endif /* CSAM_DETECT_NEW_CODE_PAGES */ 647 649 ) 648 650 { … … 662 664 663 665 STAM_PROFILE_STOP(&pVM->pgm.s.StatOutOfSync, c); 664 STAM_STATS({ pVM->pgm.s.CTX SUFF(pStatTrap0eAttribution) = &pVM->pgm.s.StatTrap0eCSAM; });666 STAM_STATS({ pVM->pgm.s.CTX_SUFF(pStatTrap0eAttribution) = &pVM->pgm.s.StatTrap0eCSAM; }); 665 667 return rc; 666 668 } 667 669 } 668 # ifdef CSAM_DETECT_NEW_CODE_PAGES670 # ifdef CSAM_DETECT_NEW_CODE_PAGES 669 671 else 670 672 if ( uErr == X86_TRAP_PF_RW … … 697 699 } 698 700 } 699 # endif /* CSAM_DETECT_NEW_CODE_PAGES */701 # endif /* CSAM_DETECT_NEW_CODE_PAGES */ 700 702 701 703 /* … … 707 709 } 708 710 } 709 # endif /* PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE) && !defined(IN_RING0) */711 # endif /* PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE) && !defined(IN_RING0) */ 710 712 rc = PGM_BTH_NAME(SyncPage)(pVM, PdeSrc, (RTGCUINTPTR)pvFault, PGM_SYNC_NR_PAGES, uErr); 711 713 if (VBOX_SUCCESS(rc)) … … 713 715 /* The page was successfully synced, return to the guest. */ 714 716 STAM_PROFILE_STOP(&pVM->pgm.s.StatOutOfSync, c); 715 STAM_STATS({ pVM->pgm.s.CTX SUFF(pStatTrap0eAttribution) = &pVM->pgm.s.StatTrap0eOutOfSync; });717 STAM_STATS({ pVM->pgm.s.CTX_SUFF(pStatTrap0eAttribution) = &pVM->pgm.s.StatTrap0eOutOfSync; }); 716 718 return VINF_SUCCESS; 717 719 } … … 741 743 * Page was successfully synced, return to guest. 742 744 */ 743 # ifdef VBOX_STRICT745 # ifdef VBOX_STRICT 744 746 RTGCPHYS GCPhys; 745 747 uint64_t fPageGst; … … 751 753 rc = PGMShwGetPage(pVM, pvFault, &fPageShw, NULL); 752 754 AssertMsg(VBOX_SUCCESS(rc) && fPageShw & X86_PTE_RW, ("rc=%Vrc fPageShw=%VX64\n", rc, fPageShw)); 753 # endif /* VBOX_STRICT */755 # endif /* VBOX_STRICT */ 754 756 STAM_PROFILE_STOP(&pVM->pgm.s.StatOutOfSync, c); 755 STAM_STATS({ pVM->pgm.s.CTX SUFF(pStatTrap0eAttribution) = &pVM->pgm.s.StatTrap0eOutOfSyncObsHnd; });757 STAM_STATS({ pVM->pgm.s.CTX_SUFF(pStatTrap0eAttribution) = &pVM->pgm.s.StatTrap0eOutOfSyncObsHnd; }); 756 758 return VINF_SUCCESS; 757 759 } … … 780 782 } 781 783 782 # if PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE)783 # ifdef VBOX_STRICT784 # if PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE) 785 # ifdef VBOX_STRICT 784 786 /* 785 787 * Check for VMM page flags vs. Guest page flags consistency. … … 808 810 else 809 811 AssertMsgFailed(("PGMGCGetPage rc=%Vrc\n", rc)); 810 # endif /* VBOX_STRICT */811 # endif /* PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE) */812 # endif /* VBOX_STRICT */ 813 # endif /* PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE) */ 812 814 } 813 815 STAM_PROFILE_STOP(&pVM->pgm.s.StatOutOfSync, c); 814 # endif /* PGM_OUT_OF_SYNC_IN_GC */816 # endif /* PGM_OUT_OF_SYNC_IN_GC */ 815 817 } 816 818 else … … 834 836 835 837 836 # if PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE)838 # if PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE) 837 839 /* 838 840 * Conclusion, this is a guest trap. … … 841 843 STAM_COUNTER_INC(&pVM->pgm.s.StatGCTrap0eUnhandled); 842 844 return VINF_EM_RAW_GUEST_TRAP; 843 # else845 # else 844 846 /* present, but not a monitored page; perhaps the guest is probing physical memory */ 845 847 return VINF_EM_RAW_EMULATE_INSTR; 846 # endif /* PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE) */847 848 849 # else /* PGM_GST_TYPE != PGM_TYPE_32BIT */848 # endif /* PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE) */ 849 850 851 # else /* PGM_GST_TYPE != PGM_TYPE_32BIT */ 850 852 851 853 AssertReleaseMsgFailed(("Shw=%d Gst=%d is not implemented!\n", PGM_GST_TYPE, PGM_SHW_TYPE)); 852 854 return VERR_INTERNAL_ERROR; 853 # endif /* PGM_GST_TYPE != PGM_TYPE_32BIT */855 # endif /* PGM_GST_TYPE != PGM_TYPE_32BIT */ 854 856 } 857 #endif /* !IN_RING3 */ 855 858 856 859 … … 896 899 { 897 900 Assert(!(pPdptDst->a[iPdpte].u & PGM_PLXFLAGS_MAPPING)); 898 STAM_COUNTER_INC(&pVM->pgm.s.CTX MID(Stat,InvalidatePageSkipped));901 STAM_COUNTER_INC(&pVM->pgm.s.CTX_MID_Z(Stat,InvalidatePageSkipped)); 899 902 return VINF_SUCCESS; 900 903 } … … 914 917 { 915 918 AssertMsg(rc == VERR_PAGE_DIRECTORY_PTR_NOT_PRESENT || rc == VERR_PAGE_MAP_LEVEL4_NOT_PRESENT, ("Unexpected rc=%Vrc\n", rc)); 916 STAM_COUNTER_INC(&pVM->pgm.s.CTX MID(Stat,InvalidatePageSkipped));919 STAM_COUNTER_INC(&pVM->pgm.s.CTX_MID_Z(Stat,InvalidatePageSkipped)); 917 920 if (!VM_FF_ISSET(pVM, VM_FF_PGM_SYNC_CR3)) 918 921 PGM_INVL_GUEST_TLBS(); … … 926 929 if (!pPdpeDst->n.u1Present) 927 930 { 928 STAM_COUNTER_INC(&pVM->pgm.s.CTX MID(Stat,InvalidatePageSkipped));931 STAM_COUNTER_INC(&pVM->pgm.s.CTX_MID_Z(Stat,InvalidatePageSkipped)); 929 932 if (!VM_FF_ISSET(pVM, VM_FF_PGM_SYNC_CR3)) 930 933 PGM_INVL_GUEST_TLBS(); … … 937 940 if (!PdeDst.n.u1Present) 938 941 { 939 STAM_COUNTER_INC(&pVM->pgm.s.CTX MID(Stat,InvalidatePageSkipped));942 STAM_COUNTER_INC(&pVM->pgm.s.CTX_MID_Z(Stat,InvalidatePageSkipped)); 940 943 return VINF_SUCCESS; 941 944 } … … 989 992 # endif 990 993 { 991 STAM_COUNTER_INC(&pVM->pgm.s. StatHCInvalidatePageSkipped);994 STAM_COUNTER_INC(&pVM->pgm.s.CTX_MID_Z(Stat,InvalidatePageSkipped)); 992 995 return VINF_SUCCESS; 993 996 } … … 1015 1018 pgmPoolFreeByPage(pPool, pShwPdpt, pVM->pgm.s.pHCShwAmd64CR3->idx, iPml4e); 1016 1019 pPml4eDst->u = 0; 1017 STAM_COUNTER_INC(&pVM->pgm.s.CTX MID(Stat,InvalidatePagePDNPs));1020 STAM_COUNTER_INC(&pVM->pgm.s.CTX_MID_Z(Stat,InvalidatePagePDNPs)); 1018 1021 PGM_INVL_GUEST_TLBS(); 1019 1022 return VINF_SUCCESS; … … 1029 1032 pgmPoolFreeByPage(pPool, pShwPdpt, pVM->pgm.s.pHCShwAmd64CR3->idx, iPml4e); 1030 1033 pPml4eDst->u = 0; 1031 STAM_COUNTER_INC(&pVM->pgm.s.CTX MID(Stat,InvalidatePagePDOutOfSync));1034 STAM_COUNTER_INC(&pVM->pgm.s.CTX_MID_Z(Stat,InvalidatePagePDOutOfSync)); 1032 1035 PGM_INVL_GUEST_TLBS(); 1033 1036 } … … 1041 1044 pgmPoolFreeByPage(pPool, pShwPdpt, pVM->pgm.s.pHCShwAmd64CR3->idx, iPml4e); 1042 1045 pPml4eDst->u = 0; 1043 STAM_COUNTER_INC(&pVM->pgm.s.CTX MID(Stat,InvalidatePagePDNAs));1046 STAM_COUNTER_INC(&pVM->pgm.s.CTX_MID_Z(Stat,InvalidatePagePDNAs)); 1044 1047 PGM_INVL_GUEST_TLBS(); 1045 1048 } … … 1055 1058 pgmPoolFreeByPage(pPool, pShwPde, pShwPdpt->idx, iPdpte); 1056 1059 pPdpeDst->u = 0; 1057 STAM_COUNTER_INC(&pVM->pgm.s.CTX MID(Stat,InvalidatePagePDNPs));1060 STAM_COUNTER_INC(&pVM->pgm.s.CTX_MID_Z(Stat,InvalidatePagePDNPs)); 1058 1061 PGM_INVL_GUEST_TLBS(); 1059 1062 return VINF_SUCCESS; … … 1069 1072 pgmPoolFreeByPage(pPool, pShwPde, pShwPdpt->idx, iPdpte); 1070 1073 pPdpeDst->u = 0; 1071 STAM_COUNTER_INC(&pVM->pgm.s.CTX MID(Stat,InvalidatePagePDOutOfSync));1074 STAM_COUNTER_INC(&pVM->pgm.s.CTX_MID_Z(Stat,InvalidatePagePDOutOfSync)); 1072 1075 PGM_INVL_GUEST_TLBS(); 1073 1076 } … … 1081 1084 pgmPoolFreeByPage(pPool, pShwPde, pShwPdpt->idx, iPdpte); 1082 1085 pPdpeDst->u = 0; 1083 STAM_COUNTER_INC(&pVM->pgm.s.CTX MID(Stat,InvalidatePagePDNAs));1086 STAM_COUNTER_INC(&pVM->pgm.s.CTX_MID_Z(Stat,InvalidatePagePDNAs)); 1084 1087 PGM_INVL_GUEST_TLBS(); 1085 1088 } … … 1144 1147 # endif 1145 1148 pPdeDst->u = 0; 1146 STAM_COUNTER_INC(&pVM->pgm.s.CTX MID(Stat,InvalidatePagePDOutOfSync));1149 STAM_COUNTER_INC(&pVM->pgm.s.CTX_MID_Z(Stat,InvalidatePagePDOutOfSync)); 1147 1150 PGM_INVL_GUEST_TLBS(); 1148 1151 } … … 1160 1163 # endif 1161 1164 pPdeDst->u = 0; 1162 STAM_COUNTER_INC(&pVM->pgm.s.CTX MID(Stat,InvalidatePagePDNAs));1165 STAM_COUNTER_INC(&pVM->pgm.s.CTX_MID_Z(Stat,InvalidatePagePDNAs)); 1163 1166 PGM_INVL_GUEST_TLBS(); 1164 1167 } … … 1192 1195 rc = VINF_SUCCESS; 1193 1196 # endif 1194 STAM_COUNTER_INC(&pVM->pgm.s.CTX MID(Stat,InvalidatePage4KBPages));1197 STAM_COUNTER_INC(&pVM->pgm.s.CTX_MID_Z(Stat,InvalidatePage4KBPages)); 1195 1198 PGM_INVL_PG(GCPtrPage); 1196 1199 } … … 1208 1211 # endif 1209 1212 pPdeDst->u = 0; 1210 STAM_COUNTER_INC(&pVM->pgm.s.CTX MID(Stat,InvalidatePagePDOutOfSync));1213 STAM_COUNTER_INC(&pVM->pgm.s.CTX_MID_Z(Stat,InvalidatePagePDOutOfSync)); 1211 1214 PGM_INVL_GUEST_TLBS(); 1212 1215 } … … 1235 1238 { 1236 1239 LogFlow(("Skipping flush for big page containing %VGv (PD=%X .u=%VX64)-> nothing has changed!\n", GCPtrPage, iPDSrc, PdeSrc.u)); 1237 STAM_COUNTER_INC(&pVM->pgm.s.CTX MID(Stat,InvalidatePage4MBPagesSkip));1240 STAM_COUNTER_INC(&pVM->pgm.s.CTX_MID_Z(Stat,InvalidatePage4MBPagesSkip)); 1238 1241 return VINF_SUCCESS; 1239 1242 } … … 1254 1257 # endif 1255 1258 pPdeDst->u = 0; 1256 STAM_COUNTER_INC(&pVM->pgm.s.CTX MID(Stat,InvalidatePage4MBPages));1259 STAM_COUNTER_INC(&pVM->pgm.s.CTX_MID_Z(Stat,InvalidatePage4MBPages)); 1257 1260 PGM_INVL_BIG_PG(GCPtrPage); 1258 1261 } … … 1271 1274 # endif 1272 1275 pPdeDst->u = 0; 1273 STAM_COUNTER_INC(&pVM->pgm.s.CTX MID(Stat,InvalidatePagePDNPs));1276 STAM_COUNTER_INC(&pVM->pgm.s.CTX_MID_Z(Stat,InvalidatePagePDNPs)); 1274 1277 PGM_INVL_PG(GCPtrPage); 1275 1278 } … … 1277 1280 { 1278 1281 Assert(pgmMapAreMappingsEnabled(&pVM->pgm.s)); 1279 STAM_COUNTER_INC(&pVM->pgm.s.CTX MID(Stat,InvalidatePagePDMappings));1282 STAM_COUNTER_INC(&pVM->pgm.s.CTX_MID_Z(Stat,InvalidatePagePDMappings)); 1280 1283 } 1281 1284 } … … 1449 1452 { 1450 1453 LogFlow(("SyncPageWorker: page and or page directory not accessed -> mark not present\n")); 1451 STAM_COUNTER_INC(&pVM->pgm.s.CTX MID(Stat,AccessedPage));1454 STAM_COUNTER_INC(&pVM->pgm.s.CTX_MID_Z(Stat,AccessedPage)); 1452 1455 PteDst.u = 0; 1453 1456 } … … 1459 1462 if (!PteSrc.n.u1Dirty && (PdeSrc.n.u1Write & PteSrc.n.u1Write)) 1460 1463 { 1461 STAM_COUNTER_INC(&pVM->pgm.s.CTX MID(Stat,DirtyPage));1464 STAM_COUNTER_INC(&pVM->pgm.s.CTX_MID_Z(Stat,DirtyPage)); 1462 1465 PteDst.u = (PteSrc.u & ~(X86_PTE_PAE_PG_MASK | X86_PTE_AVL_MASK | X86_PTE_PAT | X86_PTE_PCD | X86_PTE_PWT | X86_PTE_RW)) 1463 1466 | (HCPhys & X86_PTE_PAE_PG_MASK) … … 1467 1470 #endif 1468 1471 { 1469 STAM_COUNTER_INC(&pVM->pgm.s.CTX MID(Stat,DirtyPageSkipped));1472 STAM_COUNTER_INC(&pVM->pgm.s.CTX_MID_Z(Stat,DirtyPageSkipped)); 1470 1473 #if PGM_SHW_TYPE == PGM_TYPE_EPT 1471 1474 PteDst.u = (HCPhys & EPT_PTE_PG_MASK); … … 1775 1778 if (!PdeSrc.b.u1Dirty && PdeSrc.b.u1Write) 1776 1779 { 1777 STAM_COUNTER_INC(&pVM->pgm.s.CTX MID(Stat,DirtyPageBig));1780 STAM_COUNTER_INC(&pVM->pgm.s.CTX_MID_Z(Stat,DirtyPageBig)); 1778 1781 PdeDst.u |= PGM_PDFLAGS_TRACK_DIRTY; 1779 1782 PdeDst.n.u1Write = 0; … … 1800 1803 return VINF_SUCCESS; 1801 1804 } 1802 STAM_COUNTER_INC(&pVM->pgm.s.CTX MID(Stat,SyncPagePDNAs));1805 STAM_COUNTER_INC(&pVM->pgm.s.CTX_MID_Z(Stat,SyncPagePDNAs)); 1803 1806 } 1804 1807 else 1805 1808 { 1806 STAM_COUNTER_INC(&pVM->pgm.s.CTX MID(Stat,SyncPagePDOutOfSync));1809 STAM_COUNTER_INC(&pVM->pgm.s.CTX_MID_Z(Stat,SyncPagePDOutOfSync)); 1807 1810 Log2(("SyncPage: Out-Of-Sync PDE at %VGp PdeSrc=%RX64 PdeDst=%RX64\n", 1808 1811 GCPtrPage, (uint64_t)PdeSrc.u, (uint64_t)PdeDst.u)); … … 1978 1981 int rc; 1979 1982 1980 STAM_PROFILE_START(&pVM->pgm.s.CTX MID(Stat,DirtyBitTracking), a);1983 STAM_PROFILE_START(&pVM->pgm.s.CTX_MID_Z(Stat,DirtyBitTracking), a); 1981 1984 LogFlow(("CheckPageFault: GCPtrPage=%VGv uErr=%#x PdeSrc=%08x\n", GCPtrPage, uErr, pPdeSrc->u)); 1982 1985 … … 2065 2068 if (pPdeDst->n.u1Present && (pPdeDst->u & PGM_PDFLAGS_TRACK_DIRTY)) 2066 2069 { 2067 STAM_COUNTER_INC(&pVM->pgm.s.CTX MID(Stat,DirtyPageTrap));2070 STAM_COUNTER_INC(&pVM->pgm.s.CTX_MID_Z(Stat,DirtyPageTrap)); 2068 2071 2069 2072 Assert(pPdeSrc->b.u1Write); … … 2073 2076 pPdeDst->au32[0] &= ~PGM_PDFLAGS_TRACK_DIRTY; 2074 2077 PGM_INVL_BIG_PG(GCPtrPage); 2075 STAM_PROFILE_STOP(&pVM->pgm.s.CTX MID(Stat,DirtyBitTracking), a);2078 STAM_PROFILE_STOP(&pVM->pgm.s.CTX_MID_Z(Stat,DirtyBitTracking), a); 2076 2079 return VINF_PGM_HANDLED_DIRTY_BIT_FAULT; 2077 2080 } 2078 2081 } 2079 STAM_PROFILE_STOP(&pVM->pgm.s.CTX MID(Stat,DirtyBitTracking), a);2082 STAM_PROFILE_STOP(&pVM->pgm.s.CTX_MID_Z(Stat,DirtyBitTracking), a); 2080 2083 return VINF_PGM_NO_DIRTY_BIT_TRACKING; 2081 2084 } … … 2102 2105 ) 2103 2106 { 2104 # ifdef IN_GC 2105 STAM_COUNTER_INC(&pVM->pgm.s.StatGCDirtyTrackRealPF); 2106 # endif 2107 STAM_PROFILE_STOP(&pVM->pgm.s.CTXMID(Stat,DirtyBitTracking), a); 2107 STAM_COUNTER_INC(&pVM->pgm.s.CTX_MID_Z(Stat,DirtyTrackRealPF)); 2108 STAM_PROFILE_STOP(&pVM->pgm.s.CTX_MID_Z(Stat,DirtyBitTracking), a); 2108 2109 LogFlow(("CheckPageFault: real page fault at %VGv PteSrc.u=%08x (2)\n", GCPtrPage, PteSrc.u)); 2109 2110 … … 2114 2115 TRPMSetErrorCode(pVM, uErr | X86_TRAP_PF_P); /* page-level protection violation */ 2115 2116 2116 STAM_PROFILE_STOP(&pVM->pgm.s.CTX MID(Stat,DirtyBitTracking), a);2117 STAM_PROFILE_STOP(&pVM->pgm.s.CTX_MID_Z(Stat,DirtyBitTracking), a); 2117 2118 return VINF_EM_RAW_GUEST_TRAP; 2118 2119 } … … 2135 2136 { 2136 2137 /* Write access, so mark guest entry as dirty. */ 2137 # if defined(IN_GC) && defined(VBOX_WITH_STATISTICS)2138 # ifdef VBOX_WITH_STATISTICS 2138 2139 if (!pPteSrc->n.u1Dirty) 2139 STAM_COUNTER_INC(&pVM->pgm.s. StatGCDirtiedPage);2140 STAM_COUNTER_INC(&pVM->pgm.s.CTX_MID_Z(Stat,DirtiedPage)); 2140 2141 else 2141 STAM_COUNTER_INC(&pVM->pgm.s. StatGCPageAlreadyDirty);2142 STAM_COUNTER_INC(&pVM->pgm.s.CTX_MID_Z(Stat,PageAlreadyDirty)); 2142 2143 # endif 2143 2144 … … 2153 2154 { 2154 2155 LogRel(("CheckPageFault: write to hypervisor region %VGv\n", GCPtrPage)); 2155 STAM_PROFILE_STOP(&pVM->pgm.s.CTX MID(Stat,DirtyBitTracking), a);2156 STAM_PROFILE_STOP(&pVM->pgm.s.CTX_MID_Z(Stat,DirtyBitTracking), a); 2156 2157 return VINF_SUCCESS; 2157 2158 } … … 2175 2176 ("Unexpected dirty bit tracking on monitored page %VGv (phys %VGp)!!!!!!\n", GCPtrPage, pPteSrc->u & X86_PTE_PAE_PG_MASK)); 2176 2177 # endif 2177 STAM_COUNTER_INC(&pVM->pgm.s.CTX MID(Stat,DirtyPageTrap));2178 STAM_COUNTER_INC(&pVM->pgm.s.CTX_MID_Z(Stat,DirtyPageTrap)); 2178 2179 2179 2180 Assert(pPteSrc->n.u1Write); … … 2185 2186 PGM_INVL_PG(GCPtrPage); 2186 2187 2187 STAM_PROFILE_STOP(&pVM->pgm.s.CTX MID(Stat,DirtyBitTracking), a);2188 STAM_PROFILE_STOP(&pVM->pgm.s.CTX_MID_Z(Stat,DirtyBitTracking), a); 2188 2189 return VINF_PGM_HANDLED_DIRTY_BIT_FAULT; 2189 2190 } … … 2210 2211 } 2211 2212 # endif /* VBOX_STRICT */ 2212 STAM_PROFILE_STOP(&pVM->pgm.s.CTX MID(Stat,DirtyBitTracking), a);2213 STAM_PROFILE_STOP(&pVM->pgm.s.CTX_MID_Z(Stat,DirtyBitTracking), a); 2213 2214 return VINF_PGM_NO_DIRTY_BIT_TRACKING; 2214 2215 } 2215 2216 AssertRC(rc); 2216 STAM_PROFILE_STOP(&pVM->pgm.s.CTX MID(Stat,DirtyBitTracking), a);2217 STAM_PROFILE_STOP(&pVM->pgm.s.CTX_MID_Z(Stat,DirtyBitTracking), a); 2217 2218 return rc; 2218 2219 … … 2222 2223 * Single exit handler to get rid of duplicate code paths. 2223 2224 */ 2224 # ifdef IN_GC 2225 STAM_COUNTER_INC(&pVM->pgm.s.StatGCDirtyTrackRealPF); 2226 # endif 2227 STAM_PROFILE_STOP(&pVM->pgm.s.CTXMID(Stat, DirtyBitTracking), a); 2225 STAM_COUNTER_INC(&pVM->pgm.s.CTX_MID_Z(Stat,DirtyTrackRealPF)); 2226 STAM_PROFILE_STOP(&pVM->pgm.s.CTX_MID_Z(Stat,DirtyBitTracking), a); 2228 2227 Log(("CheckPageFault: real page fault at %VGv (%d)\n", GCPtrPage, uPageFaultLevel)); 2229 2228 … … 2280 2279 PGM_BTH_DECL(int, SyncPT)(PVM pVM, unsigned iPDSrc, PGSTPD pPDSrc, RTGCUINTPTR GCPtrPage) 2281 2280 { 2282 STAM_PROFILE_START(&pVM->pgm.s.CTX MID(Stat,SyncPT), a);2281 STAM_PROFILE_START(&pVM->pgm.s.CTX_MID_Z(Stat,SyncPT), a); 2283 2282 STAM_COUNTER_INC(&pVM->pgm.s.StatGCSyncPtPD[iPDSrc]); 2284 2283 LogFlow(("SyncPT: GCPtrPage=%VGv\n", GCPtrPage)); … … 2334 2333 # ifndef IN_RING3 2335 2334 Log(("SyncPT: Conflict at %VGv\n", GCPtrPage)); 2336 STAM_PROFILE_STOP(&pVM->pgm.s.CTX MID(Stat,SyncPT), a);2335 STAM_PROFILE_STOP(&pVM->pgm.s.CTX_MID_Z(Stat,SyncPT), a); 2337 2336 return VERR_ADDRESS_CONFLICT; 2338 2337 # else … … 2348 2347 if (VBOX_FAILURE(rc)) 2349 2348 { 2350 STAM_PROFILE_STOP(&pVM->pgm.s.CTX MID(Stat,SyncPT), a);2349 STAM_PROFILE_STOP(&pVM->pgm.s.CTX_MID_Z(Stat,SyncPT), a); 2351 2350 return rc; 2352 2351 } … … 2419 2418 if (!PdeSrc.b.u1Dirty && PdeSrc.b.u1Write) 2420 2419 { 2421 STAM_COUNTER_INC(&pVM->pgm.s.CTX MID(Stat,DirtyPageBig));2420 STAM_COUNTER_INC(&pVM->pgm.s.CTX_MID_Z(Stat,DirtyPageBig)); 2422 2421 PdeDst.u |= PGM_PDFLAGS_TRACK_DIRTY; 2423 2422 PdeDst.b.u1Write = 0; … … 2558 2557 if (!PdeSrc.b.u1Dirty && PdeSrc.b.u1Write) 2559 2558 { 2560 STAM_COUNTER_INC(&pVM->pgm.s.CTX MID(Stat,DirtyPageBig));2559 STAM_COUNTER_INC(&pVM->pgm.s.CTX_MID_Z(Stat,DirtyPageBig)); 2561 2560 PdeDst.u |= PGM_PDFLAGS_TRACK_DIRTY; 2562 2561 PdeDst.b.u1Write = 0; … … 2669 2668 AssertRelease(!PdeDst.n.u1Present); 2670 2669 2671 STAM_PROFILE_STOP(&pVM->pgm.s.CTXMID(Stat,SyncPT), a); 2672 # ifdef IN_GC 2670 STAM_PROFILE_STOP(&pVM->pgm.s.CTX_MID_Z(Stat,SyncPT), a); 2673 2671 if (VBOX_FAILURE(rc)) 2674 STAM_COUNTER_INC(&pVM->pgm.s.CTXMID(Stat,SyncPTFailed)); 2675 # endif 2672 STAM_COUNTER_INC(&pVM->pgm.s.CTX_MID_Z(Stat,SyncPTFailed)); 2676 2673 return rc; 2677 2674 … … 2762 2759 2763 2760 rc = PGM_BTH_NAME(SyncPage)(pVM, PdeSrc, (RTGCUINTPTR)GCPtrPage, PGM_SYNC_NR_PAGES, 0 /* page not present */); 2764 STAM_PROFILE_STOP(&pVM->pgm.s.CTX MID(Stat,SyncPT), a);2761 STAM_PROFILE_STOP(&pVM->pgm.s.CTX_MID_Z(Stat,SyncPT), a); 2765 2762 return rc; 2766 2763 2767 2764 #else 2768 2765 AssertReleaseMsgFailed(("Shw=%d Gst=%d is not implemented!\n", PGM_GST_TYPE, PGM_SHW_TYPE)); 2769 STAM_PROFILE_STOP(&pVM->pgm.s.CTX MID(Stat,SyncPT), a);2766 STAM_PROFILE_STOP(&pVM->pgm.s.CTX_MID_Z(Stat,SyncPT), a); 2770 2767 return VERR_INTERNAL_ERROR; 2771 2768 #endif … … 3100 3097 */ 3101 3098 /** @todo this MUST go away. See #1557. */ 3102 STAM_PROFILE_START(&pVM->pgm.s.CTX MID(Stat,SyncCR3Handlers), h);3099 STAM_PROFILE_START(&pVM->pgm.s.CTX_MID_Z(Stat,SyncCR3Handlers), h); 3103 3100 PGM_GST_NAME(HandlerVirtualUpdate)(pVM, cr4); 3104 STAM_PROFILE_STOP(&pVM->pgm.s.CTX MID(Stat,SyncCR3Handlers), h);3101 STAM_PROFILE_STOP(&pVM->pgm.s.CTX_MID_Z(Stat,SyncCR3Handlers), h); 3105 3102 #endif 3106 3103 … … 3122 3119 3123 3120 Assert(fGlobal || (cr4 & X86_CR4_PGE)); 3124 MY_STAM_COUNTER_INC(fGlobal ? &pVM->pgm.s.CTX MID(Stat,SyncCR3Global) : &pVM->pgm.s.CTXMID(Stat,SyncCR3NotGlobal));3121 MY_STAM_COUNTER_INC(fGlobal ? &pVM->pgm.s.CTX_MID_Z(Stat,SyncCR3Global) : &pVM->pgm.s.CTX_MID_Z(Stat,SyncCR3NotGlobal)); 3125 3122 3126 3123 # if PGM_GST_TYPE == PGM_TYPE_32BIT || PGM_GST_TYPE == PGM_TYPE_PAE || PGM_GST_TYPE == PGM_TYPE_AMD64 … … 3423 3420 && (cr4 & (X86_CR4_PGE | X86_CR4_PSE)) == (X86_CR4_PGE | X86_CR4_PSE)) 3424 3421 # endif 3425 MY_STAM_COUNTER_INC(&pVM->pgm.s.CTX MID(Stat,SyncCR3DstSkippedGlobalPD));3422 MY_STAM_COUNTER_INC(&pVM->pgm.s.CTX_MID_Z(Stat,SyncCR3DstSkippedGlobalPD)); 3426 3423 else if (!fGlobal && !pShwPage->fSeenNonGlobal && (cr4 & X86_CR4_PGE)) 3427 MY_STAM_COUNTER_INC(&pVM->pgm.s.CTX MID(Stat,SyncCR3DstSkippedGlobalPT));3424 MY_STAM_COUNTER_INC(&pVM->pgm.s.CTX_MID_Z(Stat,SyncCR3DstSkippedGlobalPT)); 3428 3425 else 3429 MY_STAM_COUNTER_INC(&pVM->pgm.s.CTX MID(Stat,SyncCR3DstCacheHit));3426 MY_STAM_COUNTER_INC(&pVM->pgm.s.CTX_MID_Z(Stat,SyncCR3DstCacheHit)); 3430 3427 # endif /* VBOX_WITH_STATISTICS */ 3431 3428 /** @todo a replacement strategy isn't really needed unless we're using a very small pool < 512 pages. … … 3443 3440 # endif 3444 3441 pPDEDst->u = 0; 3445 MY_STAM_COUNTER_INC(&pVM->pgm.s.CTX MID(Stat,SyncCR3DstFreed));3442 MY_STAM_COUNTER_INC(&pVM->pgm.s.CTX_MID_Z(Stat,SyncCR3DstFreed)); 3446 3443 } 3447 3444 } 3448 3445 else 3449 MY_STAM_COUNTER_INC(&pVM->pgm.s.CTX MID(Stat,SyncCR3DstNotPresent));3446 MY_STAM_COUNTER_INC(&pVM->pgm.s.CTX_MID_Z(Stat,SyncCR3DstNotPresent)); 3450 3447 pPDEDst++; 3451 3448 } … … 3476 3473 # endif 3477 3474 pPDEDst->u = 0; 3478 MY_STAM_COUNTER_INC(&pVM->pgm.s.CTX MID(Stat,SyncCR3DstFreedSrcNP));3475 MY_STAM_COUNTER_INC(&pVM->pgm.s.CTX_MID_Z(Stat,SyncCR3DstFreedSrcNP)); 3479 3476 } 3480 3477 pPDEDst++; -
trunk/src/VBox/VMM/VMMAll/PGMAllGst.h
r13062 r13067 611 611 pVM->pgm.s.pfnR3GstWriteHandlerCR3, 0, 612 612 pVM->pgm.s.pfnR0GstWriteHandlerCR3, 0, 613 pVM->pgm.s.pfn GCGstWriteHandlerCR3, 0,613 pVM->pgm.s.pfnRCGstWriteHandlerCR3, 0, 614 614 pVM->pgm.s.pszR3GstWriteHandlerCR3); 615 615 # else /* PGMPOOL_WITH_MIXED_PT_CR3 */ … … 936 936 937 937 pgmLock(pVM); 938 STAM_PROFILE_START(&pVM->pgm.s.CTX MID(Stat,SyncCR3HandlerVirtualUpdate), a);938 STAM_PROFILE_START(&pVM->pgm.s.CTX_MID_Z(Stat,SyncCR3HandlerVirtualUpdate), a); 939 939 State.pVM = pVM; 940 940 State.fTodo = pVM->pgm.s.fSyncFlags; 941 941 State.cr4 = cr4; 942 942 RTAvlroGCPtrDoWithAll(&pVM->pgm.s.CTX_SUFF(pTrees)->VirtHandlers, true, PGM_GST_NAME(VirtHandlerUpdateOne), &State); 943 STAM_PROFILE_STOP(&pVM->pgm.s.CTX MID(Stat,SyncCR3HandlerVirtualUpdate), a);943 STAM_PROFILE_STOP(&pVM->pgm.s.CTX_MID_Z(Stat,SyncCR3HandlerVirtualUpdate), a); 944 944 945 945 … … 949 949 if (State.fTodo & PGM_SYNC_UPDATE_PAGE_BIT_VIRTUAL) 950 950 { 951 STAM_PROFILE_START(&pVM->pgm.s.CTX MID(Stat,SyncCR3HandlerVirtualReset), b);951 STAM_PROFILE_START(&pVM->pgm.s.CTX_MID_Z(Stat,SyncCR3HandlerVirtualReset), b); 952 952 Log(("pgmR3VirtualHandlersUpdate: resets bits\n")); 953 953 RTAvlroGCPtrDoWithAll(&pVM->pgm.s.CTX_SUFF(pTrees)->VirtHandlers, true, pgmHandlerVirtualResetOne, pVM); 954 954 pVM->pgm.s.fSyncFlags &= ~PGM_SYNC_UPDATE_PAGE_BIT_VIRTUAL; 955 STAM_PROFILE_STOP(&pVM->pgm.s.CTX MID(Stat,SyncCR3HandlerVirtualReset), b);955 STAM_PROFILE_STOP(&pVM->pgm.s.CTX_MID_Z(Stat,SyncCR3HandlerVirtualReset), b); 956 956 } 957 957 pgmUnlock(pVM);
Note:
See TracChangeset
for help on using the changeset viewer.