- Timestamp:
- Nov 6, 2021 3:39:24 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR0/GMMR0.cpp
r92248 r92249 181 181 #include <iprt/time.h> 182 182 183 /* This is 64-bit only code now. */ 184 #if HC_ARCH_BITS != 64 || ARCH_BITS != 64 185 # error "This is 64-bit only code" 186 #endif 187 183 188 184 189 /********************************************************************************************************************************* … … 204 209 * The per-page tracking structure employed by the GMM. 205 210 * 206 * On 32-bit hosts we'll some trickery is necessary to compress all 207 * the information into 32-bits. When the fSharedFree member is set, 208 * the 30th bit decides whether it's a free page or not. 209 * 210 * Because of the different layout on 32-bit and 64-bit hosts, macros 211 * are used to get and set some of the data. 211 * Because of the different layout on 32-bit and 64-bit hosts in earlier 212 * versions of the code, macros are used to get and set some of the data. 212 213 */ 213 214 typedef union GMMPAGE 214 215 { 215 #if HC_ARCH_BITS == 64216 216 /** Unsigned integer view. */ 217 217 uint64_t u; … … 264 264 uint32_t u2State : 2; 265 265 } Free; 266 267 #else /* 32-bit */268 /** Unsigned integer view. */269 uint32_t u;270 271 /** The common view. */272 struct GMMPAGECOMMON273 {274 uint32_t uStuff : 30;275 /** The page state. */276 uint32_t u2State : 2;277 } Common;278 279 /** The view of a private page. */280 struct GMMPAGEPRIVATE281 {282 /** The guest page frame number. (Max addressable: 2 ^ 36) */283 uint32_t pfn : 24;284 /** The GVM handle. (127 VMs) */285 uint32_t hGVM : 7;286 /** The top page state bit, MBZ. */287 uint32_t fZero : 1;288 } Private;289 290 /** The view of a shared page. */291 struct GMMPAGESHARED292 {293 /** The reference count. */294 uint32_t cRefs : 30;295 /** The page state. */296 uint32_t u2State : 2;297 } Shared;298 299 /** The view of a free page. */300 struct GMMPAGEFREE301 {302 /** The index of the next page in the free list. UINT16_MAX is NIL. */303 uint32_t iNext : 16;304 /** Reserved. Checksum or something? */305 uint32_t u14Reserved : 14;306 /** The page state. */307 uint32_t u2State : 2;308 } Free;309 #endif310 266 } GMMPAGE; 311 267 AssertCompileSize(GMMPAGE, sizeof(RTHCUINTPTR)); … … 318 274 /** A private page. */ 319 275 #define GMM_PAGE_STATE_PRIVATE 0 320 /** A private page - alternative value used on the 32-bit implementation.321 * This will never be used on 64-bit hosts. */322 #define GMM_PAGE_STATE_PRIVATE_32 1323 276 /** A shared page. */ 324 277 #define GMM_PAGE_STATE_SHARED 2 … … 333 286 * @param pPage The GMM page. 334 287 */ 335 #if HC_ARCH_BITS == 64 336 # define GMM_PAGE_IS_PRIVATE(pPage) ( (pPage)->Common.u2State == GMM_PAGE_STATE_PRIVATE ) 337 #else 338 # define GMM_PAGE_IS_PRIVATE(pPage) ( (pPage)->Private.fZero == 0 ) 339 #endif 288 #define GMM_PAGE_IS_PRIVATE(pPage) ( (pPage)->Common.u2State == GMM_PAGE_STATE_PRIVATE ) 340 289 341 290 /** @def GMM_PAGE_IS_SHARED … … 358 307 * see GMM_PAGE_PFN_UNSHAREABLE. 359 308 */ 360 #if HC_ARCH_BITS == 64 361 # define GMM_PAGE_PFN_LAST UINT32_C(0xfffffff0) 362 #else 363 # define GMM_PAGE_PFN_LAST UINT32_C(0x00fffff0) 364 #endif 365 AssertCompile(GMM_PAGE_PFN_LAST == (GMM_GCPHYS_LAST >> PAGE_SHIFT)); 309 #define GMM_PAGE_PFN_LAST UINT32_C(0xfffffff0) 310 AssertCompile(GMM_PAGE_PFN_LAST == (GMM_GCPHYS_LAST >> PAGE_SHIFT)); 366 311 367 312 /** @def GMM_PAGE_PFN_UNSHAREABLE 368 313 * Indicates that this page isn't used for normal guest memory and thus isn't shareable. 369 314 */ 370 #if HC_ARCH_BITS == 64 371 # define GMM_PAGE_PFN_UNSHAREABLE UINT32_C(0xfffffff1) 372 #else 373 # define GMM_PAGE_PFN_UNSHAREABLE UINT32_C(0x00fffff1) 374 #endif 315 #define GMM_PAGE_PFN_UNSHAREABLE UINT32_C(0xfffffff1) 375 316 AssertCompile(GMM_PAGE_PFN_UNSHAREABLE == (GMM_GCPHYS_UNSHAREABLE >> PAGE_SHIFT)); 376 317 … … 3646 3587 Assert(pGVM->gmm.s.Stats.cSharedPages); 3647 3588 Assert(pPage->Shared.cRefs); 3648 #if defined(VBOX_WITH_PAGE_SHARING) && defined(VBOX_STRICT) && HC_ARCH_BITS == 643589 #if defined(VBOX_WITH_PAGE_SHARING) && defined(VBOX_STRICT) 3649 3590 if (pPage->Shared.u14Checksum) 3650 3591 { … … 4210 4151 4211 4152 4212 #if defined(VBOX_WITH_PAGE_SHARING) || (defined(VBOX_STRICT) && HC_ARCH_BITS == 64)4153 #if defined(VBOX_WITH_PAGE_SHARING) || defined(VBOX_STRICT) 4213 4154 /** 4214 4155 * Check if a chunk is mapped into the specified VM … … 4238 4179 return false; 4239 4180 } 4240 #endif /* VBOX_WITH_PAGE_SHARING || (VBOX_STRICT && 64-BIT)*/4181 #endif /* VBOX_WITH_PAGE_SHARING || VBOX_STRICT */ 4241 4182 4242 4183 … … 5339 5280 } 5340 5281 5341 #if defined(VBOX_STRICT) && HC_ARCH_BITS == 645282 #ifdef VBOX_STRICT 5342 5283 5343 5284 /** … … 5449 5390 } 5450 5391 5451 #endif /* VBOX_STRICT && HC_ARCH_BITS == 64*/5392 #endif /* VBOX_STRICT */ 5452 5393 5453 5394
Note:
See TracChangeset
for help on using the changeset viewer.