Changeset 36935 in vbox for trunk/src/VBox/VMM/include/PGMInternal.h
- Timestamp:
- May 3, 2011 1:54:06 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/include/PGMInternal.h
r36934 r36935 693 693 /** The physical address and the Page ID. */ 694 694 RTHCPHYS HCPhysAndPageID; 695 #define PGMPAGE_USE_MORE_BITFIELDS696 #ifndef PGMPAGE_USE_MORE_BITFIELDS697 /** Combination of:698 * - [0-7]: u2HandlerPhysStateY - the physical handler state699 * (PGM_PAGE_HNDL_PHYS_STATE_*).700 * - [8-9]: u2HandlerVirtStateY - the virtual handler state701 * (PGM_PAGE_HNDL_VIRT_STATE_*).702 * - [10]: fFTDirtyY - indicator of dirty page for fault tolerance tracking.703 * - [13-14]: u2PDEType - paging structure needed to map the page (PGM_PAGE_PDE_TYPE_*)704 * - [15]: fWrittenToY - flag indicating that a write monitored page was705 * written to when set.706 * - [11-13]: 3 unused bits.707 * @remarks Warning! All accesses to the bits are hardcoded.708 *709 * @todo Change this to a union with both bitfields, u8 and u accessors.710 * That'll help deal with some of the hardcoded accesses.711 *712 * @todo Include uStateY and uTypeY as well so it becomes 32-bit. This713 * will make it possible to turn some of the 16-bit accesses into714 * 32-bit ones, which may be efficient (stalls).715 */716 union717 {718 struct719 {720 uint16_t u16MiscY;721 /** The page state.722 * Only 3 bits are really needed for this. */723 uint16_t uStateY : 3;724 /** The page type (PGMPAGETYPE).725 * Only 3 bits are really needed for this. */726 uint16_t uTypeY : 3;727 /** PTE index for usage tracking (page pool). */728 uint16_t u10PteIdx : 10;729 } bit;730 731 /** 32-bit integer view. */732 uint32_t u;733 /** 16-bit view. */734 uint16_t au16[2];735 /** 8-bit view. */736 uint8_t au8[4];737 } u1;738 #else739 695 union 740 696 { … … 745 701 * (PGM_PAGE_HNDL_PHYS_STATE_*). */ 746 702 uint32_t u2HandlerPhysStateY : 8; 703 /*uint32_t u6Reserved : 6;*/ 747 704 /** 9:8 - The physical handler state 748 705 * (PGM_PAGE_HNDL_VIRT_STATE_*). */ … … 750 707 /** 10 - Indicator of dirty page for fault tolerance 751 708 * tracking. */ 752 uint32_t fFTDirtyY : 1;709 uint32_t fFTDirtyY : 1; 753 710 /** 12:11 - Currently unused. */ 754 711 uint32_t u2Unused2 : 2; … … 773 730 uint8_t au8[4]; 774 731 } u1; 775 #endif776 732 /** Usage tracking (page pool). */ 777 733 uint16_t u16TrackingY; … … 993 949 * @param a_pPage Pointer to the physical guest page tracking structure. 994 950 */ 995 #ifdef PGMPAGE_USE_MORE_BITFIELDS996 951 #define PGM_PAGE_CLEAR_WRITTEN_TO(a_pPage) do { (a_pPage)->u1.bit.fWrittenToY = 0; } while (0) 997 #else998 #define PGM_PAGE_CLEAR_WRITTEN_TO(a_pPage) do { (a_pPage)->u1.au8[1] &= UINT8_C(0x7f); } while (0)999 #endif1000 952 1001 953 /** … … 1004 956 * @param a_pPage Pointer to the physical guest page tracking structure. 1005 957 */ 1006 #ifdef PGMPAGE_USE_MORE_BITFIELDS1007 958 #define PGM_PAGE_IS_WRITTEN_TO(a_pPage) ( (a_pPage)->u1.bit.fWrittenToY ) 1008 #else1009 #define PGM_PAGE_IS_WRITTEN_TO(a_pPage) ( !!((a_pPage)->u1.au8[1] & UINT8_C(0x80)) )1010 #endif1011 959 1012 960 /** … … 1014 962 * @param a_pPage Pointer to the physical guest page tracking structure. 1015 963 */ 1016 #ifdef PGMPAGE_USE_MORE_BITFIELDS1017 964 #define PGM_PAGE_SET_FT_DIRTY(a_pPage) do { (a_pPage)->u1.bit.fFTDirtyY = 1; } while (0) 1018 #else1019 #define PGM_PAGE_SET_FT_DIRTY(a_pPage) do { (a_pPage)->u1.au8[1] |= UINT8_C(0x04); } while (0)1020 #endif1021 965 1022 966 /** … … 1024 968 * @param a_pPage Pointer to the physical guest page tracking structure. 1025 969 */ 1026 #ifdef PGMPAGE_USE_MORE_BITFIELDS1027 970 #define PGM_PAGE_CLEAR_FT_DIRTY(a_pPage) do { (a_pPage)->u1.bit.fFTDirtyY = 0; } while (0) 1028 #else1029 #define PGM_PAGE_CLEAR_FT_DIRTY(a_pPage) do { (a_pPage)->u1.au8[1] &= UINT8_C(0xfb); } while (0)1030 #endif1031 971 1032 972 /** … … 1035 975 * @param a_pPage Pointer to the physical guest page tracking structure. 1036 976 */ 1037 #ifdef PGMPAGE_USE_MORE_BITFIELDS1038 977 #define PGM_PAGE_IS_FT_DIRTY(a_pPage) ( (a_pPage)->u1.bit.fFTDirtyY ) 1039 #else1040 #define PGM_PAGE_IS_FT_DIRTY(a_pPage) ( !!((a_pPage)->u1.au8[1] & UINT8_C(0x04)) )1041 #endif1042 978 1043 979 … … 1060 996 * @param a_uType PGM_PAGE_PDE_TYPE_*. 1061 997 */ 1062 #ifdef PGMPAGE_USE_MORE_BITFIELDS1063 998 #define PGM_PAGE_SET_PDE_TYPE(a_pPage, a_uType) \ 1064 999 do { (a_pPage)->u1.bit.u2PDETypeY = (a_uType); } while (0) 1065 #else1066 #define PGM_PAGE_SET_PDE_TYPE(a_pPage, a_uType) \1067 do { \1068 (a_pPage)->u1.au8[1] = ((a_pPage)->u1.au8[1] & UINT8_C(0x9f)) \1069 | (((a_uType) & UINT8_C(0x03)) << 5); \1070 } while (0)1071 #endif1072 1000 1073 1001 /** … … 1076 1004 * @param a_pPage Pointer to the physical guest page tracking structure. 1077 1005 */ 1078 #ifdef PGMPAGE_USE_MORE_BITFIELDS1079 1006 #define PGM_PAGE_GET_PDE_TYPE(a_pPage) ( (a_pPage)->u1.bit.u2PDETypeY ) 1080 #else1081 #define PGM_PAGE_GET_PDE_TYPE(a_pPage) ( ((a_pPage)->u1.au8[1] & UINT8_C(0x60)) >> 5)1082 #endif1083 1007 1084 1008 /** Enabled optimized access handler tests. … … 1109 1033 * @param a_pPage Pointer to the physical guest page tracking structure. 1110 1034 */ 1111 #ifdef PGMPAGE_USE_MORE_BITFIELDS1112 1035 #define PGM_PAGE_GET_HNDL_PHYS_STATE(a_pPage) ( (a_pPage)->u1.bit.u2HandlerPhysStateY ) 1113 #else1114 #define PGM_PAGE_GET_HNDL_PHYS_STATE(a_pPage) ( (a_pPage)->u1.au8[0] )1115 #endif1116 1036 1117 1037 /** … … 1120 1040 * @param a_uState The new state value. 1121 1041 */ 1122 #ifdef PGMPAGE_USE_MORE_BITFIELDS1123 1042 #define PGM_PAGE_SET_HNDL_PHYS_STATE(a_pPage, a_uState) \ 1124 1043 do { (a_pPage)->u1.bit.u2HandlerPhysStateY = (a_uState); } while (0) 1125 #else1126 #define PGM_PAGE_SET_HNDL_PHYS_STATE(a_pPage, a_uState) \1127 do { (a_pPage)->u1.au8[0] = (a_uState); } while (0)1128 #endif1129 1044 1130 1045 /** … … 1164 1079 * @param a_pPage Pointer to the physical guest page tracking structure. 1165 1080 */ 1166 #ifdef PGMPAGE_USE_MORE_BITFIELDS1167 1081 #define PGM_PAGE_GET_HNDL_VIRT_STATE(a_pPage) ( (a_pPage)->u1.bit.u2HandlerVirtStateY ) 1168 #else1169 #define PGM_PAGE_GET_HNDL_VIRT_STATE(a_pPage) ((uint8_t)( (a_pPage)->u1.au8[1] & UINT8_C(0x03) ))1170 #endif1171 1082 1172 1083 /** … … 1175 1086 * @param a_uState The new state value. 1176 1087 */ 1177 #ifdef PGMPAGE_USE_MORE_BITFIELDS1178 1088 #define PGM_PAGE_SET_HNDL_VIRT_STATE(a_pPage, a_uState) \ 1179 1089 do { (a_pPage)->u1.bit.u2HandlerVirtStateY = (a_uState); } while (0) 1180 #else1181 #define PGM_PAGE_SET_HNDL_VIRT_STATE(a_pPage, a_uState) \1182 do { \1183 (a_pPage)->u1.au8[1] = ((a_pPage)->u1.au8[1] & UINT8_C(0xfc)) \1184 | ((a_uState) & UINT8_C(0x03)); \1185 } while (0)1186 #endif1187 1090 1188 1091 /**
Note:
See TracChangeset
for help on using the changeset viewer.