PGMAllPool.cpp revision eab582ddaaa130fc769ad00b09b81b3966817d3f
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * PGM Shadow Page Pool.
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * Copyright (C) 2006-2007 Sun Microsystems, Inc.
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * available from http://www.virtualbox.org. This file is free software;
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * you can redistribute it and/or modify it under the terms of the GNU
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * General Public License (GPL) as published by the Free Software
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * Clara, CA 95054 USA or visit http://www.sun.com if you need
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * additional information or have any questions.
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync/*******************************************************************************
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync* Header Files *
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync*******************************************************************************/
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync/*******************************************************************************
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync* Internal Functions *
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync*******************************************************************************/
57b49c1557a310ee615bc0ee79dd2a2e92319a1bvboxsyncDECLINLINE(unsigned) pgmPoolTrackGetShadowEntrySize(PGMPOOLKIND enmKind);
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsyncDECLINLINE(unsigned) pgmPoolTrackGetGuestEntrySize(PGMPOOLKIND enmKind);
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsyncstatic void pgmPoolTrackDeref(PPGMPOOL pPool, PPGMPOOLPAGE pPage);
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsyncstatic int pgmPoolTrackAddUser(PPGMPOOL pPool, PPGMPOOLPAGE pPage, uint16_t iUser, uint32_t iUserTable);
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsyncstatic void pgmPoolMonitorModifiedRemove(PPGMPOOL pPool, PPGMPOOLPAGE pPage);
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsyncDECLEXPORT(int) pgmPoolAccessHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPHYS GCPhysFault, void *pvUser);
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsyncstatic const char *pgmPoolPoolKindToStr(uint8_t enmKind);
f6dde23cd488aee26203b38ec67220270f5c4273vboxsyncvoid pgmPoolTrackFlushGCPhysPT(PVM pVM, PPGMPAGE pPhysPage, uint16_t iShw, uint16_t cRefs);
f6dde23cd488aee26203b38ec67220270f5c4273vboxsyncvoid pgmPoolTrackFlushGCPhysPTs(PVM pVM, PPGMPAGE pPhysPage, uint16_t iPhysExt);
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsyncint pgmPoolTrackFlushGCPhysPTsSlow(PVM pVM, PPGMPAGE pPhysPage);
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsyncPPGMPOOLPHYSEXT pgmPoolTrackPhysExtAlloc(PVM pVM, uint16_t *piPhysExt);
dc311b529996345ea65d51c87b60b6849642d894vboxsyncvoid pgmPoolTrackPhysExtFree(PVM pVM, uint16_t iPhysExt);
b8ae33177906f4130b85b7c861cae0e78ed4859bvboxsyncvoid pgmPoolTrackPhysExtFreeList(PVM pVM, uint16_t iPhysExt);
dc311b529996345ea65d51c87b60b6849642d894vboxsync * Checks if the specified page pool kind is for a 4MB or 2MB guest page.
c4d6c81bd0de216d0f42db2e477b1d788fbaefb4vboxsync * @returns true if it's the shadow of a 4MB or 2MB guest page, otherwise false.
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * @param enmKind The page kind.
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsyncDECLINLINE(bool) pgmPoolIsBigPage(PGMPOOLKIND enmKind)
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync return true;
d91dc86210d602f51a4701762488a5e696c80a45vboxsync return false;
b8ae33177906f4130b85b7c861cae0e78ed4859bvboxsync/** @def PGMPOOL_PAGE_2_LOCKED_PTR
c829b606c5535f37e00ffee381cca0815a57f319vboxsync * Maps a pool page pool into the current context and lock it (RC only).
c829b606c5535f37e00ffee381cca0815a57f319vboxsync * @returns VBox status code.
b8ae33177906f4130b85b7c861cae0e78ed4859bvboxsync * @param pVM The VM handle.
b8ae33177906f4130b85b7c861cae0e78ed4859bvboxsync * @param pPage The pool page.
b8ae33177906f4130b85b7c861cae0e78ed4859bvboxsync * @remark In RC this uses PGMGCDynMapHCPage(), so it will consume of the
7a2986a2fdd00cd130bcda05a53575fb58874754vboxsync * small page window employeed by that function. Be careful.
b8ae33177906f4130b85b7c861cae0e78ed4859bvboxsync * @remark There is no need to assert on the result.
b8ae33177906f4130b85b7c861cae0e78ed4859bvboxsyncDECLINLINE(void *) PGMPOOL_PAGE_2_LOCKED_PTR(PVM pVM, PPGMPOOLPAGE pPage)
b8ae33177906f4130b85b7c861cae0e78ed4859bvboxsync void *pv = pgmPoolMapPageInlined(&pVM->pgm.s, pPage);
b8ae33177906f4130b85b7c861cae0e78ed4859bvboxsync /* Make sure the dynamic mapping will not be reused. */
d76ca6cbea4e45aa218c74e33c784bde5e997ffcvboxsync# define PGMPOOL_PAGE_2_LOCKED_PTR(pVM, pPage) PGMPOOL_PAGE_2_PTR(pVM, pPage)
d76ca6cbea4e45aa218c74e33c784bde5e997ffcvboxsync/** @def PGMPOOL_UNLOCK_PTR
d76ca6cbea4e45aa218c74e33c784bde5e997ffcvboxsync * Unlock a previously locked dynamic caching (RC only).
b8ae33177906f4130b85b7c861cae0e78ed4859bvboxsync * @returns VBox status code.
d20e5d189feff7841cc3f40e5c9cca8c86b45eb5vboxsync * @param pVM The VM handle.
b8ae33177906f4130b85b7c861cae0e78ed4859bvboxsync * @param pPage The pool page.
dc311b529996345ea65d51c87b60b6849642d894vboxsync * @remark In RC this uses PGMGCDynMapHCPage(), so it will consume of the
b8ae33177906f4130b85b7c861cae0e78ed4859bvboxsync * small page window employeed by that function. Be careful.
b8ae33177906f4130b85b7c861cae0e78ed4859bvboxsync * @remark There is no need to assert on the result.
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsyncDECLINLINE(void) PGMPOOL_UNLOCK_PTR(PVM pVM, void *pvPage)
4831e82ecaa3c813398d2f343e9d38ee34a3acf4vboxsync# define PGMPOOL_UNLOCK_PTR(pVM, pPage) do {} while (0)
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * Determin the size of a write instruction.
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * @returns number of bytes written.
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * @param pDis The disassembler state.
f32de6c198a491c28ace2b4c53f8d04a79fd6d69vboxsyncstatic unsigned pgmPoolDisasWriteSize(PDISCPUSTATE pDis)
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * This is very crude and possibly wrong for some opcodes,
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * but since it's not really supposed to be called we can
c4d6c81bd0de216d0f42db2e477b1d788fbaefb4vboxsync * probably live with that.
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * Flushes a chain of pages sharing the same access monitor.
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * @returns VBox status code suitable for scheduling.
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * @param pPool The pool.
ea743ed8b8effc9f3647b76eb109c45788052fa0vboxsync * @param pPage A page in the chain.
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsyncint pgmPoolMonitorChainFlush(PPGMPOOL pPool, PPGMPOOLPAGE pPage)
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync LogFlow(("pgmPoolMonitorChainFlush: Flush page %RGp type=%d\n", pPage->GCPhys, pPage->enmKind));
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * Find the list head.
40becad9511726726c5959a8ad8b62fb3e1c020cvboxsync * Iterate the list flushing each shadow page.
d4f7483a46e1c44ae5fcc4195be291545ae720a4vboxsync * Wrapper for getting the current context pointer to the entry being modified.
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * @returns VBox status code suitable for scheduling.
f9cac318205d74ee5b35dabcf2bd39118f6293d7vboxsync * @param pVM VM Handle.
4831e82ecaa3c813398d2f343e9d38ee34a3acf4vboxsync * @param pvDst Destination address
d91dc86210d602f51a4701762488a5e696c80a45vboxsync * @param pvSrc Source guest virtual address.
4831e82ecaa3c813398d2f343e9d38ee34a3acf4vboxsync * @param GCPhysSrc The source guest physical address.
50453af238fcec34bf98f91cc4c32bf57f738bd3vboxsync * @param cb Size of data to read
f9cac318205d74ee5b35dabcf2bd39118f6293d7vboxsyncDECLINLINE(int) pgmPoolPhysSimpleReadGCPhys(PVM pVM, void *pvDst, CTXTYPE(RTGCPTR, RTHCPTR, RTGCPTR) pvSrc, RTGCPHYS GCPhysSrc, size_t cb)
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync memcpy(pvDst, (RTHCPTR)((uintptr_t)pvSrc & ~(RTHCUINTPTR)(cb - 1)), cb);
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync /* @todo in RC we could attempt to use the virtual address, although this can cause many faults (PAE Windows XP guest). */
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync return PGMPhysSimpleReadGCPhys(pVM, pvDst, GCPhysSrc & ~(RTGCPHYS)(cb - 1), cb);
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * Process shadow entries before they are changed by the guest.
void pgmPoolMonitorChainChanging(PVMCPU pVCpu, PPGMPOOL pPool, PPGMPOOLPAGE pPage, RTGCPHYS GCPhysFault, CTXTYPE(RTGCPTR, RTHCPTR, RTGCPTR) pvAddress, PDISCPUSTATE pDis)
AssertMsg(pPage->iMonitoredPrev == NIL_PGMPOOL_IDX, ("%#x (idx=%#x)\n", pPage->iMonitoredPrev, pPage->idx));
LogFlow(("pgmPoolMonitorChainChanging: %RGv phys=%RGp cbWrite=%d\n", (RTGCPTR)pvAddress, GCPhysFault, cbWrite));
void *pv;
} uShw;
LogFlow(("pgmPoolMonitorChainChanging: page idx=%d phys=%RGp (next=%d) kind=%s\n", pPage->idx, pPage->GCPhys, pPage->iMonitoredNext, pgmPoolPoolKindToStr(pPage->enmKind), cbWrite));
# ifdef PGMPOOL_WITH_GCPHYS_TRACKING
Log4(("pgmPoolMonitorChainChanging 32_32: deref %016RX64 GCPhys %08RX32\n", uShw.pPT->a[iShw].u & X86_PTE_PAE_PG_MASK, GstPte.u & X86_PTE_PG_MASK));
# ifdef PGMPOOL_WITH_GCPHYS_TRACKING
Log4(("pgmPoolMonitorChainChanging pae_32: deref %016RX64 GCPhys %08RX32\n", uShw.pPT->a[iShw].u & X86_PTE_PAE_PG_MASK, GstPte.u & X86_PTE_PG_MASK));
LogFlow(("pgmPoolMonitorChainChanging PAE for 32 bits: iGst=%x iShw=%x idx = %d page idx=%d\n", iGst, iShw, iShwPdpt, pPage->enmKind - PGMPOOLKIND_PAE_PD0_FOR_32BIT_PD));
# ifndef IN_RING0
if ((uShw.pPDPae->a[iShw + i].u & (PGM_PDFLAGS_MAPPING | X86_PDE_P)) == (PGM_PDFLAGS_MAPPING | X86_PDE_P))
LogFlow(("pgmPoolMonitorChainChanging: Detected conflict at iShwPdpt=%#x iShw=%#x!\n", iShwPdpt, iShw+i));
LogFlow(("pgmPoolMonitorChainChanging: pae pd iShw=%#x: %RX64 -> freeing it!\n", iShw+i, uShw.pPDPae->a[iShw+i].u));
iShw + i);
if ( pDis
# ifndef IN_RING0
if ((uShw.pPDPae->a[iShw2].u & (PGM_PDFLAGS_MAPPING | X86_PDE_P)) == (PGM_PDFLAGS_MAPPING | X86_PDE_P))
LogFlow(("pgmPoolMonitorChainChanging: Detected conflict at iShwPdpt=%#x iShw2=%#x!\n", iShwPdpt, iShw2));
LogFlow(("pgmPoolMonitorChainChanging: pae pd iShw=%#x: %RX64 -> freeing it!\n", iShw2, uShw.pPDPae->a[iShw2].u));
iShw2);
# ifdef PGMPOOL_WITH_GCPHYS_TRACKING
Log4(("pgmPoolMonitorChainChanging pae: deref %016RX64 GCPhys %016RX64\n", uShw.pPTPae->a[iShw].u & X86_PTE_PAE_PG_MASK, GstPte.u & X86_PTE_PAE_PG_MASK));
if ( pDis
# ifdef PGMPOOL_WITH_GCPHYS_TRACKING
# ifdef IN_RING3
int rc = pgmPoolPhysSimpleReadGCPhys(pVM, &GstPte, (RTHCPTR)((RTHCUINTPTR)pvAddress + sizeof(GstPte)), GCPhysFault + sizeof(GstPte), sizeof(GstPte));
int rc = pgmPoolPhysSimpleReadGCPhys(pVM, &GstPte, pvAddress + sizeof(GstPte), GCPhysFault + sizeof(GstPte), sizeof(GstPte));
Log4(("pgmPoolMonitorChainChanging pae: deref %016RX64 GCPhys %016RX64\n", uShw.pPTPae->a[iShw2].u & X86_PTE_PAE_PG_MASK, GstPte.u & X86_PTE_PAE_PG_MASK));
case PGMPOOLKIND_32BIT_PD:
# ifndef IN_RING0
# ifndef IN_RING0
LogFlow(("pgmPoolMonitorChainChanging: 32 bit pd iShw=%#x: %RX64 -> freeing it!\n", iShw, uShw.pPD->a[iShw].u));
iShw);
if ( pDis
# ifndef IN_RING0
# ifndef IN_RING0
LogFlow(("pgmPoolMonitorChainChanging: 32 bit pd iShw=%#x: %RX64 -> freeing it!\n", iShw2, uShw.pPD->a[iShw2].u));
iShw2);
LogFlow(("pgmPoolMonitorChainChanging: iShw=%#x: %RX32 -> freeing it!\n", iShw, uShw.pPD->a[iShw].u));
#ifndef IN_RING0
# ifndef IN_RING0
LogFlow(("pgmPoolMonitorChainChanging: pae pd iShw=%#x: %RX64 -> freeing it!\n", iShw, uShw.pPDPae->a[iShw].u));
iShw);
if ( pDis
#ifndef IN_RING0
# ifndef IN_RING0
LogFlow(("pgmPoolMonitorChainChanging: pae pd iShw2=%#x: %RX64 -> freeing it!\n", iShw2, uShw.pPDPae->a[iShw2].u));
iShw2);
case PGMPOOLKIND_PAE_PDPT:
if (iShw < X86_PG_PAE_PDPE_ENTRIES) /* don't use RT_ELEMENTS(uShw.pPDPT->a), because that's for long mode only */
# ifndef IN_RING0
# ifndef IN_RING0
LogFlow(("pgmPoolMonitorChainChanging: pae pdpt iShw=%#x: %RX64 -> freeing it!\n", iShw, uShw.pPDPT->a[iShw].u));
iShw);
if ( pDis
# ifndef IN_RING0
# ifndef IN_RING0
LogFlow(("pgmPoolMonitorChainChanging: pae pdpt iShw=%#x: %RX64 -> freeing it!\n", iShw2, uShw.pPDPT->a[iShw2].u));
iShw2);
#ifndef IN_RC
LogFlow(("pgmPoolMonitorChainChanging: pae pd iShw=%#x: %RX64 -> freeing it!\n", iShw, uShw.pPDPae->a[iShw].u));
iShw);
if ( pDis
LogFlow(("pgmPoolMonitorChainChanging: pae pd iShw2=%#x: %RX64 -> freeing it!\n", iShw2, uShw.pPDPae->a[iShw2].u));
iShw2);
LogFlow(("pgmPoolMonitorChainChanging: pdpt iShw=%#x: %RX64 -> freeing it!\n", iShw, uShw.pPDPT->a[iShw].u));
if ( pDis
LogFlow(("pgmPoolMonitorChainChanging: pdpt iShw2=%#x: %RX64 -> freeing it!\n", iShw2, uShw.pPDPT->a[iShw2].u));
case PGMPOOLKIND_64BIT_PML4:
LogFlow(("pgmPoolMonitorChainChanging: pml4 iShw=%#x: %RX64 -> freeing it!\n", iShw, uShw.pPML4->a[iShw].u));
if ( pDis
LogFlow(("pgmPoolMonitorChainChanging: pml4 iShw2=%#x: %RX64 -> freeing it!\n", iShw2, uShw.pPML4->a[iShw2].u));
# ifndef IN_RING3
DECLINLINE(bool) pgmPoolMonitorIsReused(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame, PDISCPUSTATE pDis, RTGCPTR pvFault)
#ifndef IN_RC
Log(("pgmPoolMonitorIsReused: reused %RGv for interrupt stack (rsp=%RGv).\n", pvFault, pRegFrame->rsp));
LogFlow(("Reused instr %RGv %d at %RGv param1.flags=%x param1.reg=%d\n", pRegFrame->rip, pDis->pCurInstr->opcode, pvFault, pDis->param1.flags, pDis->param1.base.reg_gen));
case OP_CALL:
case OP_PUSH:
case OP_PUSHF:
case OP_PUSHA:
case OP_FXSAVE:
case OP_MOVSWD:
case OP_STOSWD:
static int pgmPoolAccessHandlerFlush(PVM pVM, PVMCPU pVCpu, PPGMPOOL pPool, PPGMPOOLPAGE pPage, PDISCPUSTATE pDis,
* Emulate the instruction (xp/w2k problem, requires pc/cr2/sp detection). Must do this in raw mode (!); XP boot will fail otherwise
#ifdef IN_RC
LogFlow(("pgmPoolAccessHandlerPTWorker: Interpretation failed for patch code %04x:%RGv, ignoring.\n",
return rc;
DECLINLINE(int) pgmPoolAccessHandlerSTOSD(PVM pVM, PPGMPOOL pPool, PPGMPOOLPAGE pPage, PDISCPUSTATE pDis,
#ifdef VBOX_STRICT
#ifdef IN_RC
#ifdef IN_RC
return VINF_SUCCESS;
DECLINLINE(int) pgmPoolAccessHandlerSimple(PVM pVM, PVMCPU pVCpu, PPGMPOOL pPool, PPGMPOOLPAGE pPage, PDISCPUSTATE pDis,
*pfReused = true;
#ifdef IN_RC
return rc;
DECLEXPORT(int) pgmPoolAccessHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPHYS GCPhysFault, void *pvUser)
unsigned cMaxModifications;
bool fForcedFlush = false;
LogFlow(("pgmPoolAccessHandler: pvFault=%RGv pPage=%p:{.idx=%d} GCPhysFault=%RGp\n", pvFault, pPage, pPage->idx, GCPhysFault));
Log(("CPU%d: pgmPoolAccessHandler pgm pool page for %RGp changed (to %RGp) while waiting!\n", pVCpu->idCpu, PHYS_PAGE_ADDRESS(GCPhysFault), PHYS_PAGE_ADDRESS(pPage->GCPhys)));
STAM_PROFILE_STOP_EX(&pVM->pgm.s.CTX_SUFF(pPool)->CTX_SUFF_Z(StatMonitor), &pPool->CTX_MID_Z(StatMonitor,Handled), a);
return VINF_SUCCESS;
Log(("Possible page reuse cMods=%d -> %d (locked=%d type=%s)\n", pPage->cModifications, pPage->cModifications * 2, pgmPoolIsPageLocked(&pVM->pgm.s, pPage), pgmPoolPoolKindToStr(pPage->enmKind)));
fForcedFlush = true;
Log(("Mod overflow %VGv cMods=%d (locked=%d type=%s)\n", pvFault, pPage->cModifications, pgmPoolIsPageLocked(&pVM->pgm.s, pPage), pgmPoolPoolKindToStr(pPage->enmKind)));
bool fReused = false;
bool fNotReusedNotForking = false;
if ( ( pPage->cModifications < cMaxModifications /** @todo #define */ /** @todo need to check that it's not mapping EIP. */ /** @todo adjust this! */
rc = pgmPoolAccessHandlerSimple(pVM, pVCpu, pPool, pPage, pDis, pRegFrame, GCPhysFault, pvFault, &fReused);
if (fReused)
goto flushPage;
STAM_PROFILE_STOP_EX(&pVM->pgm.s.CTX_SUFF(pPool)->CTX_SUFF_Z(StatMonitor), &pPool->CTX_MID_Z(StatMonitor,Handled), a);
return rc;
bool fValidStosd = false;
fValidStosd = true;
fValidStosd = true;
if (fValidStosd)
STAM_PROFILE_STOP_EX(&pVM->pgm.s.CTX_SUFF(pPool)->CTX_SUFF_Z(StatMonitor), &pPool->CTX_MID_Z(StatMonitor,RepStosd), a);
return rc;
pRegFrame->eax, pRegFrame->ecx, pRegFrame->edi, pRegFrame->esi, (RTGCPTR)pRegFrame->rip, pDis->pCurInstr->opcode, pDis->prefix));
fNotReusedNotForking = true;
/* E.g. Windows 7 x64 initializes page tables and touches some pages in the table during the process. This
&& !fForcedFlush
&& ( fNotReusedNotForking
while (pPageHead)
Log(("Flush duplicate page idx=%d GCPhys=%RGp type=%s\n", pPageHead->idx, pPageHead->GCPhys, pgmPoolPoolKindToStr(pPageHead->enmKind)));
/* In the SMP case the page table might be removed while we wait for the PGM lock in the trap handler. */
return rc;
STAM_PROFILE_STOP_EX(&pVM->pgm.s.CTX_SUFF(pPool)->CTX_SUFF_Z(StatMonitor), &pPool->CTX_MID_Z(StatMonitor,FlushPage), a);
return rc;
# ifdef PGMPOOL_WITH_OPTIMIZED_DIRTY_PT
# ifdef VBOX_STRICT
DECLINLINE(void) pgmPoolTrackCheckPTPaePae(PPGMPOOL pPool, PPGMPOOLPAGE pPage, PX86PTPAE pShwPT, PCX86PTPAE pGstPT)
unsigned cErrors = 0;
#ifdef VBOX_STRICT
AssertMsg(!pShwPT->a[i].n.u1Present, ("Unexpected PTE: idx=%d %RX64 (first=%d)\n", i, pShwPT->a[i].u, pPage->iFirstPresent));
Log(("rc=%d idx=%d guest %RX64 shw=%RX64 vs %RHp\n", rc, i, pGstPT->a[i].u, pShwPT->a[i].u, HCPhys));
cErrors++;
Log(("GCPhys=%RGp idx=%d %RX64 vs %RX64\n", pTempPage->GCPhys, j, pShwPT->a[j].u, pShwPT2->a[j].u));
DECLINLINE(unsigned) pgmPoolTrackFlushPTPaePae(PPGMPOOL pPool, PPGMPOOLPAGE pPage, PX86PTPAE pShwPT, PCX86PTPAE pGstPT, PCX86PTPAE pOldGstPT)
unsigned cChanged = 0;
#ifdef VBOX_STRICT
AssertMsg(!pShwPT->a[i].n.u1Present, ("Unexpected PTE: idx=%d %RX64 (first=%d)\n", i, pShwPT->a[i].u, pPage->iFirstPresent));
#ifdef VBOX_STRICT
AssertMsg(rc == VINF_SUCCESS && (pShwPT->a[i].u & X86_PTE_PAE_PG_MASK) == HCPhys, ("rc=%d guest %RX64 old %RX64 shw=%RX64 vs %RHp\n", rc, pGstPT->a[i].u, pOldGstPT->a[i].u, pShwPT->a[i].u, HCPhys));
uint64_t uHostAttr = pShwPT->a[i].u & (X86_PTE_P | X86_PTE_US | X86_PTE_A | X86_PTE_D | X86_PTE_G | X86_PTE_PAE_NX);
uint64_t uGuestAttr = pGstPT->a[i].u & (X86_PTE_P | X86_PTE_US | X86_PTE_A | X86_PTE_D | X86_PTE_G | X86_PTE_PAE_NX);
cChanged++;
pgmPoolTracDerefGCPhysHint(pPool, pPage, pShwPT->a[i].u & X86_PTE_PAE_PG_MASK, pOldGstPT->a[i].u & X86_PTE_PAE_PG_MASK);
return cChanged;
static void pgmPoolFlushDirtyPage(PVM pVM, PPGMPOOL pPool, unsigned idxSlot, bool fForceRemoval = false)
unsigned idxPage;
void *pvGst;
unsigned cChanges = pgmPoolTrackFlushPTPaePae(pPool, pPage, (PX86PTPAE)pvShw, (PCX86PTPAE)pvGst, (PCX86PTPAE)&pPool->aDirtyPages[idxSlot][0]);
/** Note: we might want to consider keeping the dirty page active in case there were many changes. */
#ifdef VBOX_STRICT
/* In the SMP case the page table might be removed while we wait for the PGM lock in the trap handler. */
# ifndef IN_RING3
unsigned idxFree;
AssertMsg(pPool->aIdxDirtyPages[idxFree] == NIL_PGMPOOL_IDX, ("idxFree=%d cDirtyPages=%d\n", idxFree, pPool->cDirtyPages));
void *pvGst;
#ifdef VBOX_STRICT
Assert(pPool->cDirtyPages == RT_ELEMENTS(pPool->aIdxDirtyPages) || pPool->aIdxDirtyPages[pPool->idxFreeDirtyPage] == NIL_PGMPOOL_IDX);
Assert(pPool->aIdxDirtyPages[pPool->idxFreeDirtyPage] == NIL_PGMPOOL_IDX || pPool->cDirtyPages == RT_ELEMENTS(pPool->aIdxDirtyPages));
#ifdef PGMPOOL_WITH_CACHE
if (i == NIL_PGMPOOL_IDX)
iPrev = i;
#ifndef IN_RC
switch (enmKind1)
case PGMPOOLKIND_PAE_PD_PHYS:
case PGMPOOLKIND_32BIT_PD:
case PGMPOOLKIND_PAE_PDPT:
switch (enmKind2)
case PGMPOOLKIND_64BIT_PML4:
case PGMPOOLKIND_64BIT_PML4:
switch (enmKind2)
case PGMPOOLKIND_ROOT_NESTED:
static int pgmPoolCacheAlloc(PPGMPOOL pPool, RTGCPHYS GCPhys, PGMPOOLKIND enmKind, PGMPOOLACCESS enmAccess, uint16_t iUser, uint32_t iUserTable, PPPGMPOOLPAGE ppPage)
#ifndef IN_RC
Log3(("pgmPoolCacheAlloc: %RGp kind %s iUser=%x iUserTable=%x SLOT=%d\n", GCPhys, pgmPoolPoolKindToStr(enmKind), iUser, iUserTable, i));
if (i != NIL_PGMPOOL_IDX)
pPage->cModifications = 1; /* reset counter (can't use 0, or else it will be reinserted in the modified list) */
return VINF_PGM_CACHED_PAGE;
return rc;
} while (i != NIL_PGMPOOL_IDX);
Log3(("pgmPoolCacheAlloc: Missed GCPhys=%RGp enmKind=%s\n", GCPhys, pgmPoolPoolKindToStr(enmKind)));
return VERR_FILE_NOT_FOUND;
if (fCanBeCached)
#ifdef PGMPOOL_WITH_MONITORING
#ifdef PGMPOOL_WITH_CACHE
if (i == NIL_PGMPOOL_IDX)
return NULL;
case PGMPOOLKIND_64BIT_PML4:
case PGMPOOLKIND_32BIT_PD:
case PGMPOOLKIND_PAE_PDPT:
return pPage;
case PGMPOOLKIND_ROOT_NESTED:
case PGMPOOLKIND_PAE_PD_PHYS:
} while (i != NIL_PGMPOOL_IDX);
return NULL;
case PGMPOOLKIND_64BIT_PML4:
case PGMPOOLKIND_32BIT_PD:
case PGMPOOLKIND_PAE_PDPT:
case PGMPOOLKIND_ROOT_NESTED:
return VINF_SUCCESS;
case PGMPOOLKIND_PAE_PD_PHYS:
return VINF_SUCCESS;
#ifdef PGMPOOL_WITH_MIXED_PT_CR3
int rc;
if (pPageHead)
Assert(!(VMMGetCpu(pVM)->pgm.s.fSyncFlags & PGM_SYNC_CLEAR_PGM_POOL) || VMCPU_FF_ISSET(VMMGetCpu(pVM), VMCPU_FF_PGM_SYNC_CR3));
return rc;
case PGMPOOLKIND_64BIT_PML4:
case PGMPOOLKIND_32BIT_PD:
case PGMPOOLKIND_PAE_PDPT:
case PGMPOOLKIND_ROOT_NESTED:
case PGMPOOLKIND_PAE_PD_PHYS:
return VINF_SUCCESS;
#ifdef PGMPOOL_WITH_MIXED_PT_CR3
int rc;
#ifdef VBOX_STRICT
AssertMsg(!(pVCpu->pgm.s.fSyncFlags & PGM_SYNC_CLEAR_PGM_POOL) || VMCPU_FF_ISSET(pVCpu, VMCPU_FF_PGM_SYNC_CR3),
return rc;
#ifdef VBOX_WITH_STATISTICS
Log3(("pgmPoolMonitorModifiedRemove: idx=%d cModifications=%d\n", pPage->idx, pPage->cModifications));
#ifdef IN_RING3
#ifdef PGMPOOL_WITH_USER_TRACKING
#ifdef PGMPOOL_WITH_USER_TRACKING
if (!--cLeft)
#ifndef DEBUG_michael
AssertMsg(cModifiedPages == pPool->cModifiedPages, ("%d != %d\n", cModifiedPages, pPool->cModifiedPages));
#ifdef PGMPOOL_WITH_GCPHYS_TRACKING
pRam;
while (iPage-- > 0)
for (unsigned i = 0; i < cMaxPhysExts; i++)
return VINF_SUCCESS;
return VINF_PGM_SYNC_CR3;
return VINF_SUCCESS;
#ifdef PGMPOOL_WITH_USER_TRACKING
#ifdef PGMPOOL_WITH_CACHE
return rc;
return VERR_PGM_POOL_FLUSHED;
DECLINLINE(int) pgmPoolTrackInsert(PPGMPOOL pPool, PPGMPOOLPAGE pPage, RTGCPHYS GCPhys, uint16_t iUser, uint32_t iUserTable)
#ifdef VBOX_STRICT
AssertMsg(paUsers[i].iUser != iUser || paUsers[i].iUserTable != iUserTable, ("%x %x vs new %x %x\n", paUsers[i].iUser, paUsers[i].iUserTable, iUser, iUserTable));
} while (i != NIL_PGMPOOL_USER_INDEX);
if (i == NIL_PGMPOOL_USER_INDEX)
return rc;
# ifdef PGMPOOL_WITH_MIXED_PT_CR3
const bool fCanBeMonitored = true;
|| (GCPhys & X86_PTE_PAE_PG_MASK) != (pPool->CTX_SUFF(pVM)->pgm.s.GCPhysGstCR3Monitored & X86_PTE_PAE_PG_MASK)
# ifdef PGMPOOL_WITH_CACHE
if (fCanBeMonitored)
# ifdef PGMPOOL_WITH_MONITORING
return rc;
static int pgmPoolTrackAddUser(PPGMPOOL pPool, PPGMPOOLPAGE pPage, uint16_t iUser, uint32_t iUserTable)
Log3(("pgmPoolTrackAddUser GCPhys = %RGp iUser %x iUserTable %x\n", pPage->GCPhys, iUser, iUserTable));
# ifdef VBOX_STRICT
* Check that the entry doesn't already exists. We only allow multiple users of top-level paging structures (SHW_POOL_ROOT_IDX).
AssertMsg(iUser != PGMPOOL_IDX_PD || iUser != PGMPOOL_IDX_PDPT || iUser != PGMPOOL_IDX_NESTED_ROOT || iUser != PGMPOOL_IDX_AMD64_CR3 ||
paUsers[i].iUser != iUser || paUsers[i].iUserTable != iUserTable, ("%x %x vs new %x %x\n", paUsers[i].iUser, paUsers[i].iUserTable, iUser, iUserTable));
} while (i != NIL_PGMPOOL_USER_INDEX);
if (i == NIL_PGMPOOL_USER_INDEX)
return rc;
# ifdef PGMPOOL_WITH_OPTIMIZED_DIRTY_PT
# ifdef PGMPOOL_WITH_CACHE
return VINF_SUCCESS;
static void pgmPoolTrackFreeUser(PPGMPOOL pPool, PPGMPOOLPAGE pPage, uint16_t iUser, uint32_t iUserTable)
if ( i != NIL_PGMPOOL_USER_INDEX
while (i != NIL_PGMPOOL_USER_INDEX)
iPrev = i;
switch (enmKind)
case PGMPOOLKIND_32BIT_PD:
case PGMPOOLKIND_64BIT_PML4:
case PGMPOOLKIND_PAE_PDPT:
case PGMPOOLKIND_ROOT_NESTED:
case PGMPOOLKIND_PAE_PD_PHYS:
switch (enmKind)
case PGMPOOLKIND_32BIT_PD:
case PGMPOOLKIND_64BIT_PML4:
case PGMPOOLKIND_PAE_PDPT:
case PGMPOOLKIND_ROOT_NESTED:
case PGMPOOLKIND_PAE_PD_PHYS:
AssertFailed();
#ifdef PGMPOOL_WITH_GCPHYS_TRACKING
static void pgmPoolTrackFlushGCPhysPTInt(PVM pVM, PCPGMPAGE pPhysPage, uint16_t iShw, uint16_t cRefs)
LogFlow(("pgmPoolTrackFlushGCPhysPT: pPhysPage=%R[pgmpage] iShw=%d cRefs=%d\n", pPhysPage, iShw, cRefs));
pPT->a[i].u = 0;
cRefs--;
if (!cRefs)
#ifdef LOG_ENABLED
AssertFatalMsgFailed(("cRefs=%d iFirstPresent=%d cPresent=%d\n", cRefs, pPage->iFirstPresent, pPage->cPresent));
pPT->a[i].u = 0;
cRefs--;
if (!cRefs)
#ifdef LOG_ENABLED
AssertFatalMsgFailed(("cRefs=%d iFirstPresent=%d cPresent=%d u64=%RX64\n", cRefs, pPage->iFirstPresent, pPage->cPresent, u64));
pPT->a[i].u = 0;
cRefs--;
if (!cRefs)
#ifdef LOG_ENABLED
AssertFatalMsgFailed(("cRefs=%d iFirstPresent=%d cPresent=%d\n", cRefs, pPage->iFirstPresent, pPage->cPresent));
LogFlow(("pgmPoolTrackFlushGCPhysPT: pPhysPage=%R[pgmpage] iShw=%d cRefs=%d\n", pPhysPage, iShw, cRefs));
#ifdef PGMPOOL_WITH_GCPHYS_TRACKING
if (u16)
*pfFlushTLBs = true;
*pfFlushTLBs = true;
return rc;
return VINF_PGM_GCPHYS_ALIASED;
pPT->a[i].u = 0;
if (!--cPresent)
pPT->a[i].u = 0;
if (!--cPresent)
if (!--cLeft)
return VINF_SUCCESS;
LogFlow(("pgmPoolTrackClearPageUser: clear %x in %s (%RGp) (flushing %s)\n", iUserTable, pgmPoolPoolKindToStr(pUserPage->enmKind), pUserPage->Core.Key, pgmPoolPoolKindToStr(pPage->enmKind)));
#ifdef VBOX_STRICT
case PGMPOOLKIND_32BIT_PD:
case PGMPOOLKIND_PAE_PDPT:
case PGMPOOLKIND_PAE_PD_PHYS:
case PGMPOOLKIND_64BIT_PML4:
case PGMPOOLKIND_ROOT_NESTED:
case PGMPOOLKIND_32BIT_PD:
#if defined(IN_RC)
/* In 32 bits PAE mode we *must* invalidate the TLB when changing a PDPT entry; the CPU fetches them only during cr3 load, so any
ASMReloadCR3();
case PGMPOOLKIND_PAE_PD_PHYS:
case PGMPOOLKIND_64BIT_PML4:
case PGMPOOLKIND_PAE_PDPT:
case PGMPOOLKIND_ROOT_NESTED:
AssertFatalMsgFailed(("enmKind=%d iUser=%#x iUserTable=%#x\n", pUserPage->enmKind, pUser->iUser, pUser->iUserTable));
while (i != NIL_PGMPOOL_USER_INDEX)
i = iNext;
#ifdef PGMPOOL_WITH_GCPHYS_TRACKING
return NULL;
return pPhysExt;
if (!--cMax)
if (!pNew)
LogFlow(("pgmPoolTrackPhysExtInsert: added new extent %d:{%d}->%d\n", iPhysExt, iShwPT, iPhysExtStart));
if (pPhysExt)
LogFlow(("pgmPoolTrackPhysExtAddref: new extent: %d:{%d, %d}\n", iPhysExt, PGMPOOL_TD_GET_IDX(u16), iShwPT));
return u16;
AssertFatalMsg(cRefs == PGMPOOL_TD_CREFS_PHYSEXT, ("cRefs=%d pPhysPage=%R[pgmpage] pPage=%p:{.idx=%d}\n", cRefs, pPhysPage, pPage, pPage->idx));
Log2(("pgmPoolTrackPhysExtDerefGCPhys: pPhysPage=%R[pgmpage] idx=%d lonely\n", pPhysPage, pPage->idx));
Log2(("pgmPoolTrackPhysExtDerefGCPhys: pPhysPage=%R[pgmpage] idx=%d head\n", pPhysPage, pPage->idx));
AssertFatalMsgFailed(("not-found! cRefs=%d pPhysPage=%R[pgmpage] pPage=%p:{.idx=%d}\n", cRefs, pPhysPage, pPage, pPage->idx));
static void pgmPoolTracDerefGCPhys(PPGMPOOL pPool, PPGMPOOLPAGE pPage, RTHCPHYS HCPhys, RTGCPHYS GCPhys)
while (pRam)
#ifdef LOG_ENABLED
void pgmPoolTracDerefGCPhysHint(PPGMPOOL pPool, PPGMPOOLPAGE pPage, RTHCPHYS HCPhys, RTGCPHYS GCPhysHint)
while (pRam)
while (pRam)
while (iPage-- > 0)
DECLINLINE(void) pgmPoolTrackDerefPT32Bit32Bit(PPGMPOOL pPool, PPGMPOOLPAGE pPage, PX86PT pShwPT, PCX86PT pGstPT)
pgmPoolTracDerefGCPhysHint(pPool, pPage, pShwPT->a[i].u & X86_PTE_PG_MASK, pGstPT->a[i].u & X86_PTE_PG_MASK);
DECLINLINE(void) pgmPoolTrackDerefPTPae32Bit(PPGMPOOL pPool, PPGMPOOLPAGE pPage, PX86PTPAE pShwPT, PCX86PT pGstPT)
pgmPoolTracDerefGCPhysHint(pPool, pPage, pShwPT->a[i].u & X86_PTE_PAE_PG_MASK, pGstPT->a[i].u & X86_PTE_PG_MASK);
DECLINLINE(void) pgmPoolTrackDerefPTPaePae(PPGMPOOL pPool, PPGMPOOLPAGE pPage, PX86PTPAE pShwPT, PCX86PTPAE pGstPT)
pgmPoolTracDerefGCPhysHint(pPool, pPage, pShwPT->a[i].u & X86_PTE_PAE_PG_MASK, pGstPT->a[i].u & X86_PTE_PAE_PG_MASK);
PPGMPOOLPAGE pSubPage = (PPGMPOOLPAGE)RTAvloHCPhysGet(&pPool->HCPhysTree, pShwPD->a[i].u & X86_PDE_PG_MASK);
if (pSubPage)
PPGMPOOLPAGE pSubPage = (PPGMPOOLPAGE)RTAvloHCPhysGet(&pPool->HCPhysTree, pShwPD->a[i].u & X86_PDE_PAE_PG_MASK);
if (pSubPage)
for (unsigned i = 0; i < X86_PG_PAE_PDPE_ENTRIES; i++)
PPGMPOOLPAGE pSubPage = (PPGMPOOLPAGE)RTAvloHCPhysGet(&pPool->HCPhysTree, pShwPDPT->a[i].u & X86_PDPE_PG_MASK);
if (pSubPage)
PPGMPOOLPAGE pSubPage = (PPGMPOOLPAGE)RTAvloHCPhysGet(&pPool->HCPhysTree, pShwPDPT->a[i].u & X86_PDPE_PG_MASK);
if (pSubPage)
PPGMPOOLPAGE pSubPage = (PPGMPOOLPAGE)RTAvloHCPhysGet(&pPool->HCPhysTree, pShwPML4->a[i].u & X86_PDPE_PG_MASK);
if (pSubPage)
PPGMPOOLPAGE pSubPage = (PPGMPOOLPAGE)RTAvloHCPhysGet(&pPool->HCPhysTree, pShwPD->a[i].u & EPT_PDE_PG_MASK);
if (pSubPage)
PPGMPOOLPAGE pSubPage = (PPGMPOOLPAGE)RTAvloHCPhysGet(&pPool->HCPhysTree, pShwPDPT->a[i].u & EPT_PDPTE_PG_MASK);
if (pSubPage)
#ifdef PGMPOOL_WITH_GCPHYS_TRACKING
void *pvGst;
void *pvGst;
void *pvGst;
case PGMPOOLKIND_PAE_PD_PHYS:
case PGMPOOLKIND_32BIT_PD:
case PGMPOOLKIND_PAE_PDPT:
case PGMPOOLKIND_64BIT_PML4:
Log(("pgmPoolFlushPage: special root page, rejected. enmKind=%s idx=%d\n", pgmPoolPoolKindToStr(pPage->enmKind), pPage->idx));
return VINF_SUCCESS;
("Can't free the shadow CR3! (%RHp vs %RHp kind=%d\n", PGMGetHyperCR3(VMMGetCpu(pVM)), pPage->Core.Key, pPage->enmKind));
Log(("pgmPoolFlushPage: current active shadow CR3, rejected. enmKind=%s idx=%d\n", pgmPoolPoolKindToStr(pPage->enmKind), pPage->idx));
return VINF_SUCCESS;
#ifdef PGMPOOL_WITH_USER_TRACKING
#ifdef PGMPOOL_WITH_CACHE
#ifdef PGMPOOL_WITH_MONITORING
return rc;
#ifdef PGMPOOL_WITH_USER_TRACKING
#ifdef PGMPOOL_WITH_CACHE
#if defined(IN_RC)
/* Hack alert: we can't deal with jumps to ring 3 when called from MapCR3 and allocating pages for PAE PDs. */
#ifdef IN_RING3
return rc;
return VINF_SUCCESS;
#ifdef PGMPOOL_WITH_CACHE
return VERR_PGM_POOL_FLUSHED;
int pgmPoolAllocEx(PVM pVM, RTGCPHYS GCPhys, PGMPOOLKIND enmKind, PGMPOOLACCESS enmAccess, uint16_t iUser, uint32_t iUserTable, PPPGMPOOLPAGE ppPage, bool fLockPage)
LogFlow(("pgmPoolAlloc: GCPhys=%RGp enmKind=%s iUser=%#x iUserTable=%#x\n", GCPhys, pgmPoolPoolKindToStr(enmKind), iUser, iUserTable));
/** @todo CSAM/PGMPrefetchPage messes up here during CSAMR3CheckGates
* Assert(!(pVM->pgm.s.fGlobalSyncFlags & PGM_SYNC_CLEAR_PGM_POOL)); */
#ifdef PGMPOOL_WITH_CACHE
if (fLockPage)
LogFlow(("pgmPoolAlloc: cached returns %Rrc *ppPage=%p:{.Key=%RHp, .idx=%d}\n", rc2, *ppPage, (*ppPage)->Core.Key, (*ppPage)->idx));
return rc2;
return rc;
pPool->cUsedPages++; /* physical handler registration / pgmPoolTrackFlushGCPhysPTsSlow requirement. */
#ifdef PGMPOOL_WITH_MONITORING
#ifdef PGMPOOL_WITH_USER_TRACKING
return rc3;
#ifdef VBOX_WITH_STATISTICS
if (fLockPage)
LogFlow(("pgmPoolAlloc: returns %Rrc *ppPage=%p:{.Key=%RHp, .idx=%d, .fCached=%RTbool, .fMonitored=%RTbool}\n",
return rc;
PPGMPOOLPAGE pPage = (PPGMPOOLPAGE)RTAvloHCPhysGet(&pPool->HCPhysTree, HCPhys & X86_PTE_PAE_PG_MASK);
AssertFatalMsg(pPage && pPage->enmKind != PGMPOOLKIND_FREE, ("HCPhys=%RHp pPage=%p idx=%d\n", HCPhys, pPage, (pPage) ? pPage->idx : 0));
return pPage;
#ifdef IN_RING3 /* currently only used in ring 3; save some space in the R0 & GC modules (left it here as we might need it elsewhere later on) */
#ifdef PGMPOOL_WITH_CACHE
if (i == NIL_PGMPOOL_IDX)
case PGMPOOLKIND_64BIT_PML4:
case PGMPOOLKIND_32BIT_PD:
case PGMPOOLKIND_PAE_PDPT:
case PGMPOOLKIND_ROOT_NESTED:
case PGMPOOLKIND_PAE_PD_PHYS:
} while (i != NIL_PGMPOOL_IDX);
#ifdef IN_RING3
#ifdef PGMPOOL_WITH_MONITORING
#ifdef PGMPOOL_WITH_USER_TRACKING
#ifdef PGMPOOL_WITH_CACHE
#ifdef PGMPOOL_WITH_USER_TRACKING
for (unsigned i = 0; i < cMaxUsers; i++)
#ifdef PGMPOOL_WITH_GCPHYS_TRACKING
pRam;
while (iPage-- > 0)
for (unsigned i = 0; i < cMaxPhysExts; i++)
#ifdef PGMPOOL_WITH_MONITORING
#ifdef PGMPOOL_WITH_CACHE
#ifdef PGMPOOL_WITH_MONITORING
# ifdef PGMPOOL_WITH_CACHE
#ifdef PGMPOOL_WITH_USER_TRACKING
#ifdef PGMPOOL_WITH_CACHE
#ifdef LOG_ENABLED
switch(enmKind)
case PGMPOOLKIND_INVALID:
case PGMPOOLKIND_FREE:
case PGMPOOLKIND_32BIT_PD:
case PGMPOOLKIND_PAE_PD_PHYS:
case PGMPOOLKIND_PAE_PDPT:
case PGMPOOLKIND_64BIT_PML4:
case PGMPOOLKIND_ROOT_NESTED: