1 | /* $Id: gvm.h 71222 2018-03-05 22:07:48Z 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 | /** Pointer to the global (ring-0) VM structure this CPU belongs to. */
|
---|
49 | PGVM pGVM;
|
---|
50 | /** Pointer to the corresponding cross context CPU structure. */
|
---|
51 | PVMCPU pVCpu;
|
---|
52 | /** Pointer to the corresponding cross context VM structure. */
|
---|
53 | PVM pVM;
|
---|
54 |
|
---|
55 | /** The GVMM per vcpu data. */
|
---|
56 | union
|
---|
57 | {
|
---|
58 | #ifdef ___GVMMR0Internal_h
|
---|
59 | struct GVMMPERVCPU s;
|
---|
60 | #endif
|
---|
61 | uint8_t padding[64];
|
---|
62 | } gvmm;
|
---|
63 |
|
---|
64 | #ifdef VBOX_WITH_NEM_R0
|
---|
65 | /** The NEM per vcpu data. */
|
---|
66 | union
|
---|
67 | {
|
---|
68 | # ifdef ___NEMInternal_h
|
---|
69 | struct NEMR0PERVCPU s;
|
---|
70 | # endif
|
---|
71 | uint8_t padding[64];
|
---|
72 | } nem;
|
---|
73 | #endif
|
---|
74 | } GVMCPU;
|
---|
75 |
|
---|
76 | /** @} */
|
---|
77 |
|
---|
78 | /** @defgroup grp_gvm GVM - The Global VM Data
|
---|
79 | * @ingroup grp_vmm
|
---|
80 | * @{
|
---|
81 | */
|
---|
82 |
|
---|
83 | /**
|
---|
84 | * The Global VM Data.
|
---|
85 | *
|
---|
86 | * This is a ring-0 only structure where we put items we don't need to
|
---|
87 | * share with ring-3 or GC, like for instance various RTR0MEMOBJ handles.
|
---|
88 | *
|
---|
89 | * Unlike VM, there are no special alignment restrictions here. The
|
---|
90 | * paddings are checked by compile time assertions.
|
---|
91 | */
|
---|
92 | typedef struct GVM
|
---|
93 | {
|
---|
94 | /** Magic / eye-catcher (GVM_MAGIC). */
|
---|
95 | uint32_t u32Magic;
|
---|
96 | /** The global VM handle for this VM. */
|
---|
97 | uint32_t hSelf;
|
---|
98 | /** The ring-0 mapping of the VM structure. */
|
---|
99 | PVM pVM;
|
---|
100 | /** The ring-3 mapping of the VM structure. */
|
---|
101 | PVMR3 pVMR3;
|
---|
102 | /** The support driver session the VM is associated with. */
|
---|
103 | PSUPDRVSESSION pSession;
|
---|
104 | /** Number of Virtual CPUs, i.e. how many entries there are in aCpus.
|
---|
105 | * Same same as VM::cCpus. */
|
---|
106 | uint32_t cCpus;
|
---|
107 | uint32_t padding;
|
---|
108 |
|
---|
109 | /** The GVMM per vm data. */
|
---|
110 | union
|
---|
111 | {
|
---|
112 | #ifdef ___GVMMR0Internal_h
|
---|
113 | struct GVMMPERVM s;
|
---|
114 | #endif
|
---|
115 | uint8_t padding[256];
|
---|
116 | } gvmm;
|
---|
117 |
|
---|
118 | /** The GMM per vm data. */
|
---|
119 | union
|
---|
120 | {
|
---|
121 | #ifdef ___GMMR0Internal_h
|
---|
122 | struct GMMPERVM s;
|
---|
123 | #endif
|
---|
124 | uint8_t padding[512];
|
---|
125 | } gmm;
|
---|
126 |
|
---|
127 | #ifdef VBOX_WITH_NEM_R0
|
---|
128 | /** The NEM per vcpu data. */
|
---|
129 | union
|
---|
130 | {
|
---|
131 | # ifdef ___NEMInternal_h
|
---|
132 | struct NEMR0PERVM s;
|
---|
133 | # endif
|
---|
134 | uint8_t padding[128];
|
---|
135 | } nem;
|
---|
136 | #endif
|
---|
137 |
|
---|
138 | /** The RAWPCIVM per vm data. */
|
---|
139 | union
|
---|
140 | {
|
---|
141 | #ifdef ___VBox_rawpci_h
|
---|
142 | struct RAWPCIPERVM s;
|
---|
143 | #endif
|
---|
144 | uint8_t padding[64];
|
---|
145 | } rawpci;
|
---|
146 |
|
---|
147 | /** GVMCPU array for the configured number of virtual CPUs. */
|
---|
148 | GVMCPU aCpus[1];
|
---|
149 | } GVM;
|
---|
150 |
|
---|
151 | /** The GVM::u32Magic value (Wayne Shorter). */
|
---|
152 | #define GVM_MAGIC 0x19330825
|
---|
153 |
|
---|
154 | /** @} */
|
---|
155 |
|
---|
156 | #endif
|
---|
157 |
|
---|