PGMAll.cpp revision 9b45880674da6f82ca27cc28b0272de3dd3cc7df
/* $Id$ */
/** @file
* PGM - Page Manager and Monitor - All context code.
*/
/*
* Copyright (C) 2006-2007 Sun Microsystems, Inc.
*
* 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 (GPL) 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.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
* Clara, CA 95054 USA or visit http://www.sun.com if you need
* additional information or have any questions.
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
#define LOG_GROUP LOG_GROUP_PGM
#include "PGMInternal.h"
/*******************************************************************************
* Structures and Typedefs *
*******************************************************************************/
/**
* Stated structure for PGM_GST_NAME(HandlerVirtualUpdate) that's
* passed to PGM_GST_NAME(VirtHandlerUpdateOne) during enumeration.
*/
typedef struct PGMHVUSTATE
{
/** The VM handle. */
/** The todo flags. */
/** The CR4 register value. */
} PGMHVUSTATE, *PPGMHVUSTATE;
/*******************************************************************************
* Internal Functions *
*******************************************************************************/
/*
* Shadow - 32-bit mode
*/
#define PGM_SHW_TYPE PGM_TYPE_32BIT
#include "PGMAllShw.h"
/* Guest - real mode */
#define PGM_GST_TYPE PGM_TYPE_REAL
#include "PGMAllGst.h"
#include "PGMAllBth.h"
/* Guest - protected mode */
#define PGM_GST_TYPE PGM_TYPE_PROT
#include "PGMAllGst.h"
#include "PGMAllBth.h"
/* Guest - 32-bit mode */
#define PGM_GST_TYPE PGM_TYPE_32BIT
#include "PGMAllGst.h"
#include "PGMAllBth.h"
/*
* Shadow - PAE mode
*/
#define PGM_SHW_TYPE PGM_TYPE_PAE
#include "PGMAllShw.h"
/* Guest - real mode */
#define PGM_GST_TYPE PGM_TYPE_REAL
#include "PGMAllBth.h"
/* Guest - protected mode */
#define PGM_GST_TYPE PGM_TYPE_PROT
#include "PGMAllBth.h"
/* Guest - 32-bit mode */
#define PGM_GST_TYPE PGM_TYPE_32BIT
#include "PGMAllBth.h"
/* Guest - PAE mode */
#define PGM_GST_TYPE PGM_TYPE_PAE
#include "PGMAllGst.h"
#include "PGMAllBth.h"
/*
* Shadow - AMD64 mode
*/
#define PGM_SHW_TYPE PGM_TYPE_AMD64
#include "PGMAllShw.h"
/* Guest - protected mode */
#define PGM_GST_TYPE PGM_TYPE_PROT
#include "PGMAllBth.h"
/* Guest - AMD64 mode */
#define PGM_GST_TYPE PGM_TYPE_AMD64
#include "PGMAllGst.h"
#include "PGMAllBth.h"
/*
* Shadow - Nested paging mode
*/
#define PGM_SHW_TYPE PGM_TYPE_NESTED
#include "PGMAllShw.h"
/* Guest - real mode */
#define PGM_GST_TYPE PGM_TYPE_REAL
#include "PGMAllBth.h"
/* Guest - protected mode */
#define PGM_GST_TYPE PGM_TYPE_PROT
#include "PGMAllBth.h"
/* Guest - 32-bit mode */
#define PGM_GST_TYPE PGM_TYPE_32BIT
#include "PGMAllBth.h"
/* Guest - PAE mode */
#define PGM_GST_TYPE PGM_TYPE_PAE
#include "PGMAllBth.h"
/* Guest - AMD64 mode */
#define PGM_GST_TYPE PGM_TYPE_AMD64
#include "PGMAllBth.h"
#endif
/**
* #PF Handler.
*
* @returns VBox status code (appropriate for trap handling and GC return).
* @param pVM VM Handle.
* @param uErr The trap error code.
* @param pRegFrame Trap register frame.
* @param pvFault The fault address.
*/
{
LogFlow(("PGMTrap0eHandler: uErr=%#x pvFault=%VGv eip=%VGv\n", (uint32_t)uErr, pvFault, pRegFrame->rip));
#ifdef VBOX_WITH_STATISTICS
/*
* Error code stats.
*/
if (uErr & X86_TRAP_PF_US)
{
if (!(uErr & X86_TRAP_PF_P))
{
if (uErr & X86_TRAP_PF_RW)
else
}
else if (uErr & X86_TRAP_PF_RW)
else if (uErr & X86_TRAP_PF_RSVD)
else if (uErr & X86_TRAP_PF_ID)
else
}
else
{ /* Supervisor */
if (!(uErr & X86_TRAP_PF_P))
{
if (uErr & X86_TRAP_PF_RW)
else
}
else if (uErr & X86_TRAP_PF_RW)
else if (uErr & X86_TRAP_PF_ID)
else if (uErr & X86_TRAP_PF_RSVD)
}
#endif
/*
* Call the worker.
*/
if (rc == VINF_PGM_SYNCPAGE_MODIFIED_PDE)
rc = VINF_SUCCESS;
return rc;
}
/**
* Prefetch a page
*
* Typically used to sync commonly used pages before entering raw mode
* after a CR3 reload.
*
* @returns VBox status code suitable for scheduling.
* @retval VINF_SUCCESS on success.
* @retval VINF_PGM_SYNC_CR3 if we're out of shadow pages or something like that.
* @param pVM VM handle.
* @param GCPtrPage Page to invalidate.
*/
{
return rc;
}
/**
* Gets the mapping corresponding to the specified address (if any).
*
* @returns Pointer to the mapping.
* @returns NULL if not
*
* @param pVM The virtual machine.
* @param GCPtr The guest context pointer.
*/
{
while (pMapping)
{
break;
{
return pMapping;
}
}
return NULL;
}
/**
* Verifies a range of pages for read or write access
*
* Only checks the guest's page tables
*
* @returns VBox status code.
* @param pVM VM handle.
* @param Addr Guest virtual address to check
* @param cbSize Access size
* @param fAccess Access type (r/w, user/supervisor (X86_PTE_*))
*/
{
/*
* Validate input.
*/
{
return VERR_INVALID_PARAMETER;
}
if (VBOX_FAILURE(rc))
{
return VINF_EM_RAW_GUEST_TRAP;
}
/*
* Check if the access would cause a page fault
*
* Note that hypervisor page directories are not present in the guest's tables, so this check
* is sufficient.
*/
{
Log(("PGMIsValidAccess: access violation for %VGv attr %#llx vs %d:%d\n", Addr, fPage, fWrite, fUser));
return VINF_EM_RAW_GUEST_TRAP;
}
if ( VBOX_SUCCESS(rc)
return PGMIsValidAccess(pVM, Addr + PAGE_SIZE, (cbSize > PAGE_SIZE) ? cbSize - PAGE_SIZE : 1, fAccess);
return rc;
}
/**
* Verifies a range of pages for read or write access
*
* Supports handling of pages marked for dirty bit tracking and CSAM
*
* @returns VBox status code.
* @param pVM VM handle.
* @param Addr Guest virtual address to check
* @param cbSize Access size
* @param fAccess Access type (r/w, user/supervisor (X86_PTE_*))
*/
{
/*
* Validate input.
*/
{
return VERR_INVALID_PARAMETER;
}
if (VBOX_FAILURE(rc))
{
return VINF_EM_RAW_GUEST_TRAP;
}
/*
* Check if the access would cause a page fault
*
* Note that hypervisor page directories are not present in the guest's tables, so this check
* is sufficient.
*/
{
Log(("PGMVerifyAccess: access violation for %VGv attr %#llx vs %d:%d\n", Addr, fPageGst, fWrite, fUser));
return VINF_EM_RAW_GUEST_TRAP;
}
if (!HWACCMIsNestedPagingActive(pVM))
{
/*
* Next step is to verify if we protected this page for dirty bit tracking or for CSAM scanning
*/
if ( rc == VERR_PAGE_NOT_PRESENT
|| rc == VERR_PAGE_TABLE_NOT_PRESENT)
{
/*
* Page is not present in our page tables.
* Try to sync it!
*/
if (rc != VINF_SUCCESS)
return rc;
}
else
}
#if 0 /* def VBOX_STRICT; triggers too often now */
/*
* This check is a bit paranoid, but useful.
*/
/** @note this will assert when writing to monitored pages (a bit annoying actually) */
{
AssertMsgFailed(("Unexpected access violation for %VGv! rc=%Vrc write=%d user=%d\n",
return VINF_EM_RAW_GUEST_TRAP;
}
#endif
if ( VBOX_SUCCESS(rc)
{
/* Don't recursively call PGMVerifyAccess as we might run out of stack. */
for (;;)
{
else
cbSize = 1;
if (rc != VINF_SUCCESS)
break;
break;
}
}
return rc;
}
#ifndef IN_GC
/**
* Emulation of the invlpg instruction (HC only actually).
*
* @returns VBox status code.
* @param pVM VM handle.
* @param GCPtrPage Page to invalidate.
* @remark ASSUMES the page table entry or page directory is
* valid. Fairly safe, but there could be edge cases!
* @todo Flush page or page directory only if necessary!
*/
{
int rc;
/** @todo merge PGMGCInvalidatePage with this one */
#ifndef IN_RING3
/*
* Notify the recompiler so it can record this instruction.
* Failure happens when it's out of space. We'll return to HC in that case.
*/
if (VBOX_FAILURE(rc))
return rc;
#endif
#ifndef IN_RING0
/*
* Check if we have a pending update of the CR3 monitoring.
*/
if ( VBOX_SUCCESS(rc)
{
}
#endif
#ifdef IN_RING3
/*
* Inform CSAM about the flush
*/
/** @note this is to check if monitored pages have been changed; when we implement callbacks for virtual handlers, this is no longer required. */
#endif
return rc;
}
#endif
/**
* Executes an instruction using the interpreter.
*
* @returns VBox status code (appropriate for trap handling and GC return).
* @param pVM VM handle.
* @param pRegFrame Register frame.
* @param pvFault Fault address.
*/
{
if (rc == VERR_EM_INTERPRETER)
if (rc != VINF_SUCCESS)
return rc;
}
/**
* Gets effective page information (from the VMM page directory).
*
* @returns VBox status.
* @param pVM VM Handle.
* @param GCPtr Guest Context virtual address of the page.
* @param pfFlags Where to store the flags. These are X86_PTE_*.
* @param pHCPhys Where to store the HC physical address of the page.
* This is page aligned.
* @remark You should use PGMMapGetPage() for pages in a mapping.
*/
{
}
/**
* Sets (replaces) the page flags for a range of pages in the shadow context.
*
* @returns VBox status.
* @param pVM VM handle.
* @param GCPtr The address of the first page.
* @param cb The size of the range in bytes.
* @param fFlags Page flags X86_PTE_*, excluding the page mask of course.
* @remark You must use PGMMapSetPage() for pages in a mapping.
*/
{
}
/**
* Modify page flags for a range of pages in the shadow context.
*
* The existing flags are ANDed with the fMask and ORed with the fFlags.
*
* @returns VBox status code.
* @param pVM VM handle.
* @param GCPtr Virtual address of the first page in the range.
* @param cb Size (in bytes) of the range to apply the modification to.
* @param fFlags The OR mask - page flags X86_PTE_*, excluding the page mask of course.
* @param fMask The AND mask - page flags X86_PTE_*.
* Be very CAREFUL when ~'ing constants which could be 32-bit!
* @remark You must use PGMMapModifyPage() for pages in a mapping.
*/
{
/*
* Validate input.
*/
if (fFlags & X86_PTE_PAE_PG_MASK)
{
return VERR_INVALID_PARAMETER;
}
if (!cb)
{
AssertFailed();
return VERR_INVALID_PARAMETER;
}
/*
* Align the input.
*/
GCPtr = (RTGCPTR)((RTGCUINTPTR)GCPtr & PAGE_BASE_GC_MASK); /** @todo this ain't necessary, right... */
/*
* Call worker.
*/
}
/**
* Syncs the SHADOW page directory pointer for the specified address. Allocates
* backing pages in case the PDPT entry is missing.
*
* @returns VBox status.
* @param pVM VM handle.
* @param GCPtr The address.
* @param pGstPdpe Guest PDPT entry
* @param ppPD Receives address of page directory
*/
{
int rc;
/* Allocate page directory if not present. */
&& !(pPdpe->u & X86_PDPE_PG_MASK))
{
/* Create a reference back to the PDPT by using the index in its shadow page. */
rc = pgmPoolAlloc(pVM, pPdptGst->u & X86_PDPE_PG_MASK, PGMPOOLKIND_PAE_PD_FOR_PAE_PD, PGMPOOL_IDX_PDPT, iPdPt, &pShwPage);
if (rc == VERR_PGM_POOL_FLUSHED)
return VINF_PGM_SYNC_CR3;
}
else
{
}
/* The PD was cached or created; hook it up now. */
return VINF_SUCCESS;
}
/**
* Gets the SHADOW page directory pointer for the specified address.
*
* @returns VBox status.
* @param pVM VM handle.
* @param GCPtr The address.
* @param ppPdpt Receives address of pdpt
* @param ppPD Receives address of page directory
*/
{
return VINF_SUCCESS;
}
#ifndef IN_GC
/**
* Syncs the SHADOW page directory pointer for the specified address. Allocates
* backing pages in case the PDPT or PML4 entry is missing.
*
* @returns VBox status.
* @param pVM VM handle.
* @param GCPtr The address.
* @param pGstPml4e Guest PML4 entry
* @param pGstPdpe Guest PDPT entry
* @param ppPD Receives address of page directory
*/
PGMDECL(int) PGMShwSyncLongModePDPtr(PVM pVM, RTGCUINTPTR64 GCPtr, PX86PML4E pGstPml4e, PX86PDPE pGstPdpe, PX86PDPAE *ppPD)
{
int rc;
{
}
else
{
}
/* Allocate page directory pointer table if not present. */
&& !(pPml4e->u & X86_PML4E_PG_MASK))
{
rc = pgmPoolAlloc(pVM, pPml4eGst->u & X86_PML4E_PG_MASK, enmPdpt, pVM->pgm.s.pHCShwAmd64CR3->idx, iPml4e, &pShwPage);
if (rc == VERR_PGM_POOL_FLUSHED)
return VINF_PGM_SYNC_CR3;
}
else
{
}
/* The PDPT was cached or created; hook it up now. */
/* Allocate page directory if not present. */
&& !(pPdpe->u & X86_PDPE_PG_MASK))
{
/* Create a reference back to the PDPT by using the index in its shadow page. */
rc = pgmPoolAlloc(pVM, pPdptGst->a[iPdPt].u & X86_PDPE_PG_MASK, enmPd, pShwPage->idx, iPdPt, &pShwPage);
if (rc == VERR_PGM_POOL_FLUSHED)
return VINF_PGM_SYNC_CR3;
}
else
{
}
/* The PD was cached or created; hook it up now. */
return VINF_SUCCESS;
}
/**
* Gets the SHADOW page directory pointer for the specified address.
*
* @returns VBox status.
* @param pVM VM handle.
* @param GCPtr The address.
* @param ppPdpt Receives address of pdpt
* @param ppPD Receives address of page directory
*/
PGMDECL(int) PGMShwGetLongModePDPtr(PVM pVM, RTGCUINTPTR64 GCPtr, PX86PDPT *ppPdpt, PX86PDPAE *ppPD)
{
return VERR_PAGE_MAP_LEVEL4_NOT_PRESENT;
return VINF_SUCCESS;
}
#endif
/**
* Gets effective Guest OS page information.
*
* When GCPtr is in a big page, the function will return as if it was a normal
* 4KB page. If the need for distinguishing between big and normal page becomes
* necessary at a later point, a PGMGstGetPage() will be created for that
* purpose.
*
* @returns VBox status.
* @param pVM VM Handle.
* @param GCPtr Guest Context virtual address of the page.
* @param pfFlags Where to store the flags. These are X86_PTE_*, even for big pages.
* @param pGCPhys Where to store the GC physical address of the page.
* This is page aligned. The fact that the
*/
{
}
/**
* Checks if the page is present.
*
* @returns true if the page is present.
* @returns false if the page is not present.
* @param pVM The VM handle.
* @param GCPtr Address within the page.
*/
{
return VBOX_SUCCESS(rc);
}
/**
* Sets (replaces) the page flags for a range of pages in the guest's tables.
*
* @returns VBox status.
* @param pVM VM handle.
* @param GCPtr The address of the first page.
* @param cb The size of the range in bytes.
* @param fFlags Page flags X86_PTE_*, excluding the page mask of course.
*/
{
}
/**
* Modify page flags for a range of pages in the guest's tables
*
* The existing flags are ANDed with the fMask and ORed with the fFlags.
*
* @returns VBox status code.
* @param pVM VM handle.
* @param GCPtr Virtual address of the first page in the range.
* @param cb Size (in bytes) of the range to apply the modification to.
* @param fFlags The OR mask - page flags X86_PTE_*, excluding the page mask of course.
* @param fMask The AND mask - page flags X86_PTE_*, excluding the page mask of course.
* Be very CAREFUL when ~'ing constants which could be 32-bit!
*/
{
/*
* Validate input.
*/
if (fFlags & X86_PTE_PAE_PG_MASK)
{
return VERR_INVALID_PARAMETER;
}
if (!cb)
{
AssertFailed();
return VERR_INVALID_PARAMETER;
}
/*
* Adjust input.
*/
/*
* Call worker.
*/
return rc;
}
/**
* Gets the current CR3 register value for the shadow memory context.
* @returns CR3 value.
* @param pVM The VM handle.
*/
{
switch (enmShadowMode)
{
case PGMMODE_32_BIT:
case PGMMODE_PAE:
case PGMMODE_PAE_NX:
case PGMMODE_AMD64:
case PGMMODE_AMD64_NX:
case PGMMODE_NESTED:
default:
return ~0;
}
}
/**
* Gets the current CR3 register value for the nested memory context.
* @returns CR3 value.
* @param pVM The VM handle.
*/
{
switch (enmShadowMode)
{
case PGMMODE_32_BIT:
case PGMMODE_PAE:
case PGMMODE_PAE_NX:
case PGMMODE_AMD64:
case PGMMODE_AMD64_NX:
default:
return ~0;
}
}
/**
* Gets the CR3 register value for the 32-Bit shadow memory context.
* @returns CR3 value.
* @param pVM The VM handle.
*/
{
}
/**
* Gets the CR3 register value for the PAE shadow memory context.
* @returns CR3 value.
* @param pVM The VM handle.
*/
{
}
/**
* Gets the CR3 register value for the AMD64 shadow memory context.
* @returns CR3 value.
* @param pVM The VM handle.
*/
{
}
/**
* Gets the current CR3 register value for the HC intermediate memory context.
* @returns CR3 value.
* @param pVM The VM handle.
*/
{
{
case SUPPAGINGMODE_32_BIT:
case SUPPAGINGMODE_PAE:
case SUPPAGINGMODE_PAE_GLOBAL:
case SUPPAGINGMODE_PAE_NX:
case SUPPAGINGMODE_AMD64:
case SUPPAGINGMODE_AMD64_NX:
default:
return ~0;
}
}
/**
* Gets the current CR3 register value for the GC intermediate memory context.
* @returns CR3 value.
* @param pVM The VM handle.
*/
{
{
case PGMMODE_32_BIT:
case PGMMODE_PAE:
case PGMMODE_PAE_NX:
case PGMMODE_AMD64:
case PGMMODE_AMD64_NX:
case PGMMODE_NESTED:
return 0; /* not relevant */
default:
return ~0;
}
}
/**
* Gets the CR3 register value for the 32-Bit intermediate memory context.
* @returns CR3 value.
* @param pVM The VM handle.
*/
{
}
/**
* Gets the CR3 register value for the PAE intermediate memory context.
* @returns CR3 value.
* @param pVM The VM handle.
*/
{
}
/**
* Gets the CR3 register value for the AMD64 intermediate memory context.
* @returns CR3 value.
* @param pVM The VM handle.
*/
{
}
/**
* Performs and schedules necessary updates following a CR3 load or reload.
*
* This will normally involve mapping the guest PD or nPDPT
*
* @returns VBox status code.
* @retval VINF_PGM_SYNC_CR3 if monitoring requires a CR3 sync. This can
* safely be ignored and overridden since the FF will be set too then.
* @param pVM VM handle.
* @param cr3 The new cr3.
* @param fGlobal Indicates whether this is a global flush or not.
*/
{
/*
* Always flag the necessary updates; necessary for hardware acceleration
*/
if (fGlobal)
/*
* Remap the CR3 content and adjust the monitoring if CR3 was actually changed.
*/
int rc = VINF_SUCCESS;
else
{
{
}
if (fGlobal)
else
}
else
{
/*
* Check if we have a pending update of the CR3 monitoring.
*/
{
}
if (fGlobal)
else
}
return rc;
}
/**
* Performs and schedules necessary updates following a CR3 load or reload,
* without actually the TLB as with PGMFlushTLB.
*
* This will normally involve mapping the guest PD or nPDPT
*
* @returns VBox status code.
* @retval VINF_PGM_SYNC_CR3 if monitoring requires a CR3 sync. This can
* safely be ignored and overridden since the FF will be set too then.
* @param pVM VM handle.
* @param cr3 The new cr3.
*/
{
/* We assume we're only called in nested paging mode. */
/*
* Remap the CR3 content and adjust the monitoring if CR3 was actually changed.
*/
int rc = VINF_SUCCESS;
else
{
}
return rc;
}
/**
* Synchronize the paging structures.
*
* This function is called in response to the VM_FF_PGM_SYNC_CR3 and
* VM_FF_PGM_SYNC_CR3_NONGLOBAL. Those two force action flags are set
* in several places, most importantly whenever the CR3 is loaded.
*
* @returns VBox status code.
* @param pVM The virtual machine.
* @param cr0 Guest context CR0 register
* @param cr3 Guest context CR3 register
* @param cr4 Guest context CR4 register
* @param fGlobal Including global page directories or not
*/
{
/*
* We might be called when we shouldn't.
*
* The mode switching will ensure that the PD is resynced
* after every mode switch. So, if we find ourselves here
* when in protected or real mode we can safely disable the
* FF and return immediately.
*/
{
return VINF_SUCCESS;
}
/* If global pages are not supported, then all flushes are global */
if (!(cr4 & X86_CR4_PGE))
fGlobal = true;
/*
* Let the 'Bth' function do the work and we'll just keep track of the flags.
*/
if (rc == VINF_SUCCESS)
{
{
}
/*
* Check if we have a pending update of the CR3 monitoring.
*/
{
}
}
/*
* Now flush the CR3 (guest context).
*/
if (rc == VINF_SUCCESS)
return rc;
}
/**
* Called whenever CR0 or CR4 in a way which may change
* the paging mode.
*
* @returns VBox status code fit for scheduling in GC and R0.
* @retval VINF_SUCCESS if the was no change, or it was successfully dealt with.
* @retval VINF_PGM_CHANGE_MODE if we're in GC or R0 and the mode changes.
* @param pVM VM handle.
* @param cr0 The new cr0.
* @param cr4 The new cr4.
* @param efer The new extended feature enable register.
*/
{
/*
* Calc the new guest mode.
*/
if (!(cr0 & X86_CR0_PE))
else if (!(cr0 & X86_CR0_PG))
else if (!(cr4 & X86_CR4_PAE))
else if (!(efer & MSR_K6_EFER_LME))
{
if (!(efer & MSR_K6_EFER_NXE))
else
}
else
{
if (!(efer & MSR_K6_EFER_NXE))
else
}
/*
* Did it change?
*/
return VINF_SUCCESS;
#ifdef IN_RING3
#else
Log(("PGMChangeMode: returns VINF_PGM_CHANGE_MODE.\n"));
return VINF_PGM_CHANGE_MODE;
#endif
}
/**
* Gets the current guest paging mode.
*
*
* @returns The current paging mode.
* @param pVM The VM handle.
*/
{
}
/**
* Gets the current shadow paging mode.
*
* @returns The current paging mode.
* @param pVM The VM handle.
*/
{
}
/**
* Gets the current host paging mode.
*
* @returns The current paging mode.
* @param pVM The VM handle.
*/
{
{
case SUPPAGINGMODE_32_BIT:
return PGMMODE_32_BIT;
case SUPPAGINGMODE_PAE:
case SUPPAGINGMODE_PAE_GLOBAL:
return PGMMODE_PAE;
case SUPPAGINGMODE_PAE_NX:
return PGMMODE_PAE_NX;
case SUPPAGINGMODE_AMD64:
return PGMMODE_AMD64;
case SUPPAGINGMODE_AMD64_NX:
return PGMMODE_AMD64_NX;
}
return PGMMODE_INVALID;
}
/**
* Get mode name.
*
* @returns read-only name string.
* @param enmMode The mode which name is desired.
*/
{
switch (enmMode)
{
case PGMMODE_REAL: return "real";
case PGMMODE_PROTECTED: return "protected";
case PGMMODE_32_BIT: return "32-bit";
case PGMMODE_PAE: return "PAE";
case PGMMODE_PAE_NX: return "PAE+NX";
case PGMMODE_AMD64: return "AMD64";
case PGMMODE_AMD64_NX: return "AMD64+NX";
default: return "unknown mode value";
}
}
/**
* Acquire the PGM lock.
*
* @returns VBox status code
* @param pVM The VM to operate on.
*/
{
#ifdef IN_GC
if (rc == VERR_SEM_BUSY)
if (rc == VERR_SEM_BUSY)
#endif
return rc;
}
/**
* Release the PGM lock.
*
* @returns VBox status code
* @param pVM The VM to operate on.
*/
{
}
#ifdef VBOX_STRICT
/**
* Asserts that there are no mapping conflicts.
*
* @returns Number of conflicts.
* @param pVM The VM Handle.
*/
{
unsigned cErrors = 0;
/*
* Check for mapping conflicts.
*/
{
/** @todo This is slow and should be optimized, but since it's just assertions I don't care now. */
{
if (rc != VERR_PAGE_TABLE_NOT_PRESENT)
{
cErrors++;
break;
}
}
}
return cErrors;
}
/**
* Asserts that everything related to the guest CR3 is correctly shadowed.
*
* This will call PGMAssertNoMappingConflicts() and PGMAssertHandlerAndFlagsInSync(),
* and assert the correctness of the guest CR3 mapping before asserting that the
* shadow page tables is in sync with the guest page tables.
*
* @returns Number of conflicts.
* @param pVM The VM Handle.
* @param cr3 The current guest CR3 register value.
* @param cr4 The current guest CR4 register value.
*/
{
return cErrors;
return 0;
}
#endif /* VBOX_STRICT */