PGMShw.h revision fab9a17099dce8d14fd8d50b547ad4eea377a4dc
/* $Id$ */
/** @file
* VBox - Page Manager / Monitor, Shadow Paging Template.
*/
/*
* 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.
*/
/*******************************************************************************
* Defined Constants And Macros *
*******************************************************************************/
#if PGM_SHW_TYPE == PGM_TYPE_32BIT
# define SHW_PDE_PG_MASK X86_PDE_PG_MASK
# define SHW_PD_SHIFT X86_PD_SHIFT
# define SHW_PD_MASK X86_PD_MASK
# define SHW_PTE_PG_MASK X86_PTE_PG_MASK
# define SHW_PT_SHIFT X86_PT_SHIFT
# define SHW_PT_MASK X86_PT_MASK
# define SHW_POOL_ROOT_IDX PGMPOOL_IDX_PD
#else
# define PSHWPTE PX86PTEPAE
# define PSHWPDE PX86PDEPAE
# define SHW_PDE_PG_MASK X86_PDE_PAE_PG_MASK
# define SHW_PD_SHIFT X86_PD_PAE_SHIFT
# define SHW_PD_MASK X86_PD_PAE_MASK
# define SHW_PTE_PG_MASK X86_PTE_PAE_PG_MASK
# define SHW_PT_SHIFT X86_PT_PAE_SHIFT
# define SHW_PT_MASK X86_PT_PAE_MASK
# define SHW_POOL_ROOT_IDX PGMPOOL_IDX_PAE_PD
#endif
/*******************************************************************************
* Internal Functions *
*******************************************************************************/
/* r3 */
/* all */
PGM_SHW_DECL(int, ModifyPage)(PVM pVM, RTGCUINTPTR GCPtr, size_t cb, uint64_t fFlags, uint64_t fMask);
/**
* Initializes the guest bit of the paging mode data.
*
* @returns VBox status code.
* @param pVM The VM handle.
* @param fResolveGCAndR0 Indicate whether or not GC and Ring-0 symbols can be resolved now.
* This is used early in the init process to avoid trouble with PDM
* not being initialized yet.
*/
{
/* Ring-3 */
if (fResolveGCAndR0)
{
int rc;
#if PGM_SHW_TYPE != PGM_TYPE_AMD64 && PGM_SHW_TYPE != PGM_TYPE_NESTED && PGM_SHW_TYPE != PGM_TYPE_EPT /* No AMD64 for traditional virtualization, only VT-x and AMD-V. */
/* GC */
#endif /* Not AMD64 shadow paging. */
/* Ring-0 */
}
return VINF_SUCCESS;
}
/**
* Enters the shadow mode.
*
* @returns VBox status code.
* @param pVM VM handle.
*/
{
#if PGM_SHW_TYPE == PGM_TYPE_NESTED
Log(("Enter nested shadow paging mode: root %VHv phys %VHp\n", pVM->pgm.s.pHCNestedRoot, pVM->pgm.s.HCPhysNestedRoot));
/* In non-nested mode we allocate the PML4 page on-demand; in nested mode we just use our fixed nested paging root. */
#endif
return VINF_SUCCESS;
}
/**
* Relocate any GC pointers related to shadow mode paging.
*
* @returns VBox status code.
* @param pVM The VM handle.
* @param offDelta The reloation offset.
*/
{
/* nothing special to do here - InitData does the job. */
return VINF_SUCCESS;
}
/**
* Exits the shadow mode.
*
* @returns VBox status code.
* @param pVM VM handle.
*/
{
#if PGM_SHW_TYPE == PGM_TYPE_NESTED
Log(("Leave nested shadow paging mode\n"));
#endif
return VINF_SUCCESS;
}