PGMR0.cpp revision 611910c4ba57eb6db5c0d508ca7b923efd654aec
/* $Id$ */
/** @file
* PGM - Page Manager and Monitor, Ring-0.
*/
/*
* Copyright (C) 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 *
*******************************************************************************/
#include "PGMInternal.h"
#include "PGMR0Bth.h"
#include "PGMR0Bth.h"
/*
#define PGM_BTH_NAME(name) PGM_BTH_NAME_AMD64_PROT(name)
#include "PGMR0Bth.h"
*/
/**
* Worker function for PGMR3PhysAllocateHandyPages and pgmPhysEnsureHandyPage.
*
* @returns The following VBox status codes.
* @retval VINF_SUCCESS on success. FF cleared.
* @retval VINF_EM_NO_MEMORY if we're out of memory. The FF is set in this case.
*
* @param pVM The VM handle.
*
* @remarks Must be called from within the PGM critical section.
*/
{
return VERR_NOT_IMPLEMENTED;
}
/**
* #PF Handler for nested paging.
*
* @returns VBox status code (appropriate for trap handling and GC return).
* @param pVM VM Handle.
* @param enmShwPagingMode Paging mode for the nested page tables
* @param uErr The trap error code.
* @param pRegFrame Trap register frame.
* @param pvFault The fault address.
*/
PGMR0DECL(int) PGMR0Trap0eHandlerNestedPaging(PVM pVM, PGMMODE enmShwPagingMode, RTGCUINT uErr, PCPUMCTXCORE pRegFrame, RTGCPHYS pvFault)
{
int rc;
/* AMD uses the host's paging mode; Intel's version is on the todo list */
Assert(enmShwPagingMode == PGMMODE_32_BIT || enmShwPagingMode == PGMMODE_PAE); // || enmShwPagingMode == PGMMODE_AMD64);
#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.
*/
switch(enmShwPagingMode)
{
case PGMMODE_32_BIT:
break;
case PGMMODE_PAE:
break;
/*
case PGMMODE_AMD64:
rc = PGM_BTH_NAME_AMD64_PROT(Trap0eHandler)(pVM, uErr, pRegFrame, pvFault);
break;
*/
}
if (rc == VINF_PGM_SYNCPAGE_MODIFIED_PDE)
rc = VINF_SUCCESS;
return rc;
}