GMM.cpp revision 4fa9fd7328a2a320f51953c974907c53f36e5469
/* $Id$ */
/** @file
* GMM - Global Memory Manager, ring-3 request wrappers.
*/
/*
* Copyright (C) 2008 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 *
*******************************************************************************/
#define LOG_GROUP LOG_GROUP_GMM
/**
* @see GMMR0InitialReservation
*/
GMMR3DECL(int) GMMR3InitialReservation(PVM pVM, uint64_t cBasePages, uint32_t cShadowPages, uint32_t cFixedPages,
{
}
/**
* @see GMMR0UpdateReservation
*/
GMMR3DECL(int) GMMR3UpdateReservation(PVM pVM, uint64_t cBasePages, uint32_t cShadowPages, uint32_t cFixedPages)
{
}
/**
* Prepares a GMMR0AllocatePages request.
*
* @returns VINF_SUCCESS or VERR_NO_TMP_MEMORY.
* @param pVM Pointer to the shared VM structure.
* @param[out] ppReq Where to store the pointer to the request packet.
* @param cPages The number of pages that's to be allocated.
* @param enmAccount The account to charge.
*/
GMMR3DECL(int) GMMR3AllocatePagesPrepare(PVM pVM, PGMMALLOCATEPAGESREQ *ppReq, uint32_t cPages, GMMACCOUNT enmAccount)
{
if (!pReq)
return VERR_NO_TMP_MEMORY;
return VINF_SUCCESS;
}
/**
* Performs a GMMR0AllocatePages request.
* This will call VMSetError on failure.
*
* @returns VBox status code.
* @param pVM Pointer to the shared VM structure.
* @param pReq Pointer to the request (returned by GMMR3AllocatePagesPrepare).
*/
{
for (unsigned i = 0; ; i++)
{
if (RT_SUCCESS(rc))
{
#ifdef LOG_ENABLED
Log3(("GMMR3AllocatePagesPerform: idPage=%#x HCPhys=%RHp\n",
#endif
return rc;
}
if (rc != VERR_GMM_SEED_ME)
N_("GMMR0AllocatePages failed to allocate %u pages"),
/*
* Seed another chunk.
*/
void *pvChunk;
if (RT_FAILURE(rc))
N_("Out of memory (SUPR3PageAlloc) seeding a %u pages allocation request"),
if (RT_FAILURE(rc))
}
}
/**
* Cleans up a GMMR0AllocatePages request.
* @param pReq Pointer to the request (returned by GMMR3AllocatePagesPrepare).
*/
{
}
/**
* Prepares a GMMR0FreePages request.
*
* @returns VINF_SUCCESS or VERR_NO_TMP_MEMORY.
* @param pVM Pointer to the shared VM structure.
* @param[out] ppReq Where to store the pointer to the request packet.
* @param cPages The number of pages that's to be freed.
* @param enmAccount The account to charge.
*/
GMMR3DECL(int) GMMR3FreePagesPrepare(PVM pVM, PGMMFREEPAGESREQ *ppReq, uint32_t cPages, GMMACCOUNT enmAccount)
{
if (!pReq)
return VERR_NO_TMP_MEMORY;
return VINF_SUCCESS;
}
/**
* Re-prepares a GMMR0FreePages request.
*
* @returns VINF_SUCCESS or VERR_NO_TMP_MEMORY.
* @param pVM Pointer to the shared VM structure.
* @param pReq A request buffer previously returned by
* GMMR3FreePagesPrepare().
* @param cPages The number of pages originally passed to
* GMMR3FreePagesPrepare().
* @param enmAccount The account to charge.
*/
GMMR3DECL(void) GMMR3FreePagesRePrep(PVM pVM, PGMMFREEPAGESREQ pReq, uint32_t cPages, GMMACCOUNT enmAccount)
{
}
/**
* Performs a GMMR0FreePages request.
* This will call VMSetError on failure.
*
* @returns VBox status code.
* @param pVM Pointer to the shared VM structure.
* @param pReq Pointer to the request (returned by GMMR3FreePagesPrepare).
* @param cActualPages The number of pages actually freed.
*/
{
/*
* Adjust the request if we ended up with fewer pages than anticipated.
*/
{
if (!cActualPages)
return VINF_SUCCESS;
}
/*
* Do the job.
*/
if (RT_SUCCESS(rc))
return rc;
N_("GMMR0FreePages failed to free %u pages"),
}
/**
* Cleans up a GMMR0FreePages request.
* @param pReq Pointer to the request (returned by GMMR3FreePagesPrepare).
*/
{
}
/**
* Frees allocated pages, for bailing out on failure.
*
* This will not call VMSetError on failure but will use AssertLogRel instead.
*
* @param pVM Pointer to the shared VM structure.
* @param pAllocReq The allocation request to undo.
*/
{
while (iPage-- > 0)
{
}
}
/**
* @see GMMR0BalloonedPages
*/
{
}
/**
* @see GMMR0QueryTotalBalloonSizeReq
*/
{
Req.cBalloonedPages = 0;
*pcTotalBalloonedPages = 0;
if (rc == VINF_SUCCESS)
return rc;
}
/**
* @see GMMR0MapUnmapChunk
*/
GMMR3DECL(int) GMMR3MapUnmapChunk(PVM pVM, uint32_t idChunkMap, uint32_t idChunkUnmap, PRTR3PTR ppvR3)
{
return rc;
}
/**
* @see GMMR0FreeLargePage
*/
{
}
/**
* @see GMMR0SeedChunk
*/
{
}