VirtualBox

Changeset 36910 in vbox for trunk/src/VBox/VMM


Ignore:
Timestamp:
May 2, 2011 2:00:58 PM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
71492
Message:

PGMInternal.h: Cleaning up page macros before making further changes.

Location:
trunk/src/VBox/VMM
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR0/GMMR0.cpp

    r36441 r36910  
    622622*   Internal Functions                                                         *
    623623*******************************************************************************/
    624 static DECLCALLBACK(int) gmmR0TermDestroyChunk(PAVLU32NODECORE pNode, void *pvGMM);
    625 static DECLCALLBACK(int) gmmR0CleanupVMScanChunk(PAVLU32NODECORE pNode, void *pvGMM);
    626 static DECLCALLBACK(int) gmmR0CleanupSharedModule(PAVLGCPTRNODECORE pNode, void *pvGVM);
     624static DECLCALLBACK(int)     gmmR0TermDestroyChunk(PAVLU32NODECORE pNode, void *pvGMM);
     625static DECLCALLBACK(int)     gmmR0CleanupVMScanChunk(PAVLU32NODECORE pNode, void *pvGMM);
     626static DECLCALLBACK(int)     gmmR0CleanupSharedModule(PAVLGCPTRNODECORE pNode, void *pvGVM);
    627627/*static*/ DECLCALLBACK(int) gmmR0CleanupVMDestroyChunk(PAVLU32NODECORE pNode, void *pvGVM);
    628 DECLINLINE(void) gmmR0LinkChunk(PGMMCHUNK pChunk, PGMMCHUNKFREESET pSet);
    629 DECLINLINE(void) gmmR0UnlinkChunk(PGMMCHUNK pChunk);
    630 static uint32_t gmmR0SanityCheck(PGMM pGMM, const char *pszFunction, unsigned uLineNo);
    631 static void gmmR0FreeChunk(PGMM pGMM, PGVM pGVM, PGMMCHUNK pChunk);
    632 static void gmmR0FreeSharedPage(PGMM pGMM, uint32_t idPage, PGMMPAGE pPage);
    633 static int gmmR0UnmapChunk(PGMM pGMM, PGVM pGVM, PGMMCHUNK pChunk);
     628DECLINLINE(void)             gmmR0LinkChunk(PGMMCHUNK pChunk, PGMMCHUNKFREESET pSet);
     629DECLINLINE(void)             gmmR0UnlinkChunk(PGMMCHUNK pChunk);
     630static uint32_t              gmmR0SanityCheck(PGMM pGMM, const char *pszFunction, unsigned uLineNo);
     631static void                  gmmR0FreeChunk(PGMM pGMM, PGVM pGVM, PGMMCHUNK pChunk);
     632static void                  gmmR0FreeSharedPage(PGMM pGMM, uint32_t idPage, PGMMPAGE pPage);
     633static int                   gmmR0UnmapChunk(PGMM pGMM, PGVM pGVM, PGMMCHUNK pChunk);
    634634
    635635
  • trunk/src/VBox/VMM/include/PGMInternal.h

    r36905 r36910  
    322322 *
    323323 * @param   pVCpu   The current CPU.
    324  * @param   pPage   The pool page.
     324 * @param   pvPage  The pool page.
    325325 */
    326326#if defined(IN_RC) || defined(VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0)
     
    341341 *
    342342 * @param   pVM     The VM handle.
    343  * @param   pPage   The pool page.
     343 * @param   pvPage  The pool page.
    344344 */
    345345#define PGM_DYNMAP_UNUSED_HINT_VM(pVM, pvPage)  PGM_DYNMAP_UNUSED_HINT(VMMGetCpu(pVM), pvPage)
     
    739739/**
    740740 * Clears the page structure.
    741  * @param   pPage       Pointer to the physical guest page tracking structure.
    742  */
    743 #define PGM_PAGE_CLEAR(pPage) \
     741 * @param   a_pPage     Pointer to the physical guest page tracking structure.
     742 */
     743#define PGM_PAGE_CLEAR(a_pPage) \
    744744    do { \
    745         (pPage)->HCPhysAndPageID     = 0; \
    746         (pPage)->uStateY             = 0; \
    747         (pPage)->uTypeY              = 0; \
    748         (pPage)->uPteIdx             = 0; \
    749         (pPage)->u16MiscY.u          = 0; \
    750         (pPage)->u16TrackingY        = 0; \
    751         (pPage)->cReadLocksY         = 0; \
    752         (pPage)->cWriteLocksY        = 0; \
     745        (a_pPage)->HCPhysAndPageID     = 0; \
     746        (a_pPage)->uStateY             = 0; \
     747        (a_pPage)->uTypeY              = 0; \
     748        (a_pPage)->uPteIdx             = 0; \
     749        (a_pPage)->u16MiscY.u          = 0; \
     750        (a_pPage)->u16TrackingY        = 0; \
     751        (a_pPage)->cReadLocksY         = 0; \
     752        (a_pPage)->cWriteLocksY        = 0; \
    753753    } while (0)
    754754
    755755/**
    756756 * Initializes the page structure.
    757  * @param   pPage       Pointer to the physical guest page tracking structure.
    758  */
    759 #define PGM_PAGE_INIT(pPage, _HCPhys, _idPage, _uType, _uState) \
     757 * @param   a_pPage     Pointer to the physical guest page tracking structure.
     758 */
     759#define PGM_PAGE_INIT(a_pPage, a_HCPhys, a_idPage, a_uType, a_uState) \
    760760    do { \
    761         RTHCPHYS SetHCPhysTmp = (_HCPhys); \
     761        RTHCPHYS SetHCPhysTmp = (a_HCPhys); \
    762762        AssertFatal(!(SetHCPhysTmp & ~UINT64_C(0x0000fffffffff000))); \
    763         (pPage)->HCPhysAndPageID     = (SetHCPhysTmp << (28-12)) | ((_idPage) & UINT32_C(0x0fffffff)); \
    764         (pPage)->uStateY             = (_uState); \
    765         (pPage)->uTypeY              = (_uType); \
    766         (pPage)->uPteIdx             = 0; \
    767         (pPage)->u16MiscY.u          = 0; \
    768         (pPage)->u16TrackingY        = 0; \
    769         (pPage)->cReadLocksY         = 0; \
    770         (pPage)->cWriteLocksY        = 0; \
     763        (a_pPage)->HCPhysAndPageID  = (SetHCPhysTmp << (28-12)) | ((a_idPage) & UINT32_C(0x0fffffff)); \
     764        (a_pPage)->uStateY          = (a_uState); \
     765        (a_pPage)->uTypeY           = (a_uType); \
     766        (a_pPage)->uPteIdx          = 0; \
     767        (a_pPage)->u16MiscY.u       = 0; \
     768        (a_pPage)->u16TrackingY     = 0; \
     769        (a_pPage)->cReadLocksY      = 0; \
     770        (a_pPage)->cWriteLocksY     = 0; \
    771771    } while (0)
    772772
    773773/**
    774774 * Initializes the page structure of a ZERO page.
    775  * @param   pPage       Pointer to the physical guest page tracking structure.
    776  * @param   pVM         The VM handle (for getting the zero page address).
    777  * @param   uType       The page type (PGMPAGETYPE).
    778  */
    779 #define PGM_PAGE_INIT_ZERO(pPage, pVM, uType)  \
    780     PGM_PAGE_INIT((pPage), (pVM)->pgm.s.HCPhysZeroPg, NIL_GMM_PAGEID, (uType), PGM_PAGE_STATE_ZERO)
     775 * @param   a_pPage     Pointer to the physical guest page tracking structure.
     776 * @param   a_pVM       The VM handle (for getting the zero page address).
     777 * @param   a_uType     The page type (PGMPAGETYPE).
     778 */
     779#define PGM_PAGE_INIT_ZERO(a_pPage, a_pVM, a_uType)  \
     780    PGM_PAGE_INIT((a_pPage), (a_pVM)->pgm.s.HCPhysZeroPg, NIL_GMM_PAGEID, (a_uType), PGM_PAGE_STATE_ZERO)
    781781
    782782
     
    807807 * Gets the page state.
    808808 * @returns page state (PGM_PAGE_STATE_*).
    809  * @param   pPage       Pointer to the physical guest page tracking structure.
    810  */
    811 #define PGM_PAGE_GET_STATE(pPage)           ( (pPage)->uStateY )
     809 * @param   a_pPage     Pointer to the physical guest page tracking structure.
     810 */
     811#define PGM_PAGE_GET_STATE(a_pPage)           ( (a_pPage)->uStateY )
    812812
    813813/**
    814814 * Sets the page state.
    815  * @param   pPage       Pointer to the physical guest page tracking structure.
    816  * @param   _uState     The new page state.
    817  */
    818 #define PGM_PAGE_SET_STATE(pPage, _uState)  do { (pPage)->uStateY = (_uState); } while (0)
     815 * @param   a_pPage     Pointer to the physical guest page tracking structure.
     816 * @param   a_uState    The new page state.
     817 */
     818#define PGM_PAGE_SET_STATE(a_pPage, a_uState)  do { (a_pPage)->uStateY = (a_uState); } while (0)
    819819
    820820
     
    822822 * Gets the host physical address of the guest page.
    823823 * @returns host physical address (RTHCPHYS).
    824  * @param   pPage       Pointer to the physical guest page tracking structure.
    825  */
    826 #define PGM_PAGE_GET_HCPHYS(pPage)          ( ((pPage)->HCPhysAndPageID >> 28) << 12 )
     824 * @param   a_pPage     Pointer to the physical guest page tracking structure.
     825 */
     826#define PGM_PAGE_GET_HCPHYS(a_pPage)        ( ((a_pPage)->HCPhysAndPageID >> 28) << 12 )
    827827
    828828/**
    829829 * Sets the host physical address of the guest page.
    830  * @param   pPage       Pointer to the physical guest page tracking structure.
    831  * @param   _HCPhys     The new host physical address.
    832  */
    833 #define PGM_PAGE_SET_HCPHYS(pPage, _HCPhys) \
     830 * @param   a_pPage      Pointer to the physical guest page tracking structure.
     831 * @param   a_HCPhys     The new host physical address.
     832 */
     833#define PGM_PAGE_SET_HCPHYS(a_pPage, a_HCPhys) \
    834834    do { \
    835         RTHCPHYS SetHCPhysTmp = (_HCPhys); \
     835        RTHCPHYS const SetHCPhysTmp = (a_HCPhys); \
    836836        AssertFatal(!(SetHCPhysTmp & ~UINT64_C(0x0000fffffffff000))); \
    837         (pPage)->HCPhysAndPageID = ((pPage)->HCPhysAndPageID & UINT32_C(0x0fffffff)) \
    838                                  | (SetHCPhysTmp << (28-12)); \
     837        (a_pPage)->HCPhysAndPageID = ((a_pPage)->HCPhysAndPageID & UINT32_C(0x0fffffff)) \
     838                                   | (SetHCPhysTmp << (28-12)); \
    839839    } while (0)
    840840
     
    842842 * Get the Page ID.
    843843 * @returns The Page ID; NIL_GMM_PAGEID if it's a ZERO page.
    844  * @param   pPage       Pointer to the physical guest page tracking structure.
    845  */
    846 #define PGM_PAGE_GET_PAGEID(pPage)          (  (uint32_t)((pPage)->HCPhysAndPageID & UINT32_C(0x0fffffff)) )
     844 * @param   a_pPage     Pointer to the physical guest page tracking structure.
     845 */
     846#define PGM_PAGE_GET_PAGEID(a_pPage)        (  (uint32_t)((a_pPage)->HCPhysAndPageID & UINT32_C(0x0fffffff)) )
    847847
    848848/**
    849849 * Sets the Page ID.
    850  * @param   pPage       Pointer to the physical guest page tracking structure.
    851  */
    852 #define PGM_PAGE_SET_PAGEID(pPage, _idPage) \
     850 * @param   a_pPage     Pointer to the physical guest page tracking structure.
     851 * @param   a_idPage    The new page ID.
     852 */
     853#define PGM_PAGE_SET_PAGEID(a_pPage, a_idPage) \
    853854    do { \
    854         (pPage)->HCPhysAndPageID = (((pPage)->HCPhysAndPageID) & UINT64_C(0xfffffffff0000000)) \
    855                                  | ((_idPage) & UINT32_C(0x0fffffff)); \
     855        (a_pPage)->HCPhysAndPageID = (((a_pPage)->HCPhysAndPageID) & UINT64_C(0xfffffffff0000000)) \
     856                                   | ((a_idPage) & UINT32_C(0x0fffffff)); \
    856857    } while (0)
    857858
     
    859860 * Get the Chunk ID.
    860861 * @returns The Chunk ID; NIL_GMM_CHUNKID if it's a ZERO page.
    861  * @param   pPage       Pointer to the physical guest page tracking structure.
    862  */
    863 #define PGM_PAGE_GET_CHUNKID(pPage)         ( PGM_PAGE_GET_PAGEID(pPage) >> GMM_CHUNKID_SHIFT )
     862 * @param   a_pPage     Pointer to the physical guest page tracking structure.
     863 */
     864#define PGM_PAGE_GET_CHUNKID(a_pPage)           ( PGM_PAGE_GET_PAGEID(a_pPage) >> GMM_CHUNKID_SHIFT )
    864865
    865866/**
    866867 * Get the index of the page within the allocation chunk.
    867868 * @returns The page index.
    868  * @param   pPage       Pointer to the physical guest page tracking structure.
    869  */
    870 #define PGM_PAGE_GET_PAGE_IN_CHUNK(pPage)   ( (uint32_t)((pPage)->HCPhysAndPageID & GMM_PAGEID_IDX_MASK) )
     869 * @param   a_pPage     Pointer to the physical guest page tracking structure.
     870 */
     871#define PGM_PAGE_GET_PAGE_IN_CHUNK(a_pPage)     ( (uint32_t)((a_pPage)->HCPhysAndPageID & GMM_PAGEID_IDX_MASK) )
    871872
    872873/**
    873874 * Gets the page type.
    874875 * @returns The page type.
    875  * @param   pPage       Pointer to the physical guest page tracking structure.
    876  */
    877 #define PGM_PAGE_GET_TYPE(pPage)            (pPage)->uTypeY
     876 * @param   a_pPage     Pointer to the physical guest page tracking structure.
     877 */
     878#define PGM_PAGE_GET_TYPE(a_pPage)              (a_pPage)->uTypeY
    878879
    879880/**
    880881 * Sets the page type.
    881  * @param   pPage       Pointer to the physical guest page tracking structure.
    882  * @param   _enmType    The new page type (PGMPAGETYPE).
    883  */
    884 #define PGM_PAGE_SET_TYPE(pPage, _enmType)  do { (pPage)->uTypeY = (_enmType); } while (0)
     882 * @param   a_pPage     Pointer to the physical guest page tracking structure.
     883 * @param   a_enmType   The new page type (PGMPAGETYPE).
     884 */
     885#define PGM_PAGE_SET_TYPE(a_pPage, a_enmType)   do { (a_pPage)->uTypeY = (a_enmType); } while (0)
    885886
    886887/**
    887888 * Gets the page table index
    888889 * @returns The page table index.
    889  * @param   pPage       Pointer to the physical guest page tracking structure.
    890  */
    891 #define PGM_PAGE_GET_PTE_INDEX(pPage)            (pPage)->uPteIdx
    892 
    893 /**
    894  * Sets the page table index
    895  * @param   pPage       Pointer to the physical guest page tracking structure.
    896  * @param   iPte        New page table index.
    897  */
    898 #define PGM_PAGE_SET_PTE_INDEX(pPage, _iPte)  do { (pPage)->uPteIdx = (_iPte); } while (0)
     890 * @param   a_pPage     Pointer to the physical guest page tracking structure.
     891 */
     892#define PGM_PAGE_GET_PTE_INDEX(a_pPage)         (a_pPage)->uPteIdx
     893
     894/**
     895 * Sets the page table index.
     896 * @param   a_pPage     Pointer to the physical guest page tracking structure.
     897 * @param   a_iPte      New page table index.
     898 */
     899#define PGM_PAGE_SET_PTE_INDEX(a_pPage, a_iPte) do { (a_pPage)->uPteIdx = (a_iPte); } while (0)
    899900
    900901/**
    901902 * Checks if the page is marked for MMIO.
    902903 * @returns true/false.
    903  * @param   pPage       Pointer to the physical guest page tracking structure.
    904  */
    905 #define PGM_PAGE_IS_MMIO(pPage)             ( (pPage)->uTypeY == PGMPAGETYPE_MMIO )
     904 * @param   a_pPage     Pointer to the physical guest page tracking structure.
     905 */
     906#define PGM_PAGE_IS_MMIO(a_pPage)               ( (a_pPage)->uTypeY == PGMPAGETYPE_MMIO )
    906907
    907908/**
    908909 * Checks if the page is backed by the ZERO page.
    909910 * @returns true/false.
    910  * @param   pPage       Pointer to the physical guest page tracking structure.
    911  */
    912 #define PGM_PAGE_IS_ZERO(pPage)             ( (pPage)->uStateY == PGM_PAGE_STATE_ZERO )
     911 * @param   a_pPage     Pointer to the physical guest page tracking structure.
     912 */
     913#define PGM_PAGE_IS_ZERO(a_pPage)               ( (a_pPage)->uStateY == PGM_PAGE_STATE_ZERO )
    913914
    914915/**
    915916 * Checks if the page is backed by a SHARED page.
    916917 * @returns true/false.
    917  * @param   pPage       Pointer to the physical guest page tracking structure.
    918  */
    919 #define PGM_PAGE_IS_SHARED(pPage)           ( (pPage)->uStateY == PGM_PAGE_STATE_SHARED )
     918 * @param   a_pPage     Pointer to the physical guest page tracking structure.
     919 */
     920#define PGM_PAGE_IS_SHARED(a_pPage)             ( (a_pPage)->uStateY == PGM_PAGE_STATE_SHARED )
    920921
    921922/**
    922923 * Checks if the page is ballooned.
    923924 * @returns true/false.
    924  * @param   pPage       Pointer to the physical guest page tracking structure.
    925  */
    926 #define PGM_PAGE_IS_BALLOONED(pPage)        ( (pPage)->uStateY == PGM_PAGE_STATE_BALLOONED )
     925 * @param   a_pPage     Pointer to the physical guest page tracking structure.
     926 */
     927#define PGM_PAGE_IS_BALLOONED(a_pPage)          ( (a_pPage)->uStateY == PGM_PAGE_STATE_BALLOONED )
    927928
    928929/**
    929930 * Checks if the page is allocated.
    930931 * @returns true/false.
    931  * @param   pPage       Pointer to the physical guest page tracking structure.
    932  */
    933 #define PGM_PAGE_IS_ALLOCATED(pPage)        ( (pPage)->uStateY == PGM_PAGE_STATE_ALLOCATED )
     932 * @param   a_pPage     Pointer to the physical guest page tracking structure.
     933 */
     934#define PGM_PAGE_IS_ALLOCATED(a_pPage)          ( (a_pPage)->uStateY == PGM_PAGE_STATE_ALLOCATED )
    934935
    935936/**
    936937 * Marks the page as written to (for GMM change monitoring).
    937  * @param   pPage       Pointer to the physical guest page tracking structure.
    938  */
    939 #define PGM_PAGE_SET_WRITTEN_TO(pPage)      do { (pPage)->u16MiscY.au8[1] |= UINT8_C(0x80); } while (0)
     938 * @param   a_pPage     Pointer to the physical guest page tracking structure.
     939 */
     940#define PGM_PAGE_SET_WRITTEN_TO(a_pPage)        do { (a_pPage)->u16MiscY.au8[1] |= UINT8_C(0x80); } while (0)
    940941
    941942/**
    942943 * Clears the written-to indicator.
    943  * @param   pPage       Pointer to the physical guest page tracking structure.
    944  */
    945 #define PGM_PAGE_CLEAR_WRITTEN_TO(pPage)    do { (pPage)->u16MiscY.au8[1] &= UINT8_C(0x7f); } while (0)
     944 * @param   a_pPage     Pointer to the physical guest page tracking structure.
     945 */
     946#define PGM_PAGE_CLEAR_WRITTEN_TO(a_pPage)      do { (a_pPage)->u16MiscY.au8[1] &= UINT8_C(0x7f); } while (0)
    946947
    947948/**
    948949 * Checks if the page was marked as written-to.
    949950 * @returns true/false.
    950  * @param   pPage       Pointer to the physical guest page tracking structure.
    951  */
    952 #define PGM_PAGE_IS_WRITTEN_TO(pPage)       ( !!((pPage)->u16MiscY.au8[1] & UINT8_C(0x80)) )
     951 * @param   a_pPage     Pointer to the physical guest page tracking structure.
     952 */
     953#define PGM_PAGE_IS_WRITTEN_TO(a_pPage)         ( !!((a_pPage)->u16MiscY.au8[1] & UINT8_C(0x80)) )
    953954
    954955/**
    955956 * Marks the page as dirty for FTM
    956  * @param   pPage       Pointer to the physical guest page tracking structure.
    957  */
    958 #define PGM_PAGE_SET_FT_DIRTY(pPage)        do { (pPage)->u16MiscY.au8[1] |= UINT8_C(0x04); } while (0)
     957 * @param   a_pPage     Pointer to the physical guest page tracking structure.
     958 */
     959#define PGM_PAGE_SET_FT_DIRTY(a_pPage)          do { (a_pPage)->u16MiscY.au8[1] |= UINT8_C(0x04); } while (0)
    959960
    960961/**
    961962 * Clears the FTM dirty indicator
    962  * @param   pPage       Pointer to the physical guest page tracking structure.
    963  */
    964 #define PGM_PAGE_CLEAR_FT_DIRTY(pPage)      do { (pPage)->u16MiscY.au8[1] &= UINT8_C(0xfb); } while (0)
     963 * @param   a_pPage     Pointer to the physical guest page tracking structure.
     964 */
     965#define PGM_PAGE_CLEAR_FT_DIRTY(a_pPage)        do { (a_pPage)->u16MiscY.au8[1] &= UINT8_C(0xfb); } while (0)
    965966
    966967/**
    967968 * Checks if the page was marked as dirty for FTM
    968969 * @returns true/false.
    969  * @param   pPage       Pointer to the physical guest page tracking structure.
    970  */
    971 #define PGM_PAGE_IS_FT_DIRTY(pPage)         ( !!((pPage)->u16MiscY.au8[1] & UINT8_C(0x04)) )
     970 * @param   a_pPage     Pointer to the physical guest page tracking structure.
     971 */
     972#define PGM_PAGE_IS_FT_DIRTY(a_pPage)           ( !!((a_pPage)->u16MiscY.au8[1] & UINT8_C(0x04)) )
    972973
    973974
     
    976977 * @{ */
    977978/** Either as a PT or PDE. */
    978 #define PGM_PAGE_PDE_TYPE_DONTCARE             0
     979#define PGM_PAGE_PDE_TYPE_DONTCARE              0
    979980/** Must use a page table to map the range. */
    980 #define PGM_PAGE_PDE_TYPE_PT                   1
     981#define PGM_PAGE_PDE_TYPE_PT                    1
    981982/** Can use a page directory entry to map the continuous range. */
    982 #define PGM_PAGE_PDE_TYPE_PDE                  2
     983#define PGM_PAGE_PDE_TYPE_PDE                   2
    983984/** Can use a page directory entry to map the continuous range - temporarily disabled (by page monitoring). */
    984 #define PGM_PAGE_PDE_TYPE_PDE_DISABLED         3
     985#define PGM_PAGE_PDE_TYPE_PDE_DISABLED          3
    985986/** @} */
    986987
    987988/**
    988989 * Set the PDE type of the page
    989  * @param   pPage       Pointer to the physical guest page tracking structure.
    990  * @param   uType       PGM_PAGE_PDE_TYPE_*
    991  */
    992 #define PGM_PAGE_SET_PDE_TYPE(pPage, uType) \
     990 * @param   a_pPage     Pointer to the physical guest page tracking structure.
     991 * @param   a_uType     PGM_PAGE_PDE_TYPE_*.
     992 */
     993#define PGM_PAGE_SET_PDE_TYPE(a_pPage, a_uType) \
    993994    do { \
    994         (pPage)->u16MiscY.au8[1] = ((pPage)->u16MiscY.au8[1] & UINT8_C(0x9f)) \
    995                                  | (((uType)                 & UINT8_C(0x03)) << 5); \
     995        (a_pPage)->u16MiscY.au8[1] = ((a_pPage)->u16MiscY.au8[1] & UINT8_C(0x9f)) \
     996                                   | (((a_uType)                 & UINT8_C(0x03)) << 5); \
    996997    } while (0)
    997998
     
    9991000 * Checks if the page was marked being part of a large page
    10001001 * @returns true/false.
    1001  * @param   pPage       Pointer to the physical guest page tracking structure.
    1002  */
    1003 #define PGM_PAGE_GET_PDE_TYPE(pPage)       ( ((pPage)->u16MiscY.au8[1] & UINT8_C(0x60)) >> 5)
     1002 * @param   a_pPage     Pointer to the physical guest page tracking structure.
     1003 */
     1004#define PGM_PAGE_GET_PDE_TYPE(a_pPage)          ( ((a_pPage)->u16MiscY.au8[1] & UINT8_C(0x60)) >> 5)
    10041005
    10051006/** Enabled optimized access handler tests.
     
    10081009 * code.
    10091010 */
    1010 #define PGM_PAGE_WITH_OPTIMIZED_HANDLER_ACCESS 1
     1011#define PGM_PAGE_WITH_OPTIMIZED_HANDLER_ACCESS  1
    10111012
    10121013/** @name Physical Access Handler State values (PGMPAGE::u2HandlerPhysStateY).
     
    10161017 * @{ */
    10171018/** No handler installed. */
    1018 #define PGM_PAGE_HNDL_PHYS_STATE_NONE       0
     1019#define PGM_PAGE_HNDL_PHYS_STATE_NONE           0
    10191020/** Monitoring is temporarily disabled. */
    1020 #define PGM_PAGE_HNDL_PHYS_STATE_DISABLED   1
     1021#define PGM_PAGE_HNDL_PHYS_STATE_DISABLED       1
    10211022/** Write access is monitored. */
    1022 #define PGM_PAGE_HNDL_PHYS_STATE_WRITE      2
     1023#define PGM_PAGE_HNDL_PHYS_STATE_WRITE          2
    10231024/** All access is monitored. */
    1024 #define PGM_PAGE_HNDL_PHYS_STATE_ALL        3
     1025#define PGM_PAGE_HNDL_PHYS_STATE_ALL            3
    10251026/** @} */
    10261027
     
    10281029 * Gets the physical access handler state of a page.
    10291030 * @returns PGM_PAGE_HNDL_PHYS_STATE_* value.
    1030  * @param   pPage       Pointer to the physical guest page tracking structure.
    1031  */
    1032 #define PGM_PAGE_GET_HNDL_PHYS_STATE(pPage)  \
    1033     ( (pPage)->u16MiscY.au8[0] )
     1031 * @param   a_pPage     Pointer to the physical guest page tracking structure.
     1032 */
     1033#define PGM_PAGE_GET_HNDL_PHYS_STATE(a_pPage)   ( (a_pPage)->u16MiscY.au8[0] )
    10341034
    10351035/**
    10361036 * Sets the physical access handler state of a page.
    1037  * @param   pPage       Pointer to the physical guest page tracking structure.
    1038  * @param   _uState     The new state value.
    1039  */
    1040 #define PGM_PAGE_SET_HNDL_PHYS_STATE(pPage, _uState) \
    1041     do { (pPage)->u16MiscY.au8[0] = (_uState); } while (0)
     1037 * @param   a_pPage     Pointer to the physical guest page tracking structure.
     1038 * @param   a_uState    The new state value.
     1039 */
     1040#define PGM_PAGE_SET_HNDL_PHYS_STATE(a_pPage, a_uState) \
     1041    do { (a_pPage)->u16MiscY.au8[0] = (a_uState); } while (0)
    10421042
    10431043/**
    10441044 * Checks if the page has any physical access handlers, including temporarily disabled ones.
    10451045 * @returns true/false
    1046  * @param   pPage       Pointer to the physical guest page tracking structure.
    1047  */
    1048 #define PGM_PAGE_HAS_ANY_PHYSICAL_HANDLERS(pPage) \
    1049     ( PGM_PAGE_GET_HNDL_PHYS_STATE(pPage) != PGM_PAGE_HNDL_PHYS_STATE_NONE )
     1046 * @param   a_pPage     Pointer to the physical guest page tracking structure.
     1047 */
     1048#define PGM_PAGE_HAS_ANY_PHYSICAL_HANDLERS(a_pPage) \
     1049    ( PGM_PAGE_GET_HNDL_PHYS_STATE(a_pPage) != PGM_PAGE_HNDL_PHYS_STATE_NONE )
    10501050
    10511051/**
    10521052 * Checks if the page has any active physical access handlers.
    10531053 * @returns true/false
    1054  * @param   pPage       Pointer to the physical guest page tracking structure.
    1055  */
    1056 #define PGM_PAGE_HAS_ACTIVE_PHYSICAL_HANDLERS(pPage) \
    1057     ( PGM_PAGE_GET_HNDL_PHYS_STATE(pPage) >= PGM_PAGE_HNDL_PHYS_STATE_WRITE )
     1054 * @param   a_pPage     Pointer to the physical guest page tracking structure.
     1055 */
     1056#define PGM_PAGE_HAS_ACTIVE_PHYSICAL_HANDLERS(a_pPage) \
     1057    ( PGM_PAGE_GET_HNDL_PHYS_STATE(a_pPage) >= PGM_PAGE_HNDL_PHYS_STATE_WRITE )
    10581058
    10591059
     
    10641064 * @{ */
    10651065/** No handler installed. */
    1066 #define PGM_PAGE_HNDL_VIRT_STATE_NONE       0
     1066#define PGM_PAGE_HNDL_VIRT_STATE_NONE           0
    10671067/* 1 is reserved so the lineup is identical with the physical ones. */
    10681068/** Write access is monitored. */
    1069 #define PGM_PAGE_HNDL_VIRT_STATE_WRITE      2
     1069#define PGM_PAGE_HNDL_VIRT_STATE_WRITE          2
    10701070/** All access is monitored. */
    1071 #define PGM_PAGE_HNDL_VIRT_STATE_ALL        3
     1071#define PGM_PAGE_HNDL_VIRT_STATE_ALL            3
    10721072/** @} */
    10731073
     
    10751075 * Gets the virtual access handler state of a page.
    10761076 * @returns PGM_PAGE_HNDL_VIRT_STATE_* value.
    1077  * @param   pPage       Pointer to the physical guest page tracking structure.
    1078  */
    1079 #define PGM_PAGE_GET_HNDL_VIRT_STATE(pPage) ((uint8_t)( (pPage)->u16MiscY.au8[1] & UINT8_C(0x03) ))
     1077 * @param   a_pPage     Pointer to the physical guest page tracking structure.
     1078 */
     1079#define PGM_PAGE_GET_HNDL_VIRT_STATE(a_pPage)   ((uint8_t)( (a_pPage)->u16MiscY.au8[1] & UINT8_C(0x03) ))
    10801080
    10811081/**
    10821082 * Sets the virtual access handler state of a page.
    1083  * @param   pPage       Pointer to the physical guest page tracking structure.
    1084  * @param   _uState     The new state value.
    1085  */
    1086 #define PGM_PAGE_SET_HNDL_VIRT_STATE(pPage, _uState) \
     1083 * @param   a_pPage     Pointer to the physical guest page tracking structure.
     1084 * @param   a_uState    The new state value.
     1085 */
     1086#define PGM_PAGE_SET_HNDL_VIRT_STATE(a_pPage, a_uState) \
    10871087    do { \
    1088         (pPage)->u16MiscY.au8[1] = ((pPage)->u16MiscY.au8[1] & UINT8_C(0xfc)) \
    1089                                  | ((_uState)                & UINT8_C(0x03)); \
     1088        (a_pPage)->u16MiscY.au8[1] = ((a_pPage)->u16MiscY.au8[1] & UINT8_C(0xfc)) \
     1089                                   | ((a_uState)                 & UINT8_C(0x03)); \
    10901090    } while (0)
    10911091
     
    10931093 * Checks if the page has any virtual access handlers.
    10941094 * @returns true/false
    1095  * @param   pPage       Pointer to the physical guest page tracking structure.
    1096  */
    1097 #define PGM_PAGE_HAS_ANY_VIRTUAL_HANDLERS(pPage) \
    1098     ( PGM_PAGE_GET_HNDL_VIRT_STATE(pPage) != PGM_PAGE_HNDL_VIRT_STATE_NONE )
     1095 * @param   a_pPage     Pointer to the physical guest page tracking structure.
     1096 */
     1097#define PGM_PAGE_HAS_ANY_VIRTUAL_HANDLERS(a_pPage) \
     1098    ( PGM_PAGE_GET_HNDL_VIRT_STATE(a_pPage) != PGM_PAGE_HNDL_VIRT_STATE_NONE )
    10991099
    11001100/**
     
    11021102 * virtual handlers.
    11031103 * @returns true/false
    1104  * @param   pPage       Pointer to the physical guest page tracking structure.
    1105  */
    1106 #define PGM_PAGE_HAS_ACTIVE_VIRTUAL_HANDLERS(pPage) \
    1107     PGM_PAGE_HAS_ANY_VIRTUAL_HANDLERS(pPage)
     1104 * @param   a_pPage     Pointer to the physical guest page tracking structure.
     1105 */
     1106#define PGM_PAGE_HAS_ACTIVE_VIRTUAL_HANDLERS(a_pPage) \
     1107    PGM_PAGE_HAS_ANY_VIRTUAL_HANDLERS(a_pPage)
    11081108
    11091109
     
    11111111 * Checks if the page has any access handlers, including temporarily disabled ones.
    11121112 * @returns true/false
    1113  * @param   pPage       Pointer to the physical guest page tracking structure.
     1113 * @param   a_pPage     Pointer to the physical guest page tracking structure.
    11141114 */
    11151115#ifdef PGM_PAGE_WITH_OPTIMIZED_HANDLER_ACCESS
    1116 # define PGM_PAGE_HAS_ANY_HANDLERS(pPage) \
    1117     ( ((pPage)->u16MiscY.u & UINT16_C(0x0303)) != 0 )
     1116# define PGM_PAGE_HAS_ANY_HANDLERS(a_pPage) \
     1117    ( ((a_pPage)->u16MiscY.u & UINT16_C(0x0303)) != 0 )
    11181118#else
    1119 # define PGM_PAGE_HAS_ANY_HANDLERS(pPage) \
    1120     (   PGM_PAGE_GET_HNDL_PHYS_STATE(pPage) != PGM_PAGE_HNDL_PHYS_STATE_NONE \
    1121      || PGM_PAGE_GET_HNDL_VIRT_STATE(pPage) != PGM_PAGE_HNDL_VIRT_STATE_NONE )
     1119# define PGM_PAGE_HAS_ANY_HANDLERS(a_pPage) \
     1120    (   PGM_PAGE_GET_HNDL_PHYS_STATE(a_pPage) != PGM_PAGE_HNDL_PHYS_STATE_NONE \
     1121     || PGM_PAGE_GET_HNDL_VIRT_STATE(a_pPage) != PGM_PAGE_HNDL_VIRT_STATE_NONE )
    11221122#endif
    11231123
     
    11251125 * Checks if the page has any active access handlers.
    11261126 * @returns true/false
    1127  * @param   pPage       Pointer to the physical guest page tracking structure.
     1127 * @param   a_pPage     Pointer to the physical guest page tracking structure.
    11281128 */
    11291129#ifdef PGM_PAGE_WITH_OPTIMIZED_HANDLER_ACCESS
    1130 # define PGM_PAGE_HAS_ACTIVE_HANDLERS(pPage) \
    1131     ( ((pPage)->u16MiscY.u & UINT16_C(0x0202)) != 0 )
     1130# define PGM_PAGE_HAS_ACTIVE_HANDLERS(a_pPage) \
     1131    ( ((a_pPage)->u16MiscY.u & UINT16_C(0x0202)) != 0 )
    11321132#else
    1133 # define PGM_PAGE_HAS_ACTIVE_HANDLERS(pPage) \
    1134     (   PGM_PAGE_GET_HNDL_PHYS_STATE(pPage) >= PGM_PAGE_HNDL_PHYS_STATE_WRITE \
    1135      || PGM_PAGE_GET_HNDL_VIRT_STATE(pPage) >= PGM_PAGE_HNDL_VIRT_STATE_WRITE )
     1133# define PGM_PAGE_HAS_ACTIVE_HANDLERS(a_pPage) \
     1134    (   PGM_PAGE_GET_HNDL_PHYS_STATE(a_pPage) >= PGM_PAGE_HNDL_PHYS_STATE_WRITE \
     1135     || PGM_PAGE_GET_HNDL_VIRT_STATE(a_pPage) >= PGM_PAGE_HNDL_VIRT_STATE_WRITE )
    11361136#endif
    11371137
     
    11391139 * Checks if the page has any active access handlers catching all accesses.
    11401140 * @returns true/false
    1141  * @param   pPage       Pointer to the physical guest page tracking structure.
     1141 * @param   a_pPage     Pointer to the physical guest page tracking structure.
    11421142 */
    11431143#ifdef PGM_PAGE_WITH_OPTIMIZED_HANDLER_ACCESS
    1144 # define PGM_PAGE_HAS_ACTIVE_ALL_HANDLERS(pPage) \
    1145     (   ( ((pPage)->u16MiscY.au8[0] | (pPage)->u16MiscY.au8[1]) & UINT8_C(0x3) ) \
     1144# define PGM_PAGE_HAS_ACTIVE_ALL_HANDLERS(a_pPage) \
     1145    (   ( ((a_pPage)->u16MiscY.au8[0] | (a_pPage)->u16MiscY.au8[1]) & UINT8_C(0x3) ) \
    11461146     == PGM_PAGE_HNDL_PHYS_STATE_ALL )
    11471147#else
    1148 # define PGM_PAGE_HAS_ACTIVE_ALL_HANDLERS(pPage) \
    1149     (   PGM_PAGE_GET_HNDL_PHYS_STATE(pPage) == PGM_PAGE_HNDL_PHYS_STATE_ALL \
    1150      || PGM_PAGE_GET_HNDL_VIRT_STATE(pPage) == PGM_PAGE_HNDL_VIRT_STATE_ALL )
     1148# define PGM_PAGE_HAS_ACTIVE_ALL_HANDLERS(a_pPage) \
     1149    (   PGM_PAGE_GET_HNDL_PHYS_STATE(a_pPage) == PGM_PAGE_HNDL_PHYS_STATE_ALL \
     1150     || PGM_PAGE_GET_HNDL_VIRT_STATE(a_pPage) == PGM_PAGE_HNDL_VIRT_STATE_ALL )
    11511151#endif
    11521152
     
    11551155 * Gets the packed shadow page pool tracking data associated with a guest page.
    11561156 * @returns uint16_t containing the data.
    1157  * @param   pPage       Pointer to the physical guest page tracking structure.
    1158  */
    1159 #define PGM_PAGE_GET_TRACKING(pPage)        ( (pPage)->u16TrackingY )
     1157 * @param   a_pPage     Pointer to the physical guest page tracking structure.
     1158 */
     1159#define PGM_PAGE_GET_TRACKING(a_pPage)          ( (a_pPage)->u16TrackingY )
    11601160
    11611161/** @def PGM_PAGE_SET_TRACKING
    11621162 * Sets the packed shadow page pool tracking data associated with a guest page.
    1163  * @param   pPage               Pointer to the physical guest page tracking structure.
    1164  * @param   u16TrackingData     The tracking data to store.
    1165  */
    1166 #define PGM_PAGE_SET_TRACKING(pPage, u16TrackingData) \
    1167     do { (pPage)->u16TrackingY = (u16TrackingData); } while (0)
     1163 * @param   a_pPage     Pointer to the physical guest page tracking structure.
     1164 * @param   a_u16TrackingData   The tracking data to store.
     1165 */
     1166#define PGM_PAGE_SET_TRACKING(a_pPage, a_u16TrackingData) \
     1167    do { (a_pPage)->u16TrackingY = (a_u16TrackingData); } while (0)
    11681168
    11691169/** @def PGM_PAGE_GET_TD_CREFS
    11701170 * Gets the @a cRefs tracking data member.
    11711171 * @returns cRefs.
    1172  * @param   pPage               Pointer to the physical guest page tracking structure.
    1173  */
    1174 #define PGM_PAGE_GET_TD_CREFS(pPage) \
    1175     ((PGM_PAGE_GET_TRACKING(pPage) >> PGMPOOL_TD_CREFS_SHIFT) & PGMPOOL_TD_CREFS_MASK)
     1172 * @param   a_pPage     Pointer to the physical guest page tracking structure.
     1173 */
     1174#define PGM_PAGE_GET_TD_CREFS(a_pPage) \
     1175    ((PGM_PAGE_GET_TRACKING(a_pPage) >> PGMPOOL_TD_CREFS_SHIFT) & PGMPOOL_TD_CREFS_MASK)
    11761176
    11771177/** @def PGM_PAGE_GET_TD_IDX
    11781178 * Gets the @a idx tracking data member.
    11791179 * @returns idx.
    1180  * @param   pPage               Pointer to the physical guest page tracking structure.
    1181  */
    1182 #define PGM_PAGE_GET_TD_IDX(pPage) \
    1183     ((PGM_PAGE_GET_TRACKING(pPage) >> PGMPOOL_TD_IDX_SHIFT)   & PGMPOOL_TD_IDX_MASK)
     1180 * @param   a_pPage     Pointer to the physical guest page tracking structure.
     1181 */
     1182#define PGM_PAGE_GET_TD_IDX(a_pPage) \
     1183    ((PGM_PAGE_GET_TRACKING(a_pPage) >> PGMPOOL_TD_IDX_SHIFT)   & PGMPOOL_TD_IDX_MASK)
    11841184
    11851185
    11861186/** Max number of locks on a page. */
    1187 #define PGM_PAGE_MAX_LOCKS                  UINT8_C(254)
     1187#define PGM_PAGE_MAX_LOCKS                      UINT8_C(254)
    11881188
    11891189/** Get the read lock count.
    11901190 * @returns count.
    1191  * @param   pPage               Pointer to the physical guest page tracking structure.
    1192  */
    1193 #define PGM_PAGE_GET_READ_LOCKS(pPage)      ( (pPage)->cReadLocksY )
     1191 * @param   a_pPage     Pointer to the physical guest page tracking structure.
     1192 */
     1193#define PGM_PAGE_GET_READ_LOCKS(a_pPage)        ( (a_pPage)->cReadLocksY )
    11941194
    11951195/** Get the write lock count.
    11961196 * @returns count.
    1197  * @param   pPage               Pointer to the physical guest page tracking structure.
    1198  */
    1199 #define PGM_PAGE_GET_WRITE_LOCKS(pPage)     ( (pPage)->cWriteLocksY )
     1197 * @param   a_pPage     Pointer to the physical guest page tracking structure.
     1198 */
     1199#define PGM_PAGE_GET_WRITE_LOCKS(a_pPage)       ( (a_pPage)->cWriteLocksY )
    12001200
    12011201/** Decrement the read lock counter.
    1202  * @param   pPage               Pointer to the physical guest page tracking structure.
    1203  */
    1204 #define PGM_PAGE_DEC_READ_LOCKS(pPage)      do { --(pPage)->cReadLocksY; } while (0)
     1202 * @param   a_pPage     Pointer to the physical guest page tracking structure.
     1203 */
     1204#define PGM_PAGE_DEC_READ_LOCKS(a_pPage)        do { --(a_pPage)->cReadLocksY; } while (0)
    12051205
    12061206/** Decrement the write lock counter.
    1207  * @param   pPage               Pointer to the physical guest page tracking structure.
    1208  */
    1209 #define PGM_PAGE_DEC_WRITE_LOCKS(pPage)     do { --(pPage)->cWriteLocksY; } while (0)
     1207 * @param   a_pPage     Pointer to the physical guest page tracking structure.
     1208 */
     1209#define PGM_PAGE_DEC_WRITE_LOCKS(a_pPage)       do { --(a_pPage)->cWriteLocksY; } while (0)
    12101210
    12111211/** Increment the read lock counter.
    1212  * @param   pPage               Pointer to the physical guest page tracking structure.
    1213  */
    1214 #define PGM_PAGE_INC_READ_LOCKS(pPage)      do { ++(pPage)->cReadLocksY; } while (0)
     1212 * @param   a_pPage     Pointer to the physical guest page tracking structure.
     1213 */
     1214#define PGM_PAGE_INC_READ_LOCKS(a_pPage)        do { ++(a_pPage)->cReadLocksY; } while (0)
    12151215
    12161216/** Increment the write lock counter.
    1217  * @param   pPage               Pointer to the physical guest page tracking structure.
    1218  */
    1219 #define PGM_PAGE_INC_WRITE_LOCKS(pPage)     do { ++(pPage)->cWriteLocksY; } while (0)
     1217 * @param   a_pPage     Pointer to the physical guest page tracking structure.
     1218 */
     1219#define PGM_PAGE_INC_WRITE_LOCKS(a_pPage)       do { ++(a_pPage)->cWriteLocksY; } while (0)
    12201220
    12211221
     
    23742374 *
    23752375 * @returns VBox status code.
    2376  * @param   pVM     The VM handle.
    2377  * @param   pPage   The pool page.
     2376 * @param   a_pVM       The VM handle.
     2377 * @param   a_pPage     The pool page.
    23782378 *
    23792379 * @remark  In RC this uses PGMGCDynMapHCPage(), so it will consume of the
     
    23822382 */
    23832383#if defined(IN_RC) || defined(VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0)
    2384 # define PGMPOOL_PAGE_2_PTR(pVM, pPage)  pgmPoolMapPageInlined((pVM), (pPage) RTLOG_COMMA_SRC_POS)
     2384# define PGMPOOL_PAGE_2_PTR(a_pVM, a_pPage)     pgmPoolMapPageInlined((a_pVM), (a_pPage) RTLOG_COMMA_SRC_POS)
    23852385#elif defined(VBOX_STRICT)
    2386 # define PGMPOOL_PAGE_2_PTR(pVM, pPage)  pgmPoolMapPageStrict(pPage)
    2387 DECLINLINE(void *) pgmPoolMapPageStrict(PPGMPOOLPAGE pPage)
    2388 {
    2389     Assert(pPage && pPage->pvPageR3);
    2390     return pPage->pvPageR3;
     2386# define PGMPOOL_PAGE_2_PTR(a_pVM, a_pPage)     pgmPoolMapPageStrict(a_pPage)
     2387DECLINLINE(void *) pgmPoolMapPageStrict(PPGMPOOLPAGE a_pPage)
     2388{
     2389    Assert(a_pPage && a_pPage->pvPageR3);
     2390    return a_pPage->pvPageR3;
    23912391}
    23922392#else
    2393 # define PGMPOOL_PAGE_2_PTR(pVM, pPage)  ((pPage)->pvPageR3)
     2393# define PGMPOOL_PAGE_2_PTR(pVM, a_pPage)       ((a_pPage)->pvPageR3)
    23942394#endif
    23952395
     
    23992399 *
    24002400 * @returns VBox status code.
    2401  * @param   pVM     The VM handle.
    2402  * @param   pVCpu   The current CPU.
    2403  * @param   pPage   The pool page.
     2401 * @param   a_pVM       The VM handle.
     2402 * @param   a_pVCpu     The current CPU.
     2403 * @param   a_pPage     The pool page.
    24042404 *
    24052405 * @remark  In RC this uses PGMGCDynMapHCPage(), so it will consume of the
     
    24082408 */
    24092409#if defined(IN_RC) || defined(VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0)
    2410 # define PGMPOOL_PAGE_2_PTR_V2(pVM, pVCpu, pPage)   pgmPoolMapPageV2Inlined((pVM), (pVCpu), (pPage) RTLOG_COMMA_SRC_POS)
     2410# define PGMPOOL_PAGE_2_PTR_V2(a_pVM, a_pVCpu, a_pPage)     pgmPoolMapPageV2Inlined((a_pVM), (a_pVCpu), (a_pPage) RTLOG_COMMA_SRC_POS)
    24112411#else
    2412 # define PGMPOOL_PAGE_2_PTR_V2(pVM, pVCpu, pPage)   PGMPOOL_PAGE_2_PTR((pVM), (pPage))
     2412# define PGMPOOL_PAGE_2_PTR_V2(a_pVM, a_pVCpu, a_pPage)     PGMPOOL_PAGE_2_PTR((a_pVM), (a_pPage))
    24132413#endif
    24142414
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