Changeset 31775 in vbox for trunk/src/VBox/VMM/PGMInternal.h
- Timestamp:
- Aug 19, 2010 9:48:24 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/PGMInternal.h
r31657 r31775 413 413 # define PGM_INVL_ALL_VCPU_TLBS(pVM) HWACCMFlushTLBOnAllVCpus(pVM) 414 414 #endif 415 416 417 /** @name Safer Shadow PAE PT/PTE 418 * For helping avoid misinterpreting invalid PAE/AMD64 page table entries as 419 * present. 420 * 421 * @{ 422 */ 423 #if 1 424 /** 425 * For making sure that u1Present and X86_PTE_P checks doesn't mistake 426 * invalid entries for present. 427 * @sa X86PTEPAE. 428 */ 429 typedef union PGMSHWPTEPAE 430 { 431 /** Unsigned integer view */ 432 X86PGPAEUINT uCareful; 433 #if 0 434 /* Not bit field view. */ 435 /** 32-bit view. */ 436 uint32_t au32[2]; 437 /** 16-bit view. */ 438 uint16_t au16[4]; 439 /** 8-bit view. */ 440 uint8_t au8[8]; 441 #endif 442 } PGMSHWPTEPAE; 443 444 # define PGMSHWPTEPAE_IS_P(Pte) ( ((Pte).uCareful & (X86_PTE_P | X86_PTE_PAE_MBZ_MASK_NX)) == X86_PTE_P ) 445 # define PGMSHWPTEPAE_IS_RW(Pte) ( !!((Pte).uCareful & X86_PTE_RW)) 446 # define PGMSHWPTEPAE_IS_US(Pte) ( !!((Pte).uCareful & X86_PTE_US)) 447 # define PGMSHWPTEPAE_IS_A(Pte) ( !!((Pte).uCareful & X86_PTE_A)) 448 # define PGMSHWPTEPAE_IS_D(Pte) ( !!((Pte).uCareful & X86_PTE_D)) 449 # define PGMSHWPTEPAE_IS_TRACK_DIRTY(Pte) ( !!((Pte).uCareful & PGM_PTFLAGS_TRACK_DIRTY) ) 450 # define PGMSHWPTEPAE_IS_P_RW(Pte) ( ((Pte).uCareful & (X86_PTE_P | X86_PTE_RW | X86_PTE_PAE_MBZ_MASK_NX)) == (X86_PTE_P | X86_PTE_RW) ) 451 # define PGMSHWPTEPAE_GET_LOG(Pte) ( (Pte).uCareful ) 452 # define PGMSHWPTEPAE_GET_HCPHYS(Pte) ( (Pte).uCareful & X86_PTE_PAE_PG_MASK ) 453 # define PGMSHWPTEPAE_GET_U(Pte) ( (Pte).uCareful ) /**< Use with care. */ 454 # define PGMSHWPTEPAE_SET(Pte, uVal) do { (Pte).uCareful = (uVal); } while (0) 455 # define PGMSHWPTEPAE_SET2(Pte, Pte2) do { (Pte).uCareful = (Pte2).uCareful; } while (0) 456 # define PGMSHWPTEPAE_ATOMIC_SET(Pte, uVal) do { ASMAtomicWriteU64(&(Pte).uCareful, (uVal)); } while (0) 457 # define PGMSHWPTEPAE_ATOMIC_SET2(Pte, Pte2) do { ASMAtomicWriteU64(&(Pte).uCareful, (Pte2).uCareful); } while (0) 458 # define PGMSHWPTEPAE_SET_RO(Pte) do { (Pte).uCareful &= ~(X86PGPAEUINT)X86_PTE_RW; } while (0) 459 # define PGMSHWPTEPAE_SET_RW(Pte) do { (Pte).uCareful |= X86_PTE_RW; } while (0) 460 461 /** 462 * For making sure that u1Present and X86_PTE_P checks doesn't mistake 463 * invalid entries for present. 464 * @sa X86PTPAE. 465 */ 466 typedef struct PGMSHWPTPAE 467 { 468 PGMSHWPTEPAE a[X86_PG_PAE_ENTRIES]; 469 } PGMSHWPTPAE; 470 471 #else 472 typedef X86PTEPAE PGMSHWPTEPAE; 473 typedef X86PTPAE PGMSHWPTPAE; 474 # define PGMSHWPTEPAE_IS_P(Pte) ( (Pte).n.u1Present ) 475 # define PGMSHWPTEPAE_IS_RW(Pte) ( (Pte).n.u1Write ) 476 # define PGMSHWPTEPAE_IS_US(Pte) ( (Pte).n.u1User ) 477 # define PGMSHWPTEPAE_IS_A(Pte) ( (Pte).n.u1Accessed ) 478 # define PGMSHWPTEPAE_IS_D(Pte) ( (Pte).n.u1Dirty ) 479 # define PGMSHWPTEPAE_IS_TRACK_DIRTY(Pte) ( !!((Pte).u & PGM_PTFLAGS_TRACK_DIRTY) ) 480 # define PGMSHWPTEPAE_IS_P_RW(Pte) ( ((Pte).u & (X86_PTE_P | X86_PTE_RW)) == (X86_PTE_P | X86_PTE_RW) ) 481 # define PGMSHWPTEPAE_GET_LOG(Pte) ( (Pte).u ) 482 # define PGMSHWPTEPAE_GET_HCPHYS(Pte) ( (Pte).u & X86_PTE_PAE_PG_MASK ) 483 # define PGMSHWPTEPAE_GET_U(Pte) ( (Pte).u ) /**< Use with care. */ 484 # define PGMSHWPTEPAE_SET(Pte, uVal) do { (Pte).u = (uVal); } while (0) 485 # define PGMSHWPTEPAE_SET2(Pte, Pte2) do { (Pte).u = (Pte2).u; } while (0) 486 # define PGMSHWPTEPAE_ATOMIC_SET(Pte, uVal) do { ASMAtomicWriteU64(&(Pte).u, (uVal)); } while (0) 487 # define PGMSHWPTEPAE_ATOMIC_SET2(Pte, Pte2) do { ASMAtomicWriteU64(&(Pte).u, (Pte2).u); } while (0) 488 # define PGMSHWPTEPAE_SET_RO(Pte) do { (Pte).u &= ~(X86PGPAEUINT)X86_PTE_RW; } while (0) 489 # define PGMSHWPTEPAE_SET_RW(Pte) do { (Pte).u |= X86_PTE_RW; } while (0) 490 491 #endif 492 493 /** Pointer to a shadow PAE PTE. */ 494 typedef PGMSHWPTEPAE *PPGMSHWPTEPAE; 495 /** Pointer to a const shadow PAE PTE. */ 496 typedef PGMSHWPTEPAE const *PCPGMSHWPTEPAE; 497 498 /** Pointer to a shadow PAE page table. */ 499 typedef PGMSHWPTPAE *PPGMSHWPTPAE; 500 /** Pointer to a const shadow PAE page table. */ 501 typedef PGMSHWPTPAE const *PCPGMSHWPTPAE; 502 /** @} */ 503 415 504 416 505 /** Size of the GCPtrConflict array in PGMMAPPING. … … 467 556 R3PTRTYPE(PX86PT) pPTR3; 468 557 /** The HC virtual address of the two PAE page table. (i.e 1024 entries instead of 512) */ 469 R3PTRTYPE(P X86PTPAE)paPaePTsR3;558 R3PTRTYPE(PPGMSHWPTPAE) paPaePTsR3; 470 559 /** The RC virtual address of the 32-bit page table. */ 471 560 RCPTRTYPE(PX86PT) pPTRC; 472 561 /** The RC virtual address of the two PAE page table. */ 473 RCPTRTYPE(P X86PTPAE)paPaePTsRC;562 RCPTRTYPE(PPGMSHWPTPAE) paPaePTsRC; 474 563 /** The R0 virtual address of the 32-bit page table. */ 475 564 R0PTRTYPE(PX86PT) pPTR0; 476 565 /** The R0 virtual address of the two PAE page table. */ 477 R0PTRTYPE(P X86PTPAE)paPaePTsR0;566 R0PTRTYPE(PPGMSHWPTPAE) paPaePTsR0; 478 567 } aPTs[1]; 479 568 } PGMMAPPING; … … 2318 2407 * PGMPOOL_TD_CREFS_SHIFT. */ 2319 2408 #define PGMPOOL_TD_CREFS_MASK 0x3 2320 /** The cRef value used to indiciate that the idx is the head of a2409 /** The cRefs value used to indiciate that the idx is the head of a 2321 2410 * physical cross reference list. */ 2322 2411 #define PGMPOOL_TD_CREFS_PHYSEXT PGMPOOL_TD_CREFS_MASK … … 2917 3006 RCPTRTYPE(PX86PTE) paDynPageMap32BitPTEsGC; 2918 3007 /** Pointer to the page table entries for the dynamic page mapping area - GCPtr. */ 2919 RCPTRTYPE(P X86PTEPAE)paDynPageMapPaePTEsGC;3008 RCPTRTYPE(PPGMSHWPTEPAE) paDynPageMapPaePTEsGC; 2920 3009 2921 3010
Note:
See TracChangeset
for help on using the changeset viewer.