VirtualBox

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

Last change on this file since 73285 was 72300, checked in by vboxsync, 7 years ago

NEM,STAM: Partition memory statistics for NEM. bugref:9044

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