1 | /** @file
|
---|
2 | * GMM - The Global Memory Manager.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2007 InnoTek Systemberatung GmbH
|
---|
7 | *
|
---|
8 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
9 | * available from http://www.virtualbox.org. This file is free software;
|
---|
10 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
11 | * General Public License as published by the Free Software Foundation,
|
---|
12 | * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
|
---|
13 | * distribution. VirtualBox OSE is distributed in the hope that it will
|
---|
14 | * be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
15 | *
|
---|
16 | */
|
---|
17 |
|
---|
18 | #ifndef ___VBox_gmm_h
|
---|
19 | #define ___VBox_gmm_h
|
---|
20 |
|
---|
21 | #include <VBox/types.h>
|
---|
22 | #include <VBox/gvmm.h>
|
---|
23 |
|
---|
24 |
|
---|
25 | /** @defgroup grp_gmm GMM - The Global Memory Manager
|
---|
26 | * @{
|
---|
27 | */
|
---|
28 |
|
---|
29 | /** @def IN_GMM_R0
|
---|
30 | * Used to indicate whether we're inside the same link module as the ring 0
|
---|
31 | * part of the Global Memory Manager or not.
|
---|
32 | */
|
---|
33 | /** @def GMMR0DECL
|
---|
34 | * Ring 0 GMM export or import declaration.
|
---|
35 | * @param type The return type of the function declaration.
|
---|
36 | */
|
---|
37 | #ifdef IN_GMM_R0
|
---|
38 | # define GMMR0DECL(type) DECLEXPORT(type) VBOXCALL
|
---|
39 | #else
|
---|
40 | # define GMMR0DECL(type) DECLIMPORT(type) VBOXCALL
|
---|
41 | #endif
|
---|
42 |
|
---|
43 |
|
---|
44 | /** The chunk shift. (2^20 = 1 MB) */
|
---|
45 | #define GMM_CHUNK_SHIFT 20
|
---|
46 | /** The allocation chunk size. */
|
---|
47 | #define GMM_CHUNK_SIZE (1U << GMM_CHUNK_SHIFT)
|
---|
48 | /** The shift factor for converting a page id into a chunk id. */
|
---|
49 | #define GMM_CHUNKID_SHIFT (GMM_CHUNK_SHIFT - PAGE_SHIFT)
|
---|
50 | /** The NIL Chunk ID value. */
|
---|
51 | #define NIL_GMM_CHUNKID 0
|
---|
52 | /** The NIL Page ID value. */
|
---|
53 | #define NIL_GMM_PAGEID 0
|
---|
54 |
|
---|
55 |
|
---|
56 | /**
|
---|
57 | * Over-commitment policy.
|
---|
58 | */
|
---|
59 | typedef enum GMMOCPOLICY
|
---|
60 | {
|
---|
61 | /** The usual invalid 0 value. */
|
---|
62 | GMMOCPOLICY_INVALID = 0,
|
---|
63 | /** No over-commitment, fully backed.
|
---|
64 | * The GMM guarantees that it will be able to allocate all of the
|
---|
65 | * guest RAM for a VM with OC policy. */
|
---|
66 | GMMOCPOLICY_NO_OC,
|
---|
67 | /** to-be-determined. */
|
---|
68 | GMMOCPOLICY_TBD,
|
---|
69 | /** The end of the valid policy range. */
|
---|
70 | GMMOCPOLICY_END,
|
---|
71 | /** The usual 32-bit hack. */
|
---|
72 | GMMOCPOLICY_32BIT_HACK = 0x7fffffff
|
---|
73 | } GMMOCPOLICY;
|
---|
74 |
|
---|
75 | /**
|
---|
76 | * VM / Memory priority.
|
---|
77 | */
|
---|
78 | typedef enum GMMPRIORITY
|
---|
79 | {
|
---|
80 | /** The usual invalid 0 value. */
|
---|
81 | GMMPRIORITY_INVALID = 0,
|
---|
82 | /** High - avoid interrupting it if at all possible */
|
---|
83 | GMMPRIORITY_HIGH,
|
---|
84 | /** Normal - pause, save it or kill it. */
|
---|
85 | GMMPRIORITY_NORMAL,
|
---|
86 | /** Low - save or kill it. */
|
---|
87 | GMMPRIORITY_LOW,
|
---|
88 | /** The end of the valid priority range. */
|
---|
89 | GMMPRIORITY_END = 0,
|
---|
90 | /** The custom 32-bit type blowup. */
|
---|
91 | GMMPRIORITY_32BIT_HACK = 0x7fffffff
|
---|
92 | } GMMPRIORITY;
|
---|
93 |
|
---|
94 |
|
---|
95 | /** @} */
|
---|
96 |
|
---|
97 | #endif
|
---|
98 |
|
---|