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