1 | /* $Id: GMMR0Internal.h 30664 2010-07-06 12:23:56Z 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 | */
|
---|
27 | typedef 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. */
|
---|
38 | typedef GMMVMSIZES *PGMMVMSIZES;
|
---|
39 |
|
---|
40 |
|
---|
41 | /**
|
---|
42 | * Shared module registration info (per VM)
|
---|
43 | */
|
---|
44 | typedef struct GMMSHAREDMODULEPERVM
|
---|
45 | {
|
---|
46 | /** Tree node. */
|
---|
47 | AVLGCPTRNODECORE Core;
|
---|
48 |
|
---|
49 | /** Pointer to global shared module info. */
|
---|
50 | PGMMSHAREDMODULE pGlobalModule;
|
---|
51 |
|
---|
52 | /** Set if another VM registered a different shared module at the same base address. */
|
---|
53 | bool fCollision;
|
---|
54 | /** Alignment. */
|
---|
55 | bool bAlignment[3];
|
---|
56 |
|
---|
57 | /** Number of included region descriptors */
|
---|
58 | uint32_t cRegions;
|
---|
59 |
|
---|
60 | /** Shared region descriptor(s). */
|
---|
61 | GMMSHAREDREGIONDESC aRegions[1];
|
---|
62 | } GMMSHAREDMODULEPERVM;
|
---|
63 | /** Pointer to a GMMSHAREDMODULEPERVM. */
|
---|
64 | typedef GMMSHAREDMODULEPERVM *PGMMSHAREDMODULEPERVM;
|
---|
65 |
|
---|
66 | /**
|
---|
67 | * The per-VM GMM data.
|
---|
68 | */
|
---|
69 | typedef struct GMMPERVM
|
---|
70 | {
|
---|
71 | /** The reservations. */
|
---|
72 | GMMVMSIZES Reserved;
|
---|
73 | /** The actual allocations.
|
---|
74 | * This includes both private and shared page allocations. */
|
---|
75 | GMMVMSIZES Allocated;
|
---|
76 |
|
---|
77 | /** The current number of private pages. */
|
---|
78 | uint64_t cPrivatePages;
|
---|
79 | /** The current number of shared pages. */
|
---|
80 | uint64_t cSharedPages;
|
---|
81 | /** The current over-comitment policy. */
|
---|
82 | GMMOCPOLICY enmPolicy;
|
---|
83 | /** The VM priority for arbitrating VMs in low and out of memory situation.
|
---|
84 | * Like which VMs to start sequeezing first. */
|
---|
85 | GMMPRIORITY enmPriority;
|
---|
86 |
|
---|
87 | /** The current number of ballooned pages. */
|
---|
88 | uint64_t cBalloonedPages;
|
---|
89 | /** The max number of pages that can be ballooned. */
|
---|
90 | uint64_t cMaxBalloonedPages;
|
---|
91 | /** The number of pages we've currently requested the guest to give us.
|
---|
92 | * This is 0 if no pages currently requested. */
|
---|
93 | uint64_t cReqBalloonedPages;
|
---|
94 | /** The number of pages the guest has given us in response to the request.
|
---|
95 | * This is not reset on request completed and may be used in later decisions. */
|
---|
96 | uint64_t cReqActuallyBalloonedPages;
|
---|
97 | /** The number of pages we've currently requested the guest to take back. */
|
---|
98 | uint64_t cReqDeflatePages;
|
---|
99 |
|
---|
100 | /** Shared module tree (per-vm). */
|
---|
101 | PAVLGCPTRNODECORE pSharedModuleTree;
|
---|
102 |
|
---|
103 | /** Whether ballooning is enabled or not. */
|
---|
104 | bool fBallooningEnabled;
|
---|
105 |
|
---|
106 | /** Whether shared paging is enabled or not. */
|
---|
107 | bool fSharedPagingEnabled;
|
---|
108 |
|
---|
109 | /** Whether the VM is allowed to allocate memory or not.
|
---|
110 | * This is used when the reservation update request fails or when the VM has
|
---|
111 | * been told to suspend/save/die in an out-of-memory case. */
|
---|
112 | bool fMayAllocate;
|
---|
113 | } GMMPERVM;
|
---|
114 | /** Pointer to the per-VM GMM data. */
|
---|
115 | typedef GMMPERVM *PGMMPERVM;
|
---|
116 |
|
---|
117 | #endif
|
---|
118 |
|
---|