Changeset 36938 in vbox
- Timestamp:
- May 3, 2011 2:16:56 PM (14 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/include/PGMInternal.h
r36937 r36938 689 689 * accesses to the structure. 690 690 */ 691 typedef struct PGMPAGE 692 { 693 union 691 typedef union PGMPAGE 692 { 693 /** Structured view. */ 694 struct 694 695 { 695 /** Bit field. */ 696 struct 697 { 698 /** The physical address and the Page ID. */ 699 RTHCPHYS HCPhysAndPageID; 700 701 /** 7:0 - The physical handler state 702 * (PGM_PAGE_HNDL_PHYS_STATE_*). */ 703 uint32_t u2HandlerPhysStateY : 8; 704 /*uint32_t u6Reserved : 6;*/ 705 /** 9:8 - The physical handler state 706 * (PGM_PAGE_HNDL_VIRT_STATE_*). */ 707 uint32_t u2HandlerVirtStateY : 2; 708 /** 10 - Indicator of dirty page for fault tolerance 709 * tracking. */ 710 uint32_t fFTDirtyY : 1; 711 /** 12:11 - Currently unused. */ 712 uint32_t u2Unused2 : 2; 713 /** 14:13 - Paging structure needed to map the page 714 * (PGM_PAGE_PDE_TYPE_*). */ 715 uint32_t u2PDETypeY : 2; 716 /** 15 - Flag indicating that a write monitored page was written 717 * to when set. */ 718 uint32_t fWrittenToY : 1; 719 /** 18:16 - The page state. */ 720 uint32_t uStateY : 3; 721 /** 21:19 - The page type (PGMPAGETYPE). */ 722 uint32_t uTypeY : 3; 723 /** 31:22 - PTE index for usage tracking (page pool). */ 724 uint32_t u10PteIdx : 10; 725 726 /** Usage tracking (page pool). */ 727 uint16_t u16TrackingY; 728 /** The number of read locks on this page. */ 729 uint8_t cReadLocksY; 730 /** The number of write locks on this page. */ 731 uint8_t cWriteLocksY; 732 } bit; 733 734 /** 64-bit integer view. */ 735 uint64_t au64[2]; 736 /** 16-bit view. */ 737 uint32_t au32[4]; 738 /** 16-bit view. */ 739 uint16_t au16[8]; 740 /** 8-bit view. */ 741 uint8_t au8[16]; 742 } u1; 696 /** The physical address and the Page ID. */ 697 RTHCPHYS HCPhysAndPageID; 698 699 /** 7:0 - The physical handler state 700 * (PGM_PAGE_HNDL_PHYS_STATE_*). */ 701 uint32_t u2HandlerPhysStateY : 8; 702 /*uint32_t u6Reserved : 6;*/ 703 /** 9:8 - The physical handler state 704 * (PGM_PAGE_HNDL_VIRT_STATE_*). */ 705 uint32_t u2HandlerVirtStateY : 2; 706 /** 10 - Indicator of dirty page for fault tolerance 707 * tracking. */ 708 uint32_t fFTDirtyY : 1; 709 /** 12:11 - Currently unused. */ 710 uint32_t u2Unused2 : 2; 711 /** 14:13 - Paging structure needed to map the page 712 * (PGM_PAGE_PDE_TYPE_*). */ 713 uint32_t u2PDETypeY : 2; 714 /** 15 - Flag indicating that a write monitored page was written 715 * to when set. */ 716 uint32_t fWrittenToY : 1; 717 /** 18:16 - The page state. */ 718 uint32_t uStateY : 3; 719 /** 21:19 - The page type (PGMPAGETYPE). */ 720 uint32_t uTypeY : 3; 721 /** 31:22 - PTE index for usage tracking (page pool). */ 722 uint32_t u10PteIdx : 10; 723 724 /** Usage tracking (page pool). */ 725 uint16_t u16TrackingY; 726 /** The number of read locks on this page. */ 727 uint8_t cReadLocksY; 728 /** The number of write locks on this page. */ 729 uint8_t cWriteLocksY; 730 } s; 731 732 /** 64-bit integer view. */ 733 uint64_t au64[2]; 734 /** 16-bit view. */ 735 uint32_t au32[4]; 736 /** 16-bit view. */ 737 uint16_t au16[8]; 738 /** 8-bit view. */ 739 uint8_t au8[16]; 743 740 } PGMPAGE; 744 741 AssertCompileSize(PGMPAGE, 16); … … 757 754 #define PGM_PAGE_CLEAR(a_pPage) \ 758 755 do { \ 759 (a_pPage)-> u1.au64[0] = 0; \760 (a_pPage)-> u1.au64[1] = 0; \756 (a_pPage)->au64[0] = 0; \ 757 (a_pPage)->au64[1] = 0; \ 761 758 } while (0) 762 759 … … 767 764 #define PGM_PAGE_INIT(a_pPage, a_HCPhys, a_idPage, a_uType, a_uState) \ 768 765 do { \ 766 (a_pPage)->au64[1] = 0; \ 769 767 RTHCPHYS SetHCPhysTmp = (a_HCPhys); \ 770 768 AssertFatal(!(SetHCPhysTmp & ~UINT64_C(0x0000fffffffff000))); \ 771 (a_pPage)->u1.bit.HCPhysAndPageID = (SetHCPhysTmp << (28-12)) | ((a_idPage) & UINT32_C(0x0fffffff)); \ 772 (a_pPage)->u1.au64[1] = 0; \ 773 (a_pPage)->u1.bit.uStateY = (a_uState); \ 774 (a_pPage)->u1.bit.uTypeY = (a_uType); \ 769 (a_pPage)->s.HCPhysAndPageID = (SetHCPhysTmp << (28-12)) | ((a_idPage) & UINT32_C(0x0fffffff)); \ 770 (a_pPage)->s.uStateY = (a_uState); \ 771 (a_pPage)->s.uTypeY = (a_uType); \ 775 772 } while (0) 776 773 … … 813 810 * @param a_pPage Pointer to the physical guest page tracking structure. 814 811 */ 815 #define PGM_PAGE_GET_STATE(a_pPage) ( (a_pPage)-> u1.bit.uStateY )812 #define PGM_PAGE_GET_STATE(a_pPage) ( (a_pPage)->s.uStateY ) 816 813 817 814 /** … … 820 817 * @param a_uState The new page state. 821 818 */ 822 #define PGM_PAGE_SET_STATE(a_pPage, a_uState) do { (a_pPage)-> u1.bit.uStateY = (a_uState); } while (0)819 #define PGM_PAGE_SET_STATE(a_pPage, a_uState) do { (a_pPage)->s.uStateY = (a_uState); } while (0) 823 820 824 821 … … 828 825 * @param a_pPage Pointer to the physical guest page tracking structure. 829 826 */ 830 #define PGM_PAGE_GET_HCPHYS(a_pPage) ( ((a_pPage)-> u1.bit.HCPhysAndPageID >> 28) << 12 )827 #define PGM_PAGE_GET_HCPHYS(a_pPage) ( ((a_pPage)->s.HCPhysAndPageID >> 28) << 12 ) 831 828 832 829 /** … … 839 836 RTHCPHYS const SetHCPhysTmp = (a_HCPhys); \ 840 837 AssertFatal(!(SetHCPhysTmp & ~UINT64_C(0x0000fffffffff000))); \ 841 (a_pPage)-> u1.bit.HCPhysAndPageID = ((a_pPage)->u1.bit.HCPhysAndPageID & UINT32_C(0x0fffffff)) \842 838 (a_pPage)->s.HCPhysAndPageID = ((a_pPage)->s.HCPhysAndPageID & UINT32_C(0x0fffffff)) \ 839 | (SetHCPhysTmp << (28-12)); \ 843 840 } while (0) 844 841 … … 848 845 * @param a_pPage Pointer to the physical guest page tracking structure. 849 846 */ 850 #define PGM_PAGE_GET_PAGEID(a_pPage) ( (uint32_t)((a_pPage)-> u1.bit.HCPhysAndPageID & UINT32_C(0x0fffffff)) )847 #define PGM_PAGE_GET_PAGEID(a_pPage) ( (uint32_t)((a_pPage)->s.HCPhysAndPageID & UINT32_C(0x0fffffff)) ) 851 848 852 849 /** … … 857 854 #define PGM_PAGE_SET_PAGEID(a_pPage, a_idPage) \ 858 855 do { \ 859 (a_pPage)-> u1.bit.HCPhysAndPageID = (((a_pPage)->u1.bit.HCPhysAndPageID) & UINT64_C(0xfffffffff0000000)) \856 (a_pPage)->s.HCPhysAndPageID = (((a_pPage)->s.HCPhysAndPageID) & UINT64_C(0xfffffffff0000000)) \ 860 857 | ((a_idPage) & UINT32_C(0x0fffffff)); \ 861 858 } while (0) … … 873 870 * @param a_pPage Pointer to the physical guest page tracking structure. 874 871 */ 875 #define PGM_PAGE_GET_PAGE_IN_CHUNK(a_pPage) ( (uint32_t)((a_pPage)-> u1.bit.HCPhysAndPageID & GMM_PAGEID_IDX_MASK) )872 #define PGM_PAGE_GET_PAGE_IN_CHUNK(a_pPage) ( (uint32_t)((a_pPage)->s.HCPhysAndPageID & GMM_PAGEID_IDX_MASK) ) 876 873 877 874 /** … … 880 877 * @param a_pPage Pointer to the physical guest page tracking structure. 881 878 */ 882 #define PGM_PAGE_GET_TYPE(a_pPage) ( (a_pPage)-> u1.bit.uTypeY )879 #define PGM_PAGE_GET_TYPE(a_pPage) ( (a_pPage)->s.uTypeY ) 883 880 884 881 /** … … 887 884 * @param a_enmType The new page type (PGMPAGETYPE). 888 885 */ 889 #define PGM_PAGE_SET_TYPE(a_pPage, a_enmType) do { (a_pPage)-> u1.bit.uTypeY = (a_enmType); } while (0)886 #define PGM_PAGE_SET_TYPE(a_pPage, a_enmType) do { (a_pPage)->s.uTypeY = (a_enmType); } while (0) 890 887 891 888 /** … … 894 891 * @param a_pPage Pointer to the physical guest page tracking structure. 895 892 */ 896 #define PGM_PAGE_GET_PTE_INDEX(a_pPage) ( (a_pPage)-> u1.bit.u10PteIdx )893 #define PGM_PAGE_GET_PTE_INDEX(a_pPage) ( (a_pPage)->s.u10PteIdx ) 897 894 898 895 /** … … 901 898 * @param a_iPte New page table index. 902 899 */ 903 #define PGM_PAGE_SET_PTE_INDEX(a_pPage, a_iPte) do { (a_pPage)-> u1.bit.u10PteIdx = (a_iPte); } while (0)900 #define PGM_PAGE_SET_PTE_INDEX(a_pPage, a_iPte) do { (a_pPage)->s.u10PteIdx = (a_iPte); } while (0) 904 901 905 902 /** … … 908 905 * @param a_pPage Pointer to the physical guest page tracking structure. 909 906 */ 910 #define PGM_PAGE_IS_MMIO(a_pPage) ( (a_pPage)-> u1.bit.uTypeY == PGMPAGETYPE_MMIO )907 #define PGM_PAGE_IS_MMIO(a_pPage) ( (a_pPage)->s.uTypeY == PGMPAGETYPE_MMIO ) 911 908 912 909 /** … … 915 912 * @param a_pPage Pointer to the physical guest page tracking structure. 916 913 */ 917 #define PGM_PAGE_IS_ZERO(a_pPage) ( (a_pPage)-> u1.bit.uStateY == PGM_PAGE_STATE_ZERO )914 #define PGM_PAGE_IS_ZERO(a_pPage) ( (a_pPage)->s.uStateY == PGM_PAGE_STATE_ZERO ) 918 915 919 916 /** … … 922 919 * @param a_pPage Pointer to the physical guest page tracking structure. 923 920 */ 924 #define PGM_PAGE_IS_SHARED(a_pPage) ( (a_pPage)-> u1.bit.uStateY == PGM_PAGE_STATE_SHARED )921 #define PGM_PAGE_IS_SHARED(a_pPage) ( (a_pPage)->s.uStateY == PGM_PAGE_STATE_SHARED ) 925 922 926 923 /** … … 929 926 * @param a_pPage Pointer to the physical guest page tracking structure. 930 927 */ 931 #define PGM_PAGE_IS_BALLOONED(a_pPage) ( (a_pPage)-> u1.bit.uStateY == PGM_PAGE_STATE_BALLOONED )928 #define PGM_PAGE_IS_BALLOONED(a_pPage) ( (a_pPage)->s.uStateY == PGM_PAGE_STATE_BALLOONED ) 932 929 933 930 /** … … 936 933 * @param a_pPage Pointer to the physical guest page tracking structure. 937 934 */ 938 #define PGM_PAGE_IS_ALLOCATED(a_pPage) ( (a_pPage)-> u1.bit.uStateY == PGM_PAGE_STATE_ALLOCATED )935 #define PGM_PAGE_IS_ALLOCATED(a_pPage) ( (a_pPage)->s.uStateY == PGM_PAGE_STATE_ALLOCATED ) 939 936 940 937 /** … … 942 939 * @param a_pPage Pointer to the physical guest page tracking structure. 943 940 */ 944 #define PGM_PAGE_SET_WRITTEN_TO(a_pPage) do { (a_pPage)-> u1.au8[1] |= UINT8_C(0x80); } while (0)941 #define PGM_PAGE_SET_WRITTEN_TO(a_pPage) do { (a_pPage)->au8[1] |= UINT8_C(0x80); } while (0) /// FIXME FIXME 945 942 946 943 /** … … 948 945 * @param a_pPage Pointer to the physical guest page tracking structure. 949 946 */ 950 #define PGM_PAGE_CLEAR_WRITTEN_TO(a_pPage) do { (a_pPage)-> u1.bit.fWrittenToY = 0; } while (0)947 #define PGM_PAGE_CLEAR_WRITTEN_TO(a_pPage) do { (a_pPage)->s.fWrittenToY = 0; } while (0) 951 948 952 949 /** … … 955 952 * @param a_pPage Pointer to the physical guest page tracking structure. 956 953 */ 957 #define PGM_PAGE_IS_WRITTEN_TO(a_pPage) ( (a_pPage)-> u1.bit.fWrittenToY )954 #define PGM_PAGE_IS_WRITTEN_TO(a_pPage) ( (a_pPage)->s.fWrittenToY ) 958 955 959 956 /** … … 961 958 * @param a_pPage Pointer to the physical guest page tracking structure. 962 959 */ 963 #define PGM_PAGE_SET_FT_DIRTY(a_pPage) do { (a_pPage)-> u1.bit.fFTDirtyY = 1; } while (0)960 #define PGM_PAGE_SET_FT_DIRTY(a_pPage) do { (a_pPage)->s.fFTDirtyY = 1; } while (0) 964 961 965 962 /** … … 967 964 * @param a_pPage Pointer to the physical guest page tracking structure. 968 965 */ 969 #define PGM_PAGE_CLEAR_FT_DIRTY(a_pPage) do { (a_pPage)-> u1.bit.fFTDirtyY = 0; } while (0)966 #define PGM_PAGE_CLEAR_FT_DIRTY(a_pPage) do { (a_pPage)->s.fFTDirtyY = 0; } while (0) 970 967 971 968 /** … … 974 971 * @param a_pPage Pointer to the physical guest page tracking structure. 975 972 */ 976 #define PGM_PAGE_IS_FT_DIRTY(a_pPage) ( (a_pPage)-> u1.bit.fFTDirtyY )973 #define PGM_PAGE_IS_FT_DIRTY(a_pPage) ( (a_pPage)->s.fFTDirtyY ) 977 974 978 975 … … 996 993 */ 997 994 #define PGM_PAGE_SET_PDE_TYPE(a_pPage, a_uType) \ 998 do { (a_pPage)-> u1.bit.u2PDETypeY = (a_uType); } while (0)995 do { (a_pPage)->s.u2PDETypeY = (a_uType); } while (0) 999 996 1000 997 /** … … 1003 1000 * @param a_pPage Pointer to the physical guest page tracking structure. 1004 1001 */ 1005 #define PGM_PAGE_GET_PDE_TYPE(a_pPage) ( (a_pPage)-> u1.bit.u2PDETypeY )1002 #define PGM_PAGE_GET_PDE_TYPE(a_pPage) ( (a_pPage)->s.u2PDETypeY ) 1006 1003 1007 1004 /** Enabled optimized access handler tests. … … 1032 1029 * @param a_pPage Pointer to the physical guest page tracking structure. 1033 1030 */ 1034 #define PGM_PAGE_GET_HNDL_PHYS_STATE(a_pPage) ( (a_pPage)-> u1.bit.u2HandlerPhysStateY )1031 #define PGM_PAGE_GET_HNDL_PHYS_STATE(a_pPage) ( (a_pPage)->s.u2HandlerPhysStateY ) 1035 1032 1036 1033 /** … … 1040 1037 */ 1041 1038 #define PGM_PAGE_SET_HNDL_PHYS_STATE(a_pPage, a_uState) \ 1042 do { (a_pPage)-> u1.bit.u2HandlerPhysStateY = (a_uState); } while (0)1039 do { (a_pPage)->s.u2HandlerPhysStateY = (a_uState); } while (0) 1043 1040 1044 1041 /** … … 1078 1075 * @param a_pPage Pointer to the physical guest page tracking structure. 1079 1076 */ 1080 #define PGM_PAGE_GET_HNDL_VIRT_STATE(a_pPage) ( (a_pPage)-> u1.bit.u2HandlerVirtStateY )1077 #define PGM_PAGE_GET_HNDL_VIRT_STATE(a_pPage) ( (a_pPage)->s.u2HandlerVirtStateY ) 1081 1078 1082 1079 /** … … 1086 1083 */ 1087 1084 #define PGM_PAGE_SET_HNDL_VIRT_STATE(a_pPage, a_uState) \ 1088 do { (a_pPage)-> u1.bit.u2HandlerVirtStateY = (a_uState); } while (0)1085 do { (a_pPage)->s.u2HandlerVirtStateY = (a_uState); } while (0) 1089 1086 1090 1087 /** … … 1113 1110 #ifdef PGM_PAGE_WITH_OPTIMIZED_HANDLER_ACCESS 1114 1111 # define PGM_PAGE_HAS_ANY_HANDLERS(a_pPage) \ 1115 ( ((a_pPage)-> u1.au32[2] & UINT16_C(0x0303)) != 0 )1112 ( ((a_pPage)->au32[2] & UINT16_C(0x0303)) != 0 ) 1116 1113 #else 1117 1114 # define PGM_PAGE_HAS_ANY_HANDLERS(a_pPage) \ … … 1127 1124 #ifdef PGM_PAGE_WITH_OPTIMIZED_HANDLER_ACCESS 1128 1125 # define PGM_PAGE_HAS_ACTIVE_HANDLERS(a_pPage) \ 1129 ( ((a_pPage)-> u1.au32[2] & UINT16_C(0x0202)) != 0 )1126 ( ((a_pPage)->au32[2] & UINT16_C(0x0202)) != 0 ) 1130 1127 #else 1131 1128 # define PGM_PAGE_HAS_ACTIVE_HANDLERS(a_pPage) \ … … 1141 1138 #ifdef PGM_PAGE_WITH_OPTIMIZED_HANDLER_ACCESS 1142 1139 # define PGM_PAGE_HAS_ACTIVE_ALL_HANDLERS(a_pPage) \ 1143 ( ( ((a_pPage)-> u1.au8[8] | (a_pPage)->u1.au8[9]) & UINT8_C(0x3) ) \1140 ( ( ((a_pPage)->au8[8] | (a_pPage)->au8[9]) & UINT8_C(0x3) ) \ 1144 1141 == PGM_PAGE_HNDL_PHYS_STATE_ALL ) 1145 1142 #else … … 1155 1152 * @param a_pPage Pointer to the physical guest page tracking structure. 1156 1153 */ 1157 #define PGM_PAGE_GET_TRACKING(a_pPage) ( (a_pPage)-> u1.bit.u16TrackingY )1154 #define PGM_PAGE_GET_TRACKING(a_pPage) ( (a_pPage)->s.u16TrackingY ) 1158 1155 1159 1156 /** @def PGM_PAGE_SET_TRACKING … … 1163 1160 */ 1164 1161 #define PGM_PAGE_SET_TRACKING(a_pPage, a_u16TrackingData) \ 1165 do { (a_pPage)-> u1.bit.u16TrackingY = (a_u16TrackingData); } while (0)1162 do { (a_pPage)->s.u16TrackingY = (a_u16TrackingData); } while (0) 1166 1163 1167 1164 /** @def PGM_PAGE_GET_TD_CREFS … … 1189 1186 * @param a_pPage Pointer to the physical guest page tracking structure. 1190 1187 */ 1191 #define PGM_PAGE_GET_READ_LOCKS(a_pPage) ( (a_pPage)-> u1.bit.cReadLocksY )1188 #define PGM_PAGE_GET_READ_LOCKS(a_pPage) ( (a_pPage)->s.cReadLocksY ) 1192 1189 1193 1190 /** Get the write lock count. … … 1195 1192 * @param a_pPage Pointer to the physical guest page tracking structure. 1196 1193 */ 1197 #define PGM_PAGE_GET_WRITE_LOCKS(a_pPage) ( (a_pPage)-> u1.bit.cWriteLocksY )1194 #define PGM_PAGE_GET_WRITE_LOCKS(a_pPage) ( (a_pPage)->s.cWriteLocksY ) 1198 1195 1199 1196 /** Decrement the read lock counter. 1200 1197 * @param a_pPage Pointer to the physical guest page tracking structure. 1201 1198 */ 1202 #define PGM_PAGE_DEC_READ_LOCKS(a_pPage) do { --(a_pPage)-> u1.bit.cReadLocksY; } while (0)1199 #define PGM_PAGE_DEC_READ_LOCKS(a_pPage) do { --(a_pPage)->s.cReadLocksY; } while (0) 1203 1200 1204 1201 /** Decrement the write lock counter. 1205 1202 * @param a_pPage Pointer to the physical guest page tracking structure. 1206 1203 */ 1207 #define PGM_PAGE_DEC_WRITE_LOCKS(a_pPage) do { --(a_pPage)-> u1.bit.cWriteLocksY; } while (0)1204 #define PGM_PAGE_DEC_WRITE_LOCKS(a_pPage) do { --(a_pPage)->s.cWriteLocksY; } while (0) 1208 1205 1209 1206 /** Increment the read lock counter. 1210 1207 * @param a_pPage Pointer to the physical guest page tracking structure. 1211 1208 */ 1212 #define PGM_PAGE_INC_READ_LOCKS(a_pPage) do { ++(a_pPage)-> u1.bit.cReadLocksY; } while (0)1209 #define PGM_PAGE_INC_READ_LOCKS(a_pPage) do { ++(a_pPage)->s.cReadLocksY; } while (0) 1213 1210 1214 1211 /** Increment the write lock counter. 1215 1212 * @param a_pPage Pointer to the physical guest page tracking structure. 1216 1213 */ 1217 #define PGM_PAGE_INC_WRITE_LOCKS(a_pPage) do { ++(a_pPage)-> u1.bit.cWriteLocksY; } while (0)1214 #define PGM_PAGE_INC_WRITE_LOCKS(a_pPage) do { ++(a_pPage)->s.cWriteLocksY; } while (0) 1218 1215 1219 1216 -
trunk/src/VBox/VMM/testcase/tstVMStructRC.cpp
r36937 r36938 691 691 GEN_CHECK_OFF(PGMVIRTHANDLER, aPhysToVirt); 692 692 GEN_CHECK_SIZE(PGMPAGE); 693 GEN_CHECK_OFF(PGMPAGE, u1.bit.HCPhysAndPageID);694 GEN_CHECK_OFF(PGMPAGE, u1.bit.cReadLocksY);695 GEN_CHECK_OFF(PGMPAGE, u1.bit.cWriteLocksY);696 GEN_CHECK_OFF(PGMPAGE, u1.bit.u16TrackingY);693 GEN_CHECK_OFF(PGMPAGE, s.HCPhysAndPageID); 694 GEN_CHECK_OFF(PGMPAGE, s.cReadLocksY); 695 GEN_CHECK_OFF(PGMPAGE, s.cWriteLocksY); 696 GEN_CHECK_OFF(PGMPAGE, s.u16TrackingY); 697 697 GEN_CHECK_SIZE(PGMRAMRANGE); 698 698 GEN_CHECK_OFF(PGMRAMRANGE, pNextR3);
Note:
See TracChangeset
for help on using the changeset viewer.