VirtualBox

Changeset 23483 in vbox for trunk/src


Ignore:
Timestamp:
Oct 1, 2009 1:40:25 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
53105
Message:

PGMPAGE: Merging u2HandlerPhysStateY into the misc field.

File:
1 edited

Legend:

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

    r23480 r23483  
    641641    uint8_t     uTypeY;
    642642
     643#define PGM_PAGE_WITH_U16MISCY 1
     644#ifdef PGM_PAGE_WITH_U16MISCY
     645    /** Combination of:
     646     *  - [0-7]: u2HandlerPhysStateY - the physical handler state
     647     *    (PGM_PAGE_HNDL_PHYS_STATE_*).
     648     *  - [8-9]: u2HandlerVirtStateY - the virtual handler state
     649     *    (PGM_PAGE_HNDL_VIRT_STATE_*).
     650     *  - [15]:  fWrittenToY - flag indicating that a write monitored page was
     651     *    written to when set.
     652     *  - [10-14]: 5 unused bits.
     653     * @remarks Warning! All accesses to the bits are hardcoded.
     654     */
     655    RTUINT16U   u16MiscY;
     656#else
    643657    /** The physical handler state (PGM_PAGE_HNDL_PHYS_STATE*).
    644658     * Only 2 bits are really needed for this.  */
     
    651665     *  - 5 unused bits. */
    652666    uint8_t     f8MiscY;
     667#endif
    653668
    654669    /** Usage tracking (page pool). */
     
    672687 * @param   pPage       Pointer to the physical guest page tracking structure.
    673688 */
     689#ifdef PGM_PAGE_WITH_U16MISCY
     690#define PGM_PAGE_CLEAR(pPage) \
     691    do { \
     692        (pPage)->HCPhysAndPageID     = 0; \
     693        (pPage)->uStateY             = 0; \
     694        (pPage)->uTypeY              = 0; \
     695        (pPage)->u16MiscY.u          = 0; \
     696        (pPage)->u16TrackingY        = 0; \
     697        (pPage)->cReadLocksY         = 0; \
     698        (pPage)->cWriteLocksY        = 0; \
     699    } while (0)
     700#else
    674701#define PGM_PAGE_CLEAR(pPage) \
    675702    do { \
     
    683710        (pPage)->cWriteLocksY        = 0; \
    684711    } while (0)
     712#endif
    685713
    686714/**
     
    688716 * @param   pPage       Pointer to the physical guest page tracking structure.
    689717 */
     718#ifdef PGM_PAGE_WITH_U16MISCY
     719#define PGM_PAGE_INIT(pPage, _HCPhys, _idPage, _uType, _uState) \
     720    do { \
     721        RTHCPHYS SetHCPhysTmp = (_HCPhys); \
     722        AssertFatal(!(SetHCPhysTmp & ~UINT64_C(0x0000fffffffff000))); \
     723        (pPage)->HCPhysAndPageID     = (SetHCPhysTmp << (28-12)) | ((_idPage) & UINT32_C(0x0fffffff)); \
     724        (pPage)->uStateY             = (_uState); \
     725        (pPage)->uTypeY              = (_uType); \
     726        (pPage)->u16MiscY.u          = 0; \
     727        (pPage)->u16TrackingY        = 0; \
     728        (pPage)->cReadLocksY         = 0; \
     729        (pPage)->cWriteLocksY        = 0; \
     730    } while (0)
     731#else
    690732#define PGM_PAGE_INIT(pPage, _HCPhys, _idPage, _uType, _uState) \
    691733    do { \
     
    701743        (pPage)->cWriteLocksY        = 0; \
    702744    } while (0)
     745#endif
    703746
    704747/**
     
    839882 * @param   pPage       Pointer to the physical guest page tracking structure.
    840883 */
     884#ifdef PGM_PAGE_WITH_U16MISCY
     885#define PGM_PAGE_SET_WRITTEN_TO(pPage)      do { (pPage)->u16MiscY.au8[1] |= UINT8_C(0x80); } while (0)
     886#else
    841887#define PGM_PAGE_SET_WRITTEN_TO(pPage)      do { (pPage)->f8MiscY |= UINT8_C(0x80); } while (0)
     888#endif
    842889
    843890/**
     
    845892 * @param   pPage       Pointer to the physical guest page tracking structure.
    846893 */
     894#ifdef PGM_PAGE_WITH_U16MISCY
     895#define PGM_PAGE_CLEAR_WRITTEN_TO(pPage)    do { (pPage)->u16MiscY.au8[1] &= UINT8_C(0x7f); } while (0)
     896#else
    847897#define PGM_PAGE_CLEAR_WRITTEN_TO(pPage)    do { (pPage)->f8MiscY &= UINT8_C(0x7f); } while (0)
     898#endif
    848899
    849900/**
     
    852903 * @param   pPage       Pointer to the physical guest page tracking structure.
    853904 */
     905#ifdef PGM_PAGE_WITH_U16MISCY
     906#define PGM_PAGE_IS_WRITTEN_TO(pPage)       ( !!((pPage)->u16MiscY.au8[1] & UINT8_C(0x80)) )
     907#else
    854908#define PGM_PAGE_IS_WRITTEN_TO(pPage)       ( !!((pPage)->f8MiscY & UINT8_C(0x80)) )
     909#endif
    855910
    856911
     
    875930 * @param   pPage       Pointer to the physical guest page tracking structure.
    876931 */
     932#ifdef PGM_PAGE_WITH_U16MISCY
     933#define PGM_PAGE_GET_HNDL_PHYS_STATE(pPage)  \
     934    ( (pPage)->u16MiscY.au8[0] )
     935#else
    877936#define PGM_PAGE_GET_HNDL_PHYS_STATE(pPage)  \
    878937    ( (pPage)->uHandlerPhysStateY )
     938#endif
    879939
    880940/**
     
    883943 * @param   _uState     The new state value.
    884944 */
     945#ifdef PGM_PAGE_WITH_U16MISCY
     946#define PGM_PAGE_SET_HNDL_PHYS_STATE(pPage, _uState) \
     947    do { (pPage)->u16MiscY.au8[0] = (_uState); } while (0)
     948#else
    885949#define PGM_PAGE_SET_HNDL_PHYS_STATE(pPage, _uState) \
    886950    do { (pPage)->uHandlerPhysStateY = (_uState); } while (0)
     951#endif
    887952
    888953/**
     
    922987 * @param   pPage       Pointer to the physical guest page tracking structure.
    923988 */
     989#ifdef PGM_PAGE_WITH_U16MISCY
     990#define PGM_PAGE_GET_HNDL_VIRT_STATE(pPage) ( (pPage)->u16MiscY.au8[1] & UINT8_C(0x03) )
     991#else
    924992#define PGM_PAGE_GET_HNDL_VIRT_STATE(pPage) ( (pPage)->f8MiscY & UINT8_C(0x03) )
     993#endif
    925994
    926995/**
     
    929998 * @param   _uState     The new state value.
    930999 */
     1000#ifdef PGM_PAGE_WITH_U16MISCY
     1001#define PGM_PAGE_SET_HNDL_VIRT_STATE(pPage, _uState) \
     1002    do { \
     1003        (pPage)->u16MiscY.au8[1] = ((pPage)->u16MiscY.au8[1] & UINT8_C(0xfc)) \
     1004                                 | ((_uState)                & UINT8_C(0x03)); \
     1005    } while (0)
     1006#else
    9311007#define PGM_PAGE_SET_HNDL_VIRT_STATE(pPage, _uState) \
    9321008    do { \
     
    9341010                         | ((_uState)        & UINT8_C(0x03)); \
    9351011    } while (0)
     1012#endif
    9361013
    9371014/**
Note: See TracChangeset for help on using the changeset viewer.

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