VirtualBox

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

Last change on this file since 29138 was 29138, 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.2 KB
Line 
1/* $Id: GMMR0Internal.h 29138 2010-05-06 11:49:48Z 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 address array. */
52 PRTHCPHYS paHCPhysAndPageID;
53} GMMSHAREDREGIONDESC;
54/** Pointer to a GMMSHAREDREGIONDESC. */
55typedef GMMSHAREDREGIONDESC *PGMMSHAREDREGIONDESC;
56
57/**
58 * Shared module registration info (global)
59 */
60typedef struct GMMSHAREDMODULE
61{
62 /* Tree node. */
63 AVLGCPTRNODECORE Core;
64 /** Shared module size. */
65 uint32_t cbModule;
66 /** Number of included region descriptors */
67 uint32_t cRegions;
68 /** Number of users (VMs). */
69 uint32_t cUsers;
70 /** Align. */
71 uint32_t u32Align;
72 /** Module name */
73 char szName[GMM_SHARED_MODULE_MAX_NAME_STRING];
74 /** Module version */
75 char szVersion[GMM_SHARED_MODULE_MAX_VERSION_STRING];
76 /** Shared region descriptor(s). */
77 GMMSHAREDREGIONDESC aRegions[1];
78} GMMSHAREDMODULE;
79/** Pointer to a GMMSHAREDMODULE. */
80typedef GMMSHAREDMODULE *PGMMSHAREDMODULE;
81
82/**
83 * Shared module registration info (per VM)
84 */
85typedef struct GMMSHAREDMODULEPERVM
86{
87 /* Tree node. */
88 AVLGCPTRNODECORE Core;
89
90 /* Pointer to global shared module info. */
91 PGMMSHAREDMODULE pSharedModule;
92
93 /* Set if another VM registered a different shared module at the same base address. */
94 bool fCollision;
95 /** Align at 8 byte boundary */
96 bool abAlignment[7];
97
98 /** Number of regions in the aRegions array. */
99 unsigned cRegions;
100
101 /** Shared region descriptor(s). */
102 GMMSHAREDREGIONDESC aRegions[1];
103} GMMSHAREDMODULEPERVM;
104/** Pointer to a GMMSHAREDMODULEPERVM. */
105typedef GMMSHAREDMODULEPERVM *PGMMSHAREDMODULEPERVM;
106
107/**
108 * The per-VM GMM data.
109 */
110typedef struct GMMPERVM
111{
112 /** The reservations. */
113 GMMVMSIZES Reserved;
114 /** The actual allocations.
115 * This includes both private and shared page allocations. */
116 GMMVMSIZES Allocated;
117
118 /** The current number of private pages. */
119 uint64_t cPrivatePages;
120 /** The current number of shared pages. */
121 uint64_t cSharedPages;
122 /** The current over-comitment policy. */
123 GMMOCPOLICY enmPolicy;
124 /** The VM priority for arbitrating VMs in low and out of memory situation.
125 * Like which VMs to start sequeezing first. */
126 GMMPRIORITY enmPriority;
127
128 /** The current number of ballooned pages. */
129 uint64_t cBalloonedPages;
130 /** The max number of pages that can be ballooned. */
131 uint64_t cMaxBalloonedPages;
132 /** The number of pages we've currently requested the guest to give us.
133 * This is 0 if no pages currently requested. */
134 uint64_t cReqBalloonedPages;
135 /** The number of pages the guest has given us in response to the request.
136 * This is not reset on request completed and may be used in later decisions. */
137 uint64_t cReqActuallyBalloonedPages;
138 /** The number of pages we've currently requested the guest to take back. */
139 uint64_t cReqDeflatePages;
140
141 /** Shared module tree (per-vm). */
142 PAVLGCPTRNODECORE pSharedModuleTree;
143
144 /** Whether ballooning is enabled or not. */
145 bool fBallooningEnabled;
146
147 /** Whether shared paging is enabled or not. */
148 bool fSharedPagingEnabled;
149
150 /** Whether the VM is allowed to allocate memory or not.
151 * This is used when the reservation update request fails or when the VM has
152 * been told to suspend/save/die in an out-of-memory case. */
153 bool fMayAllocate;
154} GMMPERVM;
155/** Pointer to the per-VM GMM data. */
156typedef GMMPERVM *PGMMPERVM;
157
158#endif
159
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