VirtualBox

source: vbox/trunk/include/VBox/vmm/gvm.h@ 76507

Last change on this file since 76507 was 76507, checked in by vboxsync, 6 years ago

/include: scm --fix-header-guards. bugref:9344

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 4.9 KB
Line 
1/* $Id: gvm.h 76507 2018-12-30 03:43:09Z 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#ifndef ___VBox_vmm_gvm_h
28#define ___VBox_vmm_gvm_h
29#ifndef RT_WITHOUT_PRAGMA_ONCE
30# pragma once
31#endif
32
33#include <VBox/types.h>
34#include <iprt/thread.h>
35#include <iprt/assertcompile.h>
36
37
38/** @defgroup grp_gvmcpu GVMCPU - The Global VMCPU Data
39 * @ingroup grp_vmm
40 * @{
41 */
42
43typedef struct GVMCPU
44{
45 /** VCPU id (0 - (pVM->cCpus - 1). */
46 VMCPUID idCpu;
47 /** Padding. */
48 uint32_t uPadding;
49
50 /** Handle to the EMT thread. */
51 RTNATIVETHREAD hEMT;
52
53 /** Pointer to the global (ring-0) VM structure this CPU belongs to. */
54 PGVM pGVM;
55 /** Pointer to the corresponding cross context CPU structure. */
56 PVMCPU pVCpu;
57 /** Pointer to the corresponding cross context VM structure. */
58 PVM pVM;
59
60 /** Padding so gvmm starts on a 64 byte boundrary. */
61 uint8_t abPadding[HC_ARCH_BITS == 32 ? 4*4 + 24 : 24];
62
63 /** The GVMM per vcpu data. */
64 union
65 {
66#ifdef ___GVMMR0Internal_h
67 struct GVMMPERVCPU s;
68#endif
69 uint8_t padding[64];
70 } gvmm;
71
72#ifdef VBOX_WITH_NEM_R0
73 /** The NEM per vcpu data. */
74 union
75 {
76# ifdef ___NEMInternal_h
77 struct NEMR0PERVCPU s;
78# endif
79 uint8_t padding[64];
80 } nem;
81#endif
82} GVMCPU;
83AssertCompileMemberOffset(GVMCPU, gvmm, 64);
84#ifdef VBOX_WITH_NEM_R0
85AssertCompileMemberOffset(GVMCPU, nem, 64 + 64);
86AssertCompileSize( GVMCPU, 64 + 64 + 64);
87#else
88AssertCompileSize( GVMCPU, 64 + 64);
89#endif
90
91/** @} */
92
93/** @defgroup grp_gvm GVM - The Global VM Data
94 * @ingroup grp_vmm
95 * @{
96 */
97
98/**
99 * The Global VM Data.
100 *
101 * This is a ring-0 only structure where we put items we don't need to
102 * share with ring-3 or GC, like for instance various RTR0MEMOBJ handles.
103 *
104 * Unlike VM, there are no special alignment restrictions here. The
105 * paddings are checked by compile time assertions.
106 */
107typedef struct GVM
108{
109 /** Magic / eye-catcher (GVM_MAGIC). */
110 uint32_t u32Magic;
111 /** The global VM handle for this VM. */
112 uint32_t hSelf;
113 /** The ring-0 mapping of the VM structure. */
114 PVM pVM;
115 /** The ring-3 mapping of the VM structure. */
116 PVMR3 pVMR3;
117 /** The support driver session the VM is associated with. */
118 PSUPDRVSESSION pSession;
119 /** Number of Virtual CPUs, i.e. how many entries there are in aCpus.
120 * Same same as VM::cCpus. */
121 uint32_t cCpus;
122 /** Padding so gvmm starts on a 64 byte boundrary. */
123 uint8_t abPadding[HC_ARCH_BITS == 32 ? 12 + 28 : 28];
124
125 /** The GVMM per vm data. */
126 union
127 {
128#ifdef ___GVMMR0Internal_h
129 struct GVMMPERVM s;
130#endif
131 uint8_t padding[256];
132 } gvmm;
133
134 /** The GMM per vm data. */
135 union
136 {
137#ifdef ___GMMR0Internal_h
138 struct GMMPERVM s;
139#endif
140 uint8_t padding[512];
141 } gmm;
142
143#ifdef VBOX_WITH_NEM_R0
144 /** The NEM per vcpu data. */
145 union
146 {
147# ifdef ___NEMInternal_h
148 struct NEMR0PERVM s;
149# endif
150 uint8_t padding[256];
151 } nem;
152#endif
153
154 /** The RAWPCIVM per vm data. */
155 union
156 {
157#ifdef ___VBox_rawpci_h
158 struct RAWPCIPERVM s;
159#endif
160 uint8_t padding[64];
161 } rawpci;
162
163 /** GVMCPU array for the configured number of virtual CPUs. */
164 GVMCPU aCpus[1];
165} GVM;
166AssertCompileMemberOffset(GVM, gvmm, 64);
167AssertCompileMemberOffset(GVM, gmm, 64 + 256);
168#ifdef VBOX_WITH_NEM_R0
169AssertCompileMemberOffset(GVM, nem, 64 + 256 + 512);
170AssertCompileMemberOffset(GVM, rawpci, 64 + 256 + 512 + 256);
171AssertCompileMemberOffset(GVM, aCpus, 64 + 256 + 512 + 256 + 64);
172#else
173AssertCompileMemberOffset(GVM, rawpci, 64 + 256 + 512);
174AssertCompileMemberOffset(GVM, aCpus, 64 + 256 + 512 + 64);
175#endif
176
177/** The GVM::u32Magic value (Wayne Shorter). */
178#define GVM_MAGIC 0x19330825
179
180/** @} */
181
182#endif
183
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette