VirtualBox

source: vbox/trunk/src/VBox/VMM/VMMR0/GMMR0Internal.h@ 29287

Last change on this file since 29287 was 29201, checked in by vboxsync, 15 years ago

Shared paging updates

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 5.0 KB
Line 
1/* $Id: GMMR0Internal.h 29201 2010-05-07 12:24:54Z vboxsync $ */
2/** @file
3 * GMM - The Global Memory Manager, Internal Header.
4 */
5
6/*
7 * Copyright (C) 2007 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#ifndef ___GMMR0Internal_h
19#define ___GMMR0Internal_h
20
21#include <VBox/gmm.h>
22#include <iprt/avl.h>
23
24/**
25 * The allocation sizes.
26 */
27typedef struct GMMVMSIZES
28{
29 /** The number of pages of base memory.
30 * This is the sum of RAM, ROMs and handy pages. */
31 uint64_t cBasePages;
32 /** The number of pages for the shadow pool. (Can be sequeezed for memory.) */
33 uint32_t cShadowPages;
34 /** The number of pages for fixed allocations like MMIO2 and the hyper heap. */
35 uint32_t cFixedPages;
36} GMMVMSIZES;
37/** Pointer to a GMMVMSIZES. */
38typedef GMMVMSIZES *PGMMVMSIZES;
39
40/**
41 * Shared region descriptor
42 */
43typedef struct GMMSHAREDREGIONDESC
44{
45 /** Region base address. */
46 RTGCPTR64 GCRegionAddr;
47 /** Region size. */
48 uint32_t cbRegion;
49 /** Alignment. */
50 uint32_t u32Alignment;
51 /** Pointer to physical page id array. */
52 uint32_t *paHCPhysPageID;
53} GMMSHAREDREGIONDESC;
54/** Pointer to a GMMSHAREDREGIONDESC. */
55typedef GMMSHAREDREGIONDESC *PGMMSHAREDREGIONDESC;
56
57
58/**
59 * Shared module registration info (global)
60 */
61typedef struct GMMSHAREDMODULE
62{
63 /* Tree node. */
64 AVLGCPTRNODECORE Core;
65 /** Shared module size. */
66 uint32_t cbModule;
67 /** Number of included region descriptors */
68 uint32_t cRegions;
69 /** Number of users (VMs). */
70 uint32_t cUsers;
71 /** Align. */
72 uint32_t u32Align;
73 /** Module name */
74 char szName[GMM_SHARED_MODULE_MAX_NAME_STRING];
75 /** Module version */
76 char szVersion[GMM_SHARED_MODULE_MAX_VERSION_STRING];
77 /** Shared region descriptor(s). */
78 GMMSHAREDREGIONDESC aRegions[1];
79} GMMSHAREDMODULE;
80/** Pointer to a GMMSHAREDMODULE. */
81typedef GMMSHAREDMODULE *PGMMSHAREDMODULE;
82
83/**
84 * Shared module registration info (per VM)
85 */
86typedef struct GMMSHAREDMODULEPERVM
87{
88 /** Tree node. */
89 AVLGCPTRNODECORE Core;
90
91 /** Pointer to global shared module info. */
92 PGMMSHAREDMODULE pGlobalModule;
93
94 /** Set if another VM registered a different shared module at the same base address. */
95 bool fCollision;
96 /** Alignment. */
97 bool bAlignment[7];
98} GMMSHAREDMODULEPERVM;
99/** Pointer to a GMMSHAREDMODULEPERVM. */
100typedef GMMSHAREDMODULEPERVM *PGMMSHAREDMODULEPERVM;
101
102/**
103 * The per-VM GMM data.
104 */
105typedef struct GMMPERVM
106{
107 /** The reservations. */
108 GMMVMSIZES Reserved;
109 /** The actual allocations.
110 * This includes both private and shared page allocations. */
111 GMMVMSIZES Allocated;
112
113 /** The current number of private pages. */
114 uint64_t cPrivatePages;
115 /** The current number of shared pages. */
116 uint64_t cSharedPages;
117 /** The current over-comitment policy. */
118 GMMOCPOLICY enmPolicy;
119 /** The VM priority for arbitrating VMs in low and out of memory situation.
120 * Like which VMs to start sequeezing first. */
121 GMMPRIORITY enmPriority;
122
123 /** The current number of ballooned pages. */
124 uint64_t cBalloonedPages;
125 /** The max number of pages that can be ballooned. */
126 uint64_t cMaxBalloonedPages;
127 /** The number of pages we've currently requested the guest to give us.
128 * This is 0 if no pages currently requested. */
129 uint64_t cReqBalloonedPages;
130 /** The number of pages the guest has given us in response to the request.
131 * This is not reset on request completed and may be used in later decisions. */
132 uint64_t cReqActuallyBalloonedPages;
133 /** The number of pages we've currently requested the guest to take back. */
134 uint64_t cReqDeflatePages;
135
136 /** Shared module tree (per-vm). */
137 PAVLGCPTRNODECORE pSharedModuleTree;
138
139 /** Whether ballooning is enabled or not. */
140 bool fBallooningEnabled;
141
142 /** Whether shared paging is enabled or not. */
143 bool fSharedPagingEnabled;
144
145 /** Whether the VM is allowed to allocate memory or not.
146 * This is used when the reservation update request fails or when the VM has
147 * been told to suspend/save/die in an out-of-memory case. */
148 bool fMayAllocate;
149} GMMPERVM;
150/** Pointer to the per-VM GMM data. */
151typedef GMMPERVM *PGMMPERVM;
152
153#endif
154
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette