Changeset 36926 in vbox
- Timestamp:
- May 3, 2011 10:06:14 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/include/PGMInternal.h
r36910 r36926 693 693 /** The physical address and the Page ID. */ 694 694 RTHCPHYS HCPhysAndPageID; 695 #ifndef PGMPAGE_USE_MORE_BITFIELDS 695 696 /** Combination of: 696 697 * - [0-7]: u2HandlerPhysStateY - the physical handler state … … 712 713 * 32-bit ones, which may be efficient (stalls). 713 714 */ 714 RTUINT16U u16MiscY; 715 /** The page state. 716 * Only 3 bits are really needed for this. */ 717 uint16_t uStateY : 3; 718 /** The page type (PGMPAGETYPE). 719 * Only 3 bits are really needed for this. */ 720 uint16_t uTypeY : 3; 721 /** PTE index for usage tracking (page pool). */ 722 uint16_t uPteIdx : 10; 715 union 716 { 717 struct 718 { 719 uint16_t u16MiscY; 720 /** The page state. 721 * Only 3 bits are really needed for this. */ 722 uint16_t uStateY : 3; 723 /** The page type (PGMPAGETYPE). 724 * Only 3 bits are really needed for this. */ 725 uint16_t uTypeY : 3; 726 /** PTE index for usage tracking (page pool). */ 727 uint16_t u10PteIdx : 10; 728 } bit; 729 730 /** 32-bit integer view. */ 731 uint32_t u; 732 /** 16-bit view. */ 733 uint16_t au16[2]; 734 /** 8-bit view. */ 735 uint8_t au8[4]; 736 } u1; 737 #else 738 union 739 { 740 /** Bit field. */ 741 struct 742 { 743 /** 7:0 - The physical handler state 744 * (PGM_PAGE_HNDL_PHYS_STATE_*). */ 745 uint32_t u2HandlerPhysStateY : 8; 746 /** 9:8 - The physical handler state 747 * (PGM_PAGE_HNDL_VIRT_STATE_*). */ 748 uint32_t u2HandlerVirtStateY : 2; 749 /** 10 - Indicator of dirty page for fault tolerance 750 * tracking. */ 751 uint32_t u1FTDirtyY : 1; 752 /** 12:11 - Currently unused. */ 753 uint32_t u2Unused2 : 2; 754 /** 14:13 - Paging structure needed to map the page 755 * (PGM_PAGE_PDE_TYPE_*). */ 756 uint32_t u2PDETypeY : 2; 757 /** 15 - Flag indicating that a write monitored page was written 758 * to when set. */ 759 uint32_t fWrittenToY : 1; 760 /** 18:16 - The page state. */ 761 uint32_t uStateY : 3; 762 /** 21:19 - The page type (PGMPAGETYPE). */ 763 uint32_t uTypeY : 3; 764 /** 31:22 - PTE index for usage tracking (page pool). */ 765 uint32_t u10PteIdx : 10; 766 } bit; 767 /** 32-bit integer view. */ 768 uint32_t u; 769 /** 16-bit view. */ 770 uint16_t au16[2]; 771 /** 8-bit view. */ 772 uint8_t au8[4]; 773 } u1; 774 #endif 723 775 /** Usage tracking (page pool). */ 724 776 uint16_t u16TrackingY; … … 744 796 do { \ 745 797 (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; \ 798 (a_pPage)->u1.u = 0; \ 750 799 (a_pPage)->u16TrackingY = 0; \ 751 800 (a_pPage)->cReadLocksY = 0; \ … … 761 810 RTHCPHYS SetHCPhysTmp = (a_HCPhys); \ 762 811 AssertFatal(!(SetHCPhysTmp & ~UINT64_C(0x0000fffffffff000))); \ 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; \ 812 (a_pPage)->u1.u = 0; \ 813 (a_pPage)->u16TrackingY = 0; \ 814 (a_pPage)->cReadLocksY = 0; \ 815 (a_pPage)->cWriteLocksY = 0; \ 816 (a_pPage)->HCPhysAndPageID = (SetHCPhysTmp << (28-12)) | ((a_idPage) & UINT32_C(0x0fffffff)); \ 817 (a_pPage)->u1.bit.uStateY = (a_uState); \ 818 (a_pPage)->u1.bit.uTypeY = (a_uType); \ 771 819 } while (0) 772 820 … … 809 857 * @param a_pPage Pointer to the physical guest page tracking structure. 810 858 */ 811 #define PGM_PAGE_GET_STATE(a_pPage) ( (a_pPage)->uStateY )859 #define PGM_PAGE_GET_STATE(a_pPage) ( (a_pPage)->u1.bit.uStateY ) 812 860 813 861 /** … … 816 864 * @param a_uState The new page state. 817 865 */ 818 #define PGM_PAGE_SET_STATE(a_pPage, a_uState) do { (a_pPage)->uStateY = (a_uState); } while (0)866 #define PGM_PAGE_SET_STATE(a_pPage, a_uState) do { (a_pPage)->u1.bit.uStateY = (a_uState); } while (0) 819 867 820 868 … … 824 872 * @param a_pPage Pointer to the physical guest page tracking structure. 825 873 */ 826 #define PGM_PAGE_GET_HCPHYS(a_pPage) ( ((a_pPage)->HCPhysAndPageID >> 28) << 12 )874 #define PGM_PAGE_GET_HCPHYS(a_pPage) ( ((a_pPage)->HCPhysAndPageID >> 28) << 12 ) 827 875 828 876 /** … … 844 892 * @param a_pPage Pointer to the physical guest page tracking structure. 845 893 */ 846 #define PGM_PAGE_GET_PAGEID(a_pPage) ( (uint32_t)((a_pPage)->HCPhysAndPageID & UINT32_C(0x0fffffff)) )894 #define PGM_PAGE_GET_PAGEID(a_pPage) ( (uint32_t)((a_pPage)->HCPhysAndPageID & UINT32_C(0x0fffffff)) ) 847 895 848 896 /** … … 876 924 * @param a_pPage Pointer to the physical guest page tracking structure. 877 925 */ 878 #define PGM_PAGE_GET_TYPE(a_pPage) ( a_pPage)->uTypeY926 #define PGM_PAGE_GET_TYPE(a_pPage) ( (a_pPage)->u1.bit.uTypeY ) 879 927 880 928 /** … … 883 931 * @param a_enmType The new page type (PGMPAGETYPE). 884 932 */ 885 #define PGM_PAGE_SET_TYPE(a_pPage, a_enmType) do { (a_pPage)->u TypeY = (a_enmType); } while (0)933 #define PGM_PAGE_SET_TYPE(a_pPage, a_enmType) do { (a_pPage)->u1.bit.uTypeY = (a_enmType); } while (0) 886 934 887 935 /** … … 890 938 * @param a_pPage Pointer to the physical guest page tracking structure. 891 939 */ 892 #define PGM_PAGE_GET_PTE_INDEX(a_pPage) ( a_pPage)->uPteIdx940 #define PGM_PAGE_GET_PTE_INDEX(a_pPage) ( (a_pPage)->u1.bit.u10PteIdx ) 893 941 894 942 /** … … 897 945 * @param a_iPte New page table index. 898 946 */ 899 #define PGM_PAGE_SET_PTE_INDEX(a_pPage, a_iPte) do { (a_pPage)->u PteIdx = (a_iPte); } while (0)947 #define PGM_PAGE_SET_PTE_INDEX(a_pPage, a_iPte) do { (a_pPage)->u1.bit.u10PteIdx = (a_iPte); } while (0) 900 948 901 949 /** … … 904 952 * @param a_pPage Pointer to the physical guest page tracking structure. 905 953 */ 906 #define PGM_PAGE_IS_MMIO(a_pPage) ( (a_pPage)->u TypeY == PGMPAGETYPE_MMIO )954 #define PGM_PAGE_IS_MMIO(a_pPage) ( (a_pPage)->u1.bit.uTypeY == PGMPAGETYPE_MMIO ) 907 955 908 956 /** … … 911 959 * @param a_pPage Pointer to the physical guest page tracking structure. 912 960 */ 913 #define PGM_PAGE_IS_ZERO(a_pPage) ( (a_pPage)->u StateY == PGM_PAGE_STATE_ZERO )961 #define PGM_PAGE_IS_ZERO(a_pPage) ( (a_pPage)->u1.bit.uStateY == PGM_PAGE_STATE_ZERO ) 914 962 915 963 /** … … 918 966 * @param a_pPage Pointer to the physical guest page tracking structure. 919 967 */ 920 #define PGM_PAGE_IS_SHARED(a_pPage) ( (a_pPage)->u StateY == PGM_PAGE_STATE_SHARED )968 #define PGM_PAGE_IS_SHARED(a_pPage) ( (a_pPage)->u1.bit.uStateY == PGM_PAGE_STATE_SHARED ) 921 969 922 970 /** … … 925 973 * @param a_pPage Pointer to the physical guest page tracking structure. 926 974 */ 927 #define PGM_PAGE_IS_BALLOONED(a_pPage) ( (a_pPage)->u StateY == PGM_PAGE_STATE_BALLOONED )975 #define PGM_PAGE_IS_BALLOONED(a_pPage) ( (a_pPage)->u1.bit.uStateY == PGM_PAGE_STATE_BALLOONED ) 928 976 929 977 /** … … 932 980 * @param a_pPage Pointer to the physical guest page tracking structure. 933 981 */ 934 #define PGM_PAGE_IS_ALLOCATED(a_pPage) ( (a_pPage)->u StateY == PGM_PAGE_STATE_ALLOCATED )982 #define PGM_PAGE_IS_ALLOCATED(a_pPage) ( (a_pPage)->u1.bit.uStateY == PGM_PAGE_STATE_ALLOCATED ) 935 983 936 984 /** … … 938 986 * @param a_pPage Pointer to the physical guest page tracking structure. 939 987 */ 940 #define PGM_PAGE_SET_WRITTEN_TO(a_pPage) do { (a_pPage)->u1 6MiscY.au8[1] |= UINT8_C(0x80); } while (0)988 #define PGM_PAGE_SET_WRITTEN_TO(a_pPage) do { (a_pPage)->u1.au8[1] |= UINT8_C(0x80); } while (0) 941 989 942 990 /** … … 944 992 * @param a_pPage Pointer to the physical guest page tracking structure. 945 993 */ 946 #define PGM_PAGE_CLEAR_WRITTEN_TO(a_pPage) do { (a_pPage)->u1 6MiscY.au8[1] &= UINT8_C(0x7f); } while (0)994 #define PGM_PAGE_CLEAR_WRITTEN_TO(a_pPage) do { (a_pPage)->u1.au8[1] &= UINT8_C(0x7f); } while (0) 947 995 948 996 /** … … 951 999 * @param a_pPage Pointer to the physical guest page tracking structure. 952 1000 */ 953 #define PGM_PAGE_IS_WRITTEN_TO(a_pPage) ( !!((a_pPage)->u1 6MiscY.au8[1] & UINT8_C(0x80)) )1001 #define PGM_PAGE_IS_WRITTEN_TO(a_pPage) ( !!((a_pPage)->u1.au8[1] & UINT8_C(0x80)) ) 954 1002 955 1003 /** … … 957 1005 * @param a_pPage Pointer to the physical guest page tracking structure. 958 1006 */ 959 #define PGM_PAGE_SET_FT_DIRTY(a_pPage) do { (a_pPage)->u1 6MiscY.au8[1] |= UINT8_C(0x04); } while (0)1007 #define PGM_PAGE_SET_FT_DIRTY(a_pPage) do { (a_pPage)->u1.au8[1] |= UINT8_C(0x04); } while (0) 960 1008 961 1009 /** … … 963 1011 * @param a_pPage Pointer to the physical guest page tracking structure. 964 1012 */ 965 #define PGM_PAGE_CLEAR_FT_DIRTY(a_pPage) do { (a_pPage)->u1 6MiscY.au8[1] &= UINT8_C(0xfb); } while (0)1013 #define PGM_PAGE_CLEAR_FT_DIRTY(a_pPage) do { (a_pPage)->u1.au8[1] &= UINT8_C(0xfb); } while (0) 966 1014 967 1015 /** … … 970 1018 * @param a_pPage Pointer to the physical guest page tracking structure. 971 1019 */ 972 #define PGM_PAGE_IS_FT_DIRTY(a_pPage) ( !!((a_pPage)->u1 6MiscY.au8[1] & UINT8_C(0x04)) )1020 #define PGM_PAGE_IS_FT_DIRTY(a_pPage) ( !!((a_pPage)->u1.au8[1] & UINT8_C(0x04)) ) 973 1021 974 1022 … … 993 1041 #define PGM_PAGE_SET_PDE_TYPE(a_pPage, a_uType) \ 994 1042 do { \ 995 (a_pPage)->u1 6MiscY.au8[1] = ((a_pPage)->u16MiscY.au8[1] & UINT8_C(0x9f)) \996 | (((a_uType)& UINT8_C(0x03)) << 5); \1043 (a_pPage)->u1.au8[1] = ((a_pPage)->u1.au8[1] & UINT8_C(0x9f)) \ 1044 | (((a_uType) & UINT8_C(0x03)) << 5); \ 997 1045 } while (0) 998 1046 … … 1002 1050 * @param a_pPage Pointer to the physical guest page tracking structure. 1003 1051 */ 1004 #define PGM_PAGE_GET_PDE_TYPE(a_pPage) ( ((a_pPage)->u1 6MiscY.au8[1] & UINT8_C(0x60)) >> 5)1052 #define PGM_PAGE_GET_PDE_TYPE(a_pPage) ( ((a_pPage)->u1.au8[1] & UINT8_C(0x60)) >> 5) 1005 1053 1006 1054 /** Enabled optimized access handler tests. 1007 * These optimizations makes ASSUMPTIONS about the state values and the u16MiscY1055 * These optimizations makes ASSUMPTIONS about the state values and the s1 1008 1056 * layout. When enabled, the compiler should normally generate more compact 1009 1057 * code. … … 1031 1079 * @param a_pPage Pointer to the physical guest page tracking structure. 1032 1080 */ 1033 #define PGM_PAGE_GET_HNDL_PHYS_STATE(a_pPage) ( (a_pPage)->u1 6MiscY.au8[0] )1081 #define PGM_PAGE_GET_HNDL_PHYS_STATE(a_pPage) ( (a_pPage)->u1.au8[0] ) 1034 1082 1035 1083 /** … … 1039 1087 */ 1040 1088 #define PGM_PAGE_SET_HNDL_PHYS_STATE(a_pPage, a_uState) \ 1041 do { (a_pPage)->u1 6MiscY.au8[0] = (a_uState); } while (0)1089 do { (a_pPage)->u1.au8[0] = (a_uState); } while (0) 1042 1090 1043 1091 /** … … 1077 1125 * @param a_pPage Pointer to the physical guest page tracking structure. 1078 1126 */ 1079 #define PGM_PAGE_GET_HNDL_VIRT_STATE(a_pPage) ((uint8_t)( (a_pPage)->u1 6MiscY.au8[1] & UINT8_C(0x03) ))1127 #define PGM_PAGE_GET_HNDL_VIRT_STATE(a_pPage) ((uint8_t)( (a_pPage)->u1.au8[1] & UINT8_C(0x03) )) 1080 1128 1081 1129 /** … … 1086 1134 #define PGM_PAGE_SET_HNDL_VIRT_STATE(a_pPage, a_uState) \ 1087 1135 do { \ 1088 (a_pPage)->u1 6MiscY.au8[1] = ((a_pPage)->u16MiscY.au8[1] & UINT8_C(0xfc)) \1089 | ((a_uState)& UINT8_C(0x03)); \1136 (a_pPage)->u1.au8[1] = ((a_pPage)->u1.au8[1] & UINT8_C(0xfc)) \ 1137 | ((a_uState) & UINT8_C(0x03)); \ 1090 1138 } while (0) 1091 1139 … … 1115 1163 #ifdef PGM_PAGE_WITH_OPTIMIZED_HANDLER_ACCESS 1116 1164 # define PGM_PAGE_HAS_ANY_HANDLERS(a_pPage) \ 1117 ( ((a_pPage)->u1 6MiscY.u & UINT16_C(0x0303)) != 0 )1165 ( ((a_pPage)->u1.u & UINT16_C(0x0303)) != 0 ) 1118 1166 #else 1119 1167 # define PGM_PAGE_HAS_ANY_HANDLERS(a_pPage) \ … … 1129 1177 #ifdef PGM_PAGE_WITH_OPTIMIZED_HANDLER_ACCESS 1130 1178 # define PGM_PAGE_HAS_ACTIVE_HANDLERS(a_pPage) \ 1131 ( ((a_pPage)->u1 6MiscY.u & UINT16_C(0x0202)) != 0 )1179 ( ((a_pPage)->u1.u & UINT16_C(0x0202)) != 0 ) 1132 1180 #else 1133 1181 # define PGM_PAGE_HAS_ACTIVE_HANDLERS(a_pPage) \ … … 1143 1191 #ifdef PGM_PAGE_WITH_OPTIMIZED_HANDLER_ACCESS 1144 1192 # define PGM_PAGE_HAS_ACTIVE_ALL_HANDLERS(a_pPage) \ 1145 ( ( ((a_pPage)->u1 6MiscY.au8[0] | (a_pPage)->u16MiscY.au8[1]) & UINT8_C(0x3) ) \1193 ( ( ((a_pPage)->u1.au8[0] | (a_pPage)->u1.au8[1]) & UINT8_C(0x3) ) \ 1146 1194 == PGM_PAGE_HNDL_PHYS_STATE_ALL ) 1147 1195 #else
Note:
See TracChangeset
for help on using the changeset viewer.