Changeset 16260 in vbox
- Timestamp:
- Jan 27, 2009 10:45:39 AM (16 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 2 edited
-
PGMGst.h (modified) (2 diffs)
-
VMMAll/PGMAllBth.h (modified) (15 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/PGMGst.h
r14301 r16260 113 113 static DECLCALLBACK(int) pgmR3Gst32BitWriteHandlerCR3(PVM pVM, RTGCPHYS GCPhys, void *pvPhys, void *pvBuf, size_t cbBuf, PGMACCESSTYPE enmAccessType, void *pvUser); 114 114 static DECLCALLBACK(int) pgmR3GstPAEWriteHandlerCR3(PVM pVM, RTGCPHYS GCPhys, void *pvPhys, void *pvBuf, size_t cbBuf, PGMACCESSTYPE enmAccessType, void *pvUser); 115 static DECLCALLBACK(int) pgmR3GstPAEWriteHandlerPD(PVM pVM, RTGCPHYS GCPhys, void *pvPhys, void *pvBuf, size_t cbBuf, PGMACCESSTYPE enmAccessType, void *pvUser);116 115 #endif 117 116 … … 404 403 } 405 404 406 # if 0407 /**408 * Physical write access for Guest CR3.409 *410 * @returns VINF_SUCCESS if the handler have carried out the operation.411 * @returns VINF_PGM_HANDLER_DO_DEFAULT if the caller should carry out the access operation.412 * @param pVM VM Handle.413 * @param GCPhys The physical address the guest is writing to.414 * @param pvPhys The HC mapping of that address.415 * @param pvBuf What the guest is reading/writing.416 * @param cbBuf How much it's reading/writing.417 * @param enmAccessType The access type.418 * @param pvUser User argument.419 */420 static DECLCALLBACK(int) pgmR3GstPAEWriteHandlerPD(PVM pVM, RTGCPHYS GCPhys, void *pvPhys, void *pvBuf, size_t cbBuf, PGMACCESSTYPE enmAccessType, void *pvUser)421 {422 AssertMsg(!pVM->pgm.s.fMappingsFixed, ("Shouldn't be registered when mappings are fixed!\n"));423 Assert(enmAccessType == PGMACCESSTYPE_WRITE);424 Log2(("pgmR3GstPAEWriteHandlerPD: ff=%#x GCPhys=%RGp pvPhys=%p cbBuf=%d pvBuf={%.*Rhxs}\n", pVM->fForcedActions, GCPhys, pvPhys, cbBuf, cbBuf, pvBuf));425 426 /*427 * Do the write operation.428 */429 memcpy(pvPhys, pvBuf, cbBuf);430 if ( !pVM->pgm.s.fMappingsFixed431 && !VM_FF_ISPENDING(pVM, VM_FF_PGM_SYNC_CR3 | VM_FF_PGM_SYNC_CR3_NON_GLOBAL))432 {433 /*434 * Figure out which of the 4 PDs this is.435 */436 unsigned i;437 for (i = 0; i < 4; i++)438 if (pVM->pgm.s.pGstPaePdptHC->a[i].u == (GCPhys & X86_PTE_PAE_PG_MASK))439 {440 PX86PDPAE pPDSrc = pgmGstGetPaePD(&pVM->pgm.s, i << X86_PDPT_SHIFT);441 const RTGCPTR offPD = GCPhys & PAGE_OFFSET_MASK;442 const unsigned iPD1 = offPD / sizeof(X86PDEPAE);443 const unsigned iPD2 = (offPD + cbBuf - 1) / sizeof(X86PDEPAE);444 Assert(iPD1 - iPD2 <= 1);445 if ( ( pPDSrc->a[iPD1].n.u1Present446 && pgmGetMapping(pVM, (i << X86_PDPT_SHIFT) | (iPD1 << X86_PD_PAE_SHIFT)) )447 || ( iPD1 != iPD2448 && pPDSrc->a[iPD2].n.u1Present449 && pgmGetMapping(pVM, (i << X86_PDPT_SHIFT) | (iPD2 << X86_PD_PAE_SHIFT)) )450 )451 {452 Log(("pgmR3GstPaePD3WriteHandler: detected conflict. i=%d iPD1=%#x iPD2=%#x GCPhys=%RGp\n",453 i, iPD1, iPD2, GCPhys));454 STAM_COUNTER_INC(&pVM->pgm.s.StatR3GuestPDWriteConflict);455 VM_FF_SET(pVM, VM_FF_PGM_SYNC_CR3);456 }457 break; /* ASSUMES no duplicate entries... */458 }459 Assert(i < 4);460 }461 462 STAM_COUNTER_INC(&pVM->pgm.s.StatR3GuestPDWrite);463 return VINF_SUCCESS;464 }465 # endif466 467 405 #endif /* PAE */ 468 406 -
trunk/src/VBox/VMM/VMMAll/PGMAllBth.h
r16232 r16260 154 154 155 155 # ifdef VBOX_WITH_PGMPOOL_PAGING_ONLY 156 PX86PDPAE pPDDst; 156 157 # if PGM_GST_TYPE != PGM_TYPE_PAE 157 PX86PDPAE pPDDst;158 158 X86PDPE PdpeSrc; 159 159 … … 3234 3234 return VINF_SUCCESS; 3235 3235 3236 #elif PGM_SHW_TYPE == PGM_TYPE_AMD64 || defined(VBOX_WITH_PGMPOOL_PAGING_ONLY)3236 #elif PGM_SHW_TYPE == PGM_TYPE_AMD64 3237 3237 /* 3238 3238 * AMD64 (Shw & Gst) - No need to check all paging levels; we zero … … 3242 3242 3243 3243 #else /* PGM_SHW_TYPE != PGM_TYPE_NESTED && PGM_SHW_TYPE != PGM_TYPE_EPT && PGM_SHW_TYPE != PGM_TYPE_AMD64 */ 3244 3245 # ifdef VBOX_WITH_PGMPOOL_PAGING_ONLY 3246 /* Nothing to do when mappings are fixed. */ 3247 if (!pVM->pgm.s.fMappingsFixed) 3248 return VINF_SUCCESS; 3249 # endif 3250 3244 3251 /* 3245 3252 * PAE and 32-bit legacy mode (shadow). … … 3279 3286 PPGMPOOL pPool = pVM->pgm.s.CTX_SUFF(pPool); 3280 3287 3288 # ifdef VBOX_WITH_PGMPOOL_PAGING_ONLY 3289 /* Mappings are always enabled when we get here. */ 3290 Assert(pgmMapAreMappingsEnabled(&pVM->pgm.s)); 3291 pMapping = pVM->pgm.s.CTX_SUFF(pMappings); 3292 iPdNoMapping = (pMapping) ? (pMapping->GCPtr >> GST_PD_SHIFT) : ~0U; 3293 # else 3281 3294 /* Only check mappings if they are supposed to be put into the shadow page table. */ 3282 3295 if (pgmMapAreMappingsEnabled(&pVM->pgm.s)) … … 3290 3303 iPdNoMapping = ~0U; 3291 3304 } 3305 # endif 3292 3306 3293 3307 # if PGM_GST_TYPE == PGM_TYPE_PAE … … 3300 3314 PX86PDPT pPdptDst = pgmShwGetPaePDPTPtr(&pVM->pgm.s); 3301 3315 3316 # ifndef VBOX_WITH_PGMPOOL_PAGING_ONLY 3302 3317 if (pPDSrc == NULL) 3303 3318 { … … 3321 3336 continue; 3322 3337 } 3338 # endif /* !VBOX_WITH_PGMPOOL_PAGING_ONLY */ 3323 3339 # else /* PGM_GST_TYPE != PGM_TYPE_PAE */ 3324 3340 { … … 3358 3374 # endif 3359 3375 { 3376 # ifndef VBOX_WITH_PGMPOOL_PAGING_ONLY 3360 3377 if (pVM->pgm.s.fMappingsFixed) 3361 3378 { … … 3364 3381 Assert(PGM_GST_TYPE == PGM_TYPE_32BIT || (iPD + cPTs - 1) / X86_PG_PAE_ENTRIES == iPD / X86_PG_PAE_ENTRIES); 3365 3382 iPD += cPTs - 1; 3366 # if PGM_SHW_TYPE != PGM_GST_TYPE /* SHW==PAE && GST==32BIT */3383 # if PGM_SHW_TYPE != PGM_GST_TYPE /* SHW==PAE && GST==32BIT */ 3367 3384 pPDEDst = pgmShwGetPaePDEPtr(&pVM->pgm.s, (uint32_t)(iPD + 1) << GST_PD_SHIFT); 3368 # else3385 # else 3369 3386 pPDEDst += cPTs; 3370 # endif3387 # endif 3371 3388 pMapping = pMapping->CTX_SUFF(pNext); 3372 3389 iPdNoMapping = pMapping ? pMapping->GCPtr >> GST_PD_SHIFT : ~0U; 3373 3390 continue; 3374 3391 } 3392 # endif /* !VBOX_WITH_PGMPOOL_PAGING_ONLY */ 3375 3393 # ifdef IN_RING3 3376 3394 # if PGM_GST_TYPE == PGM_TYPE_32BIT … … 3398 3416 # endif /* (PGM_GST_TYPE != PGM_TYPE_32BIT && PGM_GST_TYPE != PGM_TYPE_PAE) || PGM_WITHOUT_MAPPINGS */ 3399 3417 3418 # ifndef VBOX_WITH_PGMPOOL_PAGING_ONLY 3400 3419 /* 3401 3420 * Sync page directory entry. … … 3486 3505 pPDEDst++; 3487 3506 } /* foreach 2MB PAE PDE in 4MB guest PDE */ 3507 # endif /* !VBOX_WITH_PGMPOOL_PAGING_ONLY */ 3488 3508 } 3489 3509 # if PGM_GST_TYPE == PGM_TYPE_PAE … … 3493 3513 # endif 3494 3514 { 3515 # ifndef VBOX_WITH_PGMPOOL_PAGING_ONLY 3495 3516 /* 3496 3517 * Check if there is any page directory to mark not present here. 3497 3518 */ 3498 # if PGM_SHW_TYPE == PGM_TYPE_PAE && PGM_GST_TYPE == PGM_TYPE_32BIT3519 # if PGM_SHW_TYPE == PGM_TYPE_PAE && PGM_GST_TYPE == PGM_TYPE_32BIT 3499 3520 for (unsigned i = 0, iPdShw = iPD * 2; i < 2; i++, iPdShw++) /* pray that the compiler unrolls this */ 3500 # elif PGM_GST_TYPE == PGM_TYPE_PAE3521 # elif PGM_GST_TYPE == PGM_TYPE_PAE 3501 3522 const unsigned iPdShw = iPD + iPdpt * X86_PG_PAE_ENTRIES; 3502 # else3523 # else 3503 3524 const unsigned iPdShw = iPD; 3504 # endif3525 # endif 3505 3526 { 3506 3527 if (pPDEDst->n.u1Present) … … 3512 3533 pPDEDst++; 3513 3534 } 3535 # endif /* !VBOX_WITH_PGMPOOL_PAGING_ONLY */ 3514 3536 } 3515 3537 else … … 3522 3544 3523 3545 Assert(pgmMapAreMappingsEnabled(&pVM->pgm.s)); 3546 # ifndef VBOX_WITH_PGMPOOL_PAGING_ONLY 3524 3547 if (pVM->pgm.s.fMappingsFixed) 3525 3548 { … … 3529 3552 } 3530 3553 else 3554 # endif 3531 3555 { 3532 3556 /*
Note:
See TracChangeset
for help on using the changeset viewer.

