1 | /* $Id: GMMR0Internal.h 56287 2015-06-09 11:15:22Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * GMM - The Global Memory Manager, Internal Header.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2007-2015 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/vmm/gmm.h>
|
---|
22 | #include <iprt/avl.h>
|
---|
23 |
|
---|
24 |
|
---|
25 | /**
|
---|
26 | * Shared module registration info (per VM)
|
---|
27 | */
|
---|
28 | typedef struct GMMSHAREDMODULEPERVM
|
---|
29 | {
|
---|
30 | /** Tree node. */
|
---|
31 | AVLGCPTRNODECORE Core;
|
---|
32 | /** Pointer to global shared module info. */
|
---|
33 | PGMMSHAREDMODULE pGlobalModule;
|
---|
34 | /** Pointer to the region addresses.
|
---|
35 | *
|
---|
36 | * They can differe between VMs because of address space scrambling or
|
---|
37 | * simply different loading order. */
|
---|
38 | RTGCPTR64 aRegionsGCPtrs[1];
|
---|
39 | } GMMSHAREDMODULEPERVM;
|
---|
40 | /** Pointer to a GMMSHAREDMODULEPERVM. */
|
---|
41 | typedef GMMSHAREDMODULEPERVM *PGMMSHAREDMODULEPERVM;
|
---|
42 |
|
---|
43 |
|
---|
44 | /** Pointer to a GMM allocation chunk. */
|
---|
45 | typedef struct GMMCHUNK *PGMMCHUNK;
|
---|
46 |
|
---|
47 |
|
---|
48 | /** The GMMCHUNK::cFree shift count employed by gmmR0SelectFreeSetList. */
|
---|
49 | #define GMM_CHUNK_FREE_SET_SHIFT 4
|
---|
50 | /** Index of the list containing completely unused chunks.
|
---|
51 | * The code ASSUMES this is the last list. */
|
---|
52 | #define GMM_CHUNK_FREE_SET_UNUSED_LIST (GMM_CHUNK_NUM_PAGES >> GMM_CHUNK_FREE_SET_SHIFT)
|
---|
53 |
|
---|
54 | /**
|
---|
55 | * A set of free chunks.
|
---|
56 | */
|
---|
57 | typedef struct GMMCHUNKFREESET
|
---|
58 | {
|
---|
59 | /** The number of free pages in the set. */
|
---|
60 | uint64_t cFreePages;
|
---|
61 | /** The generation ID for the set. This is incremented whenever
|
---|
62 | * something is linked or unlinked from this set. */
|
---|
63 | uint64_t idGeneration;
|
---|
64 | /** Chunks ordered by increasing number of free pages.
|
---|
65 | * In the final list the chunks are completely unused. */
|
---|
66 | PGMMCHUNK apLists[GMM_CHUNK_FREE_SET_UNUSED_LIST + 1];
|
---|
67 | } GMMCHUNKFREESET;
|
---|
68 |
|
---|
69 |
|
---|
70 |
|
---|
71 | /**
|
---|
72 | * The per-VM GMM data.
|
---|
73 | */
|
---|
74 | typedef struct GMMPERVM
|
---|
75 | {
|
---|
76 | /** Free set for use in bound mode. */
|
---|
77 | GMMCHUNKFREESET Private;
|
---|
78 | /** The VM statistics. */
|
---|
79 | GMMVMSTATS Stats;
|
---|
80 | /** Shared module tree (per-vm). */
|
---|
81 | PAVLGCPTRNODECORE pSharedModuleTree;
|
---|
82 | /** Hints at the last chunk we allocated some memory from. */
|
---|
83 | uint32_t idLastChunkHint;
|
---|
84 | } GMMPERVM;
|
---|
85 | /** Pointer to the per-VM GMM data. */
|
---|
86 | typedef GMMPERVM *PGMMPERVM;
|
---|
87 |
|
---|
88 | #endif
|
---|
89 |
|
---|