GMMR0Internal.h revision ad27e1d5e48ca41245120c331cc88b50464813ce
70N/A/* $Id$ */
70N/A/** @file
70N/A * GMM - The Global Memory Manager, Internal Header.
70N/A */
851N/A
851N/A/*
70N/A * Copyright (C) 2007 Oracle Corporation
70N/A *
70N/A * This file is part of VirtualBox Open Source Edition (OSE), as
70N/A * available from http://www.virtualbox.org. This file is free software;
70N/A * you can redistribute it and/or modify it under the terms of the GNU
70N/A * General Public License (GPL) as published by the Free Software
70N/A * Foundation, in version 2 as it comes in the "COPYING" file of the
70N/A * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
70N/A * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
70N/A */
70N/A
70N/A#ifndef ___GMMR0Internal_h
70N/A#define ___GMMR0Internal_h
70N/A
70N/A#include <VBox/gmm.h>
70N/A#include <iprt/avl.h>
70N/A
70N/A/**
70N/A * The allocation sizes.
70N/A */
70N/Atypedef struct GMMVMSIZES
70N/A{
70N/A /** The number of pages of base memory.
70N/A * This is the sum of RAM, ROMs and handy pages. */
70N/A uint64_t cBasePages;
70N/A /** The number of pages for the shadow pool. (Can be squeezed for memory.) */
851N/A uint32_t cShadowPages;
70N/A /** The number of pages for fixed allocations like MMIO2 and the hyper heap. */
70N/A uint32_t cFixedPages;
70N/A} GMMVMSIZES;
493N/A/** Pointer to a GMMVMSIZES. */
70N/Atypedef GMMVMSIZES *PGMMVMSIZES;
70N/A
851N/A
70N/A/**
70N/A * Shared module registration info (per VM)
70N/A */
70N/Atypedef struct GMMSHAREDMODULEPERVM
70N/A{
70N/A /** Tree node. */
70N/A AVLGCPTRNODECORE Core;
70N/A
70N/A /** Pointer to global shared module info. */
70N/A PGMMSHAREDMODULE pGlobalModule;
493N/A
70N/A /** Set if another VM registered a different shared module at the same base address. */
70N/A bool fCollision;
493N/A /** Alignment. */
70N/A bool bAlignment[3];
70N/A
70N/A /** Number of included region descriptors */
70N/A uint32_t cRegions;
70N/A
/** Shared region descriptor(s). */
GMMSHAREDREGIONDESC aRegions[1];
} GMMSHAREDMODULEPERVM;
/** Pointer to a GMMSHAREDMODULEPERVM. */
typedef GMMSHAREDMODULEPERVM *PGMMSHAREDMODULEPERVM;
/**
* The per-VM GMM data.
*/
typedef struct GMMPERVM
{
/** The reservations. */
GMMVMSIZES Reserved;
/** The actual allocations.
* This includes both private and shared page allocations. */
GMMVMSIZES Allocated;
/** The current number of private pages. */
uint64_t cPrivatePages;
/** The current number of shared pages. */
uint64_t cSharedPages;
/** The current over-commitment policy. */
GMMOCPOLICY enmPolicy;
/** The VM priority for arbitrating VMs in low and out of memory situation.
* Like which VMs to start squeezing first. */
GMMPRIORITY enmPriority;
/** The current number of ballooned pages. */
uint64_t cBalloonedPages;
/** The max number of pages that can be ballooned. */
uint64_t cMaxBalloonedPages;
/** The number of pages we've currently requested the guest to give us.
* This is 0 if no pages currently requested. */
uint64_t cReqBalloonedPages;
/** The number of pages the guest has given us in response to the request.
* This is not reset on request completed and may be used in later decisions. */
uint64_t cReqActuallyBalloonedPages;
/** The number of pages we've currently requested the guest to take back. */
uint64_t cReqDeflatePages;
/** Shared module tree (per-vm). */
PAVLGCPTRNODECORE pSharedModuleTree;
/** Whether ballooning is enabled or not. */
bool fBallooningEnabled;
/** Whether shared paging is enabled or not. */
bool fSharedPagingEnabled;
/** Whether the VM is allowed to allocate memory or not.
* This is used when the reservation update request fails or when the VM has
* been told to suspend/save/die in an out-of-memory case. */
bool fMayAllocate;
} GMMPERVM;
/** Pointer to the per-VM GMM data. */
typedef GMMPERVM *PGMMPERVM;
#endif