VirtualBox

Changeset 36940 in vbox for trunk/src/VBox/VMM/include


Ignore:
Timestamp:
May 3, 2011 2:55:19 PM (14 years ago)
Author:
vboxsync
Message:

PGMPAGE: Finally, idPage is 32-bit. The physical address can now be masked out, instead of shifted and masked.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/include/PGMInternal.h

    r36939 r36940  
    694694    struct
    695695    {
    696         /** The physical address and the Page ID. */
    697         RTHCPHYS    HCPhysAndPageID;
    698 
    699         /** 1:0   - The physical handler state
    700          *  (PGM_PAGE_HNDL_PHYS_STATE_*). */
    701         uint32_t    u2HandlerPhysStateY : 2;
    702         /** 7:2   - Currently unused. */
    703         uint32_t    u6Unused1  : 6;
    704         /** 9:8   - The physical handler state
    705          *  (PGM_PAGE_HNDL_VIRT_STATE_*). */
    706         uint32_t    u2HandlerVirtStateY : 2;
    707         /** 10    - Indicator of dirty page for fault tolerance
    708          *  tracking. */
    709         uint32_t    fFTDirtyY   : 1;
    710         /** 12:11 - Currently unused. */
    711         uint32_t    u2Unused2   : 2;
    712         /** 14:13 - Paging structure needed to map the page
     696        /** 1:0   - The physical handler state (PGM_PAGE_HNDL_PHYS_STATE_*). */
     697        uint64_t    u2HandlerPhysStateY : 2;
     698        /** 3:2   - Paging structure needed to map the page
    713699         * (PGM_PAGE_PDE_TYPE_*). */
    714         uint32_t    u2PDETypeY  : 2;
    715         /** 15    - Flag indicating that a write monitored page was written
    716          *  to when set. */
    717         uint32_t    fWrittenToY : 1;
    718         /** 18:16 - The page state. */
    719         uint32_t    uStateY     : 3;
    720         /** 21:19 - The page type (PGMPAGETYPE). */
    721         uint32_t    uTypeY      : 3;
    722         /** 31:22 - PTE index for usage tracking (page pool). */
    723         uint32_t    u10PteIdx   : 10;
    724 
     700        uint64_t    u2PDETypeY          : 2;
     701        /** 4     - Indicator of dirty page for fault tolerance tracking. */
     702        uint64_t    fFTDirtyY           : 1;
     703        /** 5     - Flag indicating that a write monitored page was written to
     704         *  when set. */
     705        uint64_t    fWrittenToY         : 1;
     706        /** 7:6   - Unused. */
     707        uint64_t    u2Unused0           : 2;
     708        /** 9:8   - The physical handler state (PGM_PAGE_HNDL_VIRT_STATE_*). */
     709        uint64_t    u2HandlerVirtStateY : 2;
     710        /** 11:10 - Unused. */
     711        uint64_t    u2Unused1           : 2;
     712        /** 12:48 - The host physical frame number (shift left to get the
     713         *  address). */
     714        uint64_t    HCPhysFN            : 36;
     715        /** 50:48 - The page state. */
     716        uint64_t    uStateY             : 3;
     717        /** 51:53 - The page type (PGMPAGETYPE). */
     718        uint64_t    uTypeY              : 3;
     719        /** 63:54 - PTE index for usage tracking (page pool). */
     720        uint64_t    u10PteIdx           : 10;
     721
     722        /** The GMM page ID. */
     723        uint32_t    idPage;
    725724        /** Usage tracking (page pool). */
    726725        uint16_t    u16TrackingY;
     
    765764#define PGM_PAGE_INIT(a_pPage, a_HCPhys, a_idPage, a_uType, a_uState) \
    766765    do { \
    767         (a_pPage)->au64[1]           = 0; \
    768766        RTHCPHYS SetHCPhysTmp = (a_HCPhys); \
    769767        AssertFatal(!(SetHCPhysTmp & ~UINT64_C(0x0000fffffffff000))); \
    770         (a_pPage)->s.HCPhysAndPageID = (SetHCPhysTmp << (28-12)) | ((a_idPage) & UINT32_C(0x0fffffff)); \
     768        (a_pPage)->au64[0]           = SetHCPhysTmp; \
     769        (a_pPage)->au64[1]           = 0; \
     770        (a_pPage)->s.idPage          = (a_idPage); \
    771771        (a_pPage)->s.uStateY         = (a_uState); \
    772772        (a_pPage)->s.uTypeY          = (a_uType); \
     
    826826 * @param   a_pPage     Pointer to the physical guest page tracking structure.
    827827 */
    828 #define PGM_PAGE_GET_HCPHYS(a_pPage)            ( ((a_pPage)->s.HCPhysAndPageID >> 28) << 12 )
     828#if 0
     829#define PGM_PAGE_GET_HCPHYS(a_pPage)            ( (a_pPage)->s.HCPhysFN << 12 )
     830#else
     831#define PGM_PAGE_GET_HCPHYS(a_pPage)            ( (a_pPage)->au64[0] & UINT64_C(0x0000fffffffff000) )
     832#endif
    829833
    830834/**
     
    837841        RTHCPHYS const SetHCPhysTmp = (a_HCPhys); \
    838842        AssertFatal(!(SetHCPhysTmp & ~UINT64_C(0x0000fffffffff000))); \
    839         (a_pPage)->s.HCPhysAndPageID = ((a_pPage)->s.HCPhysAndPageID & UINT32_C(0x0fffffff)) \
    840                                      | (SetHCPhysTmp << (28-12)); \
     843        (a_pPage)->s.HCPhysFN = SetHCPhysTmp >> 12; \
    841844    } while (0)
    842845
     
    846849 * @param   a_pPage     Pointer to the physical guest page tracking structure.
    847850 */
    848 #define PGM_PAGE_GET_PAGEID(a_pPage)            (  (uint32_t)((a_pPage)->s.HCPhysAndPageID & UINT32_C(0x0fffffff)) )
     851#define PGM_PAGE_GET_PAGEID(a_pPage)            (  (uint32_t)(a_pPage)->s.idPage )
    849852
    850853/**
     
    855858#define PGM_PAGE_SET_PAGEID(a_pPage, a_idPage) \
    856859    do { \
    857         (a_pPage)->s.HCPhysAndPageID = (((a_pPage)->s.HCPhysAndPageID) & UINT64_C(0xfffffffff0000000)) \
    858                                           | ((a_idPage) & UINT32_C(0x0fffffff)); \
     860        (a_pPage)->s.idPage = (a_idPage); \
    859861    } while (0)
    860862
     
    871873 * @param   a_pPage     Pointer to the physical guest page tracking structure.
    872874 */
    873 #define PGM_PAGE_GET_PAGE_IN_CHUNK(a_pPage)     ( (uint32_t)((a_pPage)->s.HCPhysAndPageID & GMM_PAGEID_IDX_MASK) )
     875#define PGM_PAGE_GET_PAGE_IN_CHUNK(a_pPage)     ( PGM_PAGE_GET_PAGEID(a_pPage) & GMM_PAGEID_IDX_MASK )
    874876
    875877/**
     
    11111113#ifdef PGM_PAGE_WITH_OPTIMIZED_HANDLER_ACCESS
    11121114# define PGM_PAGE_HAS_ANY_HANDLERS(a_pPage) \
    1113     ( ((a_pPage)->au32[2] & UINT16_C(0x0303)) != 0 )
     1115    ( ((a_pPage)->au32[0] & UINT16_C(0x0303)) != 0 )
    11141116#else
    11151117# define PGM_PAGE_HAS_ANY_HANDLERS(a_pPage) \
     
    11251127#ifdef PGM_PAGE_WITH_OPTIMIZED_HANDLER_ACCESS
    11261128# define PGM_PAGE_HAS_ACTIVE_HANDLERS(a_pPage) \
    1127     ( ((a_pPage)->au32[2] & UINT16_C(0x0202)) != 0 )
     1129    ( ((a_pPage)->au32[0] & UINT16_C(0x0202)) != 0 )
    11281130#else
    11291131# define PGM_PAGE_HAS_ACTIVE_HANDLERS(a_pPage) \
     
    11391141#ifdef PGM_PAGE_WITH_OPTIMIZED_HANDLER_ACCESS
    11401142# define PGM_PAGE_HAS_ACTIVE_ALL_HANDLERS(a_pPage) \
    1141     (   ( ((a_pPage)->au8[8] | (a_pPage)->au8[9]) & UINT8_C(0x3) ) \
     1143    (   ( ((a_pPage)->au8[0] | (a_pPage)->au8[1]) & UINT8_C(0x3) ) \
    11421144     == PGM_PAGE_HNDL_PHYS_STATE_ALL )
    11431145#else
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette