Changeset 36910 in vbox for trunk/src/VBox/VMM
- Timestamp:
- May 2, 2011 2:00:58 PM (14 years ago)
- svn:sync-xref-src-repo-rev:
- 71492
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR0/GMMR0.cpp
r36441 r36910 622 622 * Internal Functions * 623 623 *******************************************************************************/ 624 static DECLCALLBACK(int) gmmR0TermDestroyChunk(PAVLU32NODECORE pNode, void *pvGMM);625 static DECLCALLBACK(int) gmmR0CleanupVMScanChunk(PAVLU32NODECORE pNode, void *pvGMM);626 static DECLCALLBACK(int) gmmR0CleanupSharedModule(PAVLGCPTRNODECORE pNode, void *pvGVM);624 static DECLCALLBACK(int) gmmR0TermDestroyChunk(PAVLU32NODECORE pNode, void *pvGMM); 625 static DECLCALLBACK(int) gmmR0CleanupVMScanChunk(PAVLU32NODECORE pNode, void *pvGMM); 626 static DECLCALLBACK(int) gmmR0CleanupSharedModule(PAVLGCPTRNODECORE pNode, void *pvGVM); 627 627 /*static*/ DECLCALLBACK(int) gmmR0CleanupVMDestroyChunk(PAVLU32NODECORE pNode, void *pvGVM); 628 DECLINLINE(void) gmmR0LinkChunk(PGMMCHUNK pChunk, PGMMCHUNKFREESET pSet);629 DECLINLINE(void) gmmR0UnlinkChunk(PGMMCHUNK pChunk);630 static uint32_t gmmR0SanityCheck(PGMM pGMM, const char *pszFunction, unsigned uLineNo);631 static void gmmR0FreeChunk(PGMM pGMM, PGVM pGVM, PGMMCHUNK pChunk);632 static void gmmR0FreeSharedPage(PGMM pGMM, uint32_t idPage, PGMMPAGE pPage);633 static int gmmR0UnmapChunk(PGMM pGMM, PGVM pGVM, PGMMCHUNK pChunk);628 DECLINLINE(void) gmmR0LinkChunk(PGMMCHUNK pChunk, PGMMCHUNKFREESET pSet); 629 DECLINLINE(void) gmmR0UnlinkChunk(PGMMCHUNK pChunk); 630 static uint32_t gmmR0SanityCheck(PGMM pGMM, const char *pszFunction, unsigned uLineNo); 631 static void gmmR0FreeChunk(PGMM pGMM, PGVM pGVM, PGMMCHUNK pChunk); 632 static void gmmR0FreeSharedPage(PGMM pGMM, uint32_t idPage, PGMMPAGE pPage); 633 static int gmmR0UnmapChunk(PGMM pGMM, PGVM pGVM, PGMMCHUNK pChunk); 634 634 635 635 -
trunk/src/VBox/VMM/include/PGMInternal.h
r36905 r36910 322 322 * 323 323 * @param pVCpu The current CPU. 324 * @param p PageThe pool page.324 * @param pvPage The pool page. 325 325 */ 326 326 #if defined(IN_RC) || defined(VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0) … … 341 341 * 342 342 * @param pVM The VM handle. 343 * @param p PageThe pool page.343 * @param pvPage The pool page. 344 344 */ 345 345 #define PGM_DYNMAP_UNUSED_HINT_VM(pVM, pvPage) PGM_DYNMAP_UNUSED_HINT(VMMGetCpu(pVM), pvPage) … … 739 739 /** 740 740 * Clears the page structure. 741 * @param pPagePointer to the physical guest page tracking structure.742 */ 743 #define PGM_PAGE_CLEAR( pPage) \741 * @param a_pPage Pointer to the physical guest page tracking structure. 742 */ 743 #define PGM_PAGE_CLEAR(a_pPage) \ 744 744 do { \ 745 ( pPage)->HCPhysAndPageID = 0; \746 ( pPage)->uStateY = 0; \747 ( pPage)->uTypeY = 0; \748 ( pPage)->uPteIdx = 0; \749 ( pPage)->u16MiscY.u = 0; \750 ( pPage)->u16TrackingY = 0; \751 ( pPage)->cReadLocksY = 0; \752 ( pPage)->cWriteLocksY = 0; \745 (a_pPage)->HCPhysAndPageID = 0; \ 746 (a_pPage)->uStateY = 0; \ 747 (a_pPage)->uTypeY = 0; \ 748 (a_pPage)->uPteIdx = 0; \ 749 (a_pPage)->u16MiscY.u = 0; \ 750 (a_pPage)->u16TrackingY = 0; \ 751 (a_pPage)->cReadLocksY = 0; \ 752 (a_pPage)->cWriteLocksY = 0; \ 753 753 } while (0) 754 754 755 755 /** 756 756 * Initializes the page structure. 757 * @param pPagePointer to the physical guest page tracking structure.758 */ 759 #define PGM_PAGE_INIT( pPage, _HCPhys, _idPage, _uType,_uState) \757 * @param a_pPage Pointer to the physical guest page tracking structure. 758 */ 759 #define PGM_PAGE_INIT(a_pPage, a_HCPhys, a_idPage, a_uType, a_uState) \ 760 760 do { \ 761 RTHCPHYS SetHCPhysTmp = ( _HCPhys); \761 RTHCPHYS SetHCPhysTmp = (a_HCPhys); \ 762 762 AssertFatal(!(SetHCPhysTmp & ~UINT64_C(0x0000fffffffff000))); \ 763 ( pPage)->HCPhysAndPageID = (SetHCPhysTmp << (28-12)) | ((_idPage) & UINT32_C(0x0fffffff)); \764 ( pPage)->uStateY = (_uState); \765 ( pPage)->uTypeY = (_uType); \766 ( pPage)->uPteIdx= 0; \767 ( pPage)->u16MiscY.u= 0; \768 ( pPage)->u16TrackingY= 0; \769 ( pPage)->cReadLocksY= 0; \770 ( pPage)->cWriteLocksY= 0; \763 (a_pPage)->HCPhysAndPageID = (SetHCPhysTmp << (28-12)) | ((a_idPage) & UINT32_C(0x0fffffff)); \ 764 (a_pPage)->uStateY = (a_uState); \ 765 (a_pPage)->uTypeY = (a_uType); \ 766 (a_pPage)->uPteIdx = 0; \ 767 (a_pPage)->u16MiscY.u = 0; \ 768 (a_pPage)->u16TrackingY = 0; \ 769 (a_pPage)->cReadLocksY = 0; \ 770 (a_pPage)->cWriteLocksY = 0; \ 771 771 } while (0) 772 772 773 773 /** 774 774 * Initializes the page structure of a ZERO page. 775 * @param pPagePointer to the physical guest page tracking structure.776 * @param pVMThe VM handle (for getting the zero page address).777 * @param uTypeThe page type (PGMPAGETYPE).778 */ 779 #define PGM_PAGE_INIT_ZERO( pPage, pVM,uType) \780 PGM_PAGE_INIT(( pPage), (pVM)->pgm.s.HCPhysZeroPg, NIL_GMM_PAGEID, (uType), PGM_PAGE_STATE_ZERO)775 * @param a_pPage Pointer to the physical guest page tracking structure. 776 * @param a_pVM The VM handle (for getting the zero page address). 777 * @param a_uType The page type (PGMPAGETYPE). 778 */ 779 #define PGM_PAGE_INIT_ZERO(a_pPage, a_pVM, a_uType) \ 780 PGM_PAGE_INIT((a_pPage), (a_pVM)->pgm.s.HCPhysZeroPg, NIL_GMM_PAGEID, (a_uType), PGM_PAGE_STATE_ZERO) 781 781 782 782 … … 807 807 * Gets the page state. 808 808 * @returns page state (PGM_PAGE_STATE_*). 809 * @param pPagePointer to the physical guest page tracking structure.810 */ 811 #define PGM_PAGE_GET_STATE( pPage) ( (pPage)->uStateY )809 * @param a_pPage Pointer to the physical guest page tracking structure. 810 */ 811 #define PGM_PAGE_GET_STATE(a_pPage) ( (a_pPage)->uStateY ) 812 812 813 813 /** 814 814 * Sets the page state. 815 * @param pPagePointer to the physical guest page tracking structure.816 * @param _uStateThe new page state.817 */ 818 #define PGM_PAGE_SET_STATE( pPage, _uState) do { (pPage)->uStateY = (_uState); } while (0)815 * @param a_pPage Pointer to the physical guest page tracking structure. 816 * @param a_uState The new page state. 817 */ 818 #define PGM_PAGE_SET_STATE(a_pPage, a_uState) do { (a_pPage)->uStateY = (a_uState); } while (0) 819 819 820 820 … … 822 822 * Gets the host physical address of the guest page. 823 823 * @returns host physical address (RTHCPHYS). 824 * @param pPagePointer to the physical guest page tracking structure.825 */ 826 #define PGM_PAGE_GET_HCPHYS( pPage) ( ((pPage)->HCPhysAndPageID >> 28) << 12 )824 * @param a_pPage Pointer to the physical guest page tracking structure. 825 */ 826 #define PGM_PAGE_GET_HCPHYS(a_pPage) ( ((a_pPage)->HCPhysAndPageID >> 28) << 12 ) 827 827 828 828 /** 829 829 * Sets the host physical address of the guest page. 830 * @param pPagePointer to the physical guest page tracking structure.831 * @param _HCPhys The new host physical address.832 */ 833 #define PGM_PAGE_SET_HCPHYS( pPage,_HCPhys) \830 * @param a_pPage Pointer to the physical guest page tracking structure. 831 * @param a_HCPhys The new host physical address. 832 */ 833 #define PGM_PAGE_SET_HCPHYS(a_pPage, a_HCPhys) \ 834 834 do { \ 835 RTHCPHYS SetHCPhysTmp = (_HCPhys); \835 RTHCPHYS const SetHCPhysTmp = (a_HCPhys); \ 836 836 AssertFatal(!(SetHCPhysTmp & ~UINT64_C(0x0000fffffffff000))); \ 837 ( pPage)->HCPhysAndPageID = ((pPage)->HCPhysAndPageID & UINT32_C(0x0fffffff)) \838 | (SetHCPhysTmp << (28-12)); \837 (a_pPage)->HCPhysAndPageID = ((a_pPage)->HCPhysAndPageID & UINT32_C(0x0fffffff)) \ 838 | (SetHCPhysTmp << (28-12)); \ 839 839 } while (0) 840 840 … … 842 842 * Get the Page ID. 843 843 * @returns The Page ID; NIL_GMM_PAGEID if it's a ZERO page. 844 * @param pPagePointer to the physical guest page tracking structure.845 */ 846 #define PGM_PAGE_GET_PAGEID( pPage) ( (uint32_t)((pPage)->HCPhysAndPageID & UINT32_C(0x0fffffff)) )844 * @param a_pPage Pointer to the physical guest page tracking structure. 845 */ 846 #define PGM_PAGE_GET_PAGEID(a_pPage) ( (uint32_t)((a_pPage)->HCPhysAndPageID & UINT32_C(0x0fffffff)) ) 847 847 848 848 /** 849 849 * Sets the Page ID. 850 * @param pPage Pointer to the physical guest page tracking structure. 851 */ 852 #define PGM_PAGE_SET_PAGEID(pPage, _idPage) \ 850 * @param a_pPage Pointer to the physical guest page tracking structure. 851 * @param a_idPage The new page ID. 852 */ 853 #define PGM_PAGE_SET_PAGEID(a_pPage, a_idPage) \ 853 854 do { \ 854 ( pPage)->HCPhysAndPageID = (((pPage)->HCPhysAndPageID) & UINT64_C(0xfffffffff0000000)) \855 | ((_idPage) & UINT32_C(0x0fffffff)); \855 (a_pPage)->HCPhysAndPageID = (((a_pPage)->HCPhysAndPageID) & UINT64_C(0xfffffffff0000000)) \ 856 | ((a_idPage) & UINT32_C(0x0fffffff)); \ 856 857 } while (0) 857 858 … … 859 860 * Get the Chunk ID. 860 861 * @returns The Chunk ID; NIL_GMM_CHUNKID if it's a ZERO page. 861 * @param pPagePointer to the physical guest page tracking structure.862 */ 863 #define PGM_PAGE_GET_CHUNKID( pPage) ( PGM_PAGE_GET_PAGEID(pPage) >> GMM_CHUNKID_SHIFT )862 * @param a_pPage Pointer to the physical guest page tracking structure. 863 */ 864 #define PGM_PAGE_GET_CHUNKID(a_pPage) ( PGM_PAGE_GET_PAGEID(a_pPage) >> GMM_CHUNKID_SHIFT ) 864 865 865 866 /** 866 867 * Get the index of the page within the allocation chunk. 867 868 * @returns The page index. 868 * @param pPagePointer to the physical guest page tracking structure.869 */ 870 #define PGM_PAGE_GET_PAGE_IN_CHUNK( pPage) ( (uint32_t)((pPage)->HCPhysAndPageID & GMM_PAGEID_IDX_MASK) )869 * @param a_pPage Pointer to the physical guest page tracking structure. 870 */ 871 #define PGM_PAGE_GET_PAGE_IN_CHUNK(a_pPage) ( (uint32_t)((a_pPage)->HCPhysAndPageID & GMM_PAGEID_IDX_MASK) ) 871 872 872 873 /** 873 874 * Gets the page type. 874 875 * @returns The page type. 875 * @param pPagePointer to the physical guest page tracking structure.876 */ 877 #define PGM_PAGE_GET_TYPE( pPage) (pPage)->uTypeY876 * @param a_pPage Pointer to the physical guest page tracking structure. 877 */ 878 #define PGM_PAGE_GET_TYPE(a_pPage) (a_pPage)->uTypeY 878 879 879 880 /** 880 881 * Sets the page type. 881 * @param pPagePointer to the physical guest page tracking structure.882 * @param _enmTypeThe new page type (PGMPAGETYPE).883 */ 884 #define PGM_PAGE_SET_TYPE( pPage, _enmType) do { (pPage)->uTypeY = (_enmType); } while (0)882 * @param a_pPage Pointer to the physical guest page tracking structure. 883 * @param a_enmType The new page type (PGMPAGETYPE). 884 */ 885 #define PGM_PAGE_SET_TYPE(a_pPage, a_enmType) do { (a_pPage)->uTypeY = (a_enmType); } while (0) 885 886 886 887 /** 887 888 * Gets the page table index 888 889 * @returns The page table index. 889 * @param pPagePointer to the physical guest page tracking structure.890 */ 891 #define PGM_PAGE_GET_PTE_INDEX( pPage) (pPage)->uPteIdx892 893 /** 894 * Sets the page table index 895 * @param pPagePointer to the physical guest page tracking structure.896 * @param iPteNew page table index.897 */ 898 #define PGM_PAGE_SET_PTE_INDEX( pPage, _iPte) do { (pPage)->uPteIdx = (_iPte); } while (0)890 * @param a_pPage Pointer to the physical guest page tracking structure. 891 */ 892 #define PGM_PAGE_GET_PTE_INDEX(a_pPage) (a_pPage)->uPteIdx 893 894 /** 895 * Sets the page table index. 896 * @param a_pPage Pointer to the physical guest page tracking structure. 897 * @param a_iPte New page table index. 898 */ 899 #define PGM_PAGE_SET_PTE_INDEX(a_pPage, a_iPte) do { (a_pPage)->uPteIdx = (a_iPte); } while (0) 899 900 900 901 /** 901 902 * Checks if the page is marked for MMIO. 902 903 * @returns true/false. 903 * @param pPagePointer to the physical guest page tracking structure.904 */ 905 #define PGM_PAGE_IS_MMIO( pPage) ( (pPage)->uTypeY == PGMPAGETYPE_MMIO )904 * @param a_pPage Pointer to the physical guest page tracking structure. 905 */ 906 #define PGM_PAGE_IS_MMIO(a_pPage) ( (a_pPage)->uTypeY == PGMPAGETYPE_MMIO ) 906 907 907 908 /** 908 909 * Checks if the page is backed by the ZERO page. 909 910 * @returns true/false. 910 * @param pPagePointer to the physical guest page tracking structure.911 */ 912 #define PGM_PAGE_IS_ZERO( pPage) ( (pPage)->uStateY == PGM_PAGE_STATE_ZERO )911 * @param a_pPage Pointer to the physical guest page tracking structure. 912 */ 913 #define PGM_PAGE_IS_ZERO(a_pPage) ( (a_pPage)->uStateY == PGM_PAGE_STATE_ZERO ) 913 914 914 915 /** 915 916 * Checks if the page is backed by a SHARED page. 916 917 * @returns true/false. 917 * @param pPagePointer to the physical guest page tracking structure.918 */ 919 #define PGM_PAGE_IS_SHARED( pPage) ( (pPage)->uStateY == PGM_PAGE_STATE_SHARED )918 * @param a_pPage Pointer to the physical guest page tracking structure. 919 */ 920 #define PGM_PAGE_IS_SHARED(a_pPage) ( (a_pPage)->uStateY == PGM_PAGE_STATE_SHARED ) 920 921 921 922 /** 922 923 * Checks if the page is ballooned. 923 924 * @returns true/false. 924 * @param pPagePointer to the physical guest page tracking structure.925 */ 926 #define PGM_PAGE_IS_BALLOONED( pPage) ( (pPage)->uStateY == PGM_PAGE_STATE_BALLOONED )925 * @param a_pPage Pointer to the physical guest page tracking structure. 926 */ 927 #define PGM_PAGE_IS_BALLOONED(a_pPage) ( (a_pPage)->uStateY == PGM_PAGE_STATE_BALLOONED ) 927 928 928 929 /** 929 930 * Checks if the page is allocated. 930 931 * @returns true/false. 931 * @param pPagePointer to the physical guest page tracking structure.932 */ 933 #define PGM_PAGE_IS_ALLOCATED( pPage) ( (pPage)->uStateY == PGM_PAGE_STATE_ALLOCATED )932 * @param a_pPage Pointer to the physical guest page tracking structure. 933 */ 934 #define PGM_PAGE_IS_ALLOCATED(a_pPage) ( (a_pPage)->uStateY == PGM_PAGE_STATE_ALLOCATED ) 934 935 935 936 /** 936 937 * Marks the page as written to (for GMM change monitoring). 937 * @param pPagePointer to the physical guest page tracking structure.938 */ 939 #define PGM_PAGE_SET_WRITTEN_TO( pPage) do { (pPage)->u16MiscY.au8[1] |= UINT8_C(0x80); } while (0)938 * @param a_pPage Pointer to the physical guest page tracking structure. 939 */ 940 #define PGM_PAGE_SET_WRITTEN_TO(a_pPage) do { (a_pPage)->u16MiscY.au8[1] |= UINT8_C(0x80); } while (0) 940 941 941 942 /** 942 943 * Clears the written-to indicator. 943 * @param pPagePointer to the physical guest page tracking structure.944 */ 945 #define PGM_PAGE_CLEAR_WRITTEN_TO( pPage) do { (pPage)->u16MiscY.au8[1] &= UINT8_C(0x7f); } while (0)944 * @param a_pPage Pointer to the physical guest page tracking structure. 945 */ 946 #define PGM_PAGE_CLEAR_WRITTEN_TO(a_pPage) do { (a_pPage)->u16MiscY.au8[1] &= UINT8_C(0x7f); } while (0) 946 947 947 948 /** 948 949 * Checks if the page was marked as written-to. 949 950 * @returns true/false. 950 * @param pPagePointer to the physical guest page tracking structure.951 */ 952 #define PGM_PAGE_IS_WRITTEN_TO( pPage) ( !!((pPage)->u16MiscY.au8[1] & UINT8_C(0x80)) )951 * @param a_pPage Pointer to the physical guest page tracking structure. 952 */ 953 #define PGM_PAGE_IS_WRITTEN_TO(a_pPage) ( !!((a_pPage)->u16MiscY.au8[1] & UINT8_C(0x80)) ) 953 954 954 955 /** 955 956 * Marks the page as dirty for FTM 956 * @param pPagePointer to the physical guest page tracking structure.957 */ 958 #define PGM_PAGE_SET_FT_DIRTY( pPage) do { (pPage)->u16MiscY.au8[1] |= UINT8_C(0x04); } while (0)957 * @param a_pPage Pointer to the physical guest page tracking structure. 958 */ 959 #define PGM_PAGE_SET_FT_DIRTY(a_pPage) do { (a_pPage)->u16MiscY.au8[1] |= UINT8_C(0x04); } while (0) 959 960 960 961 /** 961 962 * Clears the FTM dirty indicator 962 * @param pPagePointer to the physical guest page tracking structure.963 */ 964 #define PGM_PAGE_CLEAR_FT_DIRTY( pPage) do { (pPage)->u16MiscY.au8[1] &= UINT8_C(0xfb); } while (0)963 * @param a_pPage Pointer to the physical guest page tracking structure. 964 */ 965 #define PGM_PAGE_CLEAR_FT_DIRTY(a_pPage) do { (a_pPage)->u16MiscY.au8[1] &= UINT8_C(0xfb); } while (0) 965 966 966 967 /** 967 968 * Checks if the page was marked as dirty for FTM 968 969 * @returns true/false. 969 * @param pPagePointer to the physical guest page tracking structure.970 */ 971 #define PGM_PAGE_IS_FT_DIRTY( pPage) ( !!((pPage)->u16MiscY.au8[1] & UINT8_C(0x04)) )970 * @param a_pPage Pointer to the physical guest page tracking structure. 971 */ 972 #define PGM_PAGE_IS_FT_DIRTY(a_pPage) ( !!((a_pPage)->u16MiscY.au8[1] & UINT8_C(0x04)) ) 972 973 973 974 … … 976 977 * @{ */ 977 978 /** Either as a PT or PDE. */ 978 #define PGM_PAGE_PDE_TYPE_DONTCARE 0979 #define PGM_PAGE_PDE_TYPE_DONTCARE 0 979 980 /** Must use a page table to map the range. */ 980 #define PGM_PAGE_PDE_TYPE_PT 1981 #define PGM_PAGE_PDE_TYPE_PT 1 981 982 /** Can use a page directory entry to map the continuous range. */ 982 #define PGM_PAGE_PDE_TYPE_PDE 2983 #define PGM_PAGE_PDE_TYPE_PDE 2 983 984 /** Can use a page directory entry to map the continuous range - temporarily disabled (by page monitoring). */ 984 #define PGM_PAGE_PDE_TYPE_PDE_DISABLED 3985 #define PGM_PAGE_PDE_TYPE_PDE_DISABLED 3 985 986 /** @} */ 986 987 987 988 /** 988 989 * Set the PDE type of the page 989 * @param pPagePointer to the physical guest page tracking structure.990 * @param uType PGM_PAGE_PDE_TYPE_*991 */ 992 #define PGM_PAGE_SET_PDE_TYPE( pPage,uType) \990 * @param a_pPage Pointer to the physical guest page tracking structure. 991 * @param a_uType PGM_PAGE_PDE_TYPE_*. 992 */ 993 #define PGM_PAGE_SET_PDE_TYPE(a_pPage, a_uType) \ 993 994 do { \ 994 ( pPage)->u16MiscY.au8[1] = ((pPage)->u16MiscY.au8[1] & UINT8_C(0x9f)) \995 | (((uType) & UINT8_C(0x03)) << 5); \995 (a_pPage)->u16MiscY.au8[1] = ((a_pPage)->u16MiscY.au8[1] & UINT8_C(0x9f)) \ 996 | (((a_uType) & UINT8_C(0x03)) << 5); \ 996 997 } while (0) 997 998 … … 999 1000 * Checks if the page was marked being part of a large page 1000 1001 * @returns true/false. 1001 * @param pPagePointer to the physical guest page tracking structure.1002 */ 1003 #define PGM_PAGE_GET_PDE_TYPE( pPage) ( ((pPage)->u16MiscY.au8[1] & UINT8_C(0x60)) >> 5)1002 * @param a_pPage Pointer to the physical guest page tracking structure. 1003 */ 1004 #define PGM_PAGE_GET_PDE_TYPE(a_pPage) ( ((a_pPage)->u16MiscY.au8[1] & UINT8_C(0x60)) >> 5) 1004 1005 1005 1006 /** Enabled optimized access handler tests. … … 1008 1009 * code. 1009 1010 */ 1010 #define PGM_PAGE_WITH_OPTIMIZED_HANDLER_ACCESS 11011 #define PGM_PAGE_WITH_OPTIMIZED_HANDLER_ACCESS 1 1011 1012 1012 1013 /** @name Physical Access Handler State values (PGMPAGE::u2HandlerPhysStateY). … … 1016 1017 * @{ */ 1017 1018 /** No handler installed. */ 1018 #define PGM_PAGE_HNDL_PHYS_STATE_NONE 01019 #define PGM_PAGE_HNDL_PHYS_STATE_NONE 0 1019 1020 /** Monitoring is temporarily disabled. */ 1020 #define PGM_PAGE_HNDL_PHYS_STATE_DISABLED 11021 #define PGM_PAGE_HNDL_PHYS_STATE_DISABLED 1 1021 1022 /** Write access is monitored. */ 1022 #define PGM_PAGE_HNDL_PHYS_STATE_WRITE 21023 #define PGM_PAGE_HNDL_PHYS_STATE_WRITE 2 1023 1024 /** All access is monitored. */ 1024 #define PGM_PAGE_HNDL_PHYS_STATE_ALL 31025 #define PGM_PAGE_HNDL_PHYS_STATE_ALL 3 1025 1026 /** @} */ 1026 1027 … … 1028 1029 * Gets the physical access handler state of a page. 1029 1030 * @returns PGM_PAGE_HNDL_PHYS_STATE_* value. 1030 * @param pPage Pointer to the physical guest page tracking structure. 1031 */ 1032 #define PGM_PAGE_GET_HNDL_PHYS_STATE(pPage) \ 1033 ( (pPage)->u16MiscY.au8[0] ) 1031 * @param a_pPage Pointer to the physical guest page tracking structure. 1032 */ 1033 #define PGM_PAGE_GET_HNDL_PHYS_STATE(a_pPage) ( (a_pPage)->u16MiscY.au8[0] ) 1034 1034 1035 1035 /** 1036 1036 * Sets the physical access handler state of a page. 1037 * @param pPagePointer to the physical guest page tracking structure.1038 * @param _uStateThe new state value.1039 */ 1040 #define PGM_PAGE_SET_HNDL_PHYS_STATE( pPage,_uState) \1041 do { ( pPage)->u16MiscY.au8[0] = (_uState); } while (0)1037 * @param a_pPage Pointer to the physical guest page tracking structure. 1038 * @param a_uState The new state value. 1039 */ 1040 #define PGM_PAGE_SET_HNDL_PHYS_STATE(a_pPage, a_uState) \ 1041 do { (a_pPage)->u16MiscY.au8[0] = (a_uState); } while (0) 1042 1042 1043 1043 /** 1044 1044 * Checks if the page has any physical access handlers, including temporarily disabled ones. 1045 1045 * @returns true/false 1046 * @param pPagePointer to the physical guest page tracking structure.1047 */ 1048 #define PGM_PAGE_HAS_ANY_PHYSICAL_HANDLERS( pPage) \1049 ( PGM_PAGE_GET_HNDL_PHYS_STATE( pPage) != PGM_PAGE_HNDL_PHYS_STATE_NONE )1046 * @param a_pPage Pointer to the physical guest page tracking structure. 1047 */ 1048 #define PGM_PAGE_HAS_ANY_PHYSICAL_HANDLERS(a_pPage) \ 1049 ( PGM_PAGE_GET_HNDL_PHYS_STATE(a_pPage) != PGM_PAGE_HNDL_PHYS_STATE_NONE ) 1050 1050 1051 1051 /** 1052 1052 * Checks if the page has any active physical access handlers. 1053 1053 * @returns true/false 1054 * @param pPagePointer to the physical guest page tracking structure.1055 */ 1056 #define PGM_PAGE_HAS_ACTIVE_PHYSICAL_HANDLERS( pPage) \1057 ( PGM_PAGE_GET_HNDL_PHYS_STATE( pPage) >= PGM_PAGE_HNDL_PHYS_STATE_WRITE )1054 * @param a_pPage Pointer to the physical guest page tracking structure. 1055 */ 1056 #define PGM_PAGE_HAS_ACTIVE_PHYSICAL_HANDLERS(a_pPage) \ 1057 ( PGM_PAGE_GET_HNDL_PHYS_STATE(a_pPage) >= PGM_PAGE_HNDL_PHYS_STATE_WRITE ) 1058 1058 1059 1059 … … 1064 1064 * @{ */ 1065 1065 /** No handler installed. */ 1066 #define PGM_PAGE_HNDL_VIRT_STATE_NONE 01066 #define PGM_PAGE_HNDL_VIRT_STATE_NONE 0 1067 1067 /* 1 is reserved so the lineup is identical with the physical ones. */ 1068 1068 /** Write access is monitored. */ 1069 #define PGM_PAGE_HNDL_VIRT_STATE_WRITE 21069 #define PGM_PAGE_HNDL_VIRT_STATE_WRITE 2 1070 1070 /** All access is monitored. */ 1071 #define PGM_PAGE_HNDL_VIRT_STATE_ALL 31071 #define PGM_PAGE_HNDL_VIRT_STATE_ALL 3 1072 1072 /** @} */ 1073 1073 … … 1075 1075 * Gets the virtual access handler state of a page. 1076 1076 * @returns PGM_PAGE_HNDL_VIRT_STATE_* value. 1077 * @param pPagePointer to the physical guest page tracking structure.1078 */ 1079 #define PGM_PAGE_GET_HNDL_VIRT_STATE( pPage) ((uint8_t)( (pPage)->u16MiscY.au8[1] & UINT8_C(0x03) ))1077 * @param a_pPage Pointer to the physical guest page tracking structure. 1078 */ 1079 #define PGM_PAGE_GET_HNDL_VIRT_STATE(a_pPage) ((uint8_t)( (a_pPage)->u16MiscY.au8[1] & UINT8_C(0x03) )) 1080 1080 1081 1081 /** 1082 1082 * Sets the virtual access handler state of a page. 1083 * @param pPagePointer to the physical guest page tracking structure.1084 * @param _uStateThe new state value.1085 */ 1086 #define PGM_PAGE_SET_HNDL_VIRT_STATE( pPage,_uState) \1083 * @param a_pPage Pointer to the physical guest page tracking structure. 1084 * @param a_uState The new state value. 1085 */ 1086 #define PGM_PAGE_SET_HNDL_VIRT_STATE(a_pPage, a_uState) \ 1087 1087 do { \ 1088 ( pPage)->u16MiscY.au8[1] = ((pPage)->u16MiscY.au8[1] & UINT8_C(0xfc)) \1089 | ((_uState)& UINT8_C(0x03)); \1088 (a_pPage)->u16MiscY.au8[1] = ((a_pPage)->u16MiscY.au8[1] & UINT8_C(0xfc)) \ 1089 | ((a_uState) & UINT8_C(0x03)); \ 1090 1090 } while (0) 1091 1091 … … 1093 1093 * Checks if the page has any virtual access handlers. 1094 1094 * @returns true/false 1095 * @param pPagePointer to the physical guest page tracking structure.1096 */ 1097 #define PGM_PAGE_HAS_ANY_VIRTUAL_HANDLERS( pPage) \1098 ( PGM_PAGE_GET_HNDL_VIRT_STATE( pPage) != PGM_PAGE_HNDL_VIRT_STATE_NONE )1095 * @param a_pPage Pointer to the physical guest page tracking structure. 1096 */ 1097 #define PGM_PAGE_HAS_ANY_VIRTUAL_HANDLERS(a_pPage) \ 1098 ( PGM_PAGE_GET_HNDL_VIRT_STATE(a_pPage) != PGM_PAGE_HNDL_VIRT_STATE_NONE ) 1099 1099 1100 1100 /** … … 1102 1102 * virtual handlers. 1103 1103 * @returns true/false 1104 * @param pPagePointer to the physical guest page tracking structure.1105 */ 1106 #define PGM_PAGE_HAS_ACTIVE_VIRTUAL_HANDLERS( pPage) \1107 PGM_PAGE_HAS_ANY_VIRTUAL_HANDLERS( pPage)1104 * @param a_pPage Pointer to the physical guest page tracking structure. 1105 */ 1106 #define PGM_PAGE_HAS_ACTIVE_VIRTUAL_HANDLERS(a_pPage) \ 1107 PGM_PAGE_HAS_ANY_VIRTUAL_HANDLERS(a_pPage) 1108 1108 1109 1109 … … 1111 1111 * Checks if the page has any access handlers, including temporarily disabled ones. 1112 1112 * @returns true/false 1113 * @param pPagePointer to the physical guest page tracking structure.1113 * @param a_pPage Pointer to the physical guest page tracking structure. 1114 1114 */ 1115 1115 #ifdef PGM_PAGE_WITH_OPTIMIZED_HANDLER_ACCESS 1116 # define PGM_PAGE_HAS_ANY_HANDLERS( pPage) \1117 ( (( pPage)->u16MiscY.u & UINT16_C(0x0303)) != 0 )1116 # define PGM_PAGE_HAS_ANY_HANDLERS(a_pPage) \ 1117 ( ((a_pPage)->u16MiscY.u & UINT16_C(0x0303)) != 0 ) 1118 1118 #else 1119 # define PGM_PAGE_HAS_ANY_HANDLERS( pPage) \1120 ( PGM_PAGE_GET_HNDL_PHYS_STATE( pPage) != PGM_PAGE_HNDL_PHYS_STATE_NONE \1121 || PGM_PAGE_GET_HNDL_VIRT_STATE( pPage) != PGM_PAGE_HNDL_VIRT_STATE_NONE )1119 # define PGM_PAGE_HAS_ANY_HANDLERS(a_pPage) \ 1120 ( PGM_PAGE_GET_HNDL_PHYS_STATE(a_pPage) != PGM_PAGE_HNDL_PHYS_STATE_NONE \ 1121 || PGM_PAGE_GET_HNDL_VIRT_STATE(a_pPage) != PGM_PAGE_HNDL_VIRT_STATE_NONE ) 1122 1122 #endif 1123 1123 … … 1125 1125 * Checks if the page has any active access handlers. 1126 1126 * @returns true/false 1127 * @param pPagePointer to the physical guest page tracking structure.1127 * @param a_pPage Pointer to the physical guest page tracking structure. 1128 1128 */ 1129 1129 #ifdef PGM_PAGE_WITH_OPTIMIZED_HANDLER_ACCESS 1130 # define PGM_PAGE_HAS_ACTIVE_HANDLERS( pPage) \1131 ( (( pPage)->u16MiscY.u & UINT16_C(0x0202)) != 0 )1130 # define PGM_PAGE_HAS_ACTIVE_HANDLERS(a_pPage) \ 1131 ( ((a_pPage)->u16MiscY.u & UINT16_C(0x0202)) != 0 ) 1132 1132 #else 1133 # define PGM_PAGE_HAS_ACTIVE_HANDLERS( pPage) \1134 ( PGM_PAGE_GET_HNDL_PHYS_STATE( pPage) >= PGM_PAGE_HNDL_PHYS_STATE_WRITE \1135 || PGM_PAGE_GET_HNDL_VIRT_STATE( pPage) >= PGM_PAGE_HNDL_VIRT_STATE_WRITE )1133 # define PGM_PAGE_HAS_ACTIVE_HANDLERS(a_pPage) \ 1134 ( PGM_PAGE_GET_HNDL_PHYS_STATE(a_pPage) >= PGM_PAGE_HNDL_PHYS_STATE_WRITE \ 1135 || PGM_PAGE_GET_HNDL_VIRT_STATE(a_pPage) >= PGM_PAGE_HNDL_VIRT_STATE_WRITE ) 1136 1136 #endif 1137 1137 … … 1139 1139 * Checks if the page has any active access handlers catching all accesses. 1140 1140 * @returns true/false 1141 * @param pPagePointer to the physical guest page tracking structure.1141 * @param a_pPage Pointer to the physical guest page tracking structure. 1142 1142 */ 1143 1143 #ifdef PGM_PAGE_WITH_OPTIMIZED_HANDLER_ACCESS 1144 # define PGM_PAGE_HAS_ACTIVE_ALL_HANDLERS( pPage) \1145 ( ( (( pPage)->u16MiscY.au8[0] | (pPage)->u16MiscY.au8[1]) & UINT8_C(0x3) ) \1144 # define PGM_PAGE_HAS_ACTIVE_ALL_HANDLERS(a_pPage) \ 1145 ( ( ((a_pPage)->u16MiscY.au8[0] | (a_pPage)->u16MiscY.au8[1]) & UINT8_C(0x3) ) \ 1146 1146 == PGM_PAGE_HNDL_PHYS_STATE_ALL ) 1147 1147 #else 1148 # define PGM_PAGE_HAS_ACTIVE_ALL_HANDLERS( pPage) \1149 ( PGM_PAGE_GET_HNDL_PHYS_STATE( pPage) == PGM_PAGE_HNDL_PHYS_STATE_ALL \1150 || PGM_PAGE_GET_HNDL_VIRT_STATE( pPage) == PGM_PAGE_HNDL_VIRT_STATE_ALL )1148 # define PGM_PAGE_HAS_ACTIVE_ALL_HANDLERS(a_pPage) \ 1149 ( PGM_PAGE_GET_HNDL_PHYS_STATE(a_pPage) == PGM_PAGE_HNDL_PHYS_STATE_ALL \ 1150 || PGM_PAGE_GET_HNDL_VIRT_STATE(a_pPage) == PGM_PAGE_HNDL_VIRT_STATE_ALL ) 1151 1151 #endif 1152 1152 … … 1155 1155 * Gets the packed shadow page pool tracking data associated with a guest page. 1156 1156 * @returns uint16_t containing the data. 1157 * @param pPagePointer to the physical guest page tracking structure.1158 */ 1159 #define PGM_PAGE_GET_TRACKING( pPage) ( (pPage)->u16TrackingY )1157 * @param a_pPage Pointer to the physical guest page tracking structure. 1158 */ 1159 #define PGM_PAGE_GET_TRACKING(a_pPage) ( (a_pPage)->u16TrackingY ) 1160 1160 1161 1161 /** @def PGM_PAGE_SET_TRACKING 1162 1162 * Sets the packed shadow page pool tracking data associated with a guest page. 1163 * @param pPagePointer to the physical guest page tracking structure.1164 * @param u16TrackingDataThe tracking data to store.1165 */ 1166 #define PGM_PAGE_SET_TRACKING( pPage,u16TrackingData) \1167 do { ( pPage)->u16TrackingY = (u16TrackingData); } while (0)1163 * @param a_pPage Pointer to the physical guest page tracking structure. 1164 * @param a_u16TrackingData The tracking data to store. 1165 */ 1166 #define PGM_PAGE_SET_TRACKING(a_pPage, a_u16TrackingData) \ 1167 do { (a_pPage)->u16TrackingY = (a_u16TrackingData); } while (0) 1168 1168 1169 1169 /** @def PGM_PAGE_GET_TD_CREFS 1170 1170 * Gets the @a cRefs tracking data member. 1171 1171 * @returns cRefs. 1172 * @param pPagePointer to the physical guest page tracking structure.1173 */ 1174 #define PGM_PAGE_GET_TD_CREFS( pPage) \1175 ((PGM_PAGE_GET_TRACKING( pPage) >> PGMPOOL_TD_CREFS_SHIFT) & PGMPOOL_TD_CREFS_MASK)1172 * @param a_pPage Pointer to the physical guest page tracking structure. 1173 */ 1174 #define PGM_PAGE_GET_TD_CREFS(a_pPage) \ 1175 ((PGM_PAGE_GET_TRACKING(a_pPage) >> PGMPOOL_TD_CREFS_SHIFT) & PGMPOOL_TD_CREFS_MASK) 1176 1176 1177 1177 /** @def PGM_PAGE_GET_TD_IDX 1178 1178 * Gets the @a idx tracking data member. 1179 1179 * @returns idx. 1180 * @param pPagePointer to the physical guest page tracking structure.1181 */ 1182 #define PGM_PAGE_GET_TD_IDX( pPage) \1183 ((PGM_PAGE_GET_TRACKING( pPage) >> PGMPOOL_TD_IDX_SHIFT) & PGMPOOL_TD_IDX_MASK)1180 * @param a_pPage Pointer to the physical guest page tracking structure. 1181 */ 1182 #define PGM_PAGE_GET_TD_IDX(a_pPage) \ 1183 ((PGM_PAGE_GET_TRACKING(a_pPage) >> PGMPOOL_TD_IDX_SHIFT) & PGMPOOL_TD_IDX_MASK) 1184 1184 1185 1185 1186 1186 /** Max number of locks on a page. */ 1187 #define PGM_PAGE_MAX_LOCKS UINT8_C(254)1187 #define PGM_PAGE_MAX_LOCKS UINT8_C(254) 1188 1188 1189 1189 /** Get the read lock count. 1190 1190 * @returns count. 1191 * @param pPagePointer to the physical guest page tracking structure.1192 */ 1193 #define PGM_PAGE_GET_READ_LOCKS( pPage) ( (pPage)->cReadLocksY )1191 * @param a_pPage Pointer to the physical guest page tracking structure. 1192 */ 1193 #define PGM_PAGE_GET_READ_LOCKS(a_pPage) ( (a_pPage)->cReadLocksY ) 1194 1194 1195 1195 /** Get the write lock count. 1196 1196 * @returns count. 1197 * @param pPagePointer to the physical guest page tracking structure.1198 */ 1199 #define PGM_PAGE_GET_WRITE_LOCKS( pPage) ( (pPage)->cWriteLocksY )1197 * @param a_pPage Pointer to the physical guest page tracking structure. 1198 */ 1199 #define PGM_PAGE_GET_WRITE_LOCKS(a_pPage) ( (a_pPage)->cWriteLocksY ) 1200 1200 1201 1201 /** Decrement the read lock counter. 1202 * @param pPagePointer to the physical guest page tracking structure.1203 */ 1204 #define PGM_PAGE_DEC_READ_LOCKS( pPage) do { --(pPage)->cReadLocksY; } while (0)1202 * @param a_pPage Pointer to the physical guest page tracking structure. 1203 */ 1204 #define PGM_PAGE_DEC_READ_LOCKS(a_pPage) do { --(a_pPage)->cReadLocksY; } while (0) 1205 1205 1206 1206 /** Decrement the write lock counter. 1207 * @param pPagePointer to the physical guest page tracking structure.1208 */ 1209 #define PGM_PAGE_DEC_WRITE_LOCKS( pPage) do { --(pPage)->cWriteLocksY; } while (0)1207 * @param a_pPage Pointer to the physical guest page tracking structure. 1208 */ 1209 #define PGM_PAGE_DEC_WRITE_LOCKS(a_pPage) do { --(a_pPage)->cWriteLocksY; } while (0) 1210 1210 1211 1211 /** Increment the read lock counter. 1212 * @param pPagePointer to the physical guest page tracking structure.1213 */ 1214 #define PGM_PAGE_INC_READ_LOCKS( pPage) do { ++(pPage)->cReadLocksY; } while (0)1212 * @param a_pPage Pointer to the physical guest page tracking structure. 1213 */ 1214 #define PGM_PAGE_INC_READ_LOCKS(a_pPage) do { ++(a_pPage)->cReadLocksY; } while (0) 1215 1215 1216 1216 /** Increment the write lock counter. 1217 * @param pPagePointer to the physical guest page tracking structure.1218 */ 1219 #define PGM_PAGE_INC_WRITE_LOCKS( pPage) do { ++(pPage)->cWriteLocksY; } while (0)1217 * @param a_pPage Pointer to the physical guest page tracking structure. 1218 */ 1219 #define PGM_PAGE_INC_WRITE_LOCKS(a_pPage) do { ++(a_pPage)->cWriteLocksY; } while (0) 1220 1220 1221 1221 … … 2374 2374 * 2375 2375 * @returns VBox status code. 2376 * @param pVMThe VM handle.2377 * @param pPageThe pool page.2376 * @param a_pVM The VM handle. 2377 * @param a_pPage The pool page. 2378 2378 * 2379 2379 * @remark In RC this uses PGMGCDynMapHCPage(), so it will consume of the … … 2382 2382 */ 2383 2383 #if defined(IN_RC) || defined(VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0) 2384 # define PGMPOOL_PAGE_2_PTR( pVM, pPage) pgmPoolMapPageInlined((pVM), (pPage) RTLOG_COMMA_SRC_POS)2384 # define PGMPOOL_PAGE_2_PTR(a_pVM, a_pPage) pgmPoolMapPageInlined((a_pVM), (a_pPage) RTLOG_COMMA_SRC_POS) 2385 2385 #elif defined(VBOX_STRICT) 2386 # define PGMPOOL_PAGE_2_PTR( pVM, pPage) pgmPoolMapPageStrict(pPage)2387 DECLINLINE(void *) pgmPoolMapPageStrict(PPGMPOOLPAGE pPage)2388 { 2389 Assert( pPage &&pPage->pvPageR3);2390 return pPage->pvPageR3;2386 # define PGMPOOL_PAGE_2_PTR(a_pVM, a_pPage) pgmPoolMapPageStrict(a_pPage) 2387 DECLINLINE(void *) pgmPoolMapPageStrict(PPGMPOOLPAGE a_pPage) 2388 { 2389 Assert(a_pPage && a_pPage->pvPageR3); 2390 return a_pPage->pvPageR3; 2391 2391 } 2392 2392 #else 2393 # define PGMPOOL_PAGE_2_PTR(pVM, pPage) ((pPage)->pvPageR3)2393 # define PGMPOOL_PAGE_2_PTR(pVM, a_pPage) ((a_pPage)->pvPageR3) 2394 2394 #endif 2395 2395 … … 2399 2399 * 2400 2400 * @returns VBox status code. 2401 * @param pVMThe VM handle.2402 * @param pVCpuThe current CPU.2403 * @param pPageThe pool page.2401 * @param a_pVM The VM handle. 2402 * @param a_pVCpu The current CPU. 2403 * @param a_pPage The pool page. 2404 2404 * 2405 2405 * @remark In RC this uses PGMGCDynMapHCPage(), so it will consume of the … … 2408 2408 */ 2409 2409 #if defined(IN_RC) || defined(VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0) 2410 # define PGMPOOL_PAGE_2_PTR_V2( pVM, pVCpu, pPage) pgmPoolMapPageV2Inlined((pVM), (pVCpu), (pPage) RTLOG_COMMA_SRC_POS)2410 # define PGMPOOL_PAGE_2_PTR_V2(a_pVM, a_pVCpu, a_pPage) pgmPoolMapPageV2Inlined((a_pVM), (a_pVCpu), (a_pPage) RTLOG_COMMA_SRC_POS) 2411 2411 #else 2412 # define PGMPOOL_PAGE_2_PTR_V2( pVM, pVCpu, pPage) PGMPOOL_PAGE_2_PTR((pVM), (pPage))2412 # define PGMPOOL_PAGE_2_PTR_V2(a_pVM, a_pVCpu, a_pPage) PGMPOOL_PAGE_2_PTR((a_pVM), (a_pPage)) 2413 2413 #endif 2414 2414
Note:
See TracChangeset
for help on using the changeset viewer.