VirtualBox

source: vbox/trunk/include/VBox/vmm/pgm.h@ 96407

Last change on this file since 96407 was 96407, checked in by vboxsync, 2 years ago

scm copyright and license note update

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 52.8 KB
Line 
1/** @file
2 * PGM - Page Monitor / Monitor.
3 */
4
5/*
6 * Copyright (C) 2006-2022 Oracle and/or its affiliates.
7 *
8 * This file is part of VirtualBox base platform packages, as
9 * available from https://www.virtualbox.org.
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation, in version 3 of the
14 * License.
15 *
16 * This program is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, see <https://www.gnu.org/licenses>.
23 *
24 * The contents of this file may alternatively be used under the terms
25 * of the Common Development and Distribution License Version 1.0
26 * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
27 * in the VirtualBox distribution, in which case the provisions of the
28 * CDDL are applicable instead of those of the GPL.
29 *
30 * You may elect to license modified versions of this file under the
31 * terms and conditions of either the GPL or the CDDL or both.
32 *
33 * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
34 */
35
36#ifndef VBOX_INCLUDED_vmm_pgm_h
37#define VBOX_INCLUDED_vmm_pgm_h
38#ifndef RT_WITHOUT_PRAGMA_ONCE
39# pragma once
40#endif
41
42#include <VBox/types.h>
43#include <VBox/sup.h>
44#include <VBox/vmm/vmapi.h>
45#include <VBox/vmm/gmm.h> /* for PGMMREGISTERSHAREDMODULEREQ */
46#include <VBox/vmm/hm_vmx.h>
47#include <iprt/x86.h>
48#include <VBox/param.h>
49
50RT_C_DECLS_BEGIN
51
52/** @defgroup grp_pgm The Page Monitor / Manager API
53 * @ingroup grp_vmm
54 * @{
55 */
56
57/**
58 * FNPGMRELOCATE callback mode.
59 */
60typedef enum PGMRELOCATECALL
61{
62 /** The callback is for checking if the suggested address is suitable. */
63 PGMRELOCATECALL_SUGGEST = 1,
64 /** The callback is for executing the relocation. */
65 PGMRELOCATECALL_RELOCATE
66} PGMRELOCATECALL;
67
68
69/**
70 * Callback function which will be called when PGM is trying to find
71 * a new location for the mapping.
72 *
73 * The callback is called in two modes, 1) the check mode and 2) the relocate mode.
74 * In 1) the callback should say if it objects to a suggested new location. If it
75 * accepts the new location, it is called again for doing it's relocation.
76 *
77 *
78 * @returns true if the location is ok.
79 * @returns false if another location should be found.
80 * @param pVM The cross context VM structure.
81 * @param GCPtrOld The old virtual address.
82 * @param GCPtrNew The new virtual address.
83 * @param enmMode Used to indicate the callback mode.
84 * @param pvUser User argument.
85 * @remark The return value is no a failure indicator, it's an acceptance
86 * indicator. Relocation can not fail!
87 */
88typedef DECLCALLBACKTYPE(bool, FNPGMRELOCATE,(PVM pVM, RTGCPTR GCPtrOld, RTGCPTR GCPtrNew, PGMRELOCATECALL enmMode, void *pvUser));
89/** Pointer to a relocation callback function. */
90typedef FNPGMRELOCATE *PFNPGMRELOCATE;
91
92
93/**
94 * Memory access origin.
95 */
96typedef enum PGMACCESSORIGIN
97{
98 /** Invalid zero value. */
99 PGMACCESSORIGIN_INVALID = 0,
100 /** IEM is access memory. */
101 PGMACCESSORIGIN_IEM,
102 /** HM is access memory. */
103 PGMACCESSORIGIN_HM,
104 /** Some device is access memory. */
105 PGMACCESSORIGIN_DEVICE,
106 /** Someone debugging is access memory. */
107 PGMACCESSORIGIN_DEBUGGER,
108 /** SELM is access memory. */
109 PGMACCESSORIGIN_SELM,
110 /** FTM is access memory. */
111 PGMACCESSORIGIN_FTM,
112 /** REM is access memory. */
113 PGMACCESSORIGIN_REM,
114 /** IOM is access memory. */
115 PGMACCESSORIGIN_IOM,
116 /** End of valid values. */
117 PGMACCESSORIGIN_END,
118 /** Type size hack. */
119 PGMACCESSORIGIN_32BIT_HACK = 0x7fffffff
120} PGMACCESSORIGIN;
121
122
123/**
124 * Physical page access handler kind.
125 */
126typedef enum PGMPHYSHANDLERKIND
127{
128 /** Invalid zero value. */
129 PGMPHYSHANDLERKIND_INVALID = 0,
130 /** MMIO range. Pages are not present, all access is done in interpreter or recompiler. */
131 PGMPHYSHANDLERKIND_MMIO,
132 /** Handler all write access to a physical page range. */
133 PGMPHYSHANDLERKIND_WRITE,
134 /** Handler all access to a physical page range. */
135 PGMPHYSHANDLERKIND_ALL,
136 /** End of the valid values. */
137 PGMPHYSHANDLERKIND_END,
138 /** Type size hack. */
139 PGMPHYSHANDLERKIND_32BIT_HACK = 0x7fffffff
140} PGMPHYSHANDLERKIND;
141
142/**
143 * Guest Access type
144 */
145typedef enum PGMACCESSTYPE
146{
147 /** Read access. */
148 PGMACCESSTYPE_READ = 1,
149 /** Write access. */
150 PGMACCESSTYPE_WRITE
151} PGMACCESSTYPE;
152
153
154/** @def PGM_ALL_CB_DECL
155 * Macro for declaring a handler callback for all contexts. The handler
156 * callback is static in ring-3, and exported in RC and R0.
157 * @sa PGM_ALL_CB2_DECL.
158 */
159#if defined(IN_RC) || defined(IN_RING0)
160# ifdef __cplusplus
161# define PGM_ALL_CB_DECL(type) extern "C" DECLCALLBACK(DECLEXPORT(type))
162# else
163# define PGM_ALL_CB_DECL(type) DECLCALLBACK(DECLEXPORT(type))
164# endif
165#else
166# define PGM_ALL_CB_DECL(type) static DECLCALLBACK(type)
167#endif
168
169/** @def PGM_ALL_CB2_DECL
170 * Macro for declaring a handler callback for all contexts. The handler
171 * callback is hidden in ring-3, and exported in RC and R0.
172 * @sa PGM_ALL_CB2_DECL.
173 */
174#if defined(IN_RC) || defined(IN_RING0)
175# ifdef __cplusplus
176# define PGM_ALL_CB2_DECL(type) extern "C" DECLCALLBACK(DECLEXPORT(type))
177# else
178# define PGM_ALL_CB2_DECL(type) DECLCALLBACK(DECLEXPORT(type))
179# endif
180#else
181# define PGM_ALL_CB2_DECL(type) DECL_HIDDEN_CALLBACK(type)
182#endif
183
184/** @def PGM_ALL_CB2_PROTO
185 * Macro for declaring a handler callback for all contexts. The handler
186 * callback is hidden in ring-3, and exported in RC and R0.
187 * @param fnType The callback function type.
188 * @sa PGM_ALL_CB2_DECL.
189 */
190#if defined(IN_RC) || defined(IN_RING0)
191# ifdef __cplusplus
192# define PGM_ALL_CB2_PROTO(fnType) extern "C" DECLEXPORT(fnType)
193# else
194# define PGM_ALL_CB2_PROTO(fnType) DECLEXPORT(fnType)
195# endif
196#else
197# define PGM_ALL_CB2_PROTO(fnType) DECLHIDDEN(fnType)
198#endif
199
200
201/**
202 * \#PF Handler callback for physical access handler ranges in RC and R0.
203 *
204 * @returns Strict VBox status code (appropriate for ring-0 and raw-mode).
205 * @param pVM The cross context VM structure.
206 * @param pVCpu The cross context virtual CPU structure of the calling EMT.
207 * @param uErrorCode CPU Error code.
208 * @param pRegFrame Trap register frame.
209 * NULL on DMA and other non CPU access.
210 * @param pvFault The fault address (cr2).
211 * @param GCPhysFault The GC physical address corresponding to pvFault.
212 * @param uUser User argument (not a pointer).
213 * @thread EMT(pVCpu)
214 */
215typedef DECLCALLBACKTYPE(VBOXSTRICTRC, FNPGMRZPHYSPFHANDLER,(PVMCC pVM, PVMCPUCC pVCpu, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame,
216 RTGCPTR pvFault, RTGCPHYS GCPhysFault, uint64_t uUser));
217/** Pointer to PGM access callback. */
218typedef FNPGMRZPHYSPFHANDLER *PFNPGMRZPHYSPFHANDLER;
219
220
221/**
222 * Access handler callback for physical access handler ranges.
223 *
224 * The handler can not raise any faults, it's mainly for monitoring write access
225 * to certain pages (like MMIO).
226 *
227 * @returns Strict VBox status code in ring-0 and raw-mode context, in ring-3
228 * the only supported informational status code is
229 * VINF_PGM_HANDLER_DO_DEFAULT.
230 * @retval VINF_SUCCESS if the handler have carried out the operation.
231 * @retval VINF_PGM_HANDLER_DO_DEFAULT if the caller should carry out the
232 * access operation.
233 * @retval VINF_EM_XXX in ring-0 and raw-mode context.
234 *
235 * @param pVM The cross context VM structure.
236 * @param pVCpu The cross context virtual CPU structure of the calling EMT.
237 * @param GCPhys The physical address the guest is writing to.
238 * @param pvPhys The HC mapping of that address.
239 * @param pvBuf What the guest is reading/writing.
240 * @param cbBuf How much it's reading/writing.
241 * @param enmAccessType The access type.
242 * @param enmOrigin The origin of this call.
243 * @param uUser User argument (not a pointer).
244 * @thread EMT(pVCpu)
245 */
246typedef DECLCALLBACKTYPE(VBOXSTRICTRC, FNPGMPHYSHANDLER,(PVMCC pVM, PVMCPUCC pVCpu, RTGCPHYS GCPhys, void *pvPhys,
247 void *pvBuf, size_t cbBuf, PGMACCESSTYPE enmAccessType,
248 PGMACCESSORIGIN enmOrigin, uint64_t uUser));
249/** Pointer to PGM access callback. */
250typedef FNPGMPHYSHANDLER *PFNPGMPHYSHANDLER;
251
252
253/**
254 * Paging mode.
255 *
256 * @note Part of saved state. Change with extreme care.
257 */
258typedef enum PGMMODE
259{
260 /** The usual invalid value. */
261 PGMMODE_INVALID = 0,
262 /** Real mode. */
263 PGMMODE_REAL,
264 /** Protected mode, no paging. */
265 PGMMODE_PROTECTED,
266 /** 32-bit paging. */
267 PGMMODE_32_BIT,
268 /** PAE paging. */
269 PGMMODE_PAE,
270 /** PAE paging with NX enabled. */
271 PGMMODE_PAE_NX,
272 /** 64-bit AMD paging (long mode). */
273 PGMMODE_AMD64,
274 /** 64-bit AMD paging (long mode) with NX enabled. */
275 PGMMODE_AMD64_NX,
276 /** 32-bit nested paging mode (shadow only; guest physical to host physical). */
277 PGMMODE_NESTED_32BIT,
278 /** PAE nested paging mode (shadow only; guest physical to host physical). */
279 PGMMODE_NESTED_PAE,
280 /** AMD64 nested paging mode (shadow only; guest physical to host physical). */
281 PGMMODE_NESTED_AMD64,
282 /** Extended paging (Intel) mode. */
283 PGMMODE_EPT,
284 /** Special mode used by NEM to indicate no shadow paging necessary. */
285 PGMMODE_NONE,
286 /** The max number of modes */
287 PGMMODE_MAX,
288 /** 32bit hackishness. */
289 PGMMODE_32BIT_HACK = 0x7fffffff
290} PGMMODE;
291
292/**
293 * Second level address translation (SLAT) mode.
294 */
295typedef enum PGMSLAT
296{
297 /** The usual invalid value. */
298 PGMSLAT_INVALID = 0,
299 /** No second level translation. */
300 PGMSLAT_DIRECT,
301 /** Intel Extended Page Tables (EPT). */
302 PGMSLAT_EPT,
303 /** AMD-V Nested Paging 32-bit. */
304 PGMSLAT_32BIT,
305 /** AMD-V Nested Paging PAE. */
306 PGMSLAT_PAE,
307 /** AMD-V Nested Paging 64-bit. */
308 PGMSLAT_AMD64,
309 /** 32bit hackishness. */
310 PGMSLAT_32BIT_HACK = 0x7fffffff
311} PGMSLAT;
312
313
314/** @name PGMPTWALK::fFailed flags.
315 * These flags indicate the type of a page-walk failure.
316 * @{
317 */
318typedef uint32_t PGMWALKFAIL;
319/** Regular page fault (MBZ since guest Walk code don't set these explicitly). */
320#define PGM_WALKFAIL_PAGE_FAULT UINT32_C(0)
321/** EPT violation - Intel. */
322#define PGM_WALKFAIL_EPT_VIOLATION RT_BIT_32(0)
323/** EPT violation, convertible to \#VE exception - Intel. */
324#define PGM_WALKFAIL_EPT_VIOLATION_CONVERTIBLE RT_BIT_32(1)
325/** EPT misconfiguration - Intel. */
326#define PGM_WALKFAIL_EPT_MISCONFIG RT_BIT_32(2)
327
328/** Mask of all EPT induced page-walk failures - Intel. */
329#define PGM_WALKFAIL_EPT ( PGM_WALKFAIL_EPT_VIOLATION \
330 | PGM_WALKFAIL_EPT_VIOLATION_CONVERTIBLE \
331 | PGM_WALKFAIL_EPT_MISCONFIG)
332/** @} */
333
334
335/** @name PGMPTATTRS - PGM page-table attributes.
336 *
337 * This is VirtualBox's combined page table attributes. It combines regular page
338 * table and Intel EPT attributes. It's 64-bit in size so there's ample room for
339 * bits added in the future to EPT or regular page tables (for e.g. Protection Key).
340 *
341 * The following bits map 1:1 (shifted by PGM_PTATTRS_EPT_SHIFT) to the Intel EPT
342 * attributes as these are unique to EPT and fit within 64-bits despite the shift:
343 * - EPT_R : Read access.
344 * - EPT_W : Write access.
345 * - EPT_X_SUPER : Execute or execute for supervisor-mode linear addr access.
346 * - EPT_MEMTYPE : EPT memory type.
347 * - EPT_IGNORE_PAT: Ignore PAT memory type.
348 * - EPT_X_USER : Execute access for user-mode linear addresses.
349 *
350 * For regular page tables, the R bit is always 1 (same as P bit).
351 * For Intel EPT, the EPT_R and EPT_W bits are copied to R and W bits respectively.
352 *
353 * The following EPT attributes are mapped to the following positions because they
354 * exist in the regular page tables at these positions OR are exclusive to EPT and
355 * have been mapped to arbitrarily chosen positions:
356 * - EPT_A : Accessed (EPT bit 8 maps to bit 5).
357 * - EPT_D : Dirty (EPT bit 9 maps to bit 6).
358 * - EPT_SUPER_SHW_STACK : Supervisor Shadow Stack (EPT bit 60 maps to bit 24).
359 * - EPT_SUPPRESS_VE_XCPT: Suppress \#VE exception (EPT bit 63 maps to bit 25).
360 *
361 * Bits 12, 11:9 and 43 are deliberately kept unused (correspond to bit PS and bits
362 * 11:9 in the regular page-table structures and to bit 11 in the EPT structures
363 * respectively) as bit 12 is the page-size bit and bits 11:9 are reserved for
364 * use by software and we may want to use/preserve them in the future.
365 *
366 * @{ */
367typedef uint64_t PGMPTATTRS;
368/** Pointer to a PGMPTATTRS type. */
369typedef PGMPTATTRS *PPGMPTATTRS;
370
371/** Read bit (always 1 for regular PT, copy of EPT_R for EPT). */
372#define PGM_PTATTRS_R_SHIFT 0
373#define PGM_PTATTRS_R_MASK RT_BIT_64(PGM_PTATTRS_R_SHIFT)
374/** Write access bit (aka read/write bit for regular PT). */
375#define PGM_PTATTRS_W_SHIFT 1
376#define PGM_PTATTRS_W_MASK RT_BIT_64(PGM_PTATTRS_W_SHIFT)
377/** User-mode access bit. */
378#define PGM_PTATTRS_US_SHIFT 2
379#define PGM_PTATTRS_US_MASK RT_BIT_64(PGM_PTATTRS_US_SHIFT)
380/** Write through cache bit. */
381#define PGM_PTATTRS_PWT_SHIFT 3
382#define PGM_PTATTRS_PWT_MASK RT_BIT_64(PGM_PTATTRS_PWT_SHIFT)
383/** Cache disabled bit. */
384#define PGM_PTATTRS_PCD_SHIFT 4
385#define PGM_PTATTRS_PCD_MASK RT_BIT_64(PGM_PTATTRS_PCD_SHIFT)
386/** Accessed bit. */
387#define PGM_PTATTRS_A_SHIFT 5
388#define PGM_PTATTRS_A_MASK RT_BIT_64(PGM_PTATTRS_A_SHIFT)
389/** Dirty bit. */
390#define PGM_PTATTRS_D_SHIFT 6
391#define PGM_PTATTRS_D_MASK RT_BIT_64(PGM_PTATTRS_D_SHIFT)
392/** The PAT bit. */
393#define PGM_PTATTRS_PAT_SHIFT 7
394#define PGM_PTATTRS_PAT_MASK RT_BIT_64(PGM_PTATTRS_PAT_SHIFT)
395/** The global bit. */
396#define PGM_PTATTRS_G_SHIFT 8
397#define PGM_PTATTRS_G_MASK RT_BIT_64(PGM_PTATTRS_G_SHIFT)
398/** Reserved (bits 12:9) unused. */
399#define PGM_PTATTRS_RSVD_12_9_SHIFT 9
400#define PGM_PTATTRS_RSVD_12_9_MASK UINT64_C(0x0000000000001e00)
401/** Read access bit - EPT only. */
402#define PGM_PTATTRS_EPT_R_SHIFT 13
403#define PGM_PTATTRS_EPT_R_MASK RT_BIT_64(PGM_PTATTRS_EPT_R_SHIFT)
404/** Write access bit - EPT only. */
405#define PGM_PTATTRS_EPT_W_SHIFT 14
406#define PGM_PTATTRS_EPT_W_MASK RT_BIT_64(PGM_PTATTRS_EPT_W_SHIFT)
407/** Execute or execute access for supervisor-mode linear addresses - EPT only. */
408#define PGM_PTATTRS_EPT_X_SUPER_SHIFT 15
409#define PGM_PTATTRS_EPT_X_SUPER_MASK RT_BIT_64(PGM_PTATTRS_EPT_X_SUPER_SHIFT)
410/** EPT memory type - EPT only. */
411#define PGM_PTATTRS_EPT_MEMTYPE_SHIFT 16
412#define PGM_PTATTRS_EPT_MEMTYPE_MASK UINT64_C(0x0000000000070000)
413/** Ignore PAT memory type - EPT only. */
414#define PGM_PTATTRS_EPT_IGNORE_PAT_SHIFT 19
415#define PGM_PTATTRS_EPT_IGNORE_PAT_MASK RT_BIT_64(PGM_PTATTRS_EPT_IGNORE_PAT_SHIFT)
416/** Reserved (bits 22:20) unused. */
417#define PGM_PTATTRS_RSVD_22_20_SHIFT 20
418#define PGM_PTATTRS_RSVD_22_20_MASK UINT64_C(0x0000000000700000)
419/** Execute access for user-mode linear addresses - EPT only. */
420#define PGM_PTATTRS_EPT_X_USER_SHIFT 23
421#define PGM_PTATTRS_EPT_X_USER_MASK RT_BIT_64(PGM_PTATTRS_EPT_X_USER_SHIFT)
422/** Reserved (bit 23) - unused. */
423#define PGM_PTATTRS_RSVD_23_SHIFT 24
424#define PGM_PTATTRS_RSVD_23_MASK UINT64_C(0x0000000001000000)
425/** Supervisor shadow stack - EPT only. */
426#define PGM_PTATTRS_EPT_SUPER_SHW_STACK_SHIFT 25
427#define PGM_PTATTRS_EPT_SUPER_SHW_STACK_MASK RT_BIT_64(PGM_PTATTRS_EPT_SUPER_SHW_STACK_SHIFT)
428/** Suppress \#VE exception - EPT only. */
429#define PGM_PTATTRS_EPT_SUPPRESS_VE_XCPT_SHIFT 26
430#define PGM_PTATTRS_EPT_SUPPRESS_VE_XCPT_MASK RT_BIT_64(PGM_PTATTRS_EPT_SUPPRESS_VE_XCPT_SHIFT)
431/** Reserved (bits 62:27) - unused. */
432#define PGM_PTATTRS_RSVD_62_27_SHIFT 27
433#define PGM_PTATTRS_RSVD_62_27_MASK UINT64_C(0x7ffffffff8000000)
434/** No-execute bit. */
435#define PGM_PTATTRS_NX_SHIFT 63
436#define PGM_PTATTRS_NX_MASK RT_BIT_64(PGM_PTATTRS_NX_SHIFT)
437
438RT_BF_ASSERT_COMPILE_CHECKS(PGM_PTATTRS_, UINT64_C(0), UINT64_MAX,
439 (R, W, US, PWT, PCD, A, D, PAT, G, RSVD_12_9, EPT_R, EPT_W, EPT_X_SUPER, EPT_MEMTYPE, EPT_IGNORE_PAT,
440 RSVD_22_20, EPT_X_USER, RSVD_23, EPT_SUPER_SHW_STACK, EPT_SUPPRESS_VE_XCPT, RSVD_62_27, NX));
441
442/** The bit position where the EPT specific attributes begin. */
443#define PGM_PTATTRS_EPT_SHIFT PGM_PTATTRS_EPT_R_SHIFT
444/** The mask of EPT bits (bits 26:ATTR_SHIFT). In the future we might choose to
445 * use higher unused bits for something else, in that case adjust this mask. */
446#define PGM_PTATTRS_EPT_MASK UINT64_C(0x0000000007ffe000)
447
448/** The mask of all PGM page attribute bits for regular page-tables. */
449#define PGM_PTATTRS_PT_VALID_MASK ( PGM_PTATTRS_R_MASK \
450 | PGM_PTATTRS_W_MASK \
451 | PGM_PTATTRS_US_MASK \
452 | PGM_PTATTRS_PWT_MASK \
453 | PGM_PTATTRS_PCD_MASK \
454 | PGM_PTATTRS_A_MASK \
455 | PGM_PTATTRS_D_MASK \
456 | PGM_PTATTRS_PAT_MASK \
457 | PGM_PTATTRS_G_MASK \
458 | PGM_PTATTRS_NX_MASK)
459
460/** The mask of all PGM page attribute bits for EPT. */
461#define PGM_PTATTRS_EPT_VALID_MASK ( PGM_PTATTRS_R_MASK \
462 | PGM_PTATTRS_W_MASK \
463 | PGM_PTATTRS_A_MASK \
464 | PGM_PTATTRS_D_MASK \
465 | PGM_PTATTRS_EPT_R_MASK \
466 | PGM_PTATTRS_EPT_W_MASK \
467 | PGM_PTATTRS_EPT_X_SUPER \
468 | PGM_PTATTRS_EPT_MEMTYPE \
469 | PGM_PTATTRS_EPT_IGNORE_PAT \
470 | PGM_PTATTRS_EPT_X_USER \
471 | PGM_PTATTRS_EPT_SUPER_SHW_STACK \
472 | PGM_PTATTRS_EPT_SUPPRESS_VE_XCPT)
473
474/* The mask of all PGM page attribute bits (combined). */
475#define PGM_PTATTRS_VALID_MASK (PGM_PTATTRS_PT_VALID_MASK | PGM_PTATTRS_PT_VALID_MASK)
476
477/* Verify bits match the regular PT bits. */
478AssertCompile(PGM_PTATTRS_W_SHIFT == X86_PTE_BIT_RW);
479AssertCompile(PGM_PTATTRS_US_SHIFT == X86_PTE_BIT_US);
480AssertCompile(PGM_PTATTRS_PWT_SHIFT == X86_PTE_BIT_PWT);
481AssertCompile(PGM_PTATTRS_PCD_SHIFT == X86_PTE_BIT_PCD);
482AssertCompile(PGM_PTATTRS_A_SHIFT == X86_PTE_BIT_A);
483AssertCompile(PGM_PTATTRS_D_SHIFT == X86_PTE_BIT_D);
484AssertCompile(PGM_PTATTRS_PAT_SHIFT == X86_PTE_BIT_PAT);
485AssertCompile(PGM_PTATTRS_G_SHIFT == X86_PTE_BIT_G);
486AssertCompile(PGM_PTATTRS_W_MASK == X86_PTE_RW);
487AssertCompile(PGM_PTATTRS_US_MASK == X86_PTE_US);
488AssertCompile(PGM_PTATTRS_PWT_MASK == X86_PTE_PWT);
489AssertCompile(PGM_PTATTRS_PCD_MASK == X86_PTE_PCD);
490AssertCompile(PGM_PTATTRS_A_MASK == X86_PTE_A);
491AssertCompile(PGM_PTATTRS_D_MASK == X86_PTE_D);
492AssertCompile(PGM_PTATTRS_PAT_MASK == X86_PTE_PAT);
493AssertCompile(PGM_PTATTRS_G_MASK == X86_PTE_G);
494AssertCompile(PGM_PTATTRS_NX_MASK == X86_PTE_PAE_NX);
495
496/* Verify those EPT bits that must map 1:1 (after shifting). */
497AssertCompile(PGM_PTATTRS_EPT_R_SHIFT - PGM_PTATTRS_EPT_SHIFT == EPT_E_BIT_READ);
498AssertCompile(PGM_PTATTRS_EPT_W_SHIFT - PGM_PTATTRS_EPT_SHIFT == EPT_E_BIT_WRITE);
499AssertCompile(PGM_PTATTRS_EPT_X_SUPER_SHIFT - PGM_PTATTRS_EPT_SHIFT == EPT_E_BIT_EXECUTE);
500AssertCompile(PGM_PTATTRS_EPT_IGNORE_PAT_SHIFT - PGM_PTATTRS_EPT_SHIFT == EPT_E_BIT_IGNORE_PAT);
501AssertCompile(PGM_PTATTRS_EPT_X_USER_SHIFT - PGM_PTATTRS_EPT_SHIFT == EPT_E_BIT_USER_EXECUTE);
502/** @} */
503
504
505/**
506 * Page table walk information.
507 *
508 * This provides extensive information regarding page faults (or EPT
509 * violations/misconfigurations) while traversing page tables.
510 */
511typedef struct PGMPTWALK
512{
513 /** The linear address that is being resolved (input). */
514 RTGCPTR GCPtr;
515
516 /** The second-level physical address (input/output).
517 * @remarks only valid if fIsSlat is set. */
518 RTGCPHYS GCPhysNested;
519
520 /** The physical address that is the result of the walk (output). */
521 RTGCPHYS GCPhys;
522
523 /** Set if the walk succeeded. */
524 bool fSucceeded;
525 /** Whether this is a second-level address translation. */
526 bool fIsSlat;
527 /** Whether the linear address (GCPtr) caused the second-level
528 * address translation. */
529 bool fIsLinearAddrValid;
530 /** The level problem arrised at.
531 * PTE is level 1, PDE is level 2, PDPE is level 3, PML4 is level 4, CR3 is
532 * level 8. This is 0 on success. */
533 uint8_t uLevel;
534 /** Set if the page isn't present. */
535 bool fNotPresent;
536 /** Encountered a bad physical address. */
537 bool fBadPhysAddr;
538 /** Set if there was reserved bit violations. */
539 bool fRsvdError;
540 /** Set if it involves a big page (2/4 MB). */
541 bool fBigPage;
542 /** Set if it involves a gigantic page (1 GB). */
543 bool fGigantPage;
544 bool afPadding[3];
545 /** Page-walk failure type, PGM_WALKFAIL_XXX. */
546 PGMWALKFAIL fFailed;
547
548 /** The effective page-table attributes, PGM_PTATTRS_XXX. */
549 PGMPTATTRS fEffective;
550} PGMPTWALK;
551/** Pointer to page walk information. */
552typedef PGMPTWALK *PPGMPTWALK;
553/** Pointer to const page walk information. */
554typedef PGMPTWALK const *PCPGMPTWALK;
555
556
557/** Macro for checking if the guest is using paging.
558 * @param enmMode PGMMODE_*.
559 * @remark ASSUMES certain order of the PGMMODE_* values.
560 */
561#define PGMMODE_WITH_PAGING(enmMode) ((enmMode) >= PGMMODE_32_BIT)
562
563/** Macro for checking if it's one of the long mode modes.
564 * @param enmMode PGMMODE_*.
565 */
566#define PGMMODE_IS_LONG_MODE(enmMode) ((enmMode) == PGMMODE_AMD64_NX || (enmMode) == PGMMODE_AMD64)
567
568/** Macro for checking if it's one of the AMD64 nested modes.
569 * @param enmMode PGMMODE_*.
570 */
571#define PGMMODE_IS_NESTED(enmMode) ( (enmMode) == PGMMODE_NESTED_32BIT \
572 || (enmMode) == PGMMODE_NESTED_PAE \
573 || (enmMode) == PGMMODE_NESTED_AMD64)
574
575/** Macro for checking if it's one of the PAE modes.
576 * @param enmMode PGMMODE_*.
577 */
578#define PGMMODE_IS_PAE(enmMode) ( (enmMode) == PGMMODE_PAE \
579 || (enmMode) == PGMMODE_PAE_NX)
580
581/**
582 * Is the ROM mapped (true) or is the shadow RAM mapped (false).
583 *
584 * @returns boolean.
585 * @param enmProt The PGMROMPROT value, must be valid.
586 */
587#define PGMROMPROT_IS_ROM(enmProt) \
588 ( (enmProt) == PGMROMPROT_READ_ROM_WRITE_IGNORE \
589 || (enmProt) == PGMROMPROT_READ_ROM_WRITE_RAM )
590
591
592VMMDECL(bool) PGMIsLockOwner(PVMCC pVM);
593
594VMMDECL(int) PGMRegisterStringFormatTypes(void);
595VMMDECL(void) PGMDeregisterStringFormatTypes(void);
596VMMDECL(RTHCPHYS) PGMGetHyperCR3(PVMCPU pVCpu);
597VMMDECL(int) PGMTrap0eHandler(PVMCPUCC pVCpu, RTGCUINT uErr, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault);
598VMMDECL(int) PGMPrefetchPage(PVMCPUCC pVCpu, RTGCPTR GCPtrPage);
599VMMDECL(VBOXSTRICTRC) PGMInterpretInstruction(PVMCC pVM, PVMCPUCC pVCpu, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault);
600VMMDECL(int) PGMShwGetPage(PVMCPUCC pVCpu, RTGCPTR GCPtr, uint64_t *pfFlags, PRTHCPHYS pHCPhys);
601VMMDECL(int) PGMShwMakePageReadonly(PVMCPUCC pVCpu, RTGCPTR GCPtr, uint32_t fFlags);
602VMMDECL(int) PGMShwMakePageWritable(PVMCPUCC pVCpu, RTGCPTR GCPtr, uint32_t fFlags);
603VMMDECL(int) PGMShwMakePageNotPresent(PVMCPUCC pVCpu, RTGCPTR GCPtr, uint32_t fFlags);
604/** @name Flags for PGMShwMakePageReadonly, PGMShwMakePageWritable and
605 * PGMShwMakePageNotPresent
606 * @{ */
607/** The call is from an access handler for dealing with the a faulting write
608 * operation. The virtual address is within the same page. */
609#define PGM_MK_PG_IS_WRITE_FAULT RT_BIT(0)
610/** The page is an MMIO2. */
611#define PGM_MK_PG_IS_MMIO2 RT_BIT(1)
612/** @}*/
613VMMDECL(int) PGMGstGetPage(PVMCPUCC pVCpu, RTGCPTR GCPtr, PPGMPTWALK pWalk);
614VMMDECL(int) PGMGstModifyPage(PVMCPUCC pVCpu, RTGCPTR GCPtr, size_t cb, uint64_t fFlags, uint64_t fMask);
615VMM_INT_DECL(bool) PGMGstArePaePdpesValid(PVMCPUCC pVCpu, PCX86PDPE paPaePdpes);
616VMM_INT_DECL(int) PGMGstMapPaePdpes(PVMCPUCC pVCpu, PCX86PDPE paPaePdpes);
617VMM_INT_DECL(int) PGMGstMapPaePdpesAtCr3(PVMCPUCC pVCpu, uint64_t cr3);
618
619VMMDECL(int) PGMInvalidatePage(PVMCPUCC pVCpu, RTGCPTR GCPtrPage);
620VMMDECL(int) PGMFlushTLB(PVMCPUCC pVCpu, uint64_t cr3, bool fGlobal);
621VMMDECL(int) PGMSyncCR3(PVMCPUCC pVCpu, uint64_t cr0, uint64_t cr3, uint64_t cr4, bool fGlobal);
622VMMDECL(int) PGMUpdateCR3(PVMCPUCC pVCpu, uint64_t cr3);
623VMMDECL(int) PGMChangeMode(PVMCPUCC pVCpu, uint64_t cr0, uint64_t cr4, uint64_t efer, bool fForce);
624VMM_INT_DECL(int) PGMHCChangeMode(PVMCC pVM, PVMCPUCC pVCpu, PGMMODE enmGuestMode, bool fForce);
625VMMDECL(void) PGMCr0WpEnabled(PVMCPUCC pVCpu);
626VMMDECL(PGMMODE) PGMGetGuestMode(PVMCPU pVCpu);
627VMMDECL(PGMMODE) PGMGetShadowMode(PVMCPU pVCpu);
628VMMDECL(PGMMODE) PGMGetHostMode(PVM pVM);
629VMMDECL(const char *) PGMGetModeName(PGMMODE enmMode);
630#ifdef VBOX_WITH_NESTED_HWVIRT_VMX_EPT
631VMM_INT_DECL(const char *) PGMGetSlatModeName(PGMSLAT enmSlatMode);
632#endif
633VMM_INT_DECL(RTGCPHYS) PGMGetGuestCR3Phys(PVMCPU pVCpu);
634VMM_INT_DECL(void) PGMNotifyNxeChanged(PVMCPU pVCpu, bool fNxe);
635VMMDECL(bool) PGMHasDirtyPages(PVM pVM);
636VMM_INT_DECL(void) PGMSetGuestEptPtr(PVMCPUCC pVCpu, uint64_t uEptPtr);
637
638/** PGM physical access handler type registration handle (heap offset, valid
639 * cross contexts without needing fixing up). Callbacks and handler type is
640 * associated with this and it is shared by all handler registrations. */
641typedef uint64_t PGMPHYSHANDLERTYPE;
642/** Pointer to a PGM physical handler type registration handle. */
643typedef PGMPHYSHANDLERTYPE *PPGMPHYSHANDLERTYPE;
644/** NIL value for PGM physical access handler type handle. */
645#define NIL_PGMPHYSHANDLERTYPE UINT64_MAX
646VMMDECL(int) PGMHandlerPhysicalRegister(PVMCC pVM, RTGCPHYS GCPhys, RTGCPHYS GCPhysLast, PGMPHYSHANDLERTYPE hType,
647 uint64_t uUser, R3PTRTYPE(const char *) pszDesc);
648VMMDECL(int) PGMHandlerPhysicalModify(PVMCC pVM, RTGCPHYS GCPhysCurrent, RTGCPHYS GCPhys, RTGCPHYS GCPhysLast);
649VMMDECL(int) PGMHandlerPhysicalDeregister(PVMCC pVM, RTGCPHYS GCPhys);
650VMMDECL(int) PGMHandlerPhysicalChangeUserArg(PVMCC pVM, RTGCPHYS GCPhys, uint64_t uUser);
651VMMDECL(int) PGMHandlerPhysicalSplit(PVMCC pVM, RTGCPHYS GCPhys, RTGCPHYS GCPhysSplit);
652VMMDECL(int) PGMHandlerPhysicalJoin(PVMCC pVM, RTGCPHYS GCPhys1, RTGCPHYS GCPhys2);
653VMMDECL(int) PGMHandlerPhysicalPageTempOff(PVMCC pVM, RTGCPHYS GCPhys, RTGCPHYS GCPhysPage);
654VMMDECL(int) PGMHandlerPhysicalPageAliasMmio2(PVMCC pVM, RTGCPHYS GCPhys, RTGCPHYS GCPhysPage,
655 PPDMDEVINS pDevIns, PGMMMIO2HANDLE hMmio2, RTGCPHYS offMMio2PageRemap);
656VMMDECL(int) PGMHandlerPhysicalPageAliasHC(PVMCC pVM, RTGCPHYS GCPhys, RTGCPHYS GCPhysPage, RTHCPHYS HCPhysPageRemap);
657VMMDECL(int) PGMHandlerPhysicalReset(PVMCC pVM, RTGCPHYS GCPhys);
658VMMDECL(bool) PGMHandlerPhysicalIsRegistered(PVMCC pVM, RTGCPHYS GCPhys);
659
660/** @name PGMPHYSHANDLER_F_XXX - flags for PGMR3HandlerPhysicalTypeRegister and PGMR0HandlerPhysicalTypeRegister
661 * @{ */
662/** Whether to hold the PGM lock while calling the handler or not.
663 * Mainly an optimization for PGM callers. */
664#define PGMPHYSHANDLER_F_KEEP_PGM_LOCK RT_BIT_32(0)
665/** The uUser value is a ring-0 device instance index that needs translating
666 * into a PDMDEVINS pointer before calling the handler. This is a hack to make
667 * it possible to use access handlers in devices. */
668#define PGMPHYSHANDLER_F_R0_DEVINS_IDX RT_BIT_32(1)
669/** Mask of valid bits. */
670#define PGMPHYSHANDLER_F_VALID_MASK UINT32_C(3)
671/** @} */
672
673
674/**
675 * Page type.
676 *
677 * @remarks This enum has to fit in a 3-bit field (see PGMPAGE::u3Type).
678 * @remarks This is used in the saved state, so changes to it requires bumping
679 * the saved state version.
680 * @todo So, convert to \#defines!
681 */
682typedef enum PGMPAGETYPE
683{
684 /** The usual invalid zero entry. */
685 PGMPAGETYPE_INVALID = 0,
686 /** RAM page. (RWX) */
687 PGMPAGETYPE_RAM,
688 /** MMIO2 page. (RWX) */
689 PGMPAGETYPE_MMIO2,
690 /** MMIO2 page aliased over an MMIO page. (RWX)
691 * See PGMHandlerPhysicalPageAlias(). */
692 PGMPAGETYPE_MMIO2_ALIAS_MMIO,
693 /** Special page aliased over an MMIO page. (RWX)
694 * See PGMHandlerPhysicalPageAliasHC(), but this is generally only used for
695 * VT-x's APIC access page at the moment. Treated as MMIO by everyone except
696 * the shadow paging code. */
697 PGMPAGETYPE_SPECIAL_ALIAS_MMIO,
698 /** Shadowed ROM. (RWX) */
699 PGMPAGETYPE_ROM_SHADOW,
700 /** ROM page. (R-X) */
701 PGMPAGETYPE_ROM,
702 /** MMIO page. (---) */
703 PGMPAGETYPE_MMIO,
704 /** End of valid entries. */
705 PGMPAGETYPE_END
706} PGMPAGETYPE;
707AssertCompile(PGMPAGETYPE_END == 8);
708
709/** @name PGM page type predicates.
710 * @{ */
711#define PGMPAGETYPE_IS_READABLE(a_enmType) ( (a_enmType) <= PGMPAGETYPE_ROM )
712#define PGMPAGETYPE_IS_WRITEABLE(a_enmType) ( (a_enmType) <= PGMPAGETYPE_ROM_SHADOW )
713#define PGMPAGETYPE_IS_RWX(a_enmType) ( (a_enmType) <= PGMPAGETYPE_ROM_SHADOW )
714#define PGMPAGETYPE_IS_ROX(a_enmType) ( (a_enmType) == PGMPAGETYPE_ROM )
715#define PGMPAGETYPE_IS_NP(a_enmType) ( (a_enmType) == PGMPAGETYPE_MMIO )
716/** @} */
717
718
719VMM_INT_DECL(PGMPAGETYPE) PGMPhysGetPageType(PVMCC pVM, RTGCPHYS GCPhys);
720
721VMM_INT_DECL(int) PGMPhysGCPhys2HCPhys(PVMCC pVM, RTGCPHYS GCPhys, PRTHCPHYS pHCPhys);
722VMM_INT_DECL(int) PGMPhysGCPtr2HCPhys(PVMCPUCC pVCpu, RTGCPTR GCPtr, PRTHCPHYS pHCPhys);
723VMM_INT_DECL(int) PGMPhysGCPhys2CCPtr(PVMCC pVM, RTGCPHYS GCPhys, void **ppv, PPGMPAGEMAPLOCK pLock);
724VMM_INT_DECL(int) PGMPhysGCPhys2CCPtrReadOnly(PVMCC pVM, RTGCPHYS GCPhys, void const **ppv, PPGMPAGEMAPLOCK pLock);
725VMM_INT_DECL(int) PGMPhysGCPtr2CCPtr(PVMCPU pVCpu, RTGCPTR GCPtr, void **ppv, PPGMPAGEMAPLOCK pLock);
726VMM_INT_DECL(int) PGMPhysGCPtr2CCPtrReadOnly(PVMCPUCC pVCpu, RTGCPTR GCPtr, void const **ppv, PPGMPAGEMAPLOCK pLock);
727
728VMMDECL(bool) PGMPhysIsA20Enabled(PVMCPU pVCpu);
729VMMDECL(bool) PGMPhysIsGCPhysValid(PVMCC pVM, RTGCPHYS GCPhys);
730VMMDECL(bool) PGMPhysIsGCPhysNormal(PVMCC pVM, RTGCPHYS GCPhys);
731VMMDECL(int) PGMPhysGCPtr2GCPhys(PVMCPUCC pVCpu, RTGCPTR GCPtr, PRTGCPHYS pGCPhys);
732VMMDECL(void) PGMPhysReleasePageMappingLock(PVMCC pVM, PPGMPAGEMAPLOCK pLock);
733VMMDECL(void) PGMPhysBulkReleasePageMappingLocks(PVMCC pVM, uint32_t cPages, PPGMPAGEMAPLOCK paLock);
734
735/** @def PGM_PHYS_RW_IS_SUCCESS
736 * Check whether a PGMPhysRead, PGMPhysWrite, PGMPhysReadGCPtr or
737 * PGMPhysWriteGCPtr call completed the given task.
738 *
739 * @returns true if completed, false if not.
740 * @param a_rcStrict The status code.
741 * @sa IOM_SUCCESS
742 */
743#ifdef IN_RING3
744# define PGM_PHYS_RW_IS_SUCCESS(a_rcStrict) \
745 ( (a_rcStrict) == VINF_SUCCESS \
746 || (a_rcStrict) == VINF_EM_DBG_STOP \
747 || (a_rcStrict) == VINF_EM_DBG_EVENT \
748 || (a_rcStrict) == VINF_EM_DBG_BREAKPOINT \
749 )
750#elif defined(IN_RING0)
751# define PGM_PHYS_RW_IS_SUCCESS(a_rcStrict) \
752 ( (a_rcStrict) == VINF_SUCCESS \
753 || (a_rcStrict) == VINF_IOM_R3_MMIO_COMMIT_WRITE \
754 || (a_rcStrict) == VINF_EM_OFF \
755 || (a_rcStrict) == VINF_EM_SUSPEND \
756 || (a_rcStrict) == VINF_EM_RESET \
757 || (a_rcStrict) == VINF_EM_HALT \
758 || (a_rcStrict) == VINF_EM_DBG_STOP \
759 || (a_rcStrict) == VINF_EM_DBG_EVENT \
760 || (a_rcStrict) == VINF_EM_DBG_BREAKPOINT \
761 )
762#elif defined(IN_RC)
763# define PGM_PHYS_RW_IS_SUCCESS(a_rcStrict) \
764 ( (a_rcStrict) == VINF_SUCCESS \
765 || (a_rcStrict) == VINF_IOM_R3_MMIO_COMMIT_WRITE \
766 || (a_rcStrict) == VINF_EM_OFF \
767 || (a_rcStrict) == VINF_EM_SUSPEND \
768 || (a_rcStrict) == VINF_EM_RESET \
769 || (a_rcStrict) == VINF_EM_HALT \
770 || (a_rcStrict) == VINF_SELM_SYNC_GDT \
771 || (a_rcStrict) == VINF_EM_RAW_EMULATE_INSTR_GDT_FAULT \
772 || (a_rcStrict) == VINF_EM_DBG_STOP \
773 || (a_rcStrict) == VINF_EM_DBG_EVENT \
774 || (a_rcStrict) == VINF_EM_DBG_BREAKPOINT \
775 )
776#endif
777/** @def PGM_PHYS_RW_DO_UPDATE_STRICT_RC
778 * Updates the return code with a new result.
779 *
780 * Both status codes must be successes according to PGM_PHYS_RW_IS_SUCCESS.
781 *
782 * @param a_rcStrict The current return code, to be updated.
783 * @param a_rcStrict2 The new return code to merge in.
784 */
785#ifdef IN_RING3
786# define PGM_PHYS_RW_DO_UPDATE_STRICT_RC(a_rcStrict, a_rcStrict2) \
787 do { \
788 Assert(rcStrict == VINF_SUCCESS); \
789 Assert(rcStrict2 == VINF_SUCCESS); \
790 } while (0)
791#elif defined(IN_RING0)
792# define PGM_PHYS_RW_DO_UPDATE_STRICT_RC(a_rcStrict, a_rcStrict2) \
793 do { \
794 Assert(PGM_PHYS_RW_IS_SUCCESS(rcStrict)); \
795 Assert(PGM_PHYS_RW_IS_SUCCESS(rcStrict2)); \
796 AssertCompile(VINF_IOM_R3_MMIO_COMMIT_WRITE > VINF_EM_LAST); \
797 if ((a_rcStrict2) == VINF_SUCCESS || (a_rcStrict) == (a_rcStrict2)) \
798 { /* likely */ } \
799 else if ( (a_rcStrict) == VINF_SUCCESS \
800 || (a_rcStrict) > (a_rcStrict2)) \
801 (a_rcStrict) = (a_rcStrict2); \
802 } while (0)
803#elif defined(IN_RC)
804# define PGM_PHYS_RW_DO_UPDATE_STRICT_RC(a_rcStrict, a_rcStrict2) \
805 do { \
806 Assert(PGM_PHYS_RW_IS_SUCCESS(rcStrict)); \
807 Assert(PGM_PHYS_RW_IS_SUCCESS(rcStrict2)); \
808 AssertCompile(VINF_SELM_SYNC_GDT > VINF_EM_LAST); \
809 AssertCompile(VINF_EM_RAW_EMULATE_INSTR_GDT_FAULT > VINF_EM_LAST); \
810 AssertCompile(VINF_EM_RAW_EMULATE_INSTR_GDT_FAULT < VINF_SELM_SYNC_GDT); \
811 AssertCompile(VINF_IOM_R3_MMIO_COMMIT_WRITE > VINF_EM_LAST); \
812 AssertCompile(VINF_IOM_R3_MMIO_COMMIT_WRITE > VINF_SELM_SYNC_GDT); \
813 AssertCompile(VINF_IOM_R3_MMIO_COMMIT_WRITE > VINF_EM_RAW_EMULATE_INSTR_GDT_FAULT); \
814 if ((a_rcStrict2) == VINF_SUCCESS || (a_rcStrict) == (a_rcStrict2)) \
815 { /* likely */ } \
816 else if ((a_rcStrict) == VINF_SUCCESS) \
817 (a_rcStrict) = (a_rcStrict2); \
818 else if ( ( (a_rcStrict) > (a_rcStrict2) \
819 && ( (a_rcStrict2) <= VINF_EM_RESET \
820 || (a_rcStrict) != VINF_EM_RAW_EMULATE_INSTR_GDT_FAULT) ) \
821 || ( (a_rcStrict2) == VINF_EM_RAW_EMULATE_INSTR_GDT_FAULT \
822 && (a_rcStrict) > VINF_EM_RESET) ) \
823 (a_rcStrict) = (a_rcStrict2); \
824 } while (0)
825#endif
826
827VMMDECL(VBOXSTRICTRC) PGMPhysRead(PVMCC pVM, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead, PGMACCESSORIGIN enmOrigin);
828VMMDECL(VBOXSTRICTRC) PGMPhysWrite(PVMCC pVM, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite, PGMACCESSORIGIN enmOrigin);
829VMMDECL(VBOXSTRICTRC) PGMPhysReadGCPtr(PVMCPUCC pVCpu, void *pvDst, RTGCPTR GCPtrSrc, size_t cb, PGMACCESSORIGIN enmOrigin);
830VMMDECL(VBOXSTRICTRC) PGMPhysWriteGCPtr(PVMCPUCC pVCpu, RTGCPTR GCPtrDst, const void *pvSrc, size_t cb, PGMACCESSORIGIN enmOrigin);
831
832VMMDECL(int) PGMPhysSimpleReadGCPhys(PVMCC pVM, void *pvDst, RTGCPHYS GCPhysSrc, size_t cb);
833VMMDECL(int) PGMPhysSimpleWriteGCPhys(PVMCC pVM, RTGCPHYS GCPhysDst, const void *pvSrc, size_t cb);
834VMMDECL(int) PGMPhysSimpleReadGCPtr(PVMCPUCC pVCpu, void *pvDst, RTGCPTR GCPtrSrc, size_t cb);
835VMMDECL(int) PGMPhysSimpleWriteGCPtr(PVMCPUCC pVCpu, RTGCPTR GCPtrDst, const void *pvSrc, size_t cb);
836VMMDECL(int) PGMPhysSimpleDirtyWriteGCPtr(PVMCPUCC pVCpu, RTGCPTR GCPtrDst, const void *pvSrc, size_t cb);
837
838VMM_INT_DECL(int) PGMPhysIemGCPhys2Ptr(PVMCC pVM, PVMCPUCC pVCpu, RTGCPHYS GCPhys, bool fWritable, bool fByPassHandlers, void **ppv, PPGMPAGEMAPLOCK pLock);
839VMM_INT_DECL(int) PGMPhysIemQueryAccess(PVMCC pVM, RTGCPHYS GCPhys, bool fWritable, bool fByPassHandlers);
840VMM_INT_DECL(int) PGMPhysIemGCPhys2PtrNoLock(PVMCC pVM, PVMCPUCC pVCpu, RTGCPHYS GCPhys, uint64_t const volatile *puTlbPhysRev,
841#if defined(IN_RC)
842 R3PTRTYPE(uint8_t *) *ppb,
843#else
844 R3R0PTRTYPE(uint8_t *) *ppb,
845#endif
846 uint64_t *pfTlb);
847/** @name Flags returned by PGMPhysIemGCPhys2PtrNoLock
848 * @{ */
849#define PGMIEMGCPHYS2PTR_F_NO_WRITE RT_BIT_32(3) /**< Not writable (IEMTLBE_F_PG_NO_WRITE). */
850#define PGMIEMGCPHYS2PTR_F_NO_READ RT_BIT_32(4) /**< Not readable (IEMTLBE_F_PG_NO_READ). */
851#define PGMIEMGCPHYS2PTR_F_NO_MAPPINGR3 RT_BIT_32(7) /**< No ring-3 mapping (IEMTLBE_F_NO_MAPPINGR3). */
852#define PGMIEMGCPHYS2PTR_F_UNASSIGNED RT_BIT_32(8) /**< Unassgined memory (IEMTLBE_F_PG_UNASSIGNED). */
853/** @} */
854
855/** Information returned by PGMPhysNemQueryPageInfo. */
856typedef struct PGMPHYSNEMPAGEINFO
857{
858 /** The host physical address of the page, NIL_HCPHYS if invalid page. */
859 RTHCPHYS HCPhys;
860 /** The NEM access mode for the page, NEM_PAGE_PROT_XXX */
861 uint32_t fNemProt : 8;
862 /** The NEM state associated with the PAGE. */
863 uint32_t u2NemState : 2;
864 /** The NEM state associated with the PAGE before pgmPhysPageMakeWritable was called. */
865 uint32_t u2OldNemState : 2;
866 /** Set if the page has handler. */
867 uint32_t fHasHandlers : 1;
868 /** Set if is the zero page backing it. */
869 uint32_t fZeroPage : 1;
870 /** Set if the page has handler. */
871 PGMPAGETYPE enmType;
872} PGMPHYSNEMPAGEINFO;
873/** Pointer to page information for NEM. */
874typedef PGMPHYSNEMPAGEINFO *PPGMPHYSNEMPAGEINFO;
875/**
876 * Callback for checking that the page is in sync while under the PGM lock.
877 *
878 * NEM passes this callback to PGMPhysNemQueryPageInfo to check that the page is
879 * in-sync between PGM and the native hypervisor API in an atomic fashion.
880 *
881 * @returns VBox status code.
882 * @param pVM The cross context VM structure.
883 * @param pVCpu The cross context per virtual CPU structure. Optional,
884 * see PGMPhysNemQueryPageInfo.
885 * @param GCPhys The guest physical address (not A20 masked).
886 * @param pInfo The page info structure. This function updates the
887 * u2NemState memory and the caller will update the PGMPAGE
888 * copy accordingly.
889 * @param pvUser Callback user argument.
890 */
891typedef DECLCALLBACKTYPE(int, FNPGMPHYSNEMCHECKPAGE,(PVMCC pVM, PVMCPUCC pVCpu, RTGCPHYS GCPhys, PPGMPHYSNEMPAGEINFO pInfo, void *pvUser));
892/** Pointer to a FNPGMPHYSNEMCHECKPAGE function. */
893typedef FNPGMPHYSNEMCHECKPAGE *PFNPGMPHYSNEMCHECKPAGE;
894
895VMM_INT_DECL(int) PGMPhysNemPageInfoChecker(PVMCC pVM, PVMCPUCC pVCpu, RTGCPHYS GCPhys, bool fMakeWritable,
896 PPGMPHYSNEMPAGEINFO pInfo, PFNPGMPHYSNEMCHECKPAGE pfnChecker, void *pvUser);
897
898/**
899 * Callback for use with PGMPhysNemEnumPagesByState.
900 * @returns VBox status code.
901 * Failure status will stop enumeration immediately and return.
902 * @param pVM The cross context VM structure.
903 * @param pVCpu The cross context per virtual CPU structure. Optional,
904 * see PGMPhysNemEnumPagesByState.
905 * @param GCPhys The guest physical address (not A20 masked).
906 * @param pu2NemState Pointer to variable with the NEM state. This can be
907 * update.
908 * @param pvUser The user argument.
909 */
910typedef DECLCALLBACKTYPE(int, FNPGMPHYSNEMENUMCALLBACK,(PVMCC pVM, PVMCPUCC pVCpu, RTGCPHYS GCPhys,
911 uint8_t *pu2NemState, void *pvUser));
912/** Pointer to a FNPGMPHYSNEMENUMCALLBACK function. */
913typedef FNPGMPHYSNEMENUMCALLBACK *PFNPGMPHYSNEMENUMCALLBACK;
914VMM_INT_DECL(int) PGMPhysNemEnumPagesByState(PVMCC pVM, PVMCPUCC VCpu, uint8_t uMinState,
915 PFNPGMPHYSNEMENUMCALLBACK pfnCallback, void *pvUser);
916
917
918#ifdef VBOX_STRICT
919VMMDECL(unsigned) PGMAssertHandlerAndFlagsInSync(PVMCC pVM);
920VMMDECL(unsigned) PGMAssertNoMappingConflicts(PVM pVM);
921VMMDECL(unsigned) PGMAssertCR3(PVMCC pVM, PVMCPUCC pVCpu, uint64_t cr3, uint64_t cr4);
922#endif /* VBOX_STRICT */
923
924VMMDECL(int) PGMSetLargePageUsage(PVMCC pVM, bool fUseLargePages);
925
926/**
927 * Query large page usage state
928 *
929 * @returns 0 - disabled, 1 - enabled
930 * @param pVM The cross context VM structure.
931 */
932#define PGMIsUsingLargePages(pVM) ((pVM)->pgm.s.fUseLargePages)
933
934
935#ifdef IN_RING0
936/** @defgroup grp_pgm_r0 The PGM Host Context Ring-0 API
937 * @{
938 */
939VMMR0_INT_DECL(int) PGMR0InitPerVMData(PGVM pGVM, RTR0MEMOBJ hMemObj);
940VMMR0_INT_DECL(int) PGMR0InitVM(PGVM pGVM);
941VMMR0_INT_DECL(void) PGMR0DoneInitVM(PGVM pGVM);
942VMMR0_INT_DECL(void) PGMR0CleanupVM(PGVM pGVM);
943VMMR0_INT_DECL(int) PGMR0PhysAllocateHandyPages(PGVM pGVM, VMCPUID idCpu);
944VMMR0_INT_DECL(int) PGMR0PhysFlushHandyPages(PGVM pGVM, VMCPUID idCpu);
945VMMR0_INT_DECL(int) PGMR0PhysAllocateLargePage(PGVM pGVM, VMCPUID idCpu, RTGCPHYS GCPhys);
946VMMR0_INT_DECL(int) PGMR0PhysMMIO2MapKernel(PGVM pGVM, PPDMDEVINS pDevIns, PGMMMIO2HANDLE hMmio2,
947 size_t offSub, size_t cbSub, void **ppvMapping);
948VMMR0_INT_DECL(int) PGMR0PhysSetupIoMmu(PGVM pGVM);
949VMMR0_INT_DECL(int) PGMR0PhysHandlerInitReqHandler(PGVM pGVM, uint32_t cEntries);
950VMMR0_INT_DECL(int) PGMR0HandlerPhysicalTypeSetUpContext(PGVM pGVM, PGMPHYSHANDLERKIND enmKind, uint32_t fFlags,
951 PFNPGMPHYSHANDLER pfnHandler, PFNPGMRZPHYSPFHANDLER pfnPfHandler,
952 const char *pszDesc, PGMPHYSHANDLERTYPE hType);
953
954VMMR0DECL(int) PGMR0SharedModuleCheck(PVMCC pVM, PGVM pGVM, VMCPUID idCpu, PGMMSHAREDMODULE pModule,
955 PCRTGCPTR64 paRegionsGCPtrs);
956VMMR0DECL(int) PGMR0Trap0eHandlerNestedPaging(PGVM pGVM, PGVMCPU pGVCpu, PGMMODE enmShwPagingMode, RTGCUINT uErr,
957 PCPUMCTXCORE pRegFrame, RTGCPHYS pvFault);
958VMMR0DECL(VBOXSTRICTRC) PGMR0Trap0eHandlerNPMisconfig(PGVM pGVM, PGVMCPU pGVCpu, PGMMODE enmShwPagingMode,
959 PCPUMCTXCORE pRegFrame, RTGCPHYS GCPhysFault, uint32_t uErr);
960VMMR0_INT_DECL(int) PGMR0PoolGrow(PGVM pGVM, VMCPUID idCpu);
961
962# ifdef VBOX_WITH_NESTED_HWVIRT_VMX_EPT
963VMMR0DECL(VBOXSTRICTRC) PGMR0NestedTrap0eHandlerNestedPaging(PGVMCPU pGVCpu, PGMMODE enmShwPagingMode, RTGCUINT uErr,
964 PCPUMCTXCORE pRegFrame, RTGCPHYS GCPhysNested,
965 bool fIsLinearAddrValid, RTGCPTR GCPtrNested, PPGMPTWALK pWalk);
966# endif
967/** @} */
968#endif /* IN_RING0 */
969
970
971
972#ifdef IN_RING3
973/** @defgroup grp_pgm_r3 The PGM Host Context Ring-3 API
974 * @{
975 */
976VMMR3_INT_DECL(void) PGMR3EnableNemMode(PVM pVM);
977VMMR3_INT_DECL(bool) PGMR3IsNemModeEnabled(PVM pVM);
978VMMR3DECL(int) PGMR3Init(PVM pVM);
979VMMR3DECL(int) PGMR3InitFinalize(PVM pVM);
980VMMR3_INT_DECL(int) PGMR3InitCompleted(PVM pVM, VMINITCOMPLETED enmWhat);
981VMMR3DECL(void) PGMR3Relocate(PVM pVM, RTGCINTPTR offDelta);
982VMMR3DECL(void) PGMR3ResetCpu(PVM pVM, PVMCPU pVCpu);
983VMMR3_INT_DECL(void) PGMR3Reset(PVM pVM);
984VMMR3_INT_DECL(void) PGMR3ResetNoMorePhysWritesFlag(PVM pVM);
985VMMR3_INT_DECL(void) PGMR3MemSetup(PVM pVM, bool fReset);
986VMMR3DECL(int) PGMR3Term(PVM pVM);
987
988VMMR3DECL(int) PGMR3PhysRegisterRam(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cb, const char *pszDesc);
989VMMR3DECL(int) PGMR3PhysChangeMemBalloon(PVM pVM, bool fInflate, unsigned cPages, RTGCPHYS *paPhysPage);
990VMMR3DECL(int) PGMR3PhysWriteProtectRAM(PVM pVM);
991VMMR3DECL(uint32_t) PGMR3PhysGetRamRangeCount(PVM pVM);
992VMMR3DECL(int) PGMR3PhysGetRange(PVM pVM, uint32_t iRange, PRTGCPHYS pGCPhysStart, PRTGCPHYS pGCPhysLast,
993 const char **ppszDesc, bool *pfIsMmio);
994VMMR3DECL(int) PGMR3QueryMemoryStats(PUVM pUVM, uint64_t *pcbTotalMem, uint64_t *pcbPrivateMem, uint64_t *pcbSharedMem, uint64_t *pcbZeroMem);
995VMMR3DECL(int) PGMR3QueryGlobalMemoryStats(PUVM pUVM, uint64_t *pcbAllocMem, uint64_t *pcbFreeMem, uint64_t *pcbBallonedMem, uint64_t *pcbSharedMem);
996
997VMMR3DECL(int) PGMR3PhysMMIORegister(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cb, PGMPHYSHANDLERTYPE hType,
998 uint64_t uUser, const char *pszDesc);
999VMMR3DECL(int) PGMR3PhysMMIODeregister(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cb);
1000
1001/** @name PGMPHYS_MMIO2_FLAGS_XXX - MMIO2 registration flags.
1002 * @see PGMR3PhysMmio2Register, PDMDevHlpMmio2Create
1003 * @{ */
1004/** Track dirty pages.
1005 * @see PGMR3PhysMmio2QueryAndResetDirtyBitmap(), PGMR3PhysMmio2ControlDirtyPageTracking(). */
1006#define PGMPHYS_MMIO2_FLAGS_TRACK_DIRTY_PAGES RT_BIT_32(0)
1007/** Valid flags. */
1008#define PGMPHYS_MMIO2_FLAGS_VALID_MASK UINT32_C(0x00000001)
1009/** @} */
1010
1011VMMR3_INT_DECL(int) PGMR3PhysMmio2Register(PVM pVM, PPDMDEVINS pDevIns, uint32_t iSubDev, uint32_t iRegion, RTGCPHYS cb,
1012 uint32_t fFlags, const char *pszDesc, void **ppv, PGMMMIO2HANDLE *phRegion);
1013VMMR3_INT_DECL(int) PGMR3PhysMmio2Deregister(PVM pVM, PPDMDEVINS pDevIns, PGMMMIO2HANDLE hMmio2);
1014VMMR3_INT_DECL(int) PGMR3PhysMmio2Map(PVM pVM, PPDMDEVINS pDevIns, PGMMMIO2HANDLE hMmio2, RTGCPHYS GCPhys);
1015VMMR3_INT_DECL(int) PGMR3PhysMmio2Unmap(PVM pVM, PPDMDEVINS pDevIns, PGMMMIO2HANDLE hMmio2, RTGCPHYS GCPhys);
1016VMMR3_INT_DECL(int) PGMR3PhysMmio2Reduce(PVM pVM, PPDMDEVINS pDevIns, PGMMMIO2HANDLE hMmio2, RTGCPHYS cbRegion);
1017VMMR3_INT_DECL(int) PGMR3PhysMmio2ValidateHandle(PVM pVM, PPDMDEVINS pDevIns, PGMMMIO2HANDLE hMmio2);
1018VMMR3_INT_DECL(RTGCPHYS) PGMR3PhysMmio2GetMappingAddress(PVM pVM, PPDMDEVINS pDevIns, PGMMMIO2HANDLE hMmio2);
1019VMMR3_INT_DECL(int) PGMR3PhysMmio2ChangeRegionNo(PVM pVM, PPDMDEVINS pDevIns, PGMMMIO2HANDLE hMmio2, uint32_t iNewRegion);
1020VMMR3_INT_DECL(int) PGMR3PhysMmio2QueryAndResetDirtyBitmap(PVM pVM, PPDMDEVINS pDevIns, PGMMMIO2HANDLE hMmio2,
1021 void *pvBitmap, size_t cbBitmap);
1022VMMR3_INT_DECL(int) PGMR3PhysMmio2ControlDirtyPageTracking(PVM pVM, PPDMDEVINS pDevIns, PGMMMIO2HANDLE hMmio2, bool fEnabled);
1023
1024/** @name PGMPHYS_ROM_FLAGS_XXX - ROM registration flags.
1025 * @see PGMR3PhysRegisterRom, PDMDevHlpROMRegister
1026 * @{ */
1027/** Inidicates that ROM shadowing should be enabled. */
1028#define PGMPHYS_ROM_FLAGS_SHADOWED UINT8_C(0x01)
1029/** Indicates that what pvBinary points to won't go away
1030 * and can be used for strictness checks. */
1031#define PGMPHYS_ROM_FLAGS_PERMANENT_BINARY UINT8_C(0x02)
1032/** Indicates that the ROM is allowed to be missing from saved state.
1033 * @note This is a hack for EFI, see @bugref{6940} */
1034#define PGMPHYS_ROM_FLAGS_MAYBE_MISSING_FROM_STATE UINT8_C(0x04)
1035/** Valid flags. */
1036#define PGMPHYS_ROM_FLAGS_VALID_MASK UINT8_C(0x07)
1037/** @} */
1038
1039VMMR3DECL(int) PGMR3PhysRomRegister(PVM pVM, PPDMDEVINS pDevIns, RTGCPHYS GCPhys, RTGCPHYS cb,
1040 const void *pvBinary, uint32_t cbBinary, uint8_t fFlags, const char *pszDesc);
1041VMMR3DECL(int) PGMR3PhysRomProtect(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cb, PGMROMPROT enmProt);
1042VMMDECL(void) PGMR3PhysSetA20(PVMCPU pVCpu, bool fEnable);
1043
1044VMMR3_INT_DECL(int) PGMR3HandlerPhysicalTypeRegister(PVM pVM, PGMPHYSHANDLERKIND enmKind, uint32_t fFlags,
1045 PFNPGMPHYSHANDLER pfnHandlerR3, const char *pszDesc,
1046 PPGMPHYSHANDLERTYPE phType);
1047
1048VMMR3_INT_DECL(int) PGMR3PoolGrow(PVM pVM, PVMCPU pVCpu);
1049
1050VMMR3DECL(int) PGMR3PhysTlbGCPhys2Ptr(PVM pVM, RTGCPHYS GCPhys, bool fWritable, void **ppv);
1051VMMR3DECL(uint8_t) PGMR3PhysReadU8(PVM pVM, RTGCPHYS GCPhys, PGMACCESSORIGIN enmOrigin);
1052VMMR3DECL(uint16_t) PGMR3PhysReadU16(PVM pVM, RTGCPHYS GCPhys, PGMACCESSORIGIN enmOrigin);
1053VMMR3DECL(uint32_t) PGMR3PhysReadU32(PVM pVM, RTGCPHYS GCPhys, PGMACCESSORIGIN enmOrigin);
1054VMMR3DECL(uint64_t) PGMR3PhysReadU64(PVM pVM, RTGCPHYS GCPhys, PGMACCESSORIGIN enmOrigin);
1055VMMR3DECL(void) PGMR3PhysWriteU8(PVM pVM, RTGCPHYS GCPhys, uint8_t Value, PGMACCESSORIGIN enmOrigin);
1056VMMR3DECL(void) PGMR3PhysWriteU16(PVM pVM, RTGCPHYS GCPhys, uint16_t Value, PGMACCESSORIGIN enmOrigin);
1057VMMR3DECL(void) PGMR3PhysWriteU32(PVM pVM, RTGCPHYS GCPhys, uint32_t Value, PGMACCESSORIGIN enmOrigin);
1058VMMR3DECL(void) PGMR3PhysWriteU64(PVM pVM, RTGCPHYS GCPhys, uint64_t Value, PGMACCESSORIGIN enmOrigin);
1059VMMR3DECL(int) PGMR3PhysReadExternal(PVM pVM, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead, PGMACCESSORIGIN enmOrigin);
1060VMMR3DECL(int) PGMR3PhysWriteExternal(PVM pVM, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite, PGMACCESSORIGIN enmOrigin);
1061VMMR3DECL(int) PGMR3PhysGCPhys2CCPtrExternal(PVM pVM, RTGCPHYS GCPhys, void **ppv, PPGMPAGEMAPLOCK pLock);
1062VMMR3DECL(int) PGMR3PhysGCPhys2CCPtrReadOnlyExternal(PVM pVM, RTGCPHYS GCPhys, void const **ppv, PPGMPAGEMAPLOCK pLock);
1063VMMR3DECL(int) PGMR3PhysBulkGCPhys2CCPtrExternal(PVM pVM, uint32_t cPages, PCRTGCPHYS paGCPhysPages,
1064 void **papvPages, PPGMPAGEMAPLOCK paLocks);
1065VMMR3DECL(int) PGMR3PhysBulkGCPhys2CCPtrReadOnlyExternal(PVM pVM, uint32_t cPages, PCRTGCPHYS paGCPhysPages,
1066 void const **papvPages, PPGMPAGEMAPLOCK paLocks);
1067VMMR3DECL(void) PGMR3PhysChunkInvalidateTLB(PVM pVM);
1068VMMR3DECL(int) PGMR3PhysAllocateHandyPages(PVM pVM);
1069
1070VMMR3DECL(int) PGMR3CheckIntegrity(PVM pVM);
1071
1072VMMR3DECL(int) PGMR3DbgR3Ptr2GCPhys(PUVM pUVM, RTR3PTR R3Ptr, PRTGCPHYS pGCPhys);
1073VMMR3DECL(int) PGMR3DbgR3Ptr2HCPhys(PUVM pUVM, RTR3PTR R3Ptr, PRTHCPHYS pHCPhys);
1074VMMR3DECL(int) PGMR3DbgHCPhys2GCPhys(PUVM pUVM, RTHCPHYS HCPhys, PRTGCPHYS pGCPhys);
1075VMMR3_INT_DECL(int) PGMR3DbgReadGCPhys(PVM pVM, void *pvDst, RTGCPHYS GCPhysSrc, size_t cb, uint32_t fFlags, size_t *pcbRead);
1076VMMR3_INT_DECL(int) PGMR3DbgWriteGCPhys(PVM pVM, RTGCPHYS GCPhysDst, const void *pvSrc, size_t cb, uint32_t fFlags, size_t *pcbWritten);
1077VMMR3_INT_DECL(int) PGMR3DbgReadGCPtr(PVM pVM, void *pvDst, RTGCPTR GCPtrSrc, size_t cb, uint32_t fFlags, size_t *pcbRead);
1078VMMR3_INT_DECL(int) PGMR3DbgWriteGCPtr(PVM pVM, RTGCPTR GCPtrDst, void const *pvSrc, size_t cb, uint32_t fFlags, size_t *pcbWritten);
1079VMMR3_INT_DECL(int) PGMR3DbgScanPhysical(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cbRange, RTGCPHYS GCPhysAlign, const uint8_t *pabNeedle, size_t cbNeedle, PRTGCPHYS pGCPhysHit);
1080VMMR3_INT_DECL(int) PGMR3DbgScanVirtual(PVM pVM, PVMCPU pVCpu, RTGCPTR GCPtr, RTGCPTR cbRange, RTGCPTR GCPtrAlign, const uint8_t *pabNeedle, size_t cbNeedle, PRTGCUINTPTR pGCPhysHit);
1081VMMR3_INT_DECL(int) PGMR3DumpHierarchyShw(PVM pVM, uint64_t cr3, uint32_t fFlags, uint64_t u64FirstAddr, uint64_t u64LastAddr, uint32_t cMaxDepth, PCDBGFINFOHLP pHlp);
1082VMMR3_INT_DECL(int) PGMR3DumpHierarchyGst(PVM pVM, uint64_t cr3, uint32_t fFlags, RTGCPTR FirstAddr, RTGCPTR LastAddr, uint32_t cMaxDepth, PCDBGFINFOHLP pHlp);
1083
1084
1085/** @name Page sharing
1086 * @{ */
1087VMMR3DECL(int) PGMR3SharedModuleRegister(PVM pVM, VBOXOSFAMILY enmGuestOS, char *pszModuleName, char *pszVersion,
1088 RTGCPTR GCBaseAddr, uint32_t cbModule,
1089 uint32_t cRegions, VMMDEVSHAREDREGIONDESC const *paRegions);
1090VMMR3DECL(int) PGMR3SharedModuleUnregister(PVM pVM, char *pszModuleName, char *pszVersion,
1091 RTGCPTR GCBaseAddr, uint32_t cbModule);
1092VMMR3DECL(int) PGMR3SharedModuleCheckAll(PVM pVM);
1093VMMR3DECL(int) PGMR3SharedModuleGetPageState(PVM pVM, RTGCPTR GCPtrPage, bool *pfShared, uint64_t *pfPageFlags);
1094/** @} */
1095
1096/** @} */
1097#endif /* IN_RING3 */
1098
1099RT_C_DECLS_END
1100
1101/** @} */
1102#endif /* !VBOX_INCLUDED_vmm_pgm_h */
1103
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