Changeset 8533 in vbox for trunk/src/VBox/VMM/VMMAll/PGMAll.cpp
- Timestamp:
- May 2, 2008 4:04:51 PM (17 years ago)
- svn:sync-xref-src-repo-rev:
- 30437
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/PGMAll.cpp
r8386 r8533 640 640 } 641 641 642 #ifndef IN_GC 643 /** 644 * Gets the SHADOW page directory pointer for the specified address. Allocates 645 * backing pages in case the PDPT or page dirctory is missing. 646 * 647 * @returns VBox status. 648 * @param pVM VM handle. 649 * @param GCPtr The address. 650 * @param ppPD Receives address of page directory 651 */ 652 PGMDECL(int) PGMShwGetLongModePDPtr(PVM pVM, RTGCUINTPTR64 GCPtr, PX86PDPAE *ppPD) 653 { 654 PPGM pPGM = &pVM->pgm.s; 655 const unsigned iPml4e = (GCPtr >> X86_PML4_SHIFT) & X86_PML4_MASK; 656 PPGMPOOL pPool = pPGM->CTXSUFF(pPool); 657 PX86PML4E pPml4e; 658 PPGMPOOLPAGE pShwPage; 659 int rc; 660 661 pPml4e = &pPGM->pHCPaePML4->a[iPml4e]; 662 if ( !pPml4e->n.u1Present 663 && !(pPml4e->u & X86_PML4E_PG_MASK)) 664 { 665 PX86PML4E pPml4eGst = &pPGM->pGstPaePML4HC->a[iPml4e]; 666 667 Assert(!(pPml4e->u & X86_PML4E_PG_MASK)); 668 rc = pgmPoolAlloc(pVM, pPml4eGst->u & X86_PML4E_PG_MASK, PGMPOOLKIND_64BIT_PDPT_FOR_64BIT_PDPT, PGMPOOL_IDX_PML4, iPml4e, &pShwPage); 669 if (rc == VERR_PGM_POOL_FLUSHED) 670 return VINF_PGM_SYNC_CR3; 671 672 AssertRCReturn(rc, rc); 673 674 /* The PDPT was cached or created; hook it up now. */ 675 pPml4e->u |= pShwPage->Core.Key; 676 } 677 else 678 { 679 pShwPage = pgmPoolGetPage(pPool, pPml4e->u & X86_PML4E_PG_MASK); 680 AssertReturn(pShwPage, VERR_INTERNAL_ERROR); 681 } 682 683 const unsigned iPdPt = (GCPtr >> X86_PDPT_SHIFT) & X86_PDPT_MASK_AMD64; 684 PX86PDPT pPdpt = (PX86PDPT)PGMPOOL_PAGE_2_PTR(pVM, pShwPage); 685 PX86PDPE pPdpe = &pPdpt->a[iPdPt]; 686 687 if ( !pPdpe->n.u1Present 688 && !(pPdpe->u & X86_PDPE_PG_MASK)) 689 { 690 PX86PML4E pPml4eGst = &pPGM->pGstPaePML4HC->a[iPml4e]; 691 PX86PDPT pPdptGst; 692 rc = PGM_GCPHYS_2_PTR(pVM, pPml4eGst->u & X86_PML4E_PG_MASK, &pPdptGst); 693 AssertRCReturn(rc, rc); 694 695 Assert(!(pPdpe->u & X86_PDPE_PG_MASK)); 696 rc = pgmPoolAlloc(pVM, pPdptGst->a[iPdPt].u & X86_PDPE_PG_MASK, PGMPOOLKIND_64BIT_PD_FOR_64BIT_PD, PGMPOOL_IDX_PDPT, iPdPt, &pShwPage); 697 if (rc == VERR_PGM_POOL_FLUSHED) 698 return VINF_PGM_SYNC_CR3; 699 700 AssertRCReturn(rc, rc); 701 702 /* The PDPT was cached or created; hook it up now. */ 703 pPdpe->u |= pShwPage->Core.Key; 704 } 705 else 706 { 707 pShwPage = pgmPoolGetPage(pPool, pPdpe->u & X86_PDPE_PG_MASK); 708 AssertReturn(pShwPage, VERR_INTERNAL_ERROR); 709 } 710 711 *ppPD = (PX86PDPAE)PGMPOOL_PAGE_2_PTR(pVM, pShwPage); 712 return VINF_SUCCESS; 713 } 714 #endif 642 715 643 716 /**
Note:
See TracChangeset
for help on using the changeset viewer.