1 | /* $Id: gvm.h 71075 2018-02-20 21:10:45Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * GVM - The Global VM Data.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2007-2017 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 | * The contents of this file may alternatively be used under the terms
|
---|
18 | * of the Common Development and Distribution License Version 1.0
|
---|
19 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
20 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
21 | * CDDL are applicable instead of those of the GPL.
|
---|
22 | *
|
---|
23 | * You may elect to license modified versions of this file under the
|
---|
24 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
25 | */
|
---|
26 |
|
---|
27 |
|
---|
28 | #ifndef ___VBox_vmm_gvm_h
|
---|
29 | #define ___VBox_vmm_gvm_h
|
---|
30 |
|
---|
31 | #include <VBox/types.h>
|
---|
32 | #include <iprt/thread.h>
|
---|
33 |
|
---|
34 |
|
---|
35 | /** @defgroup grp_gvmcpu GVMCPU - The Global VMCPU Data
|
---|
36 | * @ingroup grp_vmm
|
---|
37 | * @{
|
---|
38 | */
|
---|
39 |
|
---|
40 | typedef struct GVMCPU
|
---|
41 | {
|
---|
42 | /** VCPU id (0 - (pVM->cCpus - 1). */
|
---|
43 | VMCPUID idCpu;
|
---|
44 |
|
---|
45 | /** Handle to the EMT thread. */
|
---|
46 | RTNATIVETHREAD hEMT;
|
---|
47 |
|
---|
48 | /** The GVMM per vcpu data. */
|
---|
49 | union
|
---|
50 | {
|
---|
51 | #ifdef ___GVMMR0Internal_h
|
---|
52 | struct GVMMPERVCPU s;
|
---|
53 | #endif
|
---|
54 | uint8_t padding[64];
|
---|
55 | } gvmm;
|
---|
56 |
|
---|
57 | #ifdef VBOX_WITH_NEM_R0
|
---|
58 | /** The NEM per vcpu data. */
|
---|
59 | union
|
---|
60 | {
|
---|
61 | # ifdef ___NEMInternal_h
|
---|
62 | struct NEMR0PERVCPU s;
|
---|
63 | # endif
|
---|
64 | uint8_t padding[64];
|
---|
65 | } nem;
|
---|
66 | #endif
|
---|
67 | } GVMCPU;
|
---|
68 | /** Pointer to the GVMCPU data. */
|
---|
69 | typedef GVMCPU *PGVMCPU;
|
---|
70 |
|
---|
71 | /** @} */
|
---|
72 |
|
---|
73 | /** @defgroup grp_gvm GVM - The Global VM Data
|
---|
74 | * @ingroup grp_vmm
|
---|
75 | * @{
|
---|
76 | */
|
---|
77 |
|
---|
78 | /**
|
---|
79 | * The Global VM Data.
|
---|
80 | *
|
---|
81 | * This is a ring-0 only structure where we put items we don't need to
|
---|
82 | * share with ring-3 or GC, like for instance various RTR0MEMOBJ handles.
|
---|
83 | *
|
---|
84 | * Unlike VM, there are no special alignment restrictions here. The
|
---|
85 | * paddings are checked by compile time assertions.
|
---|
86 | */
|
---|
87 | typedef struct GVM
|
---|
88 | {
|
---|
89 | /** Magic / eye-catcher (GVM_MAGIC). */
|
---|
90 | uint32_t u32Magic;
|
---|
91 | /** The global VM handle for this VM. */
|
---|
92 | uint32_t hSelf;
|
---|
93 | /** The ring-0 mapping of the VM structure. */
|
---|
94 | PVM pVM;
|
---|
95 | /** The support driver session the VM is associated with. */
|
---|
96 | PSUPDRVSESSION pSession;
|
---|
97 | /** Number of Virtual CPUs, i.e. how many entries there are in aCpus.
|
---|
98 | * Same same as VM::cCpus. */
|
---|
99 | uint32_t cCpus;
|
---|
100 | uint32_t padding;
|
---|
101 |
|
---|
102 | /** The GVMM per vm data. */
|
---|
103 | union
|
---|
104 | {
|
---|
105 | #ifdef ___GVMMR0Internal_h
|
---|
106 | struct GVMMPERVM s;
|
---|
107 | #endif
|
---|
108 | uint8_t padding[256];
|
---|
109 | } gvmm;
|
---|
110 |
|
---|
111 | /** The GMM per vm data. */
|
---|
112 | union
|
---|
113 | {
|
---|
114 | #ifdef ___GMMR0Internal_h
|
---|
115 | struct GMMPERVM s;
|
---|
116 | #endif
|
---|
117 | uint8_t padding[512];
|
---|
118 | } gmm;
|
---|
119 |
|
---|
120 | #ifdef VBOX_WITH_NEM_R0
|
---|
121 | /** The NEM per vcpu data. */
|
---|
122 | union
|
---|
123 | {
|
---|
124 | # ifdef ___NEMInternal_h
|
---|
125 | struct NEMR0PERVM s;
|
---|
126 | # endif
|
---|
127 | uint8_t padding[64];
|
---|
128 | } nem;
|
---|
129 | #endif
|
---|
130 |
|
---|
131 | /** The RAWPCIVM per vm data. */
|
---|
132 | union
|
---|
133 | {
|
---|
134 | #ifdef ___VBox_rawpci_h
|
---|
135 | struct RAWPCIPERVM s;
|
---|
136 | #endif
|
---|
137 | uint8_t padding[64];
|
---|
138 | } rawpci;
|
---|
139 |
|
---|
140 | /** GVMCPU array for the configured number of virtual CPUs. */
|
---|
141 | GVMCPU aCpus[1];
|
---|
142 | } GVM;
|
---|
143 |
|
---|
144 | /** The GVM::u32Magic value (Wayne Shorter). */
|
---|
145 | #define GVM_MAGIC 0x19330825
|
---|
146 |
|
---|
147 | /** @} */
|
---|
148 |
|
---|
149 | #endif
|
---|
150 |
|
---|