PGMInternal.h revision 17ba03925269c071aa1567eb8c5a49c37a65f62f
/* $Id$ */
/** @file
* PGM - Internal header file.
*/
/*
* Copyright (C) 2006-2007 innotek GmbH
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License as published by the Free Software Foundation,
* in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
* distribution. VirtualBox OSE is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY of any kind.
*
* If you received this file as part of a commercial VirtualBox
* distribution, then only the terms of your commercial VirtualBox
* license agreement apply instead of the previous paragraph.
*/
#ifndef ___PGMInternal_h
#define ___PGMInternal_h
#include <iprt/critsect.h>
# error "Not in PGM! This is an internal header!"
#endif
/** @defgroup grp_pgm_int Internals
* @ingroup grp_pgm
* @internal
* @{
*/
/** @name PGM Compile Time Config
* @{
*/
/**
* Solve page is out of sync issues inside Guest Context (in PGMGC.cpp).
* Comment it if it will break something.
*/
#define PGM_OUT_OF_SYNC_IN_GC
/**
* Virtualize the dirty bit
* This also makes a half-hearted attempt at the accessed bit. For full
* accessed bit virtualization define PGM_SYNC_ACCESSED_BIT.
*/
#define PGM_SYNC_DIRTY_BIT
/**
* Fully virtualize the accessed bit.
* @remark This requires SYNC_DIRTY_ACCESSED_BITS to be defined!
*/
#define PGM_SYNC_ACCESSED_BIT
/**
* Check and skip global PDEs for non-global flushes
*/
/**
* Sync N pages instead of a whole page table
*/
#define PGM_SYNC_N_PAGES
/**
* Number of pages to sync during a page fault
*
* When PGMPOOL_WITH_GCPHYS_TRACKING is enabled using high values here
* causes a lot of unnecessary extents and also is slower than taking more \#PFs.
*/
#define PGM_SYNC_NR_PAGES 8
/**
* Number of PGMPhysRead/Write cache entries (must be <= sizeof(uint64_t))
*/
#define PGM_MAX_PHYSCACHE_ENTRIES 64
/**
* Enable caching of PGMR3PhysRead/WriteByte/Word/Dword
*/
#define PGM_PHYSMEMACCESS_CACHING
/*
* Assert Sanity.
*/
#if defined(PGM_SYNC_ACCESSED_BIT) && !defined(PGM_SYNC_DIRTY_BIT)
# error "PGM_SYNC_ACCESSED_BIT requires PGM_SYNC_DIRTY_BIT!"
#endif
/** @def PGMPOOL_WITH_CACHE
* Enable agressive caching using the page pool.
*
* This requires PGMPOOL_WITH_USER_TRACKING and PGMPOOL_WITH_MONITORING.
*/
#define PGMPOOL_WITH_CACHE
/** @def PGMPOOL_WITH_MIXED_PT_CR3
* When defined, we'll deal with 'uncachable' pages.
*/
#ifdef PGMPOOL_WITH_CACHE
# define PGMPOOL_WITH_MIXED_PT_CR3
#endif
/** @def PGMPOOL_WITH_MONITORING
* Monitor the guest pages which are shadowed.
* When this is enabled, PGMPOOL_WITH_CACHE or PGMPOOL_WITH_GCPHYS_TRACKING must
* be enabled as well.
*/
#ifdef PGMPOOL_WITH_CACHE
# define PGMPOOL_WITH_MONITORING
#endif
/** @def PGMPOOL_WITH_GCPHYS_TRACKING
* Tracking the of shadow pages mapping guest physical pages.
*
* This is very expensive, the current cache prototype is trying to figure out
* whether it will be acceptable with an agressive caching policy.
*/
#if defined(PGMPOOL_WITH_CACHE) || defined(PGMPOOL_WITH_MONITORING)
# define PGMPOOL_WITH_GCPHYS_TRACKING
#endif
/** @def PGMPOOL_WITH_USER_TRACKING
* Tracking users of shadow pages. This is required for the linking of shadow page
* tables and physical guest addresses.
*/
#if defined(PGMPOOL_WITH_GCPHYS_TRACKING) || defined(PGMPOOL_WITH_CACHE) || defined(PGMPOOL_WITH_MONITORING)
# define PGMPOOL_WITH_USER_TRACKING
#endif
/** @def PGMPOOL_CFG_MAX_GROW
* The maximum number of pages to add to the pool in one go.
*/
/** @def VBOX_STRICT_PGM_HANDLER_VIRTUAL
* Enables some extra assertions for virtual handlers (mainly phys2virt related).
*/
#ifdef VBOX_STRICT
# define VBOX_STRICT_PGM_HANDLER_VIRTUAL
#endif
/** @} */
/** @name PDPTR and PML4 flags.
* These are placed in the three bits available for system programs in
* the PDPTR and PML4 entries.
* @{ */
/** The entry is a permanent one and it's must always be present.
* Never free such an entry. */
/** @} */
/** @name Page directory flags.
* These are placed in the three bits available for system programs in
* the page directory entries.
* @{ */
/** Mapping (hypervisor allocated pagetable). */
/** Made read-only to facilitate dirty bit tracking. */
/** @} */
/** @name Page flags.
* These are placed in the three bits available for system programs in
* the page entries.
* @{ */
/** Made read-only to facilitate dirty bit tracking. */
#ifndef PGM_PTFLAGS_CSAM_VALIDATED
/** Scanned and approved by CSAM (tm).
* NOTE: Must be identical to the one defined in CSAMInternal.h!!
#endif
/** @} */
/** @name Defines used to indicate the shadow and guest paging in the templates.
* @{ */
#define PGM_TYPE_REAL 1
#define PGM_TYPE_PROT 2
#define PGM_TYPE_32BIT 3
#define PGM_TYPE_PAE 4
#define PGM_TYPE_AMD64 5
/** @} */
/** Macro for checking if the guest is using paging.
* @param uType PGM_TYPE_*
* @remark ASSUMES certain order of the PGM_TYPE_* values.
*/
/** @def PGM_HCPHYS_2_PTR
* Maps a HC physical page pool address to a virtual address.
*
* @returns VBox status code.
* @param pVM The VM handle.
* @param HCPhys The HC physical address to map to a virtual one.
* @param ppv Where to store the virtual address. No need to cast this.
*
* @remark In GC this uses PGMGCDynMapHCPage(), so it will consume of the
* small page window employeed by that function. Be careful.
* @remark There is no need to assert on the result.
*/
#ifdef IN_GC
#else
#endif
/** @def PGM_GCPHYS_2_PTR
* Maps a GC physical page address to a virtual address.
*
* @returns VBox status code.
* @param pVM The VM handle.
* @param GCPhys The GC physical address to map to a virtual one.
* @param ppv Where to store the virtual address. No need to cast this.
*
* @remark In GC this uses PGMGCDynMapGCPage(), so it will consume of the
* small page window employeed by that function. Be careful.
* @remark There is no need to assert on the result.
*/
#ifdef IN_GC
#else
# define PGM_GCPHYS_2_PTR(pVM, GCPhys, ppv) PGMPhysGCPhys2HCPtr(pVM, GCPhys, 1 /* one page only */, (void **)(ppv)) /** @todo this isn't asserting, use PGMRamGCPhys2HCPtr! */
#endif
/** @def PGM_GCPHYS_2_PTR_EX
* Maps a unaligned GC physical page address to a virtual address.
*
* @returns VBox status code.
* @param pVM The VM handle.
* @param GCPhys The GC physical address to map to a virtual one.
* @param ppv Where to store the virtual address. No need to cast this.
*
* @remark In GC this uses PGMGCDynMapGCPage(), so it will consume of the
* small page window employeed by that function. Be careful.
* @remark There is no need to assert on the result.
*/
#ifdef IN_GC
#else
# define PGM_GCPHYS_2_PTR_EX(pVM, GCPhys, ppv) PGMPhysGCPhys2HCPtr(pVM, GCPhys, 1 /* one page only */, (void **)(ppv)) /** @todo this isn't asserting, use PGMRamGCPhys2HCPtr! */
#endif
/** @def PGM_INVL_PG
* Invalidates a page when in GC does nothing in HC.
*
* @param GCVirt The virtual address of the page to invalidate.
*/
#ifdef IN_GC
#else
# define PGM_INVL_PG(GCVirt) ((void)0)
#endif
/** @def PGM_INVL_BIG_PG
* Invalidates a 4MB page directory entry when in GC does nothing in HC.
*
* @param GCVirt The virtual address within the page directory to invalidate.
*/
#ifdef IN_GC
#else
# define PGM_INVL_BIG_PG(GCVirt) ((void)0)
#endif
/** @def PGM_INVL_GUEST_TLBS()
* Invalidates all guest TLBs.
*/
#ifdef IN_GC
# define PGM_INVL_GUEST_TLBS() ASMReloadCR3()
#else
# define PGM_INVL_GUEST_TLBS() ((void)0)
#endif
/**
* Structure for tracking GC Mappings.
*
* This structure is used by linked list in both GC and HC.
*/
typedef struct PGMMAPPING
{
/** Pointer to next entry. */
/** Pointer to next entry. */
/** Pointer to next entry. */
/** Start Virtual address. */
/** Last Virtual address (inclusive). */
/** Range size (bytes). */
/** Pointer to relocation callback function. */
/** User argument to the callback. */
/** Mapping description / name. For easing debugging. */
/** Number of page tables. */
#if HC_ARCH_BITS != GC_ARCH_BITS
#endif
/** Array of page table mapping data. Each entry
* describes one page table. The array can be longer
* than the declared length.
*/
struct
{
/** The HC physical address of the page table. */
/** The HC physical address of the first PAE page table. */
/** The HC physical address of the second PAE page table. */
/** The HC virtual address of the 32-bit page table. */
/** The HC virtual address of the two PAE page table. (i.e 1024 entries instead of 512) */
/** The GC virtual address of the 32-bit page table. */
/** The GC virtual address of the two PAE page table. */
/** The GC virtual address of the 32-bit page table. */
/** The GC virtual address of the two PAE page table. */
} aPTs[1];
} PGMMAPPING;
/** Pointer to structure for tracking GC Mappings. */
typedef struct PGMMAPPING *PPGMMAPPING;
/**
* Physical page access handler structure.
*
* This is used to keep track of physical address ranges
* which are being monitored in some kind of way.
*/
typedef struct PGMPHYSHANDLER
{
/** Alignment padding. */
/** Access type. */
/** Number of pages to update. */
/** Pointer to R3 callback function. */
/** User argument for R3 handlers. */
/** Pointer to R0 callback function. */
/** User argument for R0 handlers. */
/** Pointer to GC callback function. */
/** User argument for GC handlers. */
/** Description / Name. For easing debugging. */
#ifdef VBOX_WITH_STATISTICS
/** Profiling of this handler. */
#endif
/** Pointer to a physical page access handler structure. */
typedef PGMPHYSHANDLER *PPGMPHYSHANDLER;
/**
* Cache node for the physical addresses covered by a virtual handler.
*/
typedef struct PGMPHYS2VIRTHANDLER
{
/** Core node for the tree based on physical ranges. */
/** Offset from this struct to the PGMVIRTHANDLER structure. */
/** Offset of the next alias relativer to this one.
* Bit 0 is used for indicating whether we're in the tree.
* Bit 1 is used for indicating that we're the head node.
*/
/** Pointer to a phys to virtual handler structure. */
typedef PGMPHYS2VIRTHANDLER *PPGMPHYS2VIRTHANDLER;
/** The bit in PGMPHYS2VIRTHANDLER::offNextAlias used to indicate that the
* node is in the tree. */
#define PGMPHYS2VIRTHANDLER_IN_TREE BIT(0)
/** The bit in PGMPHYS2VIRTHANDLER::offNextAlias used to indicate that the
* node is in the head of an alias chain.
* The PGMPHYS2VIRTHANDLER_IN_TREE is always set if this bit is set. */
/** The mask to apply to PGMPHYS2VIRTHANDLER::offNextAlias to get the offset. */
/**
* Virtual page access handler structure.
*
* This is used to keep track of virtual address ranges
* which are being monitored in some kind of way.
*/
typedef struct PGMVIRTHANDLER
{
/** Core node for the tree based on virtual ranges. */
/** Number of cache pages. */
/** Access type. */
/** Number of cache pages. */
/** @todo The next two members are redundant. It adds some readability though. */
/** Start of the range. */
/** End of the range (exclusive). */
/** Size of the range (in bytes). */
/** Pointer to the GC callback function. */
/** Pointer to the HC callback function for invalidation. */
/** Pointer to the HC callback function. */
/** Description / Name. For easing debugging. */
#ifdef VBOX_WITH_STATISTICS
/** Profiling of this handler. */
#endif
/** Array of cached physical addresses for the monitored ranged. */
/** Pointer to a virtual page access handler structure. */
typedef PGMVIRTHANDLER *PPGMVIRTHANDLER;
/**
* Ram range for GC Phys to HC Phys conversion.
*
* Can be used for HC Virt to GC Phys and HC Virt to HC Phys
* conversions too, but we'll let MM handle that for now.
*
* This structure is used by linked lists in both GC and HC.
*/
typedef struct PGMRAMRANGE
{
/** Pointer to the next RAM range - for HC. */
/** Pointer to the next RAM range - for GC. */
/** Start of the range. Page aligned. */
/** Last address in the range (inclusive). Page aligned (-1). */
/** Size of the range. (Page aligned of course). */
/** MM_RAM_* flags */
/** HC virtual lookup ranges for chunks. Currently only used with MM_RAM_FLAGS_DYNAMIC_ALLOC ranges. */
/** HC virtual lookup ranges for chunks. Currently only used with MM_RAM_FLAGS_DYNAMIC_ALLOC ranges. */
/** Start of the HC mapping of the range.
* For pure MMIO and dynamically allocated ranges this is NULL, while for all ranges this is a valid pointer. */
/** Array of the flags and HC physical addresses corresponding to the range.
* The index is the page number in the range. The size is cb >> PAGE_SHIFT.
*
* The 12 lower bits of the physical address are flags and must be masked
* off to get the correct physical address.
*
* For pure MMIO ranges only the flags are valid.
*/
} PGMRAMRANGE;
/** Pointer to Ram range for GC Phys to HC Phys conversion. */
typedef PGMRAMRANGE *PPGMRAMRANGE;
/** Return hc ptr corresponding to the ram range and physical offset */
(pRam->fFlags & MM_RAM_FLAGS_DYNAMIC_ALLOC) ? (RTHCPTR)((RTHCUINTPTR)CTXSUFF(pRam->pavHCChunk)[(off >> PGM_DYNAMIC_CHUNK_SHIFT)] + (off & PGM_DYNAMIC_CHUNK_OFFSET_MASK)) \
/** @todo r=bird: fix typename. */
/**
* PGMPhysRead/Write cache entry
*/
typedef struct PGMPHYSCACHE_ENTRY
{
/** HC pointer to physical page */
/** GC Physical address for cache entry */
#endif
/**
* PGMPhysRead/Write cache to reduce REM memory access overhead
*/
typedef struct PGMPHYSCACHE
{
/** Bitmap of valid cache entries */
/** Cache entries */
} PGMPHYSCACHE;
/** @name PGM Pool Indexes.
* Aka. the unique shadow page identifier.
* @{ */
/** NIL page pool IDX. */
#define NIL_PGMPOOL_IDX 0
/** The first normal index. */
#define PGMPOOL_IDX_FIRST_SPECIAL 1
/** Page directory (32-bit root). */
#define PGMPOOL_IDX_PD 1
/** The extended PAE page directory (2048 entries, works as root currently). */
#define PGMPOOL_IDX_PAE_PD 2
/** Page Directory Pointer Table (PAE root, not currently used). */
#define PGMPOOL_IDX_PDPTR 3
/** Page Map Level-4 (64-bit root). */
#define PGMPOOL_IDX_PML4 4
/** The first normal index. */
#define PGMPOOL_IDX_FIRST 5
/** The last valid index. (inclusive, 14 bits) */
#define PGMPOOL_IDX_LAST 0x3fff
/** @} */
/** The NIL index for the parent chain. */
/**
* Node in the chain linking a shadowed page to it's parent (user).
*/
#pragma pack(1)
typedef struct PGMPOOLUSER
{
/** The index to the next item in the chain. NIL_PGMPOOL_USER_INDEX is no next. */
/** The user page index. */
/** Index into the user table. */
} PGMPOOLUSER, *PPGMPOOLUSER;
typedef const PGMPOOLUSER *PCPGMPOOLUSER;
#pragma pack()
/** The NIL index for the phys ext chain. */
/**
* Node in the chain of physical cross reference extents.
*/
#pragma pack(1)
typedef struct PGMPOOLPHYSEXT
{
/** The index to the next item in the chain. NIL_PGMPOOL_PHYSEXT_INDEX is no next. */
/** The user page index. */
typedef const PGMPOOLPHYSEXT *PCPGMPOOLPHYSEXT;
#pragma pack()
/**
* The kind of page that's being shadowed.
*/
typedef enum PGMPOOLKIND
{
/** The virtual invalid 0 entry. */
PGMPOOLKIND_INVALID = 0,
/** The entry is free (=unused). */
/** Shw: 32-bit page table; Gst: no paging */
/** Shw: 32-bit page table; Gst: 32-bit page table. */
/** Shw: 32-bit page table; Gst: 4MB page. */
/** Shw: PAE page table; Gst: no paging */
/** Shw: PAE page table; Gst: 32-bit page table. */
/** Shw: PAE page table; Gst: Half of a 4MB page. */
/** Shw: PAE page table; Gst: PAE page table. */
/** Shw: PAE page table; Gst: 2MB page. */
/** Shw: PAE page directory; Gst: 32-bit page directory. */
/** Shw: PAE page directory; Gst: PAE page directory. */
/** Shw: 64-bit page directory pointer table; Gst: 64-bit page directory pointer table. */
/** Shw: Root 32-bit page directory. */
/** Shw: Root PAE page directory */
/** Shw: Root PAE page directory pointer table (legacy, 4 entries). */
/** Shw: Root page map level-4 table. */
/** The last valid entry. */
} PGMPOOLKIND;
/**
* The tracking data for a page in the pool.
*/
typedef struct PGMPOOLPAGE
{
/** AVL node code with the (HC) physical address of this page. */
/** Pointer to the HC mapping of the page. */
/** The guest physical address. */
/** The kind of page we're shadowing. (This is really a PGMPOOLKIND enum.) */
/** The index of this page. */
/** The next entry in the list this page currently resides in.
* It's either in the free list or in the GCPhys hash. */
#ifdef PGMPOOL_WITH_USER_TRACKING
/** Head of the user chain. NIL_PGMPOOL_USER_INDEX if not currently in use. */
/** The number of present entries. */
/** The first entry in the table which is present. */
#endif
#ifdef PGMPOOL_WITH_MONITORING
/** The number of modifications to the monitored page. */
/** The next modified page. NIL_PGMPOOL_IDX if tail. */
/** The previous modified page. NIL_PGMPOOL_IDX if head. */
/** The next page sharing access handler. NIL_PGMPOOL_IDX if tail. */
/** The previous page sharing access handler. NIL_PGMPOOL_IDX if head. */
#endif
#ifdef PGMPOOL_WITH_CACHE
/** The next page in the age list. */
/** The previous page in the age list. */
#endif /* PGMPOOL_WITH_CACHE */
/** Used to indicate that the page is zeroed. */
bool fZeroed;
/** Used to indicate that a PT has non-global entries. */
bool fSeenNonGlobal;
/** Used to indicate that we're monitoring writes to the guest page. */
bool fMonitored;
/** Used to indicate that the page is in the cache (e.g. in the GCPhys hash).
* (All pages are in the age list.) */
bool fCached;
/** This is used by the R3 access handlers when invoked by an async thread.
* It's a hack required because of REMR3NotifyHandlerPhysicalDeregister. */
bool volatile fReusedFlushPending;
/** Used to indicate that the guest is mapping the page is also used as a CR3.
* In these cases the access handler acts differently and will check
* for mapping conflicts like the normal CR3 handler.
* @todo When we change the CR3 shadowing to use pool pages, this flag can be
* replaced by a list of pages which share access handler.
*/
bool fCR3Mix;
#endif
#ifdef PGMPOOL_WITH_CACHE
/** The hash table size. */
# define PGMPOOL_HASH_SIZE 0x40
/** The hash function. */
#endif
/**
* The shadow page pool instance data.
*
* It's all one big allocation made at init time, except for the
* pages that is. The user nodes follows immediatly after the
* page structures.
*/
typedef struct PGMPOOL
{
/** The VM handle - HC Ptr. */
/** The VM handle - GC Ptr. */
/** The max pool size. This includes the special IDs. */
/** The current pool size. */
/** The head of the free page list. */
/* Padding. */
#ifdef PGMPOOL_WITH_USER_TRACKING
/** Head of the chain of free user nodes. */
/** The number of user nodes we've allocated. */
/** The number of present page table entries in the entire pool. */
/** Pointer to the array of user nodes - GC pointer. */
/** Pointer to the array of user nodes - HC pointer. */
#endif /* PGMPOOL_WITH_USER_TRACKING */
#ifdef PGMPOOL_WITH_GCPHYS_TRACKING
/** Head of the chain of free phys ext nodes. */
/** The number of user nodes we've allocated. */
/** Pointer to the array of physical xref extent - GC pointer. */
/** Pointer to the array of physical xref extent nodes - HC pointer. */
#endif /* PGMPOOL_WITH_GCPHYS_TRACKING */
#ifdef PGMPOOL_WITH_CACHE
/** Hash table for GCPhys addresses. */
/** The head of the age list. */
/** The tail of the age list. */
/** Set if the cache is enabled. */
bool fCacheEnabled;
#endif /* PGMPOOL_WITH_CACHE */
#ifdef PGMPOOL_WITH_MONITORING
/** Head of the list of modified pages. */
/** The current number of modified pages. */
/** Access handler, GC. */
/** Access handler, R0. */
/** Access handler, R3. */
/** The access handler description (HC ptr). */
R3PTRTYPE(const char *) pszAccessHandler;
#endif /* PGMPOOL_WITH_MONITORING */
/** The number of pages currently in use. */
#ifdef VBOX_WITH_STATISTICS
/** The high wather mark for cUsedPages. */
/** Profiling pgmPoolAlloc(). */
/** Profiling pgmPoolClearAll(). */
/** Profiling pgmPoolFlushAllInt(). */
/** Profiling pgmPoolFlushPage(). */
/** Profiling pgmPoolFree(). */
/** Profiling time spent zeroing pages. */
# ifdef PGMPOOL_WITH_USER_TRACKING
/** Profiling of pgmPoolTrackDeref. */
/** Profiling pgmTrackFlushGCPhysPT. */
/** Profiling pgmTrackFlushGCPhysPTs. */
/** Profiling pgmTrackFlushGCPhysPTsSlow. */
/** Number of times we've been out of user records. */
# endif
# ifdef PGMPOOL_WITH_GCPHYS_TRACKING
/** Profiling deref activity related tracking GC physical pages. */
/** Number of linear searches for a HCPhys in the ram ranges. */
/** The number of failing pgmPoolTrackPhysExtAlloc calls. */
# endif
# ifdef PGMPOOL_WITH_MONITORING
/** Profiling the GC PT access handler. */
/** Times we've failed interpreting the instruction. */
/** Profiling the pgmPoolFlushPage calls made from the GC PT access handler. */
/** Times we've detected fork(). */
/** Profiling the GC access we've handled (except REP STOSD). */
/** Times we've failed interpreting a patch code instruction. */
/** Times we've failed interpreting a patch code instruction during flushing. */
/** The number of times we've seen rep prefixes we can't handle. */
/** Profiling the REP STOSD cases we've handled. */
/** Profiling the HC PT access handler. */
/** Times we've failed interpreting the instruction. */
/** Profiling the pgmPoolFlushPage calls made from the HC PT access handler. */
/** Times we've detected fork(). */
/** Profiling the HC access we've handled (except REP STOSD). */
/** The number of times we've seen rep prefixes we can't handle. */
/** Profiling the REP STOSD cases we've handled. */
/** The number of times we're called in an async thread an need to flush. */
/** The high wather mark for cModifiedPages. */
# endif
# ifdef PGMPOOL_WITH_CACHE
/** The number of cache hits. */
/** The number of cache misses. */
/** The number of times we've got a conflict of 'kind' in the cache. */
/** Number of times we've been out of pages. */
/** The number of cacheable allocations. */
/** The number of uncacheable allocations. */
# endif
#endif
/** The AVL tree for looking up a page by its HC physical address. */
/** Array of pages. (cMaxPages in length)
* The Id is the index into thist array.
*/
/** @def PGMPOOL_PAGE_2_PTR
* Maps a pool page pool into the current context.
*
* @returns VBox status code.
* @param pVM The VM handle.
* @param pPage The pool page.
*
* @remark In HC this uses PGMGCDynMapHCPage(), so it will consume of the
* small page window employeed by that function. Be careful.
* @remark There is no need to assert on the result.
*/
#ifdef IN_GC
#else
#endif
/**
* Trees are using self relative offsets as pointers.
* So, all its data, including the root pointer, must be in the heap for HC and GC
* to have the same layout.
*/
typedef struct PGMTREES
{
/** Physical access handlers (AVL range+offsetptr tree). */
/** Virtual access handlers (AVL range + GC ptr tree). */
/** Virtual access handlers (Phys range AVL range + offsetptr tree). */
} PGMTREES;
/** Pointer to PGM trees. */
/** @name Paging mode macros
* @{ */
#ifdef IN_GC
# define PGM_CTX_STR(a,b) a "GC" b
#else
# ifdef IN_RING3
# define PGM_CTX_STR(a,b) a "R3" b
# else
# define PGM_CTX_STR(a,b) a "R0" b
# endif
#endif
/* Shw_Gst */
/** @} */
/**
* Data for each paging mode.
*/
typedef struct PGMMODEDATA
{
/** The guest mode type. */
/** The shadow mode type. */
/** @name Function pointers for Shadow paging.
* @{
*/
DECLR3CALLBACKMEMBER(int, pfnR3ShwGetPage,(PVM pVM, RTGCUINTPTR GCPtr, uint64_t *pfFlags, PRTHCPHYS pHCPhys));
DECLR3CALLBACKMEMBER(int, pfnR3ShwModifyPage,(PVM pVM, RTGCUINTPTR GCPtr, size_t cbPages, uint64_t fFlags, uint64_t fMask));
DECLR3CALLBACKMEMBER(int, pfnR3ShwModifyPDEByIndex,(PVM pVM, uint32_t iPD, uint64_t fFlags, uint64_t fMask));
DECLGCCALLBACKMEMBER(int, pfnGCShwGetPage,(PVM pVM, RTGCUINTPTR GCPtr, uint64_t *pfFlags, PRTHCPHYS pHCPhys));
DECLGCCALLBACKMEMBER(int, pfnGCShwModifyPage,(PVM pVM, RTGCUINTPTR GCPtr, size_t cbPages, uint64_t fFlags, uint64_t fMask));
DECLGCCALLBACKMEMBER(int, pfnGCShwModifyPDEByIndex,(PVM pVM, uint32_t iPD, uint64_t fFlags, uint64_t fMask));
DECLR0CALLBACKMEMBER(int, pfnR0ShwGetPage,(PVM pVM, RTGCUINTPTR GCPtr, uint64_t *pfFlags, PRTHCPHYS pHCPhys));
DECLR0CALLBACKMEMBER(int, pfnR0ShwModifyPage,(PVM pVM, RTGCUINTPTR GCPtr, size_t cbPages, uint64_t fFlags, uint64_t fMask));
DECLR0CALLBACKMEMBER(int, pfnR0ShwModifyPDEByIndex,(PVM pVM, uint32_t iPD, uint64_t fFlags, uint64_t fMask));
/** @} */
/** @name Function pointers for Guest paging.
* @{
*/
DECLR3CALLBACKMEMBER(int, pfnR3GstGetPage,(PVM pVM, RTGCUINTPTR GCPtr, uint64_t *pfFlags, PRTGCPHYS pGCPhys));
DECLR3CALLBACKMEMBER(int, pfnR3GstModifyPage,(PVM pVM, RTGCUINTPTR GCPtr, size_t cbPages, uint64_t fFlags, uint64_t fMask));
HCPTRTYPE(const char *) pszHCGstWriteHandlerCR3;
DECLGCCALLBACKMEMBER(int, pfnGCGstGetPage,(PVM pVM, RTGCUINTPTR GCPtr, uint64_t *pfFlags, PRTGCPHYS pGCPhys));
DECLGCCALLBACKMEMBER(int, pfnGCGstModifyPage,(PVM pVM, RTGCUINTPTR GCPtr, size_t cbPages, uint64_t fFlags, uint64_t fMask));
DECLR0CALLBACKMEMBER(int, pfnR0GstGetPage,(PVM pVM, RTGCUINTPTR GCPtr, uint64_t *pfFlags, PRTGCPHYS pGCPhys));
DECLR0CALLBACKMEMBER(int, pfnR0GstModifyPage,(PVM pVM, RTGCUINTPTR GCPtr, size_t cbPages, uint64_t fFlags, uint64_t fMask));
/** @} */
/** @name Function pointers for Both Shadow and Guest paging.
* @{
*/
DECLR3CALLBACKMEMBER(int, pfnR3BthTrap0eHandler,(PVM pVM, RTGCUINT uErr, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault));
DECLR3CALLBACKMEMBER(int, pfnR3BthSyncCR3,(PVM pVM, uint32_t cr0, uint32_t cr3, uint32_t cr4, bool fGlobal));
DECLR3CALLBACKMEMBER(int, pfnR3BthSyncPage,(PVM pVM, VBOXPDE PdeSrc, RTGCUINTPTR GCPtrPage, unsigned cPages, unsigned uError));
DECLR3CALLBACKMEMBER(int, pfnR3BthVerifyAccessSyncPage,(PVM pVM, RTGCUINTPTR GCPtrPage, unsigned fFlags, unsigned uError));
#ifdef VBOX_STRICT
DECLR3CALLBACKMEMBER(unsigned, pfnR3BthAssertCR3,(PVM pVM, uint32_t cr3, uint32_t cr4, RTGCUINTPTR GCPtr, RTGCUINTPTR cb));
#endif
DECLGCCALLBACKMEMBER(int, pfnGCBthTrap0eHandler,(PVM pVM, RTGCUINT uErr, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault));
DECLGCCALLBACKMEMBER(int, pfnGCBthSyncCR3,(PVM pVM, uint32_t cr0, uint32_t cr3, uint32_t cr4, bool fGlobal));
DECLGCCALLBACKMEMBER(int, pfnGCBthSyncPage,(PVM pVM, VBOXPDE PdeSrc, RTGCUINTPTR GCPtrPage, unsigned cPages, unsigned uError));
DECLGCCALLBACKMEMBER(int, pfnGCBthVerifyAccessSyncPage,(PVM pVM, RTGCUINTPTR GCPtrPage, unsigned fFlags, unsigned uError));
#ifdef VBOX_STRICT
DECLGCCALLBACKMEMBER(unsigned, pfnGCBthAssertCR3,(PVM pVM, uint32_t cr3, uint32_t cr4, RTGCUINTPTR GCPtr, RTGCUINTPTR cb));
#endif
DECLR0CALLBACKMEMBER(int, pfnR0BthTrap0eHandler,(PVM pVM, RTGCUINT uErr, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault));
DECLR0CALLBACKMEMBER(int, pfnR0BthSyncCR3,(PVM pVM, uint32_t cr0, uint32_t cr3, uint32_t cr4, bool fGlobal));
DECLR0CALLBACKMEMBER(int, pfnR0BthSyncPage,(PVM pVM, VBOXPDE PdeSrc, RTGCUINTPTR GCPtrPage, unsigned cPages, unsigned uError));
DECLR0CALLBACKMEMBER(int, pfnR0BthVerifyAccessSyncPage,(PVM pVM, RTGCUINTPTR GCPtrPage, unsigned fFlags, unsigned uError));
#ifdef VBOX_STRICT
DECLR0CALLBACKMEMBER(unsigned, pfnR0BthAssertCR3,(PVM pVM, uint32_t cr3, uint32_t cr4, RTGCUINTPTR GCPtr, RTGCUINTPTR cb));
#endif
/** @} */
} PGMMODEDATA, *PPGMMODEDATA;
/**
* Converts a PGM pointer into a VM pointer.
* @returns Pointer to the VM structure the PGM is part of.
* @param pPGM Pointer to PGM instance data.
*/
/**
* PGM Data (part of VM)
*/
typedef struct PGM
{
/** Offset to the VM structure. */
/*
* This will be redefined at least two more times before we're done, I'm sure.
* The current code is only to get on with the coding.
* - 2004-06-10: initial version, bird.
* - 2004-07-02: 1st time, bird.
* - 2004-10-18: 2nd time, bird.
* - 2005-07-xx: 3rd time, bird.
*/
/** Pointer to the page table entries for the dynamic page mapping area - GCPtr. */
/** Pointer to the page table entries for the dynamic page mapping area - GCPtr. */
/** The host paging mode. (This is what SUPLib reports.) */
/** The shadow paging mode. */
/** The guest paging mode. */
/** The current physical address representing in the guest CR3 register. */
/** Pointer to the 5 page CR3 content mapping.
* The first page is always the CR3 (in some form) while the 4 other pages
* are used of the PDs in PAE mode. */
/** The physical address of the currently monitored guest CR3 page.
* When this value is NIL_RTGCPHYS no page is being monitored. */
#endif
/** @name 32-bit Guest Paging.
* @{ */
/** The guest's page directory, HC pointer. */
/** The guest's page directory, static GC mapping. */
/** @} */
/** @name PAE Guest Paging.
* @{ */
/** The guest's page directory pointer table, static GC mapping. */
/** The guest's page directory pointer table, HC pointer. */
/** The guest's page directories, HC pointers.
* These are individual pointers and doesn't have to be adjecent.
* These doesn't have to be update to date - use pgmGstGetPaePD() to access them. */
/** The guest's page directories, static GC mapping.
* Unlike the HC array the first entry can be accessed as a 2048 entry PD.
* These doesn't have to be update to date - use pgmGstGetPaePD() to access them. */
/** The physical addresses of the guest page directories (PAE) pointed to by apGstPagePDsHC/GC. */
/** The physical addresses of the monitored guest page directories (PAE). */
/** @} */
/** @name 32-bit Shadow Paging
* @{ */
/** The 32-Bit PD - HC Ptr. */
/** The 32-Bit PD - GC Ptr. */
#endif
/** The Physical Address (HC) of the 32-Bit PD. */
/** @} */
/** @name PAE Shadow Paging
* @{ */
/** The four PDs for the low 4GB - HC Ptr.
* Even though these are 4 pointers, what they point at is a single table.
* Thus, it's possible to walk the 2048 entries starting where apHCPaePDs[0] points. */
/** The four PDs for the low 4GB - GC Ptr.
* Same kind of mapping as apHCPaePDs. */
/** The Physical Address (HC) of the four PDs for the low 4GB.
* These are *NOT* 4 contiguous pages. */
/** The PAE PDPTR - HC Ptr. */
/** The Physical Address (HC) of the PAE PDPTR. */
/** The PAE PDPTR - GC Ptr. */
/** @} */
/** @name AMD64 Shadow Paging
* Extends PAE Paging.
* @{ */
/** The Page Map Level 4 table - HC Ptr. */
/** The Page Map Level 4 table - GC Ptr. */
/** The Physical Address (HC) of the Page Map Level 4 table. */
/** @}*/
/** @name Function pointers for Shadow paging.
* @{
*/
DECLR3CALLBACKMEMBER(int, pfnR3ShwGetPage,(PVM pVM, RTGCUINTPTR GCPtr, uint64_t *pfFlags, PRTHCPHYS pHCPhys));
DECLR3CALLBACKMEMBER(int, pfnR3ShwModifyPage,(PVM pVM, RTGCUINTPTR GCPtr, size_t cbPages, uint64_t fFlags, uint64_t fMask));
DECLR3CALLBACKMEMBER(int, pfnR3ShwModifyPDEByIndex,(PVM pVM, uint32_t iPD, uint64_t fFlags, uint64_t fMask));
DECLGCCALLBACKMEMBER(int, pfnGCShwGetPage,(PVM pVM, RTGCUINTPTR GCPtr, uint64_t *pfFlags, PRTHCPHYS pHCPhys));
DECLGCCALLBACKMEMBER(int, pfnGCShwModifyPage,(PVM pVM, RTGCUINTPTR GCPtr, size_t cbPages, uint64_t fFlags, uint64_t fMask));
DECLGCCALLBACKMEMBER(int, pfnGCShwModifyPDEByIndex,(PVM pVM, uint32_t iPD, uint64_t fFlags, uint64_t fMask));
#endif
DECLR0CALLBACKMEMBER(int, pfnR0ShwGetPage,(PVM pVM, RTGCUINTPTR GCPtr, uint64_t *pfFlags, PRTHCPHYS pHCPhys));
DECLR0CALLBACKMEMBER(int, pfnR0ShwModifyPage,(PVM pVM, RTGCUINTPTR GCPtr, size_t cbPages, uint64_t fFlags, uint64_t fMask));
DECLR0CALLBACKMEMBER(int, pfnR0ShwModifyPDEByIndex,(PVM pVM, uint32_t iPD, uint64_t fFlags, uint64_t fMask));
/** @} */
/** @name Function pointers for Guest paging.
* @{
*/
DECLR3CALLBACKMEMBER(int, pfnR3GstGetPage,(PVM pVM, RTGCUINTPTR GCPtr, uint64_t *pfFlags, PRTGCPHYS pGCPhys));
DECLR3CALLBACKMEMBER(int, pfnR3GstModifyPage,(PVM pVM, RTGCUINTPTR GCPtr, size_t cbPages, uint64_t fFlags, uint64_t fMask));
HCPTRTYPE(const char *) pszHCGstWriteHandlerCR3;
DECLGCCALLBACKMEMBER(int, pfnGCGstGetPage,(PVM pVM, RTGCUINTPTR GCPtr, uint64_t *pfFlags, PRTGCPHYS pGCPhys));
DECLGCCALLBACKMEMBER(int, pfnGCGstModifyPage,(PVM pVM, RTGCUINTPTR GCPtr, size_t cbPages, uint64_t fFlags, uint64_t fMask));
DECLR0CALLBACKMEMBER(int, pfnR0GstGetPage,(PVM pVM, RTGCUINTPTR GCPtr, uint64_t *pfFlags, PRTGCPHYS pGCPhys));
DECLR0CALLBACKMEMBER(int, pfnR0GstModifyPage,(PVM pVM, RTGCUINTPTR GCPtr, size_t cbPages, uint64_t fFlags, uint64_t fMask));
/** @} */
/** @name Function pointers for Both Shadow and Guest paging.
* @{
*/
DECLR3CALLBACKMEMBER(int, pfnR3BthTrap0eHandler,(PVM pVM, RTGCUINT uErr, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault));
DECLR3CALLBACKMEMBER(int, pfnR3BthSyncCR3,(PVM pVM, uint32_t cr0, uint32_t cr3, uint32_t cr4, bool fGlobal));
DECLR3CALLBACKMEMBER(int, pfnR3BthSyncPage,(PVM pVM, VBOXPDE PdeSrc, RTGCUINTPTR GCPtrPage, unsigned cPages, unsigned uError));
DECLR3CALLBACKMEMBER(int, pfnR3BthVerifyAccessSyncPage,(PVM pVM, RTGCUINTPTR GCPtrPage, unsigned fFlags, unsigned uError));
DECLR3CALLBACKMEMBER(unsigned, pfnR3BthAssertCR3,(PVM pVM, uint32_t cr3, uint32_t cr4, RTGCUINTPTR GCPtr, RTGCUINTPTR cb));
DECLR0CALLBACKMEMBER(int, pfnR0BthTrap0eHandler,(PVM pVM, RTGCUINT uErr, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault));
DECLR0CALLBACKMEMBER(int, pfnR0BthSyncCR3,(PVM pVM, uint32_t cr0, uint32_t cr3, uint32_t cr4, bool fGlobal));
DECLR0CALLBACKMEMBER(int, pfnR0BthSyncPage,(PVM pVM, VBOXPDE PdeSrc, RTGCUINTPTR GCPtrPage, unsigned cPages, unsigned uError));
DECLR0CALLBACKMEMBER(int, pfnR0BthVerifyAccessSyncPage,(PVM pVM, RTGCUINTPTR GCPtrPage, unsigned fFlags, unsigned uError));
DECLR0CALLBACKMEMBER(unsigned, pfnR0BthAssertCR3,(PVM pVM, uint32_t cr3, uint32_t cr4, RTGCUINTPTR GCPtr, RTGCUINTPTR cb));
DECLGCCALLBACKMEMBER(int, pfnGCBthTrap0eHandler,(PVM pVM, RTGCUINT uErr, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault));
DECLGCCALLBACKMEMBER(int, pfnGCBthSyncCR3,(PVM pVM, uint32_t cr0, uint32_t cr3, uint32_t cr4, bool fGlobal));
DECLGCCALLBACKMEMBER(int, pfnGCBthSyncPage,(PVM pVM, VBOXPDE PdeSrc, RTGCUINTPTR GCPtrPage, unsigned cPages, unsigned uError));
DECLGCCALLBACKMEMBER(int, pfnGCBthVerifyAccessSyncPage,(PVM pVM, RTGCUINTPTR GCPtrPage, unsigned fFlags, unsigned uError));
DECLGCCALLBACKMEMBER(unsigned, pfnGCBthAssertCR3,(PVM pVM, uint32_t cr3, uint32_t cr4, RTGCUINTPTR GCPtr, RTGCUINTPTR cb));
#endif
/** @} */
/** Pointer to SHW+GST mode data (function pointers).
* The index into this table is made up from */
/** Pointer to the list of RAM ranges (Phys GC -> Phys HC conversion) - for HC.
* This is sorted by physical address and contains no overlaps.
* The memory locks and other conversions are managed by MM at the moment.
*/
/** Pointer to the list of RAM ranges (Phys GC -> Phys HC conversion) - for GC.
* This is sorted by physical address and contains no overlaps.
* The memory locks and other conversions are managed by MM at the moment.
*/
/** The configured RAM size. */
/** PGM offset based trees - HC Ptr. */
/** PGM offset based trees - GC Ptr. */
/** Linked list of GC mappings - for GC.
* The list is sorted ascending on address.
*/
/** Linked list of GC mappings - for HC.
* The list is sorted ascending on address.
*/
/** Linked list of GC mappings - for R0.
* The list is sorted ascending on address.
*/
/** If set no conflict checks are required. (boolean) */
bool fMappingsFixed;
/** If set, then no mappings are put into the shadow page table. (boolean) */
bool fDisableMappings;
/** Size of fixed mapping */
/** Base address (GC) of fixed mapping */
#endif
/** @name Intermediate Context
* @{ */
/** Pointer to the intermediate page directory - Normal. */
/** Pointer to the intermedate page tables - Normal.
* There are two page tables, one for the identity mapping and one for
* the host context mapping (of the core code). */
/** Pointer to the intermedate page tables - PAE. */
/** Pointer to the intermedate page directory - PAE. */
/** Pointer to the intermedate page directory - PAE. */
/** Pointer to the intermedate page-map level 4 - AMD64. */
/** Pointer to the intermedate page directory - AMD64. */
/** The Physical Address (HC) of the intermediate Page Directory - Normal. */
/** The Physical Address (HC) of the intermediate Page Directory Pointer Table - PAE. */
/** The Physical Address (HC) of the intermediate Page Map Level 4 table - AMD64. */
/** @} */
/** Base address of the dynamic page mapping area.
* The array is MM_HYPER_DYNAMIC_SIZE bytes big.
*/
/** The index of the last entry used in the dynamic page mapping area. */
/** Cache containing the last entries in the dynamic page mapping area.
* The cache size is covering half of the mapping area. */
/** A20 gate mask.
* Our current approach to A20 emulation is to let REM do it and don't bother
* anywhere else. The interesting Guests will be operating with it enabled anyway.
* But whould need arrise, we'll subject physical addresses to this mask. */
/** A20 gate state - boolean! */
/** What needs syncing (PGM_SYNC_*).
* This is used to queue operations for PGMSyncCR3, PGMInvalidatePage,
* PGMFlushTLB, and PGMR3Load. */
#endif
/** PGM critical section.
* This protects the physical & virtual access handlers, ram ranges,
* and the page flag updating (some of it anyway).
*/
/** Shadow Page Pool - HC Ptr. */
/** Shadow Page Pool - GC Ptr. */
/** We're not in a state which permits writes to guest memory.
* (Only used in strict builds.) */
bool fNoMorePhysWrites;
/** Flush the cache on the next access. */
bool fPhysCacheFlushPending;
/** @todo r=bird: Fix member names!*/
/** PGMPhysRead cache */
/** PGMPhysWrite cache */
/** @name Release Statistics
* @{ */
/** The number of times the guest has switched mode since last reset or statistics reset. */
/** @} */
#ifdef VBOX_WITH_STATISTICS
/** GC: Which statistic this \#PF should be attributed to. */
/** HC: Which statistic this \#PF should be attributed to. */
STAMPROFILE StatTrap0eDirtyAndAccessedBits; /**< Profiling of the Trap0eHandler body when the cause is dirty and/or accessed bit emulation. */
STAMPROFILE StatTrap0eGuestTrap; /**< Profiling of the Trap0eHandler body when the cause is a guest trap. */
STAMPROFILE StatTrap0eHndPhys; /**< Profiling of the Trap0eHandler body when the cause is a physical handler. */
STAMPROFILE StatTrap0eHndVirt; /**< Profiling of the Trap0eHandler body when the cause is a virtual handler. */
STAMPROFILE StatTrap0eHndUnhandled; /**< Profiling of the Trap0eHandler body when the cause is access outside the monitored areas of a monitored page. */
STAMPROFILE StatTrap0eMisc; /**< Profiling of the Trap0eHandler body when the cause is not known. */
STAMPROFILE StatTrap0eOutOfSync; /**< Profiling of the Trap0eHandler body when the cause is an out-of-sync page. */
STAMPROFILE StatTrap0eOutOfSyncHndPhys; /**< Profiling of the Trap0eHandler body when the cause is an out-of-sync physical handler page. */
STAMPROFILE StatTrap0eOutOfSyncHndVirt; /**< Profiling of the Trap0eHandler body when the cause is an out-of-sync virtual handler page. */
STAMPROFILE StatTrap0eOutOfSyncObsHnd; /**< Profiling of the Trap0eHandler body when the cause is an obsolete handler page. */
STAMPROFILE StatTrap0eSyncPT; /**< Profiling of the Trap0eHandler body when the cause is lazy syncing of a PT. */
STAMCOUNTER StatGCTrap0eConflicts; /**< GC: The number of times \#PF was caused by an undetected conflict. */
/** GC: PGMSyncPT() profiling. */
/** GC: The number of times PGMSyncPT() needed to allocate page tables. */
/** GC: The number of times PGMSyncPT() detected conflicts. */
/** GC: The number of times PGMSyncPT() failed. */
/** GC: PGMGCInvalidatePage() profiling. */
/** GC: The number of times PGMGCInvalidatePage() was called for a 4KB page. */
/** GC: The number of times PGMGCInvalidatePage() was called for a 4MB page. */
/** GC: The number of times PGMGCInvalidatePage() skipped a 4MB page. */
/** GC: The number of times PGMGCInvalidatePage() was called for a not accessed page directory. */
/** GC: The number of times PGMGCInvalidatePage() was called for a not present page directory. */
/** GC: The number of times PGMGCInvalidatePage() was called for a page directory containing mappings (no conflict). */
/** GC: The number of times PGMGCInvalidatePage() was called for an out of sync page directory. */
/** HC: The number of times PGMGCInvalidatePage() was skipped due to not present shw or pending pending SyncCR3. */
/** GC: The number of times user page is out of sync was detected in GC. */
/** GC: The number of times supervisor page is out of sync was detected in GC. */
/** GC: The number of dynamic page mapping cache hits */
/** GC: The number of dynamic page mapping cache misses */
/** GC: The number of times pgmGCGuestPDWriteHandler() was successfully called. */
/** GC: The number of times pgmGCGuestPDWriteHandler() was called and we had to fall back to the recompiler. */
/** GC: The number of times pgmGCGuestPDWriteHandler() was called and a conflict was detected. */
/** GC: Number of out-of-sync handled pages. */
/** GC: Number of traps due to physical access handlers. */
/** GC: Number of traps due to virtual access handlers. */
/** GC: Number of traps due to virtual access handlers found by physical address. */
/** GC: Number of traps due to virtual access handlers found by virtual address (without proper physical flags). */
/** GC: Number of traps due to access outside range of monitored page(s). */
/** GC: The number of times pgmGCGuestROMWriteHandler() was successfully called. */
/** GC: The number of times pgmGCGuestROMWriteHandler() was called and we had to fall back to the recompiler */
/** HC: PGMR3InvalidatePage() profiling. */
/** HC: The number of times PGMR3InvalidatePage() was called for a 4KB page. */
/** HC: The number of times PGMR3InvalidatePage() was called for a 4MB page. */
/** HC: The number of times PGMR3InvalidatePage() skipped a 4MB page. */
/** HC: The number of times PGMR3InvalidatePage() was called for a not accessed page directory. */
/** HC: The number of times PGMR3InvalidatePage() was called for a not present page directory. */
/** HC: The number of times PGMR3InvalidatePage() was called for a page directory containing mappings (no conflict). */
/** HC: The number of times PGMGCInvalidatePage() was called for an out of sync page directory. */
/** HC: The number of times PGMR3InvalidatePage() was skipped due to not present shw or pending pending SyncCR3. */
/** HC: PGMR3SyncPT() profiling. */
/** HC: pgmr3SyncPTResolveConflict() profiling (includes the entire relocation). */
/** HC: Number of times PGMR3CheckMappingConflicts() detected a conflict. */
/** HC: The total number of times pgmHCGuestPDWriteHandler() was called. */
/** HC: The number of times pgmHCGuestPDWriteHandler() detected a conflict */
/** HC: The number of pages marked not present for accessed bit emulation. */
/** HC: The number of pages marked read-only for dirty bit tracking. */
/** HC: The number of pages marked read-only for dirty bit tracking. */
/** HC: The number of traps generated for dirty bit tracking. */
/** HC: The number of pages already dirty or readonly. */
/** GC: The number of pages marked not present for accessed bit emulation. */
/** GC: The number of pages marked read-only for dirty bit tracking. */
/** GC: The number of pages marked read-only for dirty bit tracking. */
/** GC: The number of traps generated for dirty bit tracking. */
/** GC: The number of pages already dirty or readonly. */
/** GC: The number of pages marked dirty because of write accesses. */
/** GC: The number of pages already marked dirty because of write accesses. */
/** GC: The number of real pages faults during dirty bit tracking. */
/** GC: Profiling of the PGMTrackDirtyBit() body */
/** HC: Profiling of the PGMTrackDirtyBit() body */
/** GC: Profiling of the PGMGstModifyPage() body */
/** HC: Profiling of the PGMGstModifyPage() body */
/** GC: The number of time we've marked a PD not present from SyncPage to virtualize the accessed bit. */
/** GC: The number of time we've encountered an out-of-sync PD in SyncPage. */
/** HC: The number of time we've marked a PD not present from SyncPage to virtualize the accessed bit. */
/** HC: The number of time we've encountered an out-of-sync PD in SyncPage. */
/** Profiling of the PGMFlushTLB() body. */
/** The number of times PGMFlushTLB was called with a new CR3, non-global. (switch) */
/** The number of times PGMFlushTLB was called with a new CR3, global. (switch) */
/** The number of times PGMFlushTLB was called with the same CR3, non-global. (flush) */
/** The number of times PGMFlushTLB was called with the same CR3, global. (flush) */
STAMPROFILE StatGCSyncCR3Handlers; /**< GC: Profiling of the PGMSyncCR3() update handler section. */
STAMPROFILE StatGCSyncCR3HandlerVirtualUpdate; /**< GC: Profiling of the virtual handler updates. */
STAMCOUNTER StatGCSyncCR3DstFreed; /**< GC: The number of times we've had to free a shadow entry. */
STAMCOUNTER StatGCSyncCR3DstFreedSrcNP; /**< GC: The number of times we've had to free a shadow entry for which the source entry was not present. */
STAMCOUNTER StatGCSyncCR3DstNotPresent; /**< GC: The number of times we've encountered a not present shadow entry for a present guest entry. */
STAMCOUNTER StatGCSyncCR3DstSkippedGlobalPD; /**< GC: The number of times a global page directory wasn't flushed. */
STAMCOUNTER StatGCSyncCR3DstSkippedGlobalPT; /**< GC: The number of times a page table with only global entries wasn't flushed. */
STAMCOUNTER StatGCSyncCR3DstCacheHit; /**< GC: The number of times we got some kind of cache hit on a page table. */
STAMPROFILE StatHCSyncCR3Handlers; /**< HC: Profiling of the PGMSyncCR3() update handler section. */
STAMPROFILE StatHCSyncCR3HandlerVirtualUpdate; /**< HC: Profiling of the virtual handler updates. */
STAMCOUNTER StatHCSyncCR3DstFreed; /**< HC: The number of times we've had to free a shadow entry. */
STAMCOUNTER StatHCSyncCR3DstFreedSrcNP; /**< HC: The number of times we've had to free a shadow entry for which the source entry was not present. */
STAMCOUNTER StatHCSyncCR3DstNotPresent; /**< HC: The number of times we've encountered a not present shadow entry for a present guest entry. */
STAMCOUNTER StatHCSyncCR3DstSkippedGlobalPD; /**< HC: The number of times a global page directory wasn't flushed. */
STAMCOUNTER StatHCSyncCR3DstSkippedGlobalPT; /**< HC: The number of times a page table with only global entries wasn't flushed. */
STAMCOUNTER StatHCSyncCR3DstCacheHit; /**< HC: The number of times we got some kind of cache hit on a page table. */
/** GC: Profiling of pgmHandlerVirtualFindByPhysAddr. */
/** HC: Profiling of pgmHandlerVirtualFindByPhysAddr. */
/** HC: The number of times PGMR3HandlerPhysicalReset is called. */
# ifdef PGMPOOL_WITH_GCPHYS_TRACKING
/** The number of first time shadowings. */
/** The number of times switching to cRef2, i.e. the page is being shadowed by two PTs. */
/** The number of times we're tracking using cRef2. */
/** The number of times we're hitting pages which has overflowed cRef2. */
/** The number of times the extent list grows to long. */
/** Profiling of SyncPageWorkerTrackDeref (expensive). */
# endif
/** Allocated mbs of guest ram */
/** Nr of pgmr3PhysGrowRange calls. */
#endif
/** @name PGM::fSyncFlags Flags
* @{
*/
/** Updates the MM_RAM_FLAGS_VIRTUAL_HANDLER page bit. */
#define PGM_SYNC_UPDATE_PAGE_BIT_VIRTUAL BIT(0)
/** Always sync CR3. */
/** Check monitoring on next CR3 (re)load and invalidate page. */
/** Clear the page pool (a light weight flush). */
/** @} */
PGMGCDECL(int) pgmGCGuestPDWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, void *pvFault, RTGCPHYS GCPhysFault, void *pvUser);
PGMDECL(int) pgmGuestROMWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, void *pvFault, RTGCPHYS GCPhysFault, void *pvUser);
PGMGCDECL(int) pgmCachePTWriteGC(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPHYS GCPhysFault, void *pvUser);
int pgmHandlerVirtualFindByPhysAddr(PVM pVM, RTGCPHYS GCPhys, PPGMVIRTHANDLER *ppVirt, unsigned *piPage);
#ifdef VBOX_STRICT
#else
# define pgmHandlerVirtualDumpPhysPages(a) do { } while (0)
#endif
#ifdef IN_RING3
#endif
#ifdef IN_GC
#endif
int pgmPoolAlloc(PVM pVM, RTGCPHYS GCPhys, PGMPOOLKIND enmKind, uint16_t iUser, uint16_t iUserTable, PPPGMPOOLPAGE ppPage);
#ifdef PGMPOOL_WITH_MONITORING
# ifdef IN_RING3
void pgmPoolMonitorChainChanging(PPGMPOOL pPool, PPGMPOOLPAGE pPage, RTGCPHYS GCPhysFault, RTHCPTR pvAddress, PDISCPUSTATE pCpu);
# else
void pgmPoolMonitorChainChanging(PPGMPOOL pPool, PPGMPOOLPAGE pPage, RTGCPHYS GCPhysFault, RTGCPTR pvAddress, PDISCPUSTATE pCpu);
# endif
#endif
/**
* Convert GC Phys to HC Phys.
*
* @returns VBox status.
* @param pPGM PGM handle.
* @param GCPhys The GC physical address.
* @param pHCPhys Where to store the corresponding HC physical address.
*/
{
/*
* Walk range list.
*/
while (pRam)
{
{
/* Physical chunk in dynamically allocated range not present? */
{
#ifdef IN_RING3
#else
#endif
if (rc != VINF_SUCCESS)
return rc;
}
return VINF_SUCCESS;
}
}
}
/**
* Convert GC Phys to HC Virt.
*
* @returns VBox status.
* @param pPGM PGM handle.
* @param GCPhys The GC physical address.
* @param pHCPtr Where to store the corresponding HC virtual address.
*/
{
/*
* Walk range list.
*/
while (pRam)
{
{
{
/* Physical chunk in dynamically allocated range not present? */
{
#ifdef IN_RING3
#else
#endif
if (rc != VINF_SUCCESS)
return rc;
}
*pHCPtr = (RTHCPTR)((RTHCUINTPTR)CTXSUFF(pRam->pavHCChunk)[idx] + (off & PGM_DYNAMIC_CHUNK_OFFSET_MASK));
return VINF_SUCCESS;
}
{
return VINF_SUCCESS;
}
}
}
}
/**
* Convert GC Phys to HC Virt.
*
* @returns VBox status.
* @param PVM VM handle.
* @param pRam Ram range
* @param GCPhys The GC physical address.
* @param pHCPtr Where to store the corresponding HC virtual address.
*/
{
{
/* Physical chunk in dynamically allocated range not present? */
{
#ifdef IN_RING3
#else
#endif
if (rc != VINF_SUCCESS)
return rc;
}
*pHCPtr = (RTHCPTR)((RTHCUINTPTR)CTXSUFF(pRam->pavHCChunk)[idx] + (off & PGM_DYNAMIC_CHUNK_OFFSET_MASK));
return VINF_SUCCESS;
}
{
return VINF_SUCCESS;
}
}
/**
* Convert GC Phys to HC Virt and HC Phys.
*
* @returns VBox status.
* @param pPGM PGM handle.
* @param GCPhys The GC physical address.
* @param pHCPtr Where to store the corresponding HC virtual address.
* @param pHCPhys Where to store the HC Physical address and its flags.
*/
DECLINLINE(int) PGMRamGCPhys2HCPtrAndHCPhysWithFlags(PPGM pPGM, RTGCPHYS GCPhys, PRTHCPTR pHCPtr, PRTHCPHYS pHCPhys)
{
/*
* Walk range list.
*/
while (pRam)
{
{
/* Physical chunk in dynamically allocated range not present? */
{
#ifdef IN_RING3
#else
#endif
if (rc != VINF_SUCCESS)
return rc;
}
{
*pHCPtr = (RTHCPTR)((RTHCUINTPTR)CTXSUFF(pRam->pavHCChunk)[idx] + (off & PGM_DYNAMIC_CHUNK_OFFSET_MASK));
return VINF_SUCCESS;
}
{
return VINF_SUCCESS;
}
*pHCPtr = 0;
}
}
}
/**
* Convert GC Phys page to a page entry pointer.
*
* This is used by code which may have to update the flags.
*
* @returns VBox status.
* @param pPGM PGM handle.
* @param GCPhys The GC physical address.
* @param ppHCPhys Where to store the pointer to the page entry.
*/
{
/*
* Walk range list.
*/
while (pRam)
{
{
/* Physical chunk in dynamically allocated range not present? */
{
#ifdef IN_RING3
#else
#endif
if (rc != VINF_SUCCESS)
return rc;
}
return VINF_SUCCESS;
}
}
}
/**
* Convert GC Phys page to HC Phys page and flags.
*
* @returns VBox status.
* @param pPGM PGM handle.
* @param GCPhys The GC physical address.
* @param pHCPhys Where to store the corresponding HC physical address of the page
* and the page flags.
*/
{
/*
* Walk range list.
*/
while (pRam)
{
{
/* Physical chunk in dynamically allocated range not present? */
{
#ifdef IN_RING3
#else
#endif
if (rc != VINF_SUCCESS)
return rc;
}
return VINF_SUCCESS;
}
}
}
/**
* Clears flags associated with a RAM address.
*
* @returns VBox status code.
* @param pPGM PGM handle.
* @param GCPhys Guest context physical address.
* @param fFlags fFlags to clear. (Bits 0-11.)
*/
{
/*
* Walk range list.
*/
while (pRam)
{
{
/* Physical chunk in dynamically allocated range not present? */
{
#ifdef IN_RING3
#else
#endif
if (rc != VINF_SUCCESS)
return rc;
}
return VINF_SUCCESS;
}
}
}
/**
* Clears flags associated with a RAM address.
*
* @returns VBox status code.
* @param pPGM PGM handle.
* @param GCPhys Guest context physical address.
* @param fFlags fFlags to clear. (Bits 0-11.)
* @param ppRamHint Where to read and store the ram list hint.
* The caller initializes this to NULL before the call.
*/
DECLINLINE(int) PGMRamFlagsClearByGCPhysWithHint(PPGM pPGM, RTGCPHYS GCPhys, unsigned fFlags, PPGMRAMRANGE *ppRamHint)
{
/*
* Check the hint.
*/
if (pRam)
{
{
/* Physical chunk in dynamically allocated range not present? */
{
#ifdef IN_RING3
#else
#endif
if (rc != VINF_SUCCESS)
return rc;
}
return VINF_SUCCESS;
}
}
/*
* Walk range list.
*/
while (pRam)
{
{
/* Physical chunk in dynamically allocated range not present? */
{
#ifdef IN_RING3
#else
#endif
if (rc != VINF_SUCCESS)
return rc;
}
return VINF_SUCCESS;
}
}
}
/**
* Sets (bitwise OR) flags associated with a RAM address.
*
* @returns VBox status code.
* @param pPGM PGM handle.
* @param GCPhys Guest context physical address.
* @param fFlags fFlags to set clear. (Bits 0-11.)
*/
{
/*
* Walk range list.
*/
while (pRam)
{
{
/* Physical chunk in dynamically allocated range not present? */
{
#ifdef IN_RING3
#else
#endif
if (rc != VINF_SUCCESS)
return rc;
}
return VINF_SUCCESS;
}
}
}
/**
* Sets (bitwise OR) flags associated with a RAM address.
*
* @returns VBox status code.
* @param pPGM PGM handle.
* @param GCPhys Guest context physical address.
* @param fFlags fFlags to set clear. (Bits 0-11.)
* @param ppRamHint Where to read and store the ram list hint.
* The caller initializes this to NULL before the call.
*/
DECLINLINE(int) PGMRamFlagsSetByGCPhysWithHint(PPGM pPGM, RTGCPHYS GCPhys, unsigned fFlags, PPGMRAMRANGE *ppRamHint)
{
/*
* Check the hint.
*/
if (pRam)
{
{
/* Physical chunk in dynamically allocated range not present? */
{
#ifdef IN_RING3
#else
#endif
if (rc != VINF_SUCCESS)
return rc;
}
return VINF_SUCCESS;
}
}
/*
* Walk range list.
*/
while (pRam)
{
{
/* Physical chunk in dynamically allocated range not present? */
{
#ifdef IN_RING3
#else
#endif
if (rc != VINF_SUCCESS)
return rc;
}
return VINF_SUCCESS;
}
}
}
/**
* Gets the page directory for the specified address.
*
* @returns Pointer to the page directory in question.
* @returns NULL if the page directory is not present or on an invalid page.
* @param pPGM Pointer to the PGM instance data.
* @param GCPtr The address.
*/
{
{
if ((CTXSUFF(pPGM->pGstPaePDPTR)->a[iPdPtr].u & X86_PDPE_PG_MASK) == pPGM->aGCPhysGstPaePDs[iPdPtr])
/* cache is out-of-sync. */
int rc = PGM_GCPHYS_2_PTR(PGM2VM(pPGM), CTXSUFF(pPGM->pGstPaePDPTR)->a[iPdPtr].u & X86_PDPE_PG_MASK, &pPD);
if (VBOX_SUCCESS(rc))
return pPD;
/* returning NIL_RTGCPHYS is ok if we assume it's just an invalid page of some kind emualted as all 0s. */
}
return NULL;
}
/**
* Gets the page directory entry for the specified address.
*
* @returns Pointer to the page directory entry in question.
* @returns NULL if the page directory is not present or on an invalid page.
* @param pPGM Pointer to the PGM instance data.
* @param GCPtr The address.
*/
{
{
if ((CTXSUFF(pPGM->pGstPaePDPTR)->a[iPdPtr].u & X86_PDPE_PG_MASK) == pPGM->aGCPhysGstPaePDs[iPdPtr])
/* The cache is out-of-sync. */
int rc = PGM_GCPHYS_2_PTR(PGM2VM(pPGM), CTXSUFF(pPGM->pGstPaePDPTR)->a[iPdPtr].u & X86_PDPE_PG_MASK, &pPD);
if (VBOX_SUCCESS(rc))
AssertMsgFailed(("Impossible! rc=%Vrc PDPE=%RX64\n", rc, CTXSUFF(pPGM->pGstPaePDPTR)->a[iPdPtr].u));
/* returning NIL_RTGCPHYS is ok if we assume it's just an invalid page or something which we'll emulate as all 0s. */
}
return NULL;
}
/**
* Gets the page directory entry for the specified address.
*
* @returns The page directory entry in question.
* @returns A non-present entry if the page directory is not present or on an invalid page.
* @param pPGM Pointer to the PGM instance data.
* @param GCPtr The address.
*/
{
{
if ((CTXSUFF(pPGM->pGstPaePDPTR)->a[iPdPtr].u & X86_PDPE_PG_MASK) == pPGM->aGCPhysGstPaePDs[iPdPtr])
/* cache is out-of-sync. */
int rc = PGM_GCPHYS_2_PTR(PGM2VM(pPGM), CTXSUFF(pPGM->pGstPaePDPTR)->a[iPdPtr].u & X86_PDPE_PG_MASK, &pPD);
if (VBOX_SUCCESS(rc))
}
return 0;
}
/**
* Checks if any of the specified page flags are set for the given page.
*
* @returns true if any of the flags are set.
* @returns false if all the flags are clear.
* @param pPGM PGM handle.
* @param GCPhys The GC physical address.
* @param fFlags The flags to check for.
*/
{
/*
* Walk range list.
*/
pRam;
{
}
return false;
}
/**
* Gets the ram flags for a handler.
*
* @returns The ram flags.
* @param pCur The physical handler in question.
*/
{
{
return MM_RAM_FLAGS_PHYSICAL_HANDLER;
case PGMPHYSHANDLERTYPE_MMIO:
default:
}
}
/**
* Clears one physical page of a virtual handler
*
* @param pPGM Pointer to the PGM instance.
* @param pCur Virtual handler structure
* @param iPage Physical page index
*/
{
/*
* Remove the node from the tree (it's supposed to be in the tree if we get here!).
*/
("pPhys2Virt=%p:{.Core.Key=%VGp, .Core.KeyLast=%VGp, .offVirtHandler=%#RX32, .offNextAlias=%#RX32}\n",
pPhys2Virt, pPhys2Virt->Core.Key, pPhys2Virt->Core.KeyLast, pPhys2Virt->offVirtHandler, pPhys2Virt->offNextAlias));
#endif
{
/* We're the head of the alias chain. */
PPGMPHYS2VIRTHANDLER pRemove = (PPGMPHYS2VIRTHANDLER)RTAvlroGCPhysRemove(&pPGM->CTXSUFF(pTrees)->PhysToVirtHandlers, pPhys2Virt->Core.Key); NOREF(pRemove);
("pPhys2Virt=%p:{.Core.Key=%VGp, .Core.KeyLast=%VGp, .offVirtHandler=%#RX32, .offNextAlias=%#RX32}\n",
pPhys2Virt, pPhys2Virt->Core.Key, pPhys2Virt->Core.KeyLast, pPhys2Virt->offVirtHandler, pPhys2Virt->offNextAlias));
("wanted: pPhys2Virt=%p:{.Core.Key=%VGp, .Core.KeyLast=%VGp, .offVirtHandler=%#RX32, .offNextAlias=%#RX32}\n"
" got: pRemove=%p:{.Core.Key=%VGp, .Core.KeyLast=%VGp, .offVirtHandler=%#RX32, .offNextAlias=%#RX32}\n",
pPhys2Virt, pPhys2Virt->Core.Key, pPhys2Virt->Core.KeyLast, pPhys2Virt->offVirtHandler, pPhys2Virt->offNextAlias,
pRemove, pRemove->Core.Key, pRemove->Core.KeyLast, pRemove->offVirtHandler, pRemove->offNextAlias));
#endif
{
/* Insert the next list in the alias chain into the tree. */
PPGMPHYS2VIRTHANDLER pNext = (PPGMPHYS2VIRTHANDLER)((intptr_t)pPhys2Virt + (pPhys2Virt->offNextAlias & PGMPHYS2VIRTHANDLER_OFF_MASK));
("pNext=%p:{.Core.Key=%VGp, .Core.KeyLast=%VGp, .offVirtHandler=%#RX32, .offNextAlias=%#RX32}\n",
#endif
}
}
else
{
/* Locate the previous node in the alias chain. */
PPGMPHYS2VIRTHANDLER pPrev = (PPGMPHYS2VIRTHANDLER)RTAvlroGCPhysGet(&pPGM->CTXSUFF(pTrees)->PhysToVirtHandlers, pPhys2Virt->Core.Key);
("pPhys2Virt=%p:{.Core.Key=%VGp, .Core.KeyLast=%VGp, .offVirtHandler=%#RX32, .offNextAlias=%#RX32} pPrev=%p\n",
pPhys2Virt, pPhys2Virt->Core.Key, pPhys2Virt->Core.KeyLast, pPhys2Virt->offVirtHandler, pPhys2Virt->offNextAlias, pPrev));
#endif
for (;;)
{
PPGMPHYS2VIRTHANDLER pNext = (PPGMPHYS2VIRTHANDLER)((intptr_t)pPrev + (pPrev->offNextAlias & PGMPHYS2VIRTHANDLER_OFF_MASK));
if (pNext == pPhys2Virt)
{
/* unlink. */
LogFlow(("pgmHandlerVirtualClearPage: removed %p:{.offNextAlias=%#RX32} from alias chain. prev %p:{.offNextAlias=%#RX32} [%VGp-%VGp]\n",
pPhys2Virt, pPhys2Virt->offNextAlias, pPrev, pPrev->offNextAlias, pPhys2Virt->Core.Key, pPhys2Virt->Core.KeyLast));
else
{
PPGMPHYS2VIRTHANDLER pNewNext = (PPGMPHYS2VIRTHANDLER)((intptr_t)pPhys2Virt + (pPhys2Virt->offNextAlias & PGMPHYS2VIRTHANDLER_OFF_MASK));
}
break;
}
/* next */
{
("pPhys2Virt=%p:{.Core.Key=%VGp, .Core.KeyLast=%VGp, .offVirtHandler=%#RX32, .offNextAlias=%#RX32} pPrev=%p\n",
pPhys2Virt, pPhys2Virt->Core.Key, pPhys2Virt->Core.KeyLast, pPhys2Virt->offVirtHandler, pPhys2Virt->offNextAlias, pPrev));
#endif
break;
}
}
}
Log2(("PHYS2VIRT: Removing %VGp-%VGp %#RX32 %s\n",
pPhys2Virt->Core.Key, pPhys2Virt->Core.KeyLast, pPhys2Virt->offNextAlias, HCSTRING(pCur->pszDesc)));
pPhys2Virt->offNextAlias = 0;
/*
* Clear the ram flags for this page.
*/
}
/**
* Internal worker for finding a 'in-use' shadow page give by it's physical address.
*
* @returns Pointer to the shadow page structure.
* @param pPool The pool.
* @param HCPhys The HC physical address of the shadow page.
*/
{
/*
* Look up the page.
*/
PPGMPOOLPAGE pPage = (PPGMPOOLPAGE)RTAvloHCPhysGet(&pPool->HCPhysTree, HCPhys & X86_PTE_PAE_PG_MASK);
AssertFatalMsg(pPage && pPage->enmKind != PGMPOOLKIND_FREE, ("HCPhys=%VHp pPage=%p type=%d\n", HCPhys, pPage, (pPage) ? pPage->enmKind : 0));
return pPage;
}
/**
* Internal worker for finding a 'in-use' shadow page give by it's physical address.
*
* @returns Pointer to the shadow page structure.
* @param pPool The pool.
* @param idx The pool page index.
*/
{
}
#ifdef PGMPOOL_WITH_GCPHYS_TRACKING
/**
* Clear references to guest physical memory.
*
* @param pPool The pool.
* @param pPage The page.
* @param pHCPhys Pointer to the aHCPhys entry in the ram range.
*/
{
/*
* Just deal with the simple case here.
*/
#ifdef LOG_ENABLED
#endif
if (cRefs == 1)
{
}
else
}
#endif
#ifdef PGMPOOL_WITH_CACHE
/**
* Moves the page to the head of the age list.
*
* This is done when the cached page is used in one way or another.
*
* @param pPool The pool.
* @param pPage The cached page.
* @todo inline in PGMInternal.h!
*/
{
/*
* Move to the head of the age list.
*/
{
/* unlink */
else
/* insert at head */
}
}
#endif /* PGMPOOL_WITH_CACHE */
/**
* Tells if mappings are to be put into the shadow page table or not
*
* @returns boolean result
* @param pVM VM handle.
*/
{
return !pPGM->fDisableMappings;
}
/** @} */
#endif