pgm.h revision f18060397202298d86552c3c16a2f7473c852e5c
88b7935c7a9d5156b439570abcea19c121ecf60bvboxsync * PGM - Page Monitor / Monitor.
88b7935c7a9d5156b439570abcea19c121ecf60bvboxsync * Copyright (C) 2006-2007 Sun Microsystems, Inc.
88b7935c7a9d5156b439570abcea19c121ecf60bvboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
88b7935c7a9d5156b439570abcea19c121ecf60bvboxsync * available from http://www.virtualbox.org. This file is free software;
88b7935c7a9d5156b439570abcea19c121ecf60bvboxsync * you can redistribute it and/or modify it under the terms of the GNU
88b7935c7a9d5156b439570abcea19c121ecf60bvboxsync * General Public License (GPL) as published by the Free Software
88b7935c7a9d5156b439570abcea19c121ecf60bvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
88b7935c7a9d5156b439570abcea19c121ecf60bvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
88b7935c7a9d5156b439570abcea19c121ecf60bvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
88b7935c7a9d5156b439570abcea19c121ecf60bvboxsync * The contents of this file may alternatively be used under the terms
88b7935c7a9d5156b439570abcea19c121ecf60bvboxsync * of the Common Development and Distribution License Version 1.0
88b7935c7a9d5156b439570abcea19c121ecf60bvboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
88b7935c7a9d5156b439570abcea19c121ecf60bvboxsync * VirtualBox OSE distribution, in which case the provisions of the
88b7935c7a9d5156b439570abcea19c121ecf60bvboxsync * CDDL are applicable instead of those of the GPL.
88b7935c7a9d5156b439570abcea19c121ecf60bvboxsync * You may elect to license modified versions of this file under the
88b7935c7a9d5156b439570abcea19c121ecf60bvboxsync * terms and conditions of either the GPL or the CDDL or both.
88b7935c7a9d5156b439570abcea19c121ecf60bvboxsync * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
88b7935c7a9d5156b439570abcea19c121ecf60bvboxsync * Clara, CA 95054 USA or visit http://www.sun.com if you need
88b7935c7a9d5156b439570abcea19c121ecf60bvboxsync * additional information or have any questions.
88b7935c7a9d5156b439570abcea19c121ecf60bvboxsync/** @defgroup grp_pgm The Page Monitor / Manager API
88b7935c7a9d5156b439570abcea19c121ecf60bvboxsync/** Chunk size for dynamically allocated physical memory. */
88b7935c7a9d5156b439570abcea19c121ecf60bvboxsync/** Shift GC physical address by 20 bits to get the offset into the pvHCChunkHC array. */
88b7935c7a9d5156b439570abcea19c121ecf60bvboxsync/** Dynamic chunk offset mask. */
88b7935c7a9d5156b439570abcea19c121ecf60bvboxsync/** Dynamic chunk base mask. */
88b7935c7a9d5156b439570abcea19c121ecf60bvboxsync#define PGM_DYNAMIC_CHUNK_BASE_MASK (~(RTGCPHYS)PGM_DYNAMIC_CHUNK_OFFSET_MASK)
88b7935c7a9d5156b439570abcea19c121ecf60bvboxsync * FNPGMRELOCATE callback mode.
88b7935c7a9d5156b439570abcea19c121ecf60bvboxsync /** The callback is for checking if the suggested address is suitable. */
88b7935c7a9d5156b439570abcea19c121ecf60bvboxsync /** The callback is for executing the relocation. */
typedef DECLCALLBACK(bool) FNPGMRELOCATE(PVM pVM, RTGCPTR GCPtrOld, RTGCPTR GCPtrNew, PGMRELOCATECALL enmMode, void *pvUser);
typedef enum PGMPHYSHANDLERTYPE
typedef DECLCALLBACK(int) FNPGMRCPHYSHANDLER(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPHYS GCPhysFault, void *pvUser);
typedef DECLCALLBACK(int) FNPGMR0PHYSHANDLER(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPHYS GCPhysFault, void *pvUser);
typedef enum PGMACCESSTYPE
typedef DECLCALLBACK(int) FNPGMR3PHYSHANDLER(PVM pVM, RTGCPHYS GCPhys, void *pvPhys, void *pvBuf, size_t cbBuf, PGMACCESSTYPE enmAccessType, void *pvUser);
typedef enum PGMVIRTHANDLERTYPE
typedef DECLCALLBACK(int) FNPGMRCVIRTHANDLER(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPTR pvRange, uintptr_t offRange);
typedef DECLCALLBACK(int) FNPGMR3VIRTHANDLER(PVM pVM, RTGCPTR GCPtr, void *pvPtr, void *pvBuf, size_t cbBuf, PGMACCESSTYPE enmAccessType, void *pvUser);
typedef enum PGMMODE
PGMMODE_INVALID = 0,
} PGMMODE;
typedef enum PGMROMPROT
PGMROMPROT_INVALID = 0,
} PGMROMPROT;
VMMDECL(int) PGMHandlerPhysicalRegisterEx(PVM pVM, PGMPHYSHANDLERTYPE enmType, RTGCPHYS GCPhys, RTGCPHYS GCPhysLast,
VMMDECL(int) PGMHandlerPhysicalModify(PVM pVM, RTGCPHYS GCPhysCurrent, RTGCPHYS GCPhys, RTGCPHYS GCPhysLast);
VMMDECL(int) PGMHandlerPhysicalPageAlias(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS GCPhysPage, RTGCPHYS GCPhysPageRemap);
typedef struct PGMPAGEMAPLOCK
#ifdef IN_RC
void *pvPage;
void *pvMap;
VMMDECL(int) PGMPhysGCPhys2CCPtrReadOnly(PVM pVM, RTGCPHYS GCPhys, void const **ppv, PPGMPAGEMAPLOCK pLock);
VMMDECL(int) PGMPhysGCPtr2CCPtrReadOnly(PVM pVM, RTGCPTR GCPtr, void const **ppv, PPGMPAGEMAPLOCK pLock);
#ifdef IN_RC
VMMDECL(int) PGMPhysGCPtr2HCPtrByGstCR3(PVM pVM, RTGCPTR GCPtr, uint64_t cr3, unsigned fFlags, PRTHCPTR pHCPtr);
VMMDECL(int) PGMPhysInterpretedRead(PVM pVM, PCPUMCTXCORE pCtxCore, void *pvDst, RTGCPTR GCPtrSrc, size_t cb);
#ifdef VBOX_STRICT
#ifdef IN_RC
#ifdef IN_RING0
VMMR0DECL(int) PGMR0Trap0eHandlerNestedPaging(PVM pVM, PGMMODE enmShwPagingMode, RTGCUINT uErr, PCPUMCTXCORE pRegFrame, RTGCPHYS pvFault);
# ifdef VBOX_WITH_2X_4GB_ADDR_SPACE
#ifdef IN_RING3
#ifndef VBOX_WITH_NEW_PHYS_CODE
VMMR3DECL(int) PGMR3PhysMMIO2Register(PVM pVM, PPDMDEVINS pDevIns, uint32_t iRegion, RTGCPHYS cb, uint32_t fFlags, void **ppv, const char *pszDesc);
VMMR3DECL(int) PGMR3PhysMMIO2GetHCPhys(PVM pVM, PPDMDEVINS pDevIns, uint32_t iRegion, RTGCPHYS off, PRTHCPHYS pHCPhys);
VMMR3DECL(int) PGMR3PhysRegister(PVM pVM, void *pvRam, RTGCPHYS GCPhys, size_t cb, unsigned fFlags, const SUPPAGE *paPages, const char *pszDesc);
#ifndef VBOX_WITH_NEW_PHYS_CODE
VMMR3DECL(int) PGMR3PhysRegisterChunk(PVM pVM, void *pvRam, RTGCPHYS GCPhys, size_t cb, unsigned fFlags, const SUPPAGE *paPages, const char *pszDesc);
VMMR3DECL(int) PGMR3PhysSetFlags(PVM pVM, RTGCPHYS GCPhys, size_t cb, unsigned fFlags, unsigned fMask);
VMMR3DECL(int) PGMR3MapPT(PVM pVM, RTGCPTR GCPtr, uint32_t cb, PFNPGMRELOCATE pfnRelocate, void *pvUser, const char *pszDesc);
VMMR3DECL(int) PGMR3HandlerPhysicalRegister(PVM pVM, PGMPHYSHANDLERTYPE enmType, RTGCPHYS GCPhys, RTGCPHYS GCPhysLast,
VMMDECL(int) PGMR3HandlerVirtualRegisterEx(PVM pVM, PGMVIRTHANDLERTYPE enmType, RTGCPTR GCPtr, RTGCPTR GCPtrLast,
VMMR3DECL(int) PGMR3HandlerVirtualRegister(PVM pVM, PGMVIRTHANDLERTYPE enmType, RTGCPTR GCPtr, RTGCPTR GCPtrLast,
VMMDECL(int) PGMHandlerVirtualChangeInvalidateCallback(PVM pVM, RTGCPTR GCPtr, R3PTRTYPE(PFNPGMR3VIRTINVALIDATE) pfnInvalidateR3);
VMMR3DECL(int) PGMR3DumpHierarchyHC(PVM pVM, uint64_t cr3, uint64_t cr4, bool fLongMode, unsigned cMaxDepth, PCDBGFINFOHLP pHlp);
VMMR3DECL(int) PGMR3DbgScanPhysical(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cbRange, const uint8_t *pabNeedle, size_t cbNeedle, PRTGCPHYS pGCPhysHit);
VMMR3DECL(int) PGMR3DbgScanVirtual(PVM pVM, RTGCPTR GCPtr, RTGCPTR cbRange, const uint8_t *pabNeedle, size_t cbNeedle, PRTGCUINTPTR pGCPhysHit);