MMRamGC.cpp revision 545430fcd4a3982629fc07aed3ed3c97e6c79975
/* $Id$ */
/** @file
* MMRamGC - Guest Context Ram access Routines, pair for MMRamGCA.asm.
*/
/*
* 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.
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
#define LOG_GROUP LOG_GROUP_MM
#include "MMInternal.h"
/*******************************************************************************
* Internal Functions *
*******************************************************************************/
DECLASM(void) MMGCRamReadNoTrapHandler_EndProc(void);
DECLASM(void) MMGCRamWriteNoTrapHandler_EndProc(void);
DECLASM(void) EMGCEmulateLockCmpXchg_EndProc(void);
DECLASM(void) EMGCEmulateLockCmpXchg_Error(void);
DECLASM(void) EMGCEmulateCmpXchg_EndProc(void);
DECLASM(void) EMGCEmulateCmpXchg_Error(void);
DECLASM(void) EMEmulateLockOr_EndProc(void);
DECLASM(void) EMEmulateLockOr_Error(void);
DECLASM(void) EMEmulateLockBtr_EndProc(void);
DECLASM(void) EMEmulateLockBtr_Error(void);
DECLASM(void) MMGCRamRead_Error(void);
DECLASM(void) MMGCRamWrite_Error(void);
/**
* Install MMGCRam Hypervisor page fault handler for normal working
* of MMGCRamRead and MMGCRamWrite calls.
* This handler will be automatically removed at page fault.
* In other case it must be removed by MMGCRamDeregisterTrapHandler call.
*
* @param pVM VM handle.
*/
{
}
/**
* Remove MMGCRam Hypervisor page fault handler.
* See description of MMGCRamRegisterTrapHandler call.
*
* @param pVM VM handle.
*/
{
}
/**
* Read data in guest context with #PF control.
*
* @returns VBox status.
* @param pVM The VM handle.
* @param pDst Where to store the readed data.
* @param pSrc Pointer to the data to read.
* @param cb Size of data to read, only 1/2/4/8 is valid.
*/
{
int rc;
TRPMSaveTrap(pVM); /* save the current trap info, because it will get trashed if our access failed. */
if (VBOX_FAILURE(rc))
return rc;
}
/**
* Write data in guest context with #PF control.
*
* @returns VBox status.
* @param pVM The VM handle.
* @param pDst Where to write the data.
* @param pSrc Pointer to the data to write.
* @param cb Size of data to write, only 1/2/4 is valid.
*/
{
int rc;
TRPMSaveTrap(pVM); /* save the current trap info, because it will get trashed if our access failed. */
if (VBOX_FAILURE(rc))
/*
* And mark the relevant guest page as accessed and dirty.
*/
return rc;
}
/**
* \#PF Handler for servicing traps inside MMGCRamReadNoTrapHandler and MMGCRamWriteNoTrapHandler functions.
*
* @internal
*/
{
/*
* Page fault inside MMGCRamRead()? Resume at *_Error.
*/
{
/* Must be a read violation. */
return VINF_SUCCESS;
}
/*
* Page fault inside MMGCRamWrite()? Resume at _Error.
*/
{
/* Must be a write violation. */
return VINF_SUCCESS;
}
/*
* Page fault inside EMGCEmulateLockCmpXchg()? Resume at _Error.
*/
{
return VINF_SUCCESS;
}
/*
* Page fault inside EMGCEmulateCmpXchg()? Resume at _Error.
*/
{
return VINF_SUCCESS;
}
/*
* Page fault inside EMEmulateLockOr()? Resume at *_Error.
*/
{
return VINF_SUCCESS;
}
/*
* Page fault inside EMEmulateLockBtr()? Resume at *_Error.
*/
{
return VINF_SUCCESS;
}
/*
* #PF is not handled - cause guru meditation.
*/
return VERR_INTERNAL_ERROR;
}