gmm.h revision 530c5ad6ea29dc5dc7a512482d3257faafdb2812
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @file
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * GMM - The Global Memory Manager.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/*
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Copyright (C) 2007-2010 Oracle Corporation
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * available from http://www.virtualbox.org. This file is free software;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * you can redistribute it and/or modify it under the terms of the GNU
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * General Public License (GPL) as published by the Free Software
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * The contents of this file may alternatively be used under the terms
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * of the Common Development and Distribution License Version 1.0
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * VirtualBox OSE distribution, in which case the provisions of the
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * CDDL are applicable instead of those of the GPL.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * You may elect to license modified versions of this file under the
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * terms and conditions of either the GPL or the CDDL or both.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifndef ___VBox_vmm_gmm_h
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#define ___VBox_vmm_gmm_h
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#include <VBox/vmm/gvmm.h>
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#include <VBox/sup.h>
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#include <VBox/param.h>
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#include <iprt/avl.h>
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncRT_C_DECLS_BEGIN
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @defgroup grp_gmm GMM - The Global Memory Manager
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @{
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @def IN_GMM_R0
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Used to indicate whether we're inside the same link module as the ring 0
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * part of the Global Memory Manager or not.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifdef DOXYGEN_RUNNING
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define IN_GMM_R0
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @def GMMR0DECL
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Ring 0 GMM export or import declaration.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param type The return type of the function declaration.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifdef IN_GMM_R0
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define GMMR0DECL(type) DECLEXPORT(type) VBOXCALL
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#else
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define GMMR0DECL(type) DECLIMPORT(type) VBOXCALL
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @def IN_GMM_R3
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Used to indicate whether we're inside the same link module as the ring 3
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * part of the Global Memory Manager or not.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifdef DOXYGEN_RUNNING
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define IN_GMM_R3
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @def GMMR3DECL
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Ring 3 GMM export or import declaration.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param type The return type of the function declaration.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifdef IN_GMM_R3
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define GMMR3DECL(type) DECLEXPORT(type) VBOXCALL
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#else
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define GMMR3DECL(type) DECLIMPORT(type) VBOXCALL
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** The chunk shift. (2^21 = 2 MB) */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#define GMM_CHUNK_SHIFT 21
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** The allocation chunk size. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#define GMM_CHUNK_SIZE (1U << GMM_CHUNK_SHIFT)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** The allocation chunk size in pages. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#define GMM_CHUNK_NUM_PAGES (1U << (GMM_CHUNK_SHIFT - PAGE_SHIFT))
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** The shift factor for converting a page id into a chunk id. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#define GMM_CHUNKID_SHIFT (GMM_CHUNK_SHIFT - PAGE_SHIFT)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** The last valid Chunk ID value. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#define GMM_CHUNKID_LAST (GMM_PAGEID_LAST >> GMM_CHUNKID_SHIFT)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** The last valid Page ID value.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * The current limit is 2^28 - 1, or almost 1TB if you like.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * The constraints are currently dictated by PGMPAGE. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#define GMM_PAGEID_LAST (RT_BIT_32(28) - 1)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** Mask out the page index from the Page ID. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#define GMM_PAGEID_IDX_MASK ((1U << GMM_CHUNKID_SHIFT) - 1)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** The NIL Chunk ID value. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#define NIL_GMM_CHUNKID 0
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** The NIL Page ID value. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#define NIL_GMM_PAGEID 0
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#if 0 /* wrong - these are guest page pfns and not page ids! */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** Special Page ID used by unassigned pages. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#define GMM_PAGEID_UNASSIGNED 0x0fffffffU
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** Special Page ID used by unsharable pages.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Like MMIO2, shadow and heap. This is for later, obviously. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#define GMM_PAGEID_UNSHARABLE 0x0ffffffeU
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** The end of the valid Page IDs. This is the first special one. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#define GMM_PAGEID_END 0x0ffffff0U
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @def GMM_GCPHYS_LAST
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * The last of the valid guest physical address as it applies to GMM pages.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * This must reflect the constraints imposed by the RTGCPHYS type and
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * the guest page frame number used internally in GMMPAGE.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @note Note this corresponds to GMM_PAGE_PFN_LAST. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#if HC_ARCH_BITS == 64
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define GMM_GCPHYS_LAST UINT64_C(0x00000fffffff0000) /* 2^44 (16TB) - 0x10000 */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#else
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define GMM_GCPHYS_LAST UINT64_C(0x0000000fffff0000) /* 2^36 (64GB) - 0x10000 */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/**
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Over-commitment policy.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsynctypedef enum GMMOCPOLICY
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync{
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** The usual invalid 0 value. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync GMMOCPOLICY_INVALID = 0,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** No over-commitment, fully backed.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * The GMM guarantees that it will be able to allocate all of the
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * guest RAM for a VM with OC policy. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync GMMOCPOLICY_NO_OC,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** to-be-determined. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync GMMOCPOLICY_TBD,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** The end of the valid policy range. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync GMMOCPOLICY_END,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** The usual 32-bit hack. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync GMMOCPOLICY_32BIT_HACK = 0x7fffffff
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync} GMMOCPOLICY;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/**
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * VM / Memory priority.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsynctypedef enum GMMPRIORITY
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync{
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** The usual invalid 0 value. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync GMMPRIORITY_INVALID = 0,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** High.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * When ballooning, ask these VMs last.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * When running out of memory, try not to interrupt these VMs. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync GMMPRIORITY_HIGH,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Normal.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * When ballooning, don't wait to ask these.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * When running out of memory, pause, save and/or kill these VMs. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync GMMPRIORITY_NORMAL,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Low.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * When ballooning, maximize these first.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * When running out of memory, save or kill these VMs. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync GMMPRIORITY_LOW,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** The end of the valid priority range. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync GMMPRIORITY_END,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** The custom 32-bit type blowup. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync GMMPRIORITY_32BIT_HACK = 0x7fffffff
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync} GMMPRIORITY;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/**
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * GMM Memory Accounts.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsynctypedef enum GMMACCOUNT
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync{
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** The customary invalid zero entry. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync GMMACCOUNT_INVALID = 0,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Account with the base allocations. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync GMMACCOUNT_BASE,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Account with the shadow allocations. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync GMMACCOUNT_SHADOW,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Account with the fixed allocations. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync GMMACCOUNT_FIXED,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** The end of the valid values. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync GMMACCOUNT_END,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** The usual 32-bit value to finish it off. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync GMMACCOUNT_32BIT_HACK = 0x7fffffff
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync} GMMACCOUNT;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/**
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Balloon actions.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsynctypedef enum
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync{
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Invalid zero entry. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync GMMBALLOONACTION_INVALID = 0,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Inflate the balloon. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync GMMBALLOONACTION_INFLATE,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Deflate the balloon. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync GMMBALLOONACTION_DEFLATE,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Puncture the balloon because of VM reset. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync GMMBALLOONACTION_RESET,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** End of the valid actions. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync GMMBALLOONACTION_END,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** hack forcing the size of the enum to 32-bits. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync GMMBALLOONACTION_MAKE_32BIT_HACK = 0x7fffffff
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync} GMMBALLOONACTION;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/**
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * A page descriptor for use when freeing pages.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * See GMMR0FreePages, GMMR0BalloonedPages.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsynctypedef struct GMMFREEPAGEDESC
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync{
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** The Page ID of the page to be freed. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync uint32_t idPage;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync} GMMFREEPAGEDESC;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** Pointer to a page descriptor for freeing pages. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsynctypedef GMMFREEPAGEDESC *PGMMFREEPAGEDESC;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/**
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * A page descriptor for use when updating and allocating pages.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * This is a bit complicated because we want to do as much as possible
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * with the same structure.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsynctypedef struct GMMPAGEDESC
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync{
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** The physical address of the page.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @input GMMR0AllocateHandyPages expects the guest physical address
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * to update the GMMPAGE structure with. Pass GMM_GCPHYS_UNSHAREABLE
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * when appropriate and NIL_RTHCPHYS when the page wasn't used
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * for any specific guest address.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * GMMR0AllocatePage expects the guest physical address to put in
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * the GMMPAGE structure for the page it allocates for this entry.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Pass NIL_RTHCPHYS and GMM_GCPHYS_UNSHAREABLE as above.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @output The host physical address of the allocated page.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * NIL_RTHCPHYS on allocation failure.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * ASSUMES: sizeof(RTHCPHYS) >= sizeof(RTGCPHYS).
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync RTHCPHYS HCPhysGCPhys;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** The Page ID.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @intput GMMR0AllocateHandyPages expects the Page ID of the page to
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * update here. NIL_GMM_PAGEID means no page should be updated.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * GMMR0AllocatePages requires this to be initialized to
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * NIL_GMM_PAGEID currently.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @output The ID of the page, NIL_GMM_PAGEID if the allocation failed.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync uint32_t idPage;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** The Page ID of the shared page was replaced by this page.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @input GMMR0AllocateHandyPages expects this to indicate a shared
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * page that has been replaced by this page and should have its
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * reference counter decremented and perhaps be freed up. Use
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * NIL_GMM_PAGEID if no shared page was involved.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * All other APIs expects NIL_GMM_PAGEID here.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @output All APIs sets this to NIL_GMM_PAGEID.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync uint32_t idSharedPage;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync} GMMPAGEDESC;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncAssertCompileSize(GMMPAGEDESC, 16);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** Pointer to a page allocation. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsynctypedef GMMPAGEDESC *PGMMPAGEDESC;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** GMMPAGEDESC::HCPhysGCPhys value that indicates that the page is unsharable.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @note This corresponds to GMM_PAGE_PFN_UNSHAREABLE. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#if HC_ARCH_BITS == 64
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define GMM_GCPHYS_UNSHAREABLE UINT64_C(0x00000fffffff1000)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#else
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define GMM_GCPHYS_UNSHAREABLE UINT64_C(0x0000000fffff1000)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync/**
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync * The allocation sizes.
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync */
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsynctypedef struct GMMVMSIZES
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync{
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync /** The number of pages of base memory.
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync * This is the sum of RAM, ROMs and handy pages. */
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync uint64_t cBasePages;
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync /** The number of pages for the shadow pool. (Can be squeezed for memory.) */
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync uint32_t cShadowPages;
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync /** The number of pages for fixed allocations like MMIO2 and the hyper heap. */
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync uint32_t cFixedPages;
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync} GMMVMSIZES;
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync/** Pointer to a GMMVMSIZES. */
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsynctypedef GMMVMSIZES *PGMMVMSIZES;
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync/**
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync * GMM VM statistics.
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync */
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsynctypedef struct GMMVMSTATS
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync{
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync /** The reservations. */
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync GMMVMSIZES Reserved;
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync /** The actual allocations.
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync * This includes both private and shared page allocations. */
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync GMMVMSIZES Allocated;
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync /** The current number of private pages. */
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync uint64_t cPrivatePages;
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync /** The current number of shared pages. */
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync uint64_t cSharedPages;
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync /** The current number of ballooned pages. */
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync uint64_t cBalloonedPages;
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync /** The max number of pages that can be ballooned. */
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync uint64_t cMaxBalloonedPages;
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync /** The number of pages we've currently requested the guest to give us.
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync * This is 0 if no pages currently requested. */
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync uint64_t cReqBalloonedPages;
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync /** The number of pages the guest has given us in response to the request.
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync * This is not reset on request completed and may be used in later decisions. */
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync uint64_t cReqActuallyBalloonedPages;
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync /** The number of pages we've currently requested the guest to take back. */
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync uint64_t cReqDeflatePages;
530c5ad6ea29dc5dc7a512482d3257faafdb2812vboxsync /** The number of shareable module tracked by this VM. */
530c5ad6ea29dc5dc7a512482d3257faafdb2812vboxsync uint32_t cShareableModules;
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync /** The current over-commitment policy. */
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync GMMOCPOLICY enmPolicy;
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync /** The VM priority for arbitrating VMs in low and out of memory situation.
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync * Like which VMs to start squeezing first. */
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync GMMPRIORITY enmPriority;
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync /** Whether ballooning is enabled or not. */
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync bool fBallooningEnabled;
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync /** Whether shared paging is enabled or not. */
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync bool fSharedPagingEnabled;
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync /** Whether the VM is allowed to allocate memory or not.
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync * This is used when the reservation update request fails or when the VM has
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync * been told to suspend/save/die in an out-of-memory case. */
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync bool fMayAllocate;
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync /** Explicit alignment. */
530c5ad6ea29dc5dc7a512482d3257faafdb2812vboxsync bool afReserved[1];
530c5ad6ea29dc5dc7a512482d3257faafdb2812vboxsync
530c5ad6ea29dc5dc7a512482d3257faafdb2812vboxsync
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync} GMMVMSTATS;
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync/**
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync * The GMM statistics.
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync */
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsynctypedef struct GMMSTATS
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync{
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync /** The maximum number of pages we're allowed to allocate
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync * (GMM::cMaxPages). */
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync uint64_t cMaxPages;
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync /** The number of pages that has been reserved (GMM::cReservedPages). */
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync uint64_t cReservedPages;
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync /** The number of pages that we have over-committed in reservations
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync * (GMM::cOverCommittedPages). */
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync uint64_t cOverCommittedPages;
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync /** The number of actually allocated (committed if you like) pages
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync * (GMM::cAllocatedPages). */
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync uint64_t cAllocatedPages;
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync /** The number of pages that are shared. A subset of cAllocatedPages.
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync * (GMM::cSharedPages) */
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync uint64_t cSharedPages;
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync /** The number of pages that are actually shared between VMs.
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync * (GMM:cDuplicatePages) */
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync uint64_t cDuplicatePages;
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync /** The number of pages that are shared that has been left behind by
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync * VMs not doing proper cleanups (GMM::cLeftBehindSharedPages). */
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync uint64_t cLeftBehindSharedPages;
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync /** The number of current ballooned pages (GMM::cBalloonedPages). */
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync uint64_t cBalloonedPages;
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync /** The number of allocation chunks (GMM::cChunks). */
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync uint32_t cChunks;
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync /** The number of freed chunks ever (GMM::cFreedChunks). */
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync uint32_t cFreedChunks;
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync /** The number of shareable modules (GMM:cShareableModules). */
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync uint64_t cShareableModules;
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync /** Space reserved for later. */
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync uint64_t au64Reserved[2];
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync /** Statistics for the specified VM. (Zero filled if not requested.) */
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync GMMVMSTATS VMStats;
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync} GMMSTATS;
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync/** Pointer to the GMM statistics. */
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsynctypedef GMMSTATS *PGMMSTATS;
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync/** Const pointer to the GMM statistics. */
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsynctypedef const GMMSTATS *PCGMMSTATS;
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncGMMR0DECL(int) GMMR0Init(void);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncGMMR0DECL(void) GMMR0Term(void);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncGMMR0DECL(void) GMMR0InitPerVMData(PGVM pGVM);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncGMMR0DECL(void) GMMR0CleanupVM(PGVM pGVM);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncGMMR0DECL(int) GMMR0InitialReservation(PVM pVM, VMCPUID idCpu, uint64_t cBasePages, uint32_t cShadowPages, uint32_t cFixedPages,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync GMMOCPOLICY enmPolicy, GMMPRIORITY enmPriority);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncGMMR0DECL(int) GMMR0UpdateReservation(PVM pVM, VMCPUID idCpu, uint64_t cBasePages, uint32_t cShadowPages, uint32_t cFixedPages);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncGMMR0DECL(int) GMMR0AllocateHandyPages(PVM pVM, VMCPUID idCpu, uint32_t cPagesToUpdate, uint32_t cPagesToAlloc, PGMMPAGEDESC paPages);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncGMMR0DECL(int) GMMR0AllocatePages(PVM pVM, VMCPUID idCpu, uint32_t cPages, PGMMPAGEDESC paPages, GMMACCOUNT enmAccount);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncGMMR0DECL(int) GMMR0AllocateLargePage(PVM pVM, VMCPUID idCpu, uint32_t cbPage, uint32_t *pIdPage, RTHCPHYS *pHCPhys);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncGMMR0DECL(int) GMMR0FreePages(PVM pVM, VMCPUID idCpu, uint32_t cPages, PGMMFREEPAGEDESC paPages, GMMACCOUNT enmAccount);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncGMMR0DECL(int) GMMR0FreeLargePage(PVM pVM, VMCPUID idCpu, uint32_t idPage);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncGMMR0DECL(int) GMMR0BalloonedPages(PVM pVM, VMCPUID idCpu, GMMBALLOONACTION enmAction, uint32_t cBalloonedPages);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncGMMR0DECL(int) GMMR0MapUnmapChunk(PVM pVM, uint32_t idChunkMap, uint32_t idChunkUnmap, PRTR3PTR ppvR3);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncGMMR0DECL(int) GMMR0SeedChunk(PVM pVM, VMCPUID idCpu, RTR3PTR pvR3);
530c5ad6ea29dc5dc7a512482d3257faafdb2812vboxsyncGMMR0DECL(int) GMMR0RegisterSharedModule(PVM pVM, VMCPUID idCpu, VBOXOSFAMILY enmGuestOS, char *pszModuleName, char *pszVersion,
530c5ad6ea29dc5dc7a512482d3257faafdb2812vboxsync RTGCPTR GCBaseAddr, uint32_t cbModule, uint32_t cRegions,
530c5ad6ea29dc5dc7a512482d3257faafdb2812vboxsync struct VMMDEVSHAREDREGIONDESC *pRegions);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncGMMR0DECL(int) GMMR0UnregisterSharedModule(PVM pVM, VMCPUID idCpu, char *pszModuleName, char *pszVersion, RTGCPTR GCBaseAddr, uint32_t cbModule);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncGMMR0DECL(int) GMMR0UnregisterAllSharedModules(PVM pVM, VMCPUID idCpu);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncGMMR0DECL(int) GMMR0CheckSharedModules(PVM pVM, PVMCPU pVCpu);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncGMMR0DECL(int) GMMR0ResetSharedModules(PVM pVM, VMCPUID idCpu);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncGMMR0DECL(int) GMMR0CheckSharedModulesStart(PVM pVM);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncGMMR0DECL(int) GMMR0CheckSharedModulesEnd(PVM pVM);
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsyncGMMR0DECL(int) GMMR0QueryStatistics(PGMMSTATS pStats, PSUPDRVSESSION pSession);
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsyncGMMR0DECL(int) GMMR0ResetStatistics(PCGMMSTATS pStats, PSUPDRVSESSION pSession);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/**
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Request buffer for GMMR0InitialReservationReq / VMMR0_DO_GMM_INITIAL_RESERVATION.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @see GMMR0InitialReservation
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsynctypedef struct GMMINITIALRESERVATIONREQ
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync{
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** The header. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync SUPVMMR0REQHDR Hdr;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync uint64_t cBasePages; /**< @see GMMR0InitialReservation */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync uint32_t cShadowPages; /**< @see GMMR0InitialReservation */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync uint32_t cFixedPages; /**< @see GMMR0InitialReservation */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync GMMOCPOLICY enmPolicy; /**< @see GMMR0InitialReservation */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync GMMPRIORITY enmPriority; /**< @see GMMR0InitialReservation */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync} GMMINITIALRESERVATIONREQ;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** Pointer to a GMMR0InitialReservationReq / VMMR0_DO_GMM_INITIAL_RESERVATION request buffer. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsynctypedef GMMINITIALRESERVATIONREQ *PGMMINITIALRESERVATIONREQ;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncGMMR0DECL(int) GMMR0InitialReservationReq(PVM pVM, VMCPUID idCpu, PGMMINITIALRESERVATIONREQ pReq);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/**
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Request buffer for GMMR0UpdateReservationReq / VMMR0_DO_GMM_UPDATE_RESERVATION.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @see GMMR0UpdateReservation
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsynctypedef struct GMMUPDATERESERVATIONREQ
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync{
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** The header. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync SUPVMMR0REQHDR Hdr;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync uint64_t cBasePages; /**< @see GMMR0UpdateReservation */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync uint32_t cShadowPages; /**< @see GMMR0UpdateReservation */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync uint32_t cFixedPages; /**< @see GMMR0UpdateReservation */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync} GMMUPDATERESERVATIONREQ;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** Pointer to a GMMR0InitialReservationReq / VMMR0_DO_GMM_INITIAL_RESERVATION request buffer. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsynctypedef GMMUPDATERESERVATIONREQ *PGMMUPDATERESERVATIONREQ;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncGMMR0DECL(int) GMMR0UpdateReservationReq(PVM pVM, VMCPUID idCpu, PGMMUPDATERESERVATIONREQ pReq);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/**
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Request buffer for GMMR0AllocatePagesReq / VMMR0_DO_GMM_ALLOCATE_PAGES.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @see GMMR0AllocatePages.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsynctypedef struct GMMALLOCATEPAGESREQ
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync{
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** The header. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync SUPVMMR0REQHDR Hdr;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** The account to charge the allocation to. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync GMMACCOUNT enmAccount;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** The number of pages to allocate. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync uint32_t cPages;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Array of page descriptors. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync GMMPAGEDESC aPages[1];
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync} GMMALLOCATEPAGESREQ;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** Pointer to a GMMR0AllocatePagesReq / VMMR0_DO_GMM_ALLOCATE_PAGES request buffer. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsynctypedef GMMALLOCATEPAGESREQ *PGMMALLOCATEPAGESREQ;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncGMMR0DECL(int) GMMR0AllocatePagesReq(PVM pVM, VMCPUID idCpu, PGMMALLOCATEPAGESREQ pReq);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/**
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Request buffer for GMMR0FreePagesReq / VMMR0_DO_GMM_FREE_PAGES.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @see GMMR0FreePages.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsynctypedef struct GMMFREEPAGESREQ
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync{
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** The header. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync SUPVMMR0REQHDR Hdr;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** The account this relates to. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync GMMACCOUNT enmAccount;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** The number of pages to free. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync uint32_t cPages;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Array of free page descriptors. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync GMMFREEPAGEDESC aPages[1];
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync} GMMFREEPAGESREQ;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** Pointer to a GMMR0FreePagesReq / VMMR0_DO_GMM_FREE_PAGES request buffer. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsynctypedef GMMFREEPAGESREQ *PGMMFREEPAGESREQ;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncGMMR0DECL(int) GMMR0FreePagesReq(PVM pVM, VMCPUID idCpu, PGMMFREEPAGESREQ pReq);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/**
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Request buffer for GMMR0BalloonedPagesReq / VMMR0_DO_GMM_BALLOONED_PAGES.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @see GMMR0BalloonedPages.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsynctypedef struct GMMBALLOONEDPAGESREQ
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync{
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** The header. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync SUPVMMR0REQHDR Hdr;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** The number of ballooned pages. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync uint32_t cBalloonedPages;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Inflate or deflate the balloon. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync GMMBALLOONACTION enmAction;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync} GMMBALLOONEDPAGESREQ;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** Pointer to a GMMR0BalloonedPagesReq / VMMR0_DO_GMM_BALLOONED_PAGES request buffer. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsynctypedef GMMBALLOONEDPAGESREQ *PGMMBALLOONEDPAGESREQ;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncGMMR0DECL(int) GMMR0BalloonedPagesReq(PVM pVM, VMCPUID idCpu, PGMMBALLOONEDPAGESREQ pReq);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/**
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Request buffer for GMMR0QueryHypervisorMemoryStatsReq / VMMR0_DO_GMM_QUERY_VMM_MEM_STATS.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @see GMMR0QueryHypervisorMemoryStatsReq.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsynctypedef struct GMMMEMSTATSREQ
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync{
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** The header. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync SUPVMMR0REQHDR Hdr;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** The number of allocated pages (out). */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync uint64_t cAllocPages;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** The number of free pages (out). */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync uint64_t cFreePages;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** The number of ballooned pages (out). */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync uint64_t cBalloonedPages;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** The number of shared pages (out). */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync uint64_t cSharedPages;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Maximum nr of pages (out). */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync uint64_t cMaxPages;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync} GMMMEMSTATSREQ;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** Pointer to a GMMR0QueryHypervisorMemoryStatsReq / VMMR0_DO_GMM_QUERY_HYPERVISOR_MEM_STATS request buffer. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsynctypedef GMMMEMSTATSREQ *PGMMMEMSTATSREQ;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncGMMR0DECL(int) GMMR0QueryHypervisorMemoryStatsReq(PVM pVM, PGMMMEMSTATSREQ pReq);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncGMMR0DECL(int) GMMR0QueryMemoryStatsReq(PVM pVM, VMCPUID idCpu, PGMMMEMSTATSREQ pReq);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/**
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Request buffer for GMMR0MapUnmapChunkReq / VMMR0_DO_GMM_MAP_UNMAP_CHUNK.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @see GMMR0MapUnmapChunk
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsynctypedef struct GMMMAPUNMAPCHUNKREQ
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync{
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** The header. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync SUPVMMR0REQHDR Hdr;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** The chunk to map, NIL_GMM_CHUNKID if unmap only. (IN) */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync uint32_t idChunkMap;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** The chunk to unmap, NIL_GMM_CHUNKID if map only. (IN) */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync uint32_t idChunkUnmap;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Where the mapping address is returned. (OUT) */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync RTR3PTR pvR3;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync} GMMMAPUNMAPCHUNKREQ;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** Pointer to a GMMR0MapUnmapChunkReq / VMMR0_DO_GMM_MAP_UNMAP_CHUNK request buffer. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsynctypedef GMMMAPUNMAPCHUNKREQ *PGMMMAPUNMAPCHUNKREQ;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncGMMR0DECL(int) GMMR0MapUnmapChunkReq(PVM pVM, PGMMMAPUNMAPCHUNKREQ pReq);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/**
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Request buffer for GMMR0FreeLargePageReq / VMMR0_DO_GMM_FREE_LARGE_PAGE.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @see GMMR0FreeLargePage.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsynctypedef struct GMMFREELARGEPAGEREQ
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync{
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** The header. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync SUPVMMR0REQHDR Hdr;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** The Page ID. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync uint32_t idPage;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync} GMMFREELARGEPAGEREQ;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** Pointer to a GMMR0FreePagesReq / VMMR0_DO_GMM_FREE_PAGES request buffer. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsynctypedef GMMFREELARGEPAGEREQ *PGMMFREELARGEPAGEREQ;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncGMMR0DECL(int) GMMR0FreeLargePageReq(PVM pVM, VMCPUID idCpu, PGMMFREELARGEPAGEREQ pReq);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** Maximum length of the shared module name string. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#define GMM_SHARED_MODULE_MAX_NAME_STRING 128
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** Maximum length of the shared module version string. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#define GMM_SHARED_MODULE_MAX_VERSION_STRING 16
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/**
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Request buffer for GMMR0RegisterSharedModuleReq / VMMR0_DO_GMM_REGISTER_SHARED_MODULE.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @see GMMR0RegisterSharedModule.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsynctypedef struct GMMREGISTERSHAREDMODULEREQ
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync{
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** The header. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync SUPVMMR0REQHDR Hdr;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Shared module size. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync uint32_t cbModule;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Number of included region descriptors */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync uint32_t cRegions;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Base address of the shared module. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync RTGCPTR64 GCBaseAddr;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Guest OS type. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync VBOXOSFAMILY enmGuestOS;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** return code. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync uint32_t rc;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Module name */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync char szName[GMM_SHARED_MODULE_MAX_NAME_STRING];
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Module version */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync char szVersion[GMM_SHARED_MODULE_MAX_VERSION_STRING];
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Shared region descriptor(s). */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync VMMDEVSHAREDREGIONDESC aRegions[1];
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync} GMMREGISTERSHAREDMODULEREQ;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** Pointer to a GMMR0RegisterSharedModuleReq / VMMR0_DO_GMM_REGISTER_SHARED_MODULE request buffer. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsynctypedef GMMREGISTERSHAREDMODULEREQ *PGMMREGISTERSHAREDMODULEREQ;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncGMMR0DECL(int) GMMR0RegisterSharedModuleReq(PVM pVM, VMCPUID idCpu, PGMMREGISTERSHAREDMODULEREQ pReq);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/**
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Shared region descriptor
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsynctypedef struct GMMSHAREDREGIONDESC
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync{
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Region base address. */
61ec6a59a936b2f248a67be4c4f8f9325f85b702vboxsync RTGCPTR64 GCRegionAddr;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Region size. */
61ec6a59a936b2f248a67be4c4f8f9325f85b702vboxsync uint32_t cbRegion;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Alignment. */
61ec6a59a936b2f248a67be4c4f8f9325f85b702vboxsync uint32_t u32Alignment;
61ec6a59a936b2f248a67be4c4f8f9325f85b702vboxsync /** Pointer to physical GMM page ID array. */
61ec6a59a936b2f248a67be4c4f8f9325f85b702vboxsync uint32_t *paidPages;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync} GMMSHAREDREGIONDESC;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** Pointer to a GMMSHAREDREGIONDESC. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsynctypedef GMMSHAREDREGIONDESC *PGMMSHAREDREGIONDESC;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/**
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Shared module registration info (global)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsynctypedef struct GMMSHAREDMODULE
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync{
530c5ad6ea29dc5dc7a512482d3257faafdb2812vboxsync /** Tree node. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync AVLGCPTRNODECORE Core;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Shared module size. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync uint32_t cbModule;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Number of included region descriptors */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync uint32_t cRegions;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Number of users (VMs). */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync uint32_t cUsers;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Guest OS family type. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync VBOXOSFAMILY enmGuestOS;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Module name */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync char szName[GMM_SHARED_MODULE_MAX_NAME_STRING];
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Module version */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync char szVersion[GMM_SHARED_MODULE_MAX_VERSION_STRING];
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Shared region descriptor(s). */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync GMMSHAREDREGIONDESC aRegions[1];
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync} GMMSHAREDMODULE;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** Pointer to a GMMSHAREDMODULE. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsynctypedef GMMSHAREDMODULE *PGMMSHAREDMODULE;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/**
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Page descriptor for GMMR0SharedModuleCheckRange
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsynctypedef struct GMMSHAREDPAGEDESC
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync{
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** HC Physical address (in/out) */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync RTHCPHYS HCPhys;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** GC Physical address (in) */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync RTGCPHYS GCPhys;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** GMM page id. (in/out) */
61ec6a59a936b2f248a67be4c4f8f9325f85b702vboxsync uint32_t idPage;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Align at 8 byte boundary. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync uint32_t uAlignment;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync} GMMSHAREDPAGEDESC;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** Pointer to a GMMSHAREDPAGEDESC. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsynctypedef GMMSHAREDPAGEDESC *PGMMSHAREDPAGEDESC;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
61ec6a59a936b2f248a67be4c4f8f9325f85b702vboxsyncGMMR0DECL(int) GMMR0SharedModuleCheckPage(PGVM pGVM, PGMMSHAREDMODULE pModule, unsigned idxRegion, unsigned idxPage,
61ec6a59a936b2f248a67be4c4f8f9325f85b702vboxsync PGMMSHAREDPAGEDESC pPageDesc);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/**
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Request buffer for GMMR0UnregisterSharedModuleReq / VMMR0_DO_GMM_UNREGISTER_SHARED_MODULE.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @see GMMR0UnregisterSharedModule.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsynctypedef struct GMMUNREGISTERSHAREDMODULEREQ
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync{
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** The header. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync SUPVMMR0REQHDR Hdr;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Shared module size. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync uint32_t cbModule;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Align at 8 byte boundary. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync uint32_t u32Alignment;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Base address of the shared module. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync RTGCPTR64 GCBaseAddr;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Module name */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync char szName[GMM_SHARED_MODULE_MAX_NAME_STRING];
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Module version */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync char szVersion[GMM_SHARED_MODULE_MAX_VERSION_STRING];
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync} GMMUNREGISTERSHAREDMODULEREQ;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** Pointer to a GMMR0UnregisterSharedModuleReq / VMMR0_DO_GMM_UNREGISTER_SHARED_MODULE request buffer. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsynctypedef GMMUNREGISTERSHAREDMODULEREQ *PGMMUNREGISTERSHAREDMODULEREQ;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncGMMR0DECL(int) GMMR0UnregisterSharedModuleReq(PVM pVM, VMCPUID idCpu, PGMMUNREGISTERSHAREDMODULEREQ pReq);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#if defined(VBOX_STRICT) && HC_ARCH_BITS == 64
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/**
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Request buffer for GMMR0FindDuplicatePageReq / VMMR0_DO_GMM_FIND_DUPLICATE_PAGE.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @see GMMR0FindDuplicatePage.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsynctypedef struct GMMFINDDUPLICATEPAGEREQ
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync{
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** The header. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync SUPVMMR0REQHDR Hdr;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Page id. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync uint32_t idPage;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Duplicate flag (out) */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync bool fDuplicate;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync} GMMFINDDUPLICATEPAGEREQ;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** Pointer to a GMMR0FindDuplicatePageReq / VMMR0_DO_GMM_FIND_DUPLICATE_PAGE request buffer. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsynctypedef GMMFINDDUPLICATEPAGEREQ *PGMMFINDDUPLICATEPAGEREQ;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncGMMR0DECL(int) GMMR0FindDuplicatePageReq(PVM pVM, PGMMFINDDUPLICATEPAGEREQ pReq);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif /* VBOX_STRICT && HC_ARCH_BITS == 64 */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync/**
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync * Request buffer for GMMR0QueryStatisticsReq / VMMR0_DO_GMM_QUERY_STATISTICS.
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync * @see GMMR0QueryStatistics.
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync */
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsynctypedef struct GMMQUERYSTATISTICSSREQ
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync{
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync /** The header. */
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync SUPVMMR0REQHDR Hdr;
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync /** The support driver session. */
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync PSUPDRVSESSION pSession;
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync /** The statistics. */
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync GMMSTATS Stats;
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync} GMMQUERYSTATISTICSSREQ;
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync/** Pointer to a GMMR0QueryStatisticsReq / VMMR0_DO_GMM_QUERY_STATISTICS
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync * request buffer. */
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsynctypedef GMMQUERYSTATISTICSSREQ *PGMMQUERYSTATISTICSSREQ;
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsyncGMMR0DECL(int) GMMR0QueryStatisticsReq(PVM pVM, PGMMQUERYSTATISTICSSREQ pReq);
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync/**
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync * Request buffer for GMMR0ResetStatisticsReq / VMMR0_DO_GMM_RESET_STATISTICS.
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync * @see GMMR0ResetStatistics.
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync */
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsynctypedef struct GMMRESETSTATISTICSSREQ
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync{
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync /** The header. */
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync SUPVMMR0REQHDR Hdr;
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync /** The support driver session. */
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync PSUPDRVSESSION pSession;
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync /** The statistics to reset.
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync * Any non-zero entry will be reset (if permitted). */
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync GMMSTATS Stats;
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync} GMMRESETSTATISTICSSREQ;
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync/** Pointer to a GMMR0ResetStatisticsReq / VMMR0_DO_GMM_RESET_STATISTICS
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync * request buffer. */
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsynctypedef GMMRESETSTATISTICSSREQ *PGMMRESETSTATISTICSSREQ;
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsyncGMMR0DECL(int) GMMR0ResetStatisticsReq(PVM pVM, PGMMRESETSTATISTICSSREQ pReq);
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifdef IN_RING3
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @defgroup grp_gmm_r3 The Global Memory Manager Ring-3 API Wrappers
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @ingroup grp_gmm
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @{
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncGMMR3DECL(int) GMMR3InitialReservation(PVM pVM, uint64_t cBasePages, uint32_t cShadowPages, uint32_t cFixedPages,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync GMMOCPOLICY enmPolicy, GMMPRIORITY enmPriority);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncGMMR3DECL(int) GMMR3UpdateReservation(PVM pVM, uint64_t cBasePages, uint32_t cShadowPages, uint32_t cFixedPages);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncGMMR3DECL(int) GMMR3AllocatePagesPrepare(PVM pVM, PGMMALLOCATEPAGESREQ *ppReq, uint32_t cPages, GMMACCOUNT enmAccount);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncGMMR3DECL(int) GMMR3AllocatePagesPerform(PVM pVM, PGMMALLOCATEPAGESREQ pReq);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncGMMR3DECL(void) GMMR3AllocatePagesCleanup(PGMMALLOCATEPAGESREQ pReq);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncGMMR3DECL(int) GMMR3FreePagesPrepare(PVM pVM, PGMMFREEPAGESREQ *ppReq, uint32_t cPages, GMMACCOUNT enmAccount);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncGMMR3DECL(void) GMMR3FreePagesRePrep(PVM pVM, PGMMFREEPAGESREQ pReq, uint32_t cPages, GMMACCOUNT enmAccount);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncGMMR3DECL(int) GMMR3FreePagesPerform(PVM pVM, PGMMFREEPAGESREQ pReq, uint32_t cActualPages);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncGMMR3DECL(void) GMMR3FreePagesCleanup(PGMMFREEPAGESREQ pReq);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncGMMR3DECL(void) GMMR3FreeAllocatedPages(PVM pVM, GMMALLOCATEPAGESREQ const *pAllocReq);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncGMMR3DECL(int) GMMR3AllocateLargePage(PVM pVM, uint32_t cbPage);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncGMMR3DECL(int) GMMR3FreeLargePage(PVM pVM, uint32_t idPage);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncGMMR3DECL(int) GMMR3MapUnmapChunk(PVM pVM, uint32_t idChunkMap, uint32_t idChunkUnmap, PRTR3PTR ppvR3);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncGMMR3DECL(int) GMMR3SeedChunk(PVM pVM, RTR3PTR pvR3);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncGMMR3DECL(int) GMMR3QueryHypervisorMemoryStats(PVM pVM, uint64_t *pcTotalAllocPages, uint64_t *pcTotalFreePages, uint64_t *pcTotalBalloonPages, uint64_t *puTotalBalloonSize);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncGMMR3DECL(int) GMMR3QueryMemoryStats(PVM pVM, uint64_t *pcAllocPages, uint64_t *pcMaxPages, uint64_t *pcBalloonPages);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncGMMR3DECL(int) GMMR3BalloonedPages(PVM pVM, GMMBALLOONACTION enmAction, uint32_t cBalloonedPages);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncGMMR3DECL(int) GMMR3RegisterSharedModule(PVM pVM, PGMMREGISTERSHAREDMODULEREQ pReq);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncGMMR3DECL(int) GMMR3UnregisterSharedModule(PVM pVM, PGMMUNREGISTERSHAREDMODULEREQ pReq);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncGMMR3DECL(int) GMMR3CheckSharedModules(PVM pVM);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncGMMR3DECL(int) GMMR3ResetSharedModules(PVM pVM);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# if defined(VBOX_STRICT) && HC_ARCH_BITS == 64
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncGMMR3DECL(bool) GMMR3IsDuplicatePage(PVM pVM, uint32_t idPage);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @} */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif /* IN_RING3 */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @} */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncRT_C_DECLS_END
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync