mm.h revision 3ef11cccd00213ce59cbd26d2676a37c40241b70
/** @file
* MM - The Memory Manager.
*/
/*
* 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.
*
* The contents of this file may alternatively be used under the terms
* of the Common Development and Distribution License Version 1.0
* (CDDL) only, as it comes in the "COPYING.CDDL" file of the
* VirtualBox OSE distribution, in which case the provisions of the
* CDDL are applicable instead of those of the GPL.
*
* You may elect to license modified versions of this file under the
* terms and conditions of either the GPL or the CDDL or both.
*
* 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.
*/
#ifndef ___VBox_mm_h
#define ___VBox_mm_h
/** @defgroup grp_mm The Memory Manager API
* @{
*/
/**
* Memory Allocation Tags.
* For use with MMHyperAlloc(), MMR3HeapAlloc(), MMR3HeapAllocEx(),
* MMR3HeapAllocZ() and MMR3HeapAllocZEx().
*
* @remark Don't forget to update the dump command in MMHeap.cpp!
*/
typedef enum MMTAG
{
MM_TAG_INVALID = 0,
MM_TAG_32BIT_HACK = 0x7fffffff
} MMTAG;
/** @defgroup grp_mm_hyper Hypervisor Memory Management
* @ingroup grp_mm
* @{ */
#ifndef IN_RING0
#endif
#ifndef IN_RING3
#else
{
return R3Ptr;
}
#endif
#ifndef IN_RC
#else
{
return (void *)RCPtr;
}
#endif
#ifndef IN_RING3
#else
{
return pv;
}
#endif
#ifndef IN_RING0
#else
{
return pv;
}
#endif
#ifndef IN_RC
#else
{
}
#endif
#ifdef DEBUG
#endif
/** @def MMHYPER_RC_ASSERT_RCPTR
* Asserts that an address is either NULL or inside the hypervisor memory area.
* This assertion only works while IN_RC, it's a NOP everywhere else.
* @thread The Emulation Thread.
*/
#ifdef IN_RC
# define MMHYPER_RC_ASSERT_RCPTR(pVM, RCPtr) Assert(MMHyperIsInsideArea((pVM), (RTRCUINTPTR)(RCPtr)) || !(RCPtr))
#else
#endif
/** @} */
#ifdef IN_RING3
/** @defgroup grp_mm_r3 The MM Host Context Ring-3 API
* @ingroup grp_mm
* @{
*/
/** @defgroup grp_mm_r3_hyper Hypervisor Memory Manager (HC R3 Portion)
* @ingroup grp_mm_r3
* @{ */
VMMDECL(int) MMR3HyperAllocOnceNoRel(PVM pVM, size_t cb, uint32_t uAlignment, MMTAG enmTag, void **ppv);
VMMR3DECL(int) MMR3HyperMapHCPhys(PVM pVM, void *pvR3, RTR0PTR pvR0, RTHCPHYS HCPhys, size_t cb, const char *pszDesc, PRTGCPTR pGCPtr);
VMMR3DECL(int) MMR3HyperMapGCPhys(PVM pVM, RTGCPHYS GCPhys, size_t cb, const char *pszDesc, PRTGCPTR pGCPtr);
VMMR3DECL(int) MMR3HyperMapMMIO2(PVM pVM, PPDMDEVINS pDevIns, uint32_t iRegion, RTGCPHYS off, RTGCPHYS cb, const char *pszDesc, PRTRCPTR pRCPtr);
VMMR3DECL(int) MMR3HyperMapPages(PVM pVM, void *pvR3, RTR0PTR pvR0, size_t cPages, PCSUPPAGE paPages, const char *pszDesc, PRTGCPTR pGCPtr);
/** @} */
/** @defgroup grp_mm_phys Guest Physical Memory Manager
* @todo retire this group, elimintating or moving MMR3PhysGetRamSize to PGMPhys.
* @ingroup grp_mm_r3
* @{ */
/** @} */
/** @defgroup grp_mm_page Physical Page Pool
* @ingroup grp_mm_r3
* @{ */
/** @} */
/** @defgroup grp_mm_heap Heap Manager
* @ingroup grp_mm_r3
* @{ */
/** @} */
/** @defgroup grp_mm_heap User-kernel Heap Manager.
* @ingroup grp_mm_r3
*
* The memory is safely accessible from kernel context as well as user land.
*
* @{ */
VMMR3DECL(int) MMR3UkHeapAllocEx(PVM pVM, MMTAG enmTag, size_t cbSize, void **ppv, PRTR0PTR pR0Ptr);
VMMR3DECL(int) MMR3UkHeapAllocZEx(PVM pVM, MMTAG enmTag, size_t cbSize, void **ppv, PRTR0PTR pR0Ptr);
/** @} */
/** @} */
#endif /* IN_RING3 */
#ifdef IN_RC
/** @defgroup grp_mm_gc The MM Guest Context API
* @ingroup grp_mm
* @{
*/
/** @} */
#endif /* IN_RC */
/** @} */
#endif