Changeset 23453 in vbox for trunk/src/VBox/VMM/VMMAll
- Timestamp:
- Sep 30, 2009 9:55:25 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 53050
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/PGMAllPhys.cpp
r23398 r23453 432 432 * Deal with pages that are not writable, i.e. not in the ALLOCATED state. 433 433 * 434 * @returns VBox st atus code.434 * @returns VBox strict status code. 435 435 * @retval VINF_SUCCESS on success. 436 436 * @retval VINF_PGM_SYNC_CR3 on success and a page pool flush is pending. … … 476 476 * Wrapper for pgmPhysPageMakeWritable which enters the critsect. 477 477 * 478 * @returns VBox st atus code.478 * @returns VBox strict status code. 479 479 * @retval VINF_SUCCESS on success. 480 480 * @retval VINF_PGM_SYNC_CR3 on success and a page pool flush is pending. … … 509 509 * @param ppv Where to store the mapping address. 510 510 * 511 * @remarks Called from within the PGM critical section. 511 * @remarks Called from within the PGM critical section. The mapping is only 512 * valid while your inside this section. 512 513 */ 513 514 int pgmPhysPageMapByPageID(PVM pVM, uint32_t idPage, RTHCPHYS HCPhys, void **ppv) … … 596 597 * @remarks Called from within the PGM critical section. 597 598 */ 598 int pgmPhysPageMap(PVM pVM, PPGMPAGE pPage, RTGCPHYS GCPhys, PPPGMPAGEMAP ppMap, void **ppv)599 static int pgmPhysPageMapCommon(PVM pVM, PPGMPAGE pPage, RTGCPHYS GCPhys, PPPGMPAGEMAP ppMap, void **ppv) 599 600 { 600 601 Assert(PGMIsLocked(pVM)); … … 699 700 700 701 702 /** 703 * Combination of pgmPhysPageMakeWritable and pgmPhysPageMapWritable. 704 * 705 * This is typically used is paths where we cannot use the TLB methods (like ROM 706 * pages) or where there is no point in using them since we won't get many hits. 707 * 708 * @returns VBox strict status code. 709 * @retval VINF_SUCCESS on success. 710 * @retval VINF_PGM_SYNC_CR3 on success and a page pool flush is pending. 711 * @retval VERR_PGM_PHYS_PAGE_RESERVED it it's a valid page but has no physical backing. 712 * 713 * @param pVM The VM address. 714 * @param pPage The physical page tracking structure. 715 * @param GCPhys The address of the page. 716 * @param ppv Where to store the mapping address of the page. The page 717 * offset is masked off! 718 * 719 * @remarks Called from within the PGM critical section. The mapping is only 720 * valid while your inside this section. 721 */ 722 int pgmPhysPageMakeWritableAndMap(PVM pVM, PPGMPAGE pPage, RTGCPHYS GCPhys, void **ppv) 723 { 724 int rc = pgmPhysPageMakeWritable(pVM, pPage, GCPhys); 725 if (RT_SUCCESS(rc)) 726 { 727 AssertMsg(rc == VINF_SUCCESS || rc == VINF_PGM_SYNC_CR3 /* returned */, ("%Rrc\n", rc)); 728 PPGMPAGEMAP pMapIgnore; 729 int rc2 = pgmPhysPageMapCommon(pVM, pPage, GCPhys, &pMapIgnore, ppv); 730 if (RT_FAILURE(rc2)) /* preserve rc */ 731 rc = rc2; 732 } 733 return rc; 734 } 735 736 737 /** 738 * Maps a page into the current virtual address space so it can be accessed for 739 * both writing and reading. 740 * 741 * This is typically used is paths where we cannot use the TLB methods (like ROM 742 * pages) or where there is no point in using them since we won't get many hits. 743 * 744 * @returns VBox status code. 745 * @retval VINF_SUCCESS on success. 746 * @retval VERR_PGM_PHYS_PAGE_RESERVED it it's a valid page but has no physical backing. 747 * 748 * @param pVM The VM address. 749 * @param pPage The physical page tracking structure. Must be in the 750 * allocated state. 751 * @param GCPhys The address of the page. 752 * @param ppv Where to store the mapping address of the page. The page 753 * offset is masked off! 754 * 755 * @remarks Called from within the PGM critical section. The mapping is only 756 * valid while your inside this section. 757 */ 758 int pgmPhysPageMap(PVM pVM, PPGMPAGE pPage, RTGCPHYS GCPhys, void **ppv) 759 { 760 Assert(PGM_PAGE_GET_STATE(pPage) == PGM_PAGE_STATE_ALLOCATED); 761 PPGMPAGEMAP pMapIgnore; 762 return pgmPhysPageMapCommon(pVM, pPage, GCPhys, &pMapIgnore, ppv); 763 } 764 765 766 /** 767 * Maps a page into the current virtual address space so it can be accessed for 768 * reading. 769 * 770 * This is typically used is paths where we cannot use the TLB methods (like ROM 771 * pages) or where there is no point in using them since we won't get many hits. 772 * 773 * @returns VBox status code. 774 * @retval VINF_SUCCESS on success. 775 * @retval VERR_PGM_PHYS_PAGE_RESERVED it it's a valid page but has no physical backing. 776 * 777 * @param pVM The VM address. 778 * @param pPage The physical page tracking structure. 779 * @param GCPhys The address of the page. 780 * @param ppv Where to store the mapping address of the page. The page 781 * offset is masked off! 782 * 783 * @remarks Called from within the PGM critical section. The mapping is only 784 * valid while your inside this section. 785 */ 786 int pgmPhysPageMapReadOnly(PVM pVM, PPGMPAGE pPage, RTGCPHYS GCPhys, void const **ppv) 787 { 788 PPGMPAGEMAP pMapIgnore; 789 return pgmPhysPageMapCommon(pVM, pPage, GCPhys, &pMapIgnore, (void **)ppv); 790 } 791 792 701 793 #if !defined(IN_RC) && !defined(VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0) 702 794 /** … … 740 832 void *pv; 741 833 PPGMPAGEMAP pMap; 742 int rc = pgmPhysPageMap (PGM2VM(pPGM), pPage, GCPhys, &pMap, &pv);834 int rc = pgmPhysPageMapCommon(PGM2VM(pPGM), pPage, GCPhys, &pMap, &pv); 743 835 if (RT_FAILURE(rc)) 744 836 return rc; … … 782 874 void *pv; 783 875 PPGMPAGEMAP pMap; 784 int rc = pgmPhysPageMap (PGM2VM(pPGM), pPage, GCPhys, &pMap, &pv);876 int rc = pgmPhysPageMapCommon(PGM2VM(pPGM), pPage, GCPhys, &pMap, &pv); 785 877 if (RT_FAILURE(rc)) 786 878 return rc;
Note:
See TracChangeset
for help on using the changeset viewer.