1 | /** @file
|
---|
2 | * PGM - Page Monitor / Monitor.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006-2019 Oracle Corporation
|
---|
7 | *
|
---|
8 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
9 | * available from http://www.virtualbox.org. This file is free software;
|
---|
10 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
11 | * General Public License (GPL) as published by the Free Software
|
---|
12 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
13 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
14 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
15 | *
|
---|
16 | * The contents of this file may alternatively be used under the terms
|
---|
17 | * of the Common Development and Distribution License Version 1.0
|
---|
18 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
19 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
20 | * CDDL are applicable instead of those of the GPL.
|
---|
21 | *
|
---|
22 | * You may elect to license modified versions of this file under the
|
---|
23 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
24 | */
|
---|
25 |
|
---|
26 | #ifndef VBOX_INCLUDED_vmm_pgm_h
|
---|
27 | #define VBOX_INCLUDED_vmm_pgm_h
|
---|
28 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
29 | # pragma once
|
---|
30 | #endif
|
---|
31 |
|
---|
32 | #include <VBox/types.h>
|
---|
33 | #include <VBox/sup.h>
|
---|
34 | #include <VBox/vmm/vmapi.h>
|
---|
35 | #include <VBox/vmm/gmm.h> /* for PGMMREGISTERSHAREDMODULEREQ */
|
---|
36 | #include <iprt/x86.h>
|
---|
37 | #include <VBox/param.h>
|
---|
38 |
|
---|
39 | RT_C_DECLS_BEGIN
|
---|
40 |
|
---|
41 | /** @defgroup grp_pgm The Page Monitor / Manager API
|
---|
42 | * @ingroup grp_vmm
|
---|
43 | * @{
|
---|
44 | */
|
---|
45 |
|
---|
46 | /**
|
---|
47 | * FNPGMRELOCATE callback mode.
|
---|
48 | */
|
---|
49 | typedef enum PGMRELOCATECALL
|
---|
50 | {
|
---|
51 | /** The callback is for checking if the suggested address is suitable. */
|
---|
52 | PGMRELOCATECALL_SUGGEST = 1,
|
---|
53 | /** The callback is for executing the relocation. */
|
---|
54 | PGMRELOCATECALL_RELOCATE
|
---|
55 | } PGMRELOCATECALL;
|
---|
56 |
|
---|
57 |
|
---|
58 | /**
|
---|
59 | * Callback function which will be called when PGM is trying to find
|
---|
60 | * a new location for the mapping.
|
---|
61 | *
|
---|
62 | * The callback is called in two modes, 1) the check mode and 2) the relocate mode.
|
---|
63 | * In 1) the callback should say if it objects to a suggested new location. If it
|
---|
64 | * accepts the new location, it is called again for doing it's relocation.
|
---|
65 | *
|
---|
66 | *
|
---|
67 | * @returns true if the location is ok.
|
---|
68 | * @returns false if another location should be found.
|
---|
69 | * @param pVM The cross context VM structure.
|
---|
70 | * @param GCPtrOld The old virtual address.
|
---|
71 | * @param GCPtrNew The new virtual address.
|
---|
72 | * @param enmMode Used to indicate the callback mode.
|
---|
73 | * @param pvUser User argument.
|
---|
74 | * @remark The return value is no a failure indicator, it's an acceptance
|
---|
75 | * indicator. Relocation can not fail!
|
---|
76 | */
|
---|
77 | typedef DECLCALLBACK(bool) FNPGMRELOCATE(PVM pVM, RTGCPTR GCPtrOld, RTGCPTR GCPtrNew, PGMRELOCATECALL enmMode, void *pvUser);
|
---|
78 | /** Pointer to a relocation callback function. */
|
---|
79 | typedef FNPGMRELOCATE *PFNPGMRELOCATE;
|
---|
80 |
|
---|
81 |
|
---|
82 | /**
|
---|
83 | * Memory access origin.
|
---|
84 | */
|
---|
85 | typedef enum PGMACCESSORIGIN
|
---|
86 | {
|
---|
87 | /** Invalid zero value. */
|
---|
88 | PGMACCESSORIGIN_INVALID = 0,
|
---|
89 | /** IEM is access memory. */
|
---|
90 | PGMACCESSORIGIN_IEM,
|
---|
91 | /** HM is access memory. */
|
---|
92 | PGMACCESSORIGIN_HM,
|
---|
93 | /** Some device is access memory. */
|
---|
94 | PGMACCESSORIGIN_DEVICE,
|
---|
95 | /** Someone debugging is access memory. */
|
---|
96 | PGMACCESSORIGIN_DEBUGGER,
|
---|
97 | /** SELM is access memory. */
|
---|
98 | PGMACCESSORIGIN_SELM,
|
---|
99 | /** FTM is access memory. */
|
---|
100 | PGMACCESSORIGIN_FTM,
|
---|
101 | /** REM is access memory. */
|
---|
102 | PGMACCESSORIGIN_REM,
|
---|
103 | /** IOM is access memory. */
|
---|
104 | PGMACCESSORIGIN_IOM,
|
---|
105 | /** End of valid values. */
|
---|
106 | PGMACCESSORIGIN_END,
|
---|
107 | /** Type size hack. */
|
---|
108 | PGMACCESSORIGIN_32BIT_HACK = 0x7fffffff
|
---|
109 | } PGMACCESSORIGIN;
|
---|
110 |
|
---|
111 |
|
---|
112 | /**
|
---|
113 | * Physical page access handler kind.
|
---|
114 | */
|
---|
115 | typedef enum PGMPHYSHANDLERKIND
|
---|
116 | {
|
---|
117 | /** MMIO range. Pages are not present, all access is done in interpreter or recompiler. */
|
---|
118 | PGMPHYSHANDLERKIND_MMIO = 1,
|
---|
119 | /** Handler all write access to a physical page range. */
|
---|
120 | PGMPHYSHANDLERKIND_WRITE,
|
---|
121 | /** Handler all access to a physical page range. */
|
---|
122 | PGMPHYSHANDLERKIND_ALL
|
---|
123 |
|
---|
124 | } PGMPHYSHANDLERKIND;
|
---|
125 |
|
---|
126 | /**
|
---|
127 | * Guest Access type
|
---|
128 | */
|
---|
129 | typedef enum PGMACCESSTYPE
|
---|
130 | {
|
---|
131 | /** Read access. */
|
---|
132 | PGMACCESSTYPE_READ = 1,
|
---|
133 | /** Write access. */
|
---|
134 | PGMACCESSTYPE_WRITE
|
---|
135 | } PGMACCESSTYPE;
|
---|
136 |
|
---|
137 |
|
---|
138 | /** @def PGM_ALL_CB_DECL
|
---|
139 | * Macro for declaring a handler callback for all contexts. The handler
|
---|
140 | * callback is static in ring-3, and exported in RC and R0.
|
---|
141 | * @sa PGM_ALL_CB2_DECL.
|
---|
142 | */
|
---|
143 | #if defined(IN_RC) || defined(IN_RING0)
|
---|
144 | # ifdef __cplusplus
|
---|
145 | # define PGM_ALL_CB_DECL(type) extern "C" DECLCALLBACK(DECLEXPORT(type))
|
---|
146 | # else
|
---|
147 | # define PGM_ALL_CB_DECL(type) DECLCALLBACK(DECLEXPORT(type))
|
---|
148 | # endif
|
---|
149 | #else
|
---|
150 | # define PGM_ALL_CB_DECL(type) static DECLCALLBACK(type)
|
---|
151 | #endif
|
---|
152 |
|
---|
153 | /** @def PGM_ALL_CB2_DECL
|
---|
154 | * Macro for declaring a handler callback for all contexts. The handler
|
---|
155 | * callback is hidden in ring-3, and exported in RC and R0.
|
---|
156 | * @sa PGM_ALL_CB2_DECL.
|
---|
157 | */
|
---|
158 | #if defined(IN_RC) || defined(IN_RING0)
|
---|
159 | # ifdef __cplusplus
|
---|
160 | # define PGM_ALL_CB2_DECL(type) extern "C" DECLCALLBACK(DECLEXPORT(type))
|
---|
161 | # else
|
---|
162 | # define PGM_ALL_CB2_DECL(type) DECLCALLBACK(DECLEXPORT(type))
|
---|
163 | # endif
|
---|
164 | #else
|
---|
165 | # define PGM_ALL_CB2_DECL(type) DECLCALLBACK(DECLHIDDEN(type))
|
---|
166 | #endif
|
---|
167 |
|
---|
168 | /** @def PGM_ALL_CB2_PROTO
|
---|
169 | * Macro for declaring a handler callback for all contexts. The handler
|
---|
170 | * callback is hidden in ring-3, and exported in RC and R0.
|
---|
171 | * @param fnType The callback function type.
|
---|
172 | * @sa PGM_ALL_CB2_DECL.
|
---|
173 | */
|
---|
174 | #if defined(IN_RC) || defined(IN_RING0)
|
---|
175 | # ifdef __cplusplus
|
---|
176 | # define PGM_ALL_CB2_PROTO(fnType) extern "C" DECLEXPORT(fnType)
|
---|
177 | # else
|
---|
178 | # define PGM_ALL_CB2_PROTO(fnType) DECLEXPORT(fnType)
|
---|
179 | # endif
|
---|
180 | #else
|
---|
181 | # define PGM_ALL_CB2_PROTO(fnType) DECLHIDDEN(fnType)
|
---|
182 | #endif
|
---|
183 |
|
---|
184 |
|
---|
185 | /**
|
---|
186 | * \#PF Handler callback for physical access handler ranges in RC and R0.
|
---|
187 | *
|
---|
188 | * @returns Strict VBox status code (appropriate for ring-0 and raw-mode).
|
---|
189 | * @param pVM The cross context VM structure.
|
---|
190 | * @param pVCpu The cross context virtual CPU structure of the calling EMT.
|
---|
191 | * @param uErrorCode CPU Error code.
|
---|
192 | * @param pRegFrame Trap register frame.
|
---|
193 | * NULL on DMA and other non CPU access.
|
---|
194 | * @param pvFault The fault address (cr2).
|
---|
195 | * @param GCPhysFault The GC physical address corresponding to pvFault.
|
---|
196 | * @param pvUser User argument.
|
---|
197 | * @thread EMT(pVCpu)
|
---|
198 | */
|
---|
199 | typedef DECLCALLBACK(VBOXSTRICTRC) FNPGMRZPHYSPFHANDLER(PVM pVM, PVMCPU pVCpu, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame,
|
---|
200 | RTGCPTR pvFault, RTGCPHYS GCPhysFault, void *pvUser);
|
---|
201 | /** Pointer to PGM access callback. */
|
---|
202 | typedef FNPGMRZPHYSPFHANDLER *PFNPGMRZPHYSPFHANDLER;
|
---|
203 |
|
---|
204 |
|
---|
205 | /**
|
---|
206 | * Access handler callback for physical access handler ranges.
|
---|
207 | *
|
---|
208 | * The handler can not raise any faults, it's mainly for monitoring write access
|
---|
209 | * to certain pages (like MMIO).
|
---|
210 | *
|
---|
211 | * @returns Strict VBox status code in ring-0 and raw-mode context, in ring-3
|
---|
212 | * the only supported informational status code is
|
---|
213 | * VINF_PGM_HANDLER_DO_DEFAULT.
|
---|
214 | * @retval VINF_SUCCESS if the handler have carried out the operation.
|
---|
215 | * @retval VINF_PGM_HANDLER_DO_DEFAULT if the caller should carry out the
|
---|
216 | * access operation.
|
---|
217 | * @retval VINF_EM_XXX in ring-0 and raw-mode context.
|
---|
218 | *
|
---|
219 | * @param pVM The cross context VM structure.
|
---|
220 | * @param pVCpu The cross context virtual CPU structure of the calling EMT.
|
---|
221 | * @param GCPhys The physical address the guest is writing to.
|
---|
222 | * @param pvPhys The HC mapping of that address.
|
---|
223 | * @param pvBuf What the guest is reading/writing.
|
---|
224 | * @param cbBuf How much it's reading/writing.
|
---|
225 | * @param enmAccessType The access type.
|
---|
226 | * @param enmOrigin The origin of this call.
|
---|
227 | * @param pvUser User argument.
|
---|
228 | * @thread EMT(pVCpu)
|
---|
229 | */
|
---|
230 | typedef DECLCALLBACK(VBOXSTRICTRC) FNPGMPHYSHANDLER(PVM pVM, PVMCPU pVCpu, RTGCPHYS GCPhys, void *pvPhys, void *pvBuf, size_t cbBuf,
|
---|
231 | PGMACCESSTYPE enmAccessType, PGMACCESSORIGIN enmOrigin, void *pvUser);
|
---|
232 | /** Pointer to PGM access callback. */
|
---|
233 | typedef FNPGMPHYSHANDLER *PFNPGMPHYSHANDLER;
|
---|
234 |
|
---|
235 |
|
---|
236 | /**
|
---|
237 | * Virtual access handler type.
|
---|
238 | */
|
---|
239 | typedef enum PGMVIRTHANDLERKIND
|
---|
240 | {
|
---|
241 | /** Write access handled. */
|
---|
242 | PGMVIRTHANDLERKIND_WRITE = 1,
|
---|
243 | /** All access handled. */
|
---|
244 | PGMVIRTHANDLERKIND_ALL,
|
---|
245 | /** Hypervisor write access handled.
|
---|
246 | * This is used to catch the guest trying to write to LDT, TSS and any other
|
---|
247 | * system structure which the brain dead intel guys let unprivilegde code find. */
|
---|
248 | PGMVIRTHANDLERKIND_HYPERVISOR
|
---|
249 | } PGMVIRTHANDLERKIND;
|
---|
250 |
|
---|
251 | /**
|
---|
252 | * \#PF handler callback for virtual access handler ranges, RC.
|
---|
253 | *
|
---|
254 | * Important to realize that a physical page in a range can have aliases, and
|
---|
255 | * for ALL and WRITE handlers these will also trigger.
|
---|
256 | *
|
---|
257 | * @returns Strict VBox status code (appropriate for raw-mode).
|
---|
258 | * @param pVM The cross context VM structure.
|
---|
259 | * @param pVCpu The cross context virtual CPU structure of the calling EMT.
|
---|
260 | * @param uErrorCode CPU Error code (X86_TRAP_PF_XXX).
|
---|
261 | * @param pRegFrame Trap register frame.
|
---|
262 | * @param pvFault The fault address (cr2).
|
---|
263 | * @param pvRange The base address of the handled virtual range.
|
---|
264 | * @param offRange The offset of the access into this range.
|
---|
265 | * (If it's a EIP range this is the EIP, if not it's pvFault.)
|
---|
266 | * @param pvUser User argument.
|
---|
267 | * @thread EMT(pVCpu)
|
---|
268 | */
|
---|
269 | typedef DECLCALLBACK(VBOXSTRICTRC) FNPGMRCVIRTPFHANDLER(PVM pVM, PVMCPU pVCpu, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame,
|
---|
270 | RTGCPTR pvFault, RTGCPTR pvRange, uintptr_t offRange, void *pvUser);
|
---|
271 | /** Pointer to PGM access callback. */
|
---|
272 | typedef FNPGMRCVIRTPFHANDLER *PFNPGMRCVIRTPFHANDLER;
|
---|
273 |
|
---|
274 | /**
|
---|
275 | * Access handler callback for virtual access handler ranges.
|
---|
276 | *
|
---|
277 | * Important to realize that a physical page in a range can have aliases, and
|
---|
278 | * for ALL and WRITE handlers these will also trigger.
|
---|
279 | *
|
---|
280 | * @returns VINF_SUCCESS if the handler have carried out the operation.
|
---|
281 | * @returns VINF_PGM_HANDLER_DO_DEFAULT if the caller should carry out the access operation.
|
---|
282 | * @param pVM The cross context VM structure.
|
---|
283 | * @param pVCpu The cross context virtual CPU structure of the calling EMT.
|
---|
284 | * @param GCPtr The virtual address the guest is writing to. This
|
---|
285 | * is the registered address corresponding to the
|
---|
286 | * access, so no aliasing trouble here.
|
---|
287 | * @param pvPtr The HC mapping of that address.
|
---|
288 | * @param pvBuf What the guest is reading/writing.
|
---|
289 | * @param cbBuf How much it's reading/writing.
|
---|
290 | * @param enmAccessType The access type.
|
---|
291 | * @param enmOrigin Who is calling.
|
---|
292 | * @param pvUser User argument.
|
---|
293 | * @thread EMT(pVCpu)
|
---|
294 | */
|
---|
295 | typedef DECLCALLBACK(VBOXSTRICTRC) FNPGMVIRTHANDLER(PVM pVM, PVMCPU pVCpu, RTGCPTR GCPtr, void *pvPtr, void *pvBuf, size_t cbBuf,
|
---|
296 | PGMACCESSTYPE enmAccessType, PGMACCESSORIGIN enmOrigin, void *pvUser);
|
---|
297 | /** Pointer to PGM access callback. */
|
---|
298 | typedef FNPGMVIRTHANDLER *PFNPGMVIRTHANDLER;
|
---|
299 |
|
---|
300 | /**
|
---|
301 | * \#PF Handler callback for invalidation of virtual access handler ranges.
|
---|
302 | *
|
---|
303 | * @param pVM The cross context VM structure.
|
---|
304 | * @param pVCpu The cross context virtual CPU structure of the calling EMT.
|
---|
305 | * @param GCPtr The virtual address the guest has changed.
|
---|
306 | * @param pvUser User argument.
|
---|
307 | * @thread EMT(pVCpu)
|
---|
308 | *
|
---|
309 | * @todo FNPGMR3VIRTINVALIDATE will not actually be called! It was introduced
|
---|
310 | * in r13179 (1.1) and stopped working with r13806 (PGMPool merge,
|
---|
311 | * v1.2), exactly a month later.
|
---|
312 | */
|
---|
313 | typedef DECLCALLBACK(int) FNPGMR3VIRTINVALIDATE(PVM pVM, PVMCPU pVCpu, RTGCPTR GCPtr, void *pvUser);
|
---|
314 | /** Pointer to PGM invalidation callback. */
|
---|
315 | typedef FNPGMR3VIRTINVALIDATE *PFNPGMR3VIRTINVALIDATE;
|
---|
316 |
|
---|
317 |
|
---|
318 | /**
|
---|
319 | * PGMR3PhysEnumDirtyFTPages callback for syncing dirty physical pages
|
---|
320 | *
|
---|
321 | * @param pVM The cross context VM structure.
|
---|
322 | * @param GCPhys GC physical address
|
---|
323 | * @param pRange HC virtual address of the page(s)
|
---|
324 | * @param cbRange Size of the dirty range in bytes.
|
---|
325 | * @param pvUser User argument.
|
---|
326 | */
|
---|
327 | typedef DECLCALLBACK(int) FNPGMENUMDIRTYFTPAGES(PVM pVM, RTGCPHYS GCPhys, uint8_t *pRange, unsigned cbRange, void *pvUser);
|
---|
328 | /** Pointer to PGMR3PhysEnumDirtyFTPages callback. */
|
---|
329 | typedef FNPGMENUMDIRTYFTPAGES *PFNPGMENUMDIRTYFTPAGES;
|
---|
330 |
|
---|
331 |
|
---|
332 | /**
|
---|
333 | * Paging mode.
|
---|
334 | *
|
---|
335 | * @note Part of saved state. Change with extreme care.
|
---|
336 | */
|
---|
337 | typedef enum PGMMODE
|
---|
338 | {
|
---|
339 | /** The usual invalid value. */
|
---|
340 | PGMMODE_INVALID = 0,
|
---|
341 | /** Real mode. */
|
---|
342 | PGMMODE_REAL,
|
---|
343 | /** Protected mode, no paging. */
|
---|
344 | PGMMODE_PROTECTED,
|
---|
345 | /** 32-bit paging. */
|
---|
346 | PGMMODE_32_BIT,
|
---|
347 | /** PAE paging. */
|
---|
348 | PGMMODE_PAE,
|
---|
349 | /** PAE paging with NX enabled. */
|
---|
350 | PGMMODE_PAE_NX,
|
---|
351 | /** 64-bit AMD paging (long mode). */
|
---|
352 | PGMMODE_AMD64,
|
---|
353 | /** 64-bit AMD paging (long mode) with NX enabled. */
|
---|
354 | PGMMODE_AMD64_NX,
|
---|
355 | /** 32-bit nested paging mode (shadow only; guest physical to host physical). */
|
---|
356 | PGMMODE_NESTED_32BIT,
|
---|
357 | /** PAE nested paging mode (shadow only; guest physical to host physical). */
|
---|
358 | PGMMODE_NESTED_PAE,
|
---|
359 | /** AMD64 nested paging mode (shadow only; guest physical to host physical). */
|
---|
360 | PGMMODE_NESTED_AMD64,
|
---|
361 | /** Extended paging (Intel) mode. */
|
---|
362 | PGMMODE_EPT,
|
---|
363 | /** Special mode used by NEM to indicate no shadow paging necessary. */
|
---|
364 | PGMMODE_NONE,
|
---|
365 | /** The max number of modes */
|
---|
366 | PGMMODE_MAX,
|
---|
367 | /** 32bit hackishness. */
|
---|
368 | PGMMODE_32BIT_HACK = 0x7fffffff
|
---|
369 | } PGMMODE;
|
---|
370 |
|
---|
371 | /** Macro for checking if the guest is using paging.
|
---|
372 | * @param enmMode PGMMODE_*.
|
---|
373 | * @remark ASSUMES certain order of the PGMMODE_* values.
|
---|
374 | */
|
---|
375 | #define PGMMODE_WITH_PAGING(enmMode) ((enmMode) >= PGMMODE_32_BIT)
|
---|
376 |
|
---|
377 | /** Macro for checking if it's one of the long mode modes.
|
---|
378 | * @param enmMode PGMMODE_*.
|
---|
379 | */
|
---|
380 | #define PGMMODE_IS_LONG_MODE(enmMode) ((enmMode) == PGMMODE_AMD64_NX || (enmMode) == PGMMODE_AMD64)
|
---|
381 |
|
---|
382 | /** Macro for checking if it's one of the AMD64 nested modes.
|
---|
383 | * @param enmMode PGMMODE_*.
|
---|
384 | */
|
---|
385 | #define PGMMODE_IS_NESTED(enmMode) ( (enmMode) == PGMMODE_NESTED_32BIT \
|
---|
386 | || (enmMode) == PGMMODE_NESTED_PAE \
|
---|
387 | || (enmMode) == PGMMODE_NESTED_AMD64)
|
---|
388 |
|
---|
389 | /**
|
---|
390 | * Is the ROM mapped (true) or is the shadow RAM mapped (false).
|
---|
391 | *
|
---|
392 | * @returns boolean.
|
---|
393 | * @param enmProt The PGMROMPROT value, must be valid.
|
---|
394 | */
|
---|
395 | #define PGMROMPROT_IS_ROM(enmProt) \
|
---|
396 | ( (enmProt) == PGMROMPROT_READ_ROM_WRITE_IGNORE \
|
---|
397 | || (enmProt) == PGMROMPROT_READ_ROM_WRITE_RAM )
|
---|
398 |
|
---|
399 |
|
---|
400 | VMMDECL(bool) PGMIsLockOwner(PVM pVM);
|
---|
401 |
|
---|
402 | VMMDECL(int) PGMRegisterStringFormatTypes(void);
|
---|
403 | VMMDECL(void) PGMDeregisterStringFormatTypes(void);
|
---|
404 | VMMDECL(RTHCPHYS) PGMGetHyperCR3(PVMCPU pVCpu);
|
---|
405 | VMMDECL(RTHCPHYS) PGMGetNestedCR3(PVMCPU pVCpu, PGMMODE enmShadowMode);
|
---|
406 | VMMDECL(RTHCPHYS) PGMGetInterHCCR3(PVM pVM);
|
---|
407 | VMMDECL(RTHCPHYS) PGMGetInterRCCR3(PVM pVM, PVMCPU pVCpu);
|
---|
408 | VMMDECL(RTHCPHYS) PGMGetInter32BitCR3(PVM pVM);
|
---|
409 | VMMDECL(RTHCPHYS) PGMGetInterPaeCR3(PVM pVM);
|
---|
410 | VMMDECL(RTHCPHYS) PGMGetInterAmd64CR3(PVM pVM);
|
---|
411 | VMMDECL(int) PGMTrap0eHandler(PVMCPU pVCpu, RTGCUINT uErr, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault);
|
---|
412 | VMMDECL(int) PGMPrefetchPage(PVMCPU pVCpu, RTGCPTR GCPtrPage);
|
---|
413 | VMMDECL(int) PGMVerifyAccess(PVMCPU pVCpu, RTGCPTR Addr, uint32_t cbSize, uint32_t fAccess);
|
---|
414 | VMMDECL(int) PGMIsValidAccess(PVMCPU pVCpu, RTGCPTR Addr, uint32_t cbSize, uint32_t fAccess);
|
---|
415 | VMMDECL(VBOXSTRICTRC) PGMInterpretInstruction(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault);
|
---|
416 | VMMDECL(int) PGMMap(PVM pVM, RTGCPTR GCPtr, RTHCPHYS HCPhys, uint32_t cbPages, unsigned fFlags);
|
---|
417 | VMMDECL(int) PGMMapGetPage(PVM pVM, RTGCPTR GCPtr, uint64_t *pfFlags, PRTHCPHYS pHCPhys);
|
---|
418 | VMMDECL(int) PGMMapSetPage(PVM pVM, RTGCPTR GCPtr, uint64_t cb, uint64_t fFlags);
|
---|
419 | VMMDECL(int) PGMMapModifyPage(PVM pVM, RTGCPTR GCPtr, size_t cb, uint64_t fFlags, uint64_t fMask);
|
---|
420 | #ifndef IN_RING0
|
---|
421 | VMMDECL(bool) PGMMapHasConflicts(PVM pVM);
|
---|
422 | #endif
|
---|
423 | #ifdef VBOX_STRICT
|
---|
424 | VMMDECL(void) PGMMapCheck(PVM pVM);
|
---|
425 | #endif
|
---|
426 | VMMDECL(int) PGMShwGetPage(PVMCPU pVCpu, RTGCPTR GCPtr, uint64_t *pfFlags, PRTHCPHYS pHCPhys);
|
---|
427 | VMMDECL(int) PGMShwMakePageReadonly(PVMCPU pVCpu, RTGCPTR GCPtr, uint32_t fFlags);
|
---|
428 | VMMDECL(int) PGMShwMakePageWritable(PVMCPU pVCpu, RTGCPTR GCPtr, uint32_t fFlags);
|
---|
429 | VMMDECL(int) PGMShwMakePageNotPresent(PVMCPU pVCpu, RTGCPTR GCPtr, uint32_t fFlags);
|
---|
430 | /** @name Flags for PGMShwMakePageReadonly, PGMShwMakePageWritable and
|
---|
431 | * PGMShwMakePageNotPresent
|
---|
432 | * @{ */
|
---|
433 | /** The call is from an access handler for dealing with the a faulting write
|
---|
434 | * operation. The virtual address is within the same page. */
|
---|
435 | #define PGM_MK_PG_IS_WRITE_FAULT RT_BIT(0)
|
---|
436 | /** The page is an MMIO2. */
|
---|
437 | #define PGM_MK_PG_IS_MMIO2 RT_BIT(1)
|
---|
438 | /** @}*/
|
---|
439 | VMMDECL(int) PGMGstGetPage(PVMCPU pVCpu, RTGCPTR GCPtr, uint64_t *pfFlags, PRTGCPHYS pGCPhys);
|
---|
440 | VMMDECL(bool) PGMGstIsPagePresent(PVMCPU pVCpu, RTGCPTR GCPtr);
|
---|
441 | VMMDECL(int) PGMGstSetPage(PVMCPU pVCpu, RTGCPTR GCPtr, size_t cb, uint64_t fFlags);
|
---|
442 | VMMDECL(int) PGMGstModifyPage(PVMCPU pVCpu, RTGCPTR GCPtr, size_t cb, uint64_t fFlags, uint64_t fMask);
|
---|
443 | VMM_INT_DECL(int) PGMGstGetPaePdpes(PVMCPU pVCpu, PX86PDPE paPdpes);
|
---|
444 | VMM_INT_DECL(void) PGMGstUpdatePaePdpes(PVMCPU pVCpu, PCX86PDPE paPdpes);
|
---|
445 |
|
---|
446 | VMMDECL(int) PGMInvalidatePage(PVMCPU pVCpu, RTGCPTR GCPtrPage);
|
---|
447 | VMMDECL(int) PGMFlushTLB(PVMCPU pVCpu, uint64_t cr3, bool fGlobal);
|
---|
448 | VMMDECL(int) PGMSyncCR3(PVMCPU pVCpu, uint64_t cr0, uint64_t cr3, uint64_t cr4, bool fGlobal);
|
---|
449 | VMMDECL(int) PGMUpdateCR3(PVMCPU pVCpu, uint64_t cr3);
|
---|
450 | VMMDECL(int) PGMChangeMode(PVMCPU pVCpu, uint64_t cr0, uint64_t cr4, uint64_t efer);
|
---|
451 | VMM_INT_DECL(int) PGMHCChangeMode(PVM pVM, PVMCPU pVCpu, PGMMODE enmGuestMode);
|
---|
452 | VMMDECL(void) PGMCr0WpEnabled(PVMCPU pVCpu);
|
---|
453 | VMMDECL(PGMMODE) PGMGetGuestMode(PVMCPU pVCpu);
|
---|
454 | VMMDECL(PGMMODE) PGMGetShadowMode(PVMCPU pVCpu);
|
---|
455 | VMMDECL(PGMMODE) PGMGetHostMode(PVM pVM);
|
---|
456 | VMMDECL(const char *) PGMGetModeName(PGMMODE enmMode);
|
---|
457 | VMM_INT_DECL(RTGCPHYS) PGMGetGuestCR3Phys(PVMCPU pVCpu);
|
---|
458 | VMM_INT_DECL(void) PGMNotifyNxeChanged(PVMCPU pVCpu, bool fNxe);
|
---|
459 | VMMDECL(bool) PGMHasDirtyPages(PVM pVM);
|
---|
460 |
|
---|
461 | /** PGM physical access handler type registration handle (heap offset, valid
|
---|
462 | * cross contexts without needing fixing up). Callbacks and handler type is
|
---|
463 | * associated with this and it is shared by all handler registrations. */
|
---|
464 | typedef uint32_t PGMPHYSHANDLERTYPE;
|
---|
465 | /** Pointer to a PGM physical handler type registration handle. */
|
---|
466 | typedef PGMPHYSHANDLERTYPE *PPGMPHYSHANDLERTYPE;
|
---|
467 | /** NIL value for PGM physical access handler type handle. */
|
---|
468 | #define NIL_PGMPHYSHANDLERTYPE UINT32_MAX
|
---|
469 | VMMDECL(uint32_t) PGMHandlerPhysicalTypeRelease(PVM pVM, PGMPHYSHANDLERTYPE hType);
|
---|
470 | VMMDECL(uint32_t) PGMHandlerPhysicalTypeRetain(PVM pVM, PGMPHYSHANDLERTYPE hType);
|
---|
471 |
|
---|
472 | VMMDECL(int) PGMHandlerPhysicalRegister(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS GCPhysLast, PGMPHYSHANDLERTYPE hType,
|
---|
473 | RTR3PTR pvUserR3, RTR0PTR pvUserR0, RTRCPTR pvUserRC,
|
---|
474 | R3PTRTYPE(const char *) pszDesc);
|
---|
475 | VMMDECL(int) PGMHandlerPhysicalModify(PVM pVM, RTGCPHYS GCPhysCurrent, RTGCPHYS GCPhys, RTGCPHYS GCPhysLast);
|
---|
476 | VMMDECL(int) PGMHandlerPhysicalDeregister(PVM pVM, RTGCPHYS GCPhys);
|
---|
477 | VMMDECL(int) PGMHandlerPhysicalChangeUserArgs(PVM pVM, RTGCPHYS GCPhys, RTR3PTR pvUserR3, RTR0PTR pvUserR0, RTRCPTR pvUserRC);
|
---|
478 | VMMDECL(int) PGMHandlerPhysicalSplit(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS GCPhysSplit);
|
---|
479 | VMMDECL(int) PGMHandlerPhysicalJoin(PVM pVM, RTGCPHYS GCPhys1, RTGCPHYS GCPhys2);
|
---|
480 | VMMDECL(int) PGMHandlerPhysicalPageTempOff(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS GCPhysPage);
|
---|
481 | VMMDECL(int) PGMHandlerPhysicalPageAlias(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS GCPhysPage, RTGCPHYS GCPhysPageRemap);
|
---|
482 | VMMDECL(int) PGMHandlerPhysicalPageAliasHC(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS GCPhysPage, RTHCPHYS HCPhysPageRemap);
|
---|
483 | VMMDECL(int) PGMHandlerPhysicalReset(PVM pVM, RTGCPHYS GCPhys);
|
---|
484 | VMMDECL(bool) PGMHandlerPhysicalIsRegistered(PVM pVM, RTGCPHYS GCPhys);
|
---|
485 |
|
---|
486 | /** PGM virtual access handler type registration handle (heap offset, valid
|
---|
487 | * cross contexts without needing fixing up). Callbacks and handler type is
|
---|
488 | * associated with this and it is shared by all handler registrations. */
|
---|
489 | typedef uint32_t PGMVIRTHANDLERTYPE;
|
---|
490 | /** Pointer to a PGM virtual handler type registration handle. */
|
---|
491 | typedef PGMVIRTHANDLERTYPE *PPGMVIRTHANDLERTYPE;
|
---|
492 | /** NIL value for PGM virtual access handler type handle. */
|
---|
493 | #define NIL_PGMVIRTHANDLERTYPE UINT32_MAX
|
---|
494 | #ifdef VBOX_WITH_RAW_MODE
|
---|
495 | VMM_INT_DECL(uint32_t) PGMHandlerVirtualTypeRelease(PVM pVM, PGMVIRTHANDLERTYPE hType);
|
---|
496 | VMM_INT_DECL(uint32_t) PGMHandlerVirtualTypeRetain(PVM pVM, PGMVIRTHANDLERTYPE hType);
|
---|
497 | VMM_INT_DECL(bool) PGMHandlerVirtualIsRegistered(PVM pVM, RTGCPTR GCPtr);
|
---|
498 | #endif
|
---|
499 |
|
---|
500 |
|
---|
501 | /**
|
---|
502 | * Page type.
|
---|
503 | *
|
---|
504 | * @remarks This enum has to fit in a 3-bit field (see PGMPAGE::u3Type).
|
---|
505 | * @remarks This is used in the saved state, so changes to it requires bumping
|
---|
506 | * the saved state version.
|
---|
507 | * @todo So, convert to \#defines!
|
---|
508 | */
|
---|
509 | typedef enum PGMPAGETYPE
|
---|
510 | {
|
---|
511 | /** The usual invalid zero entry. */
|
---|
512 | PGMPAGETYPE_INVALID = 0,
|
---|
513 | /** RAM page. (RWX) */
|
---|
514 | PGMPAGETYPE_RAM,
|
---|
515 | /** MMIO2 page. (RWX) */
|
---|
516 | PGMPAGETYPE_MMIO2,
|
---|
517 | /** MMIO2 page aliased over an MMIO page. (RWX)
|
---|
518 | * See PGMHandlerPhysicalPageAlias(). */
|
---|
519 | PGMPAGETYPE_MMIO2_ALIAS_MMIO,
|
---|
520 | /** Special page aliased over an MMIO page. (RWX)
|
---|
521 | * See PGMHandlerPhysicalPageAliasHC(), but this is generally only used for
|
---|
522 | * VT-x's APIC access page at the moment. Treated as MMIO by everyone except
|
---|
523 | * the shadow paging code. */
|
---|
524 | PGMPAGETYPE_SPECIAL_ALIAS_MMIO,
|
---|
525 | /** Shadowed ROM. (RWX) */
|
---|
526 | PGMPAGETYPE_ROM_SHADOW,
|
---|
527 | /** ROM page. (R-X) */
|
---|
528 | PGMPAGETYPE_ROM,
|
---|
529 | /** MMIO page. (---) */
|
---|
530 | PGMPAGETYPE_MMIO,
|
---|
531 | /** End of valid entries. */
|
---|
532 | PGMPAGETYPE_END
|
---|
533 | } PGMPAGETYPE;
|
---|
534 | AssertCompile(PGMPAGETYPE_END == 8);
|
---|
535 |
|
---|
536 | /** @name PGM page type predicates.
|
---|
537 | * @{ */
|
---|
538 | #define PGMPAGETYPE_IS_READABLE(a_enmType) ( (a_enmType) <= PGMPAGETYPE_ROM )
|
---|
539 | #define PGMPAGETYPE_IS_WRITEABLE(a_enmType) ( (a_enmType) <= PGMPAGETYPE_ROM_SHADOW )
|
---|
540 | #define PGMPAGETYPE_IS_RWX(a_enmType) ( (a_enmType) <= PGMPAGETYPE_ROM_SHADOW )
|
---|
541 | #define PGMPAGETYPE_IS_ROX(a_enmType) ( (a_enmType) == PGMPAGETYPE_ROM )
|
---|
542 | #define PGMPAGETYPE_IS_NP(a_enmType) ( (a_enmType) == PGMPAGETYPE_MMIO )
|
---|
543 | /** @} */
|
---|
544 |
|
---|
545 |
|
---|
546 | VMM_INT_DECL(PGMPAGETYPE) PGMPhysGetPageType(PVM pVM, RTGCPHYS GCPhys);
|
---|
547 |
|
---|
548 | VMM_INT_DECL(int) PGMPhysGCPhys2HCPhys(PVM pVM, RTGCPHYS GCPhys, PRTHCPHYS pHCPhys);
|
---|
549 | VMM_INT_DECL(int) PGMPhysGCPtr2HCPhys(PVMCPU pVCpu, RTGCPTR GCPtr, PRTHCPHYS pHCPhys);
|
---|
550 | VMM_INT_DECL(int) PGMPhysGCPhys2CCPtr(PVM pVM, RTGCPHYS GCPhys, void **ppv, PPGMPAGEMAPLOCK pLock);
|
---|
551 | VMM_INT_DECL(int) PGMPhysGCPhys2CCPtrReadOnly(PVM pVM, RTGCPHYS GCPhys, void const **ppv, PPGMPAGEMAPLOCK pLock);
|
---|
552 | VMM_INT_DECL(int) PGMPhysGCPtr2CCPtr(PVMCPU pVCpu, RTGCPTR GCPtr, void **ppv, PPGMPAGEMAPLOCK pLock);
|
---|
553 | VMM_INT_DECL(int) PGMPhysGCPtr2CCPtrReadOnly(PVMCPU pVCpu, RTGCPTR GCPtr, void const **ppv, PPGMPAGEMAPLOCK pLock);
|
---|
554 |
|
---|
555 | VMMDECL(bool) PGMPhysIsA20Enabled(PVMCPU pVCpu);
|
---|
556 | VMMDECL(bool) PGMPhysIsGCPhysValid(PVM pVM, RTGCPHYS GCPhys);
|
---|
557 | VMMDECL(bool) PGMPhysIsGCPhysNormal(PVM pVM, RTGCPHYS GCPhys);
|
---|
558 | VMMDECL(int) PGMPhysGCPtr2GCPhys(PVMCPU pVCpu, RTGCPTR GCPtr, PRTGCPHYS pGCPhys);
|
---|
559 | VMMDECL(void) PGMPhysReleasePageMappingLock(PVM pVM, PPGMPAGEMAPLOCK pLock);
|
---|
560 |
|
---|
561 | /** @def PGM_PHYS_RW_IS_SUCCESS
|
---|
562 | * Check whether a PGMPhysRead, PGMPhysWrite, PGMPhysReadGCPtr or
|
---|
563 | * PGMPhysWriteGCPtr call completed the given task.
|
---|
564 | *
|
---|
565 | * @returns true if completed, false if not.
|
---|
566 | * @param a_rcStrict The status code.
|
---|
567 | * @sa IOM_SUCCESS
|
---|
568 | */
|
---|
569 | #ifdef IN_RING3
|
---|
570 | # define PGM_PHYS_RW_IS_SUCCESS(a_rcStrict) \
|
---|
571 | ( (a_rcStrict) == VINF_SUCCESS \
|
---|
572 | || (a_rcStrict) == VINF_EM_DBG_STOP \
|
---|
573 | || (a_rcStrict) == VINF_EM_DBG_EVENT \
|
---|
574 | || (a_rcStrict) == VINF_EM_DBG_BREAKPOINT \
|
---|
575 | )
|
---|
576 | #elif defined(IN_RING0)
|
---|
577 | # define PGM_PHYS_RW_IS_SUCCESS(a_rcStrict) \
|
---|
578 | ( (a_rcStrict) == VINF_SUCCESS \
|
---|
579 | || (a_rcStrict) == VINF_IOM_R3_MMIO_COMMIT_WRITE \
|
---|
580 | || (a_rcStrict) == VINF_EM_OFF \
|
---|
581 | || (a_rcStrict) == VINF_EM_SUSPEND \
|
---|
582 | || (a_rcStrict) == VINF_EM_RESET \
|
---|
583 | || (a_rcStrict) == VINF_EM_HALT \
|
---|
584 | || (a_rcStrict) == VINF_EM_DBG_STOP \
|
---|
585 | || (a_rcStrict) == VINF_EM_DBG_EVENT \
|
---|
586 | || (a_rcStrict) == VINF_EM_DBG_BREAKPOINT \
|
---|
587 | )
|
---|
588 | #elif defined(IN_RC)
|
---|
589 | # define PGM_PHYS_RW_IS_SUCCESS(a_rcStrict) \
|
---|
590 | ( (a_rcStrict) == VINF_SUCCESS \
|
---|
591 | || (a_rcStrict) == VINF_IOM_R3_MMIO_COMMIT_WRITE \
|
---|
592 | || (a_rcStrict) == VINF_EM_OFF \
|
---|
593 | || (a_rcStrict) == VINF_EM_SUSPEND \
|
---|
594 | || (a_rcStrict) == VINF_EM_RESET \
|
---|
595 | || (a_rcStrict) == VINF_EM_HALT \
|
---|
596 | || (a_rcStrict) == VINF_SELM_SYNC_GDT \
|
---|
597 | || (a_rcStrict) == VINF_EM_RAW_EMULATE_INSTR_GDT_FAULT \
|
---|
598 | || (a_rcStrict) == VINF_EM_DBG_STOP \
|
---|
599 | || (a_rcStrict) == VINF_EM_DBG_EVENT \
|
---|
600 | || (a_rcStrict) == VINF_EM_DBG_BREAKPOINT \
|
---|
601 | )
|
---|
602 | #endif
|
---|
603 | /** @def PGM_PHYS_RW_DO_UPDATE_STRICT_RC
|
---|
604 | * Updates the return code with a new result.
|
---|
605 | *
|
---|
606 | * Both status codes must be successes according to PGM_PHYS_RW_IS_SUCCESS.
|
---|
607 | *
|
---|
608 | * @param a_rcStrict The current return code, to be updated.
|
---|
609 | * @param a_rcStrict2 The new return code to merge in.
|
---|
610 | */
|
---|
611 | #ifdef IN_RING3
|
---|
612 | # define PGM_PHYS_RW_DO_UPDATE_STRICT_RC(a_rcStrict, a_rcStrict2) \
|
---|
613 | do { \
|
---|
614 | Assert(rcStrict == VINF_SUCCESS); \
|
---|
615 | Assert(rcStrict2 == VINF_SUCCESS); \
|
---|
616 | } while (0)
|
---|
617 | #elif defined(IN_RING0)
|
---|
618 | # define PGM_PHYS_RW_DO_UPDATE_STRICT_RC(a_rcStrict, a_rcStrict2) \
|
---|
619 | do { \
|
---|
620 | Assert(PGM_PHYS_RW_IS_SUCCESS(rcStrict)); \
|
---|
621 | Assert(PGM_PHYS_RW_IS_SUCCESS(rcStrict2)); \
|
---|
622 | AssertCompile(VINF_IOM_R3_MMIO_COMMIT_WRITE > VINF_EM_LAST); \
|
---|
623 | if ((a_rcStrict2) == VINF_SUCCESS || (a_rcStrict) == (a_rcStrict2)) \
|
---|
624 | { /* likely */ } \
|
---|
625 | else if ( (a_rcStrict) == VINF_SUCCESS \
|
---|
626 | || (a_rcStrict) > (a_rcStrict2)) \
|
---|
627 | (a_rcStrict) = (a_rcStrict2); \
|
---|
628 | } while (0)
|
---|
629 | #elif defined(IN_RC)
|
---|
630 | # define PGM_PHYS_RW_DO_UPDATE_STRICT_RC(a_rcStrict, a_rcStrict2) \
|
---|
631 | do { \
|
---|
632 | Assert(PGM_PHYS_RW_IS_SUCCESS(rcStrict)); \
|
---|
633 | Assert(PGM_PHYS_RW_IS_SUCCESS(rcStrict2)); \
|
---|
634 | AssertCompile(VINF_SELM_SYNC_GDT > VINF_EM_LAST); \
|
---|
635 | AssertCompile(VINF_EM_RAW_EMULATE_INSTR_GDT_FAULT > VINF_EM_LAST); \
|
---|
636 | AssertCompile(VINF_EM_RAW_EMULATE_INSTR_GDT_FAULT < VINF_SELM_SYNC_GDT); \
|
---|
637 | AssertCompile(VINF_IOM_R3_MMIO_COMMIT_WRITE > VINF_EM_LAST); \
|
---|
638 | AssertCompile(VINF_IOM_R3_MMIO_COMMIT_WRITE > VINF_SELM_SYNC_GDT); \
|
---|
639 | AssertCompile(VINF_IOM_R3_MMIO_COMMIT_WRITE > VINF_EM_RAW_EMULATE_INSTR_GDT_FAULT); \
|
---|
640 | if ((a_rcStrict2) == VINF_SUCCESS || (a_rcStrict) == (a_rcStrict2)) \
|
---|
641 | { /* likely */ } \
|
---|
642 | else if ((a_rcStrict) == VINF_SUCCESS) \
|
---|
643 | (a_rcStrict) = (a_rcStrict2); \
|
---|
644 | else if ( ( (a_rcStrict) > (a_rcStrict2) \
|
---|
645 | && ( (a_rcStrict2) <= VINF_EM_RESET \
|
---|
646 | || (a_rcStrict) != VINF_EM_RAW_EMULATE_INSTR_GDT_FAULT) ) \
|
---|
647 | || ( (a_rcStrict2) == VINF_EM_RAW_EMULATE_INSTR_GDT_FAULT \
|
---|
648 | && (a_rcStrict) > VINF_EM_RESET) ) \
|
---|
649 | (a_rcStrict) = (a_rcStrict2); \
|
---|
650 | } while (0)
|
---|
651 | #endif
|
---|
652 |
|
---|
653 | VMMDECL(VBOXSTRICTRC) PGMPhysRead(PVM pVM, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead, PGMACCESSORIGIN enmOrigin);
|
---|
654 | VMMDECL(VBOXSTRICTRC) PGMPhysWrite(PVM pVM, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite, PGMACCESSORIGIN enmOrigin);
|
---|
655 | VMMDECL(VBOXSTRICTRC) PGMPhysReadGCPtr(PVMCPU pVCpu, void *pvDst, RTGCPTR GCPtrSrc, size_t cb, PGMACCESSORIGIN enmOrigin);
|
---|
656 | VMMDECL(VBOXSTRICTRC) PGMPhysWriteGCPtr(PVMCPU pVCpu, RTGCPTR GCPtrDst, const void *pvSrc, size_t cb, PGMACCESSORIGIN enmOrigin);
|
---|
657 |
|
---|
658 | VMMDECL(int) PGMPhysSimpleReadGCPhys(PVM pVM, void *pvDst, RTGCPHYS GCPhysSrc, size_t cb);
|
---|
659 | VMMDECL(int) PGMPhysSimpleWriteGCPhys(PVM pVM, RTGCPHYS GCPhysDst, const void *pvSrc, size_t cb);
|
---|
660 | VMMDECL(int) PGMPhysSimpleReadGCPtr(PVMCPU pVCpu, void *pvDst, RTGCPTR GCPtrSrc, size_t cb);
|
---|
661 | VMMDECL(int) PGMPhysSimpleWriteGCPtr(PVMCPU pVCpu, RTGCPTR GCPtrDst, const void *pvSrc, size_t cb);
|
---|
662 | VMMDECL(int) PGMPhysSimpleDirtyWriteGCPtr(PVMCPU pVCpu, RTGCPTR GCPtrDst, const void *pvSrc, size_t cb);
|
---|
663 | VMMDECL(int) PGMPhysInterpretedRead(PVMCPU pVCpu, PCPUMCTXCORE pCtxCore, void *pvDst, RTGCPTR GCPtrSrc, size_t cb);
|
---|
664 | VMMDECL(int) PGMPhysInterpretedReadNoHandlers(PVMCPU pVCpu, PCPUMCTXCORE pCtxCore, void *pvDst, RTGCUINTPTR GCPtrSrc, size_t cb, bool fRaiseTrap);
|
---|
665 | VMMDECL(int) PGMPhysInterpretedWriteNoHandlers(PVMCPU pVCpu, PCPUMCTXCORE pCtxCore, RTGCPTR GCPtrDst, void const *pvSrc, size_t cb, bool fRaiseTrap);
|
---|
666 |
|
---|
667 | VMM_INT_DECL(int) PGMPhysIemGCPhys2Ptr(PVM pVM, PVMCPU pVCpu, RTGCPHYS GCPhys, bool fWritable, bool fByPassHandlers, void **ppv, PPGMPAGEMAPLOCK pLock);
|
---|
668 | VMM_INT_DECL(int) PGMPhysIemQueryAccess(PVM pVM, RTGCPHYS GCPhys, bool fWritable, bool fByPassHandlers);
|
---|
669 | VMM_INT_DECL(int) PGMPhysIemGCPhys2PtrNoLock(PVM pVM, PVMCPU pVCpu, RTGCPHYS GCPhys, uint64_t const volatile *puTlbPhysRev,
|
---|
670 | #if defined(IN_RC) || defined(VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0)
|
---|
671 | R3PTRTYPE(uint8_t *) *ppb,
|
---|
672 | #else
|
---|
673 | R3R0PTRTYPE(uint8_t *) *ppb,
|
---|
674 | #endif
|
---|
675 | uint64_t *pfTlb);
|
---|
676 | /** @name Flags returned by PGMPhysIemGCPhys2PtrNoLock
|
---|
677 | * @{ */
|
---|
678 | #define PGMIEMGCPHYS2PTR_F_NO_WRITE RT_BIT_32(3) /**< Not writable (IEMTLBE_F_PG_NO_WRITE). */
|
---|
679 | #define PGMIEMGCPHYS2PTR_F_NO_READ RT_BIT_32(4) /**< Not readable (IEMTLBE_F_PG_NO_READ). */
|
---|
680 | #define PGMIEMGCPHYS2PTR_F_NO_MAPPINGR3 RT_BIT_32(7) /**< No ring-3 mapping (IEMTLBE_F_NO_MAPPINGR3). */
|
---|
681 | /** @} */
|
---|
682 |
|
---|
683 | /** Information returned by PGMPhysNemQueryPageInfo. */
|
---|
684 | typedef struct PGMPHYSNEMPAGEINFO
|
---|
685 | {
|
---|
686 | /** The host physical address of the page, NIL_HCPHYS if invalid page. */
|
---|
687 | RTHCPHYS HCPhys;
|
---|
688 | /** The NEM access mode for the page, NEM_PAGE_PROT_XXX */
|
---|
689 | uint32_t fNemProt : 8;
|
---|
690 | /** The NEM state associated with the PAGE. */
|
---|
691 | uint32_t u2NemState : 2;
|
---|
692 | /** The NEM state associated with the PAGE before pgmPhysPageMakeWritable was called. */
|
---|
693 | uint32_t u2OldNemState : 2;
|
---|
694 | /** Set if the page has handler. */
|
---|
695 | uint32_t fHasHandlers : 1;
|
---|
696 | /** Set if is the zero page backing it. */
|
---|
697 | uint32_t fZeroPage : 1;
|
---|
698 | /** Set if the page has handler. */
|
---|
699 | PGMPAGETYPE enmType;
|
---|
700 | } PGMPHYSNEMPAGEINFO;
|
---|
701 | /** Pointer to page information for NEM. */
|
---|
702 | typedef PGMPHYSNEMPAGEINFO *PPGMPHYSNEMPAGEINFO;
|
---|
703 | /**
|
---|
704 | * Callback for checking that the page is in sync while under the PGM lock.
|
---|
705 | *
|
---|
706 | * NEM passes this callback to PGMPhysNemQueryPageInfo to check that the page is
|
---|
707 | * in-sync between PGM and the native hypervisor API in an atomic fashion.
|
---|
708 | *
|
---|
709 | * @returns VBox status code.
|
---|
710 | * @param pVM The cross context VM structure.
|
---|
711 | * @param pVCpu The cross context per virtual CPU structure. Optional,
|
---|
712 | * see PGMPhysNemQueryPageInfo.
|
---|
713 | * @param GCPhys The guest physical address (not A20 masked).
|
---|
714 | * @param pInfo The page info structure. This function updates the
|
---|
715 | * u2NemState memory and the caller will update the PGMPAGE
|
---|
716 | * copy accordingly.
|
---|
717 | * @param pvUser Callback user argument.
|
---|
718 | */
|
---|
719 | typedef DECLCALLBACK(int) FNPGMPHYSNEMCHECKPAGE(PVM pVM, PVMCPU pVCpu, RTGCPHYS GCPhys, PPGMPHYSNEMPAGEINFO pInfo, void *pvUser);
|
---|
720 | /** Pointer to a FNPGMPHYSNEMCHECKPAGE function. */
|
---|
721 | typedef FNPGMPHYSNEMCHECKPAGE *PFNPGMPHYSNEMCHECKPAGE;
|
---|
722 |
|
---|
723 | VMM_INT_DECL(int) PGMPhysNemPageInfoChecker(PVM pVM, PVMCPU pVCpu, RTGCPHYS GCPhys, bool fMakeWritable,
|
---|
724 | PPGMPHYSNEMPAGEINFO pInfo, PFNPGMPHYSNEMCHECKPAGE pfnChecker, void *pvUser);
|
---|
725 |
|
---|
726 | /**
|
---|
727 | * Callback for use with PGMPhysNemEnumPagesByState.
|
---|
728 | * @returns VBox status code.
|
---|
729 | * Failure status will stop enumeration immediately and return.
|
---|
730 | * @param pVM The cross context VM structure.
|
---|
731 | * @param pVCpu The cross context per virtual CPU structure. Optional,
|
---|
732 | * see PGMPhysNemEnumPagesByState.
|
---|
733 | * @param GCPhys The guest physical address (not A20 masked).
|
---|
734 | * @param pu2NemState Pointer to variable with the NEM state. This can be
|
---|
735 | * update.
|
---|
736 | * @param pvUser The user argument.
|
---|
737 | */
|
---|
738 | typedef DECLCALLBACK(int) FNPGMPHYSNEMENUMCALLBACK(PVM pVM, PVMCPU pVCpu, RTGCPHYS GCPhys, uint8_t *pu2NemState, void *pvUser);
|
---|
739 | /** Pointer to a FNPGMPHYSNEMENUMCALLBACK function. */
|
---|
740 | typedef FNPGMPHYSNEMENUMCALLBACK *PFNPGMPHYSNEMENUMCALLBACK;
|
---|
741 | VMM_INT_DECL(int) PGMPhysNemEnumPagesByState(PVM pVM, PVMCPU VCpu, uint8_t uMinState,
|
---|
742 | PFNPGMPHYSNEMENUMCALLBACK pfnCallback, void *pvUser);
|
---|
743 |
|
---|
744 |
|
---|
745 | #ifdef VBOX_STRICT
|
---|
746 | VMMDECL(unsigned) PGMAssertHandlerAndFlagsInSync(PVM pVM);
|
---|
747 | VMMDECL(unsigned) PGMAssertNoMappingConflicts(PVM pVM);
|
---|
748 | VMMDECL(unsigned) PGMAssertCR3(PVM pVM, PVMCPU pVCpu, uint64_t cr3, uint64_t cr4);
|
---|
749 | #endif /* VBOX_STRICT */
|
---|
750 |
|
---|
751 | #if defined(IN_RC) || defined(VBOX_WITH_2X_4GB_ADDR_SPACE)
|
---|
752 | VMMDECL(void) PGMRZDynMapStartAutoSet(PVMCPU pVCpu);
|
---|
753 | VMMDECL(void) PGMRZDynMapReleaseAutoSet(PVMCPU pVCpu);
|
---|
754 | VMMDECL(void) PGMRZDynMapFlushAutoSet(PVMCPU pVCpu);
|
---|
755 | VMMDECL(uint32_t) PGMRZDynMapPushAutoSubset(PVMCPU pVCpu);
|
---|
756 | VMMDECL(void) PGMRZDynMapPopAutoSubset(PVMCPU pVCpu, uint32_t iPrevSubset);
|
---|
757 | #endif
|
---|
758 |
|
---|
759 | VMMDECL(int) PGMSetLargePageUsage(PVM pVM, bool fUseLargePages);
|
---|
760 |
|
---|
761 | /**
|
---|
762 | * Query large page usage state
|
---|
763 | *
|
---|
764 | * @returns 0 - disabled, 1 - enabled
|
---|
765 | * @param pVM The cross context VM structure.
|
---|
766 | */
|
---|
767 | #define PGMIsUsingLargePages(pVM) ((pVM)->fUseLargePages)
|
---|
768 |
|
---|
769 |
|
---|
770 | #ifdef IN_RC
|
---|
771 | /** @defgroup grp_pgm_gc The PGM Guest Context API
|
---|
772 | * @{
|
---|
773 | */
|
---|
774 | VMMRCDECL(int) PGMRCDynMapInit(PVM pVM);
|
---|
775 | /** @} */
|
---|
776 | #endif /* IN_RC */
|
---|
777 |
|
---|
778 |
|
---|
779 | #ifdef IN_RING0
|
---|
780 | /** @defgroup grp_pgm_r0 The PGM Host Context Ring-0 API
|
---|
781 | * @{
|
---|
782 | */
|
---|
783 | VMMR0_INT_DECL(int) PGMR0PhysAllocateHandyPages(PGVM pGVM, PVM pVM, VMCPUID idCpu);
|
---|
784 | VMMR0_INT_DECL(int) PGMR0PhysFlushHandyPages(PGVM pGVM, PVM pVM, VMCPUID idCpu);
|
---|
785 | VMMR0_INT_DECL(int) PGMR0PhysAllocateLargeHandyPage(PGVM pGVM, PVM pVM, VMCPUID idCpu);
|
---|
786 | VMMR0_INT_DECL(int) PGMR0PhysSetupIoMmu(PGVM pGVM, PVM pVM);
|
---|
787 | VMMR0DECL(int) PGMR0SharedModuleCheck(PVM pVM, PGVM pGVM, VMCPUID idCpu, PGMMSHAREDMODULE pModule, PCRTGCPTR64 paRegionsGCPtrs);
|
---|
788 | VMMR0DECL(int) PGMR0Trap0eHandlerNestedPaging(PVM pVM, PVMCPU pVCpu, PGMMODE enmShwPagingMode, RTGCUINT uErr, PCPUMCTXCORE pRegFrame, RTGCPHYS pvFault);
|
---|
789 | VMMR0DECL(VBOXSTRICTRC) PGMR0Trap0eHandlerNPMisconfig(PVM pVM, PVMCPU pVCpu, PGMMODE enmShwPagingMode, PCPUMCTXCORE pRegFrame, RTGCPHYS GCPhysFault, uint32_t uErr);
|
---|
790 | # ifdef VBOX_WITH_2X_4GB_ADDR_SPACE
|
---|
791 | VMMR0DECL(int) PGMR0DynMapInit(void);
|
---|
792 | VMMR0DECL(void) PGMR0DynMapTerm(void);
|
---|
793 | VMMR0DECL(int) PGMR0DynMapInitVM(PVM pVM);
|
---|
794 | VMMR0DECL(void) PGMR0DynMapTermVM(PVM pVM);
|
---|
795 | VMMR0DECL(int) PGMR0DynMapAssertIntegrity(void);
|
---|
796 | VMMR0DECL(bool) PGMR0DynMapStartOrMigrateAutoSet(PVMCPU pVCpu);
|
---|
797 | VMMR0DECL(void) PGMR0DynMapMigrateAutoSet(PVMCPU pVCpu);
|
---|
798 | # endif
|
---|
799 | /** @} */
|
---|
800 | #endif /* IN_RING0 */
|
---|
801 |
|
---|
802 |
|
---|
803 |
|
---|
804 | #ifdef IN_RING3
|
---|
805 | /** @defgroup grp_pgm_r3 The PGM Host Context Ring-3 API
|
---|
806 | * @{
|
---|
807 | */
|
---|
808 | VMMR3DECL(int) PGMR3Init(PVM pVM);
|
---|
809 | VMMR3DECL(int) PGMR3InitDynMap(PVM pVM);
|
---|
810 | VMMR3DECL(int) PGMR3InitFinalize(PVM pVM);
|
---|
811 | VMMR3_INT_DECL(int) PGMR3InitCompleted(PVM pVM, VMINITCOMPLETED enmWhat);
|
---|
812 | VMMR3DECL(void) PGMR3Relocate(PVM pVM, RTGCINTPTR offDelta);
|
---|
813 | VMMR3DECL(void) PGMR3ResetCpu(PVM pVM, PVMCPU pVCpu);
|
---|
814 | VMMR3_INT_DECL(void) PGMR3Reset(PVM pVM);
|
---|
815 | VMMR3_INT_DECL(void) PGMR3ResetNoMorePhysWritesFlag(PVM pVM);
|
---|
816 | VMMR3_INT_DECL(void) PGMR3MemSetup(PVM pVM, bool fReset);
|
---|
817 | VMMR3DECL(int) PGMR3Term(PVM pVM);
|
---|
818 | VMMR3DECL(int) PGMR3LockCall(PVM pVM);
|
---|
819 |
|
---|
820 | VMMR3DECL(int) PGMR3PhysRegisterRam(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cb, const char *pszDesc);
|
---|
821 | VMMR3DECL(int) PGMR3PhysChangeMemBalloon(PVM pVM, bool fInflate, unsigned cPages, RTGCPHYS *paPhysPage);
|
---|
822 | VMMR3DECL(int) PGMR3PhysWriteProtectRAM(PVM pVM);
|
---|
823 | VMMR3DECL(int) PGMR3PhysEnumDirtyFTPages(PVM pVM, PFNPGMENUMDIRTYFTPAGES pfnEnum, void *pvUser);
|
---|
824 | VMMR3DECL(uint32_t) PGMR3PhysGetRamRangeCount(PVM pVM);
|
---|
825 | VMMR3DECL(int) PGMR3PhysGetRange(PVM pVM, uint32_t iRange, PRTGCPHYS pGCPhysStart, PRTGCPHYS pGCPhysLast,
|
---|
826 | const char **ppszDesc, bool *pfIsMmio);
|
---|
827 | VMMR3DECL(int) PGMR3QueryMemoryStats(PUVM pUVM, uint64_t *pcbTotalMem, uint64_t *pcbPrivateMem, uint64_t *pcbSharedMem, uint64_t *pcbZeroMem);
|
---|
828 | VMMR3DECL(int) PGMR3QueryGlobalMemoryStats(PUVM pUVM, uint64_t *pcbAllocMem, uint64_t *pcbFreeMem, uint64_t *pcbBallonedMem, uint64_t *pcbSharedMem);
|
---|
829 |
|
---|
830 | VMMR3DECL(int) PGMR3PhysMMIORegister(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cb, PGMPHYSHANDLERTYPE hType,
|
---|
831 | RTR3PTR pvUserR3, RTR0PTR pvUserR0, RTRCPTR pvUserRC, const char *pszDesc);
|
---|
832 | VMMR3DECL(int) PGMR3PhysMMIODeregister(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cb);
|
---|
833 | VMMR3DECL(int) PGMR3PhysMMIO2Register(PVM pVM, PPDMDEVINS pDevIns, uint32_t iSubDev, uint32_t iRegion, RTGCPHYS cb, uint32_t fFlags, void **ppv, const char *pszDesc);
|
---|
834 | VMMR3DECL(int) PGMR3PhysMMIOExPreRegister(PVM pVM, PPDMDEVINS pDevIns, uint32_t iSubDev, uint32_t iRegion, RTGCPHYS cbRegion, PGMPHYSHANDLERTYPE hType,
|
---|
835 | RTR3PTR pvUserR3, RTR0PTR pvUserR0, RTRCPTR pvUserRC, const char *pszDesc);
|
---|
836 | VMMR3DECL(int) PGMR3PhysMMIOExDeregister(PVM pVM, PPDMDEVINS pDevIns, uint32_t iSubDev, uint32_t iRegion);
|
---|
837 | VMMR3DECL(int) PGMR3PhysMMIOExMap(PVM pVM, PPDMDEVINS pDevIns, uint32_t iSubDev, uint32_t iRegion, RTGCPHYS GCPhys);
|
---|
838 | VMMR3DECL(int) PGMR3PhysMMIOExUnmap(PVM pVM, PPDMDEVINS pDevIns, uint32_t iSubDev, uint32_t iRegion, RTGCPHYS GCPhys);
|
---|
839 | VMMR3_INT_DECL(int) PGMR3PhysMMIOExReduce(PVM pVM, PPDMDEVINS pDevIns, uint32_t iSubDev, uint32_t iRegion, RTGCPHYS cbRegion);
|
---|
840 | VMMR3DECL(bool) PGMR3PhysMMIOExIsBase(PVM pVM, PPDMDEVINS pDevIns, RTGCPHYS GCPhys);
|
---|
841 | VMMR3_INT_DECL(int) PGMR3PhysMMIO2GetHCPhys(PVM pVM, PPDMDEVINS pDevIns, uint32_t iSubDev, uint32_t iRegion, RTGCPHYS off, PRTHCPHYS pHCPhys);
|
---|
842 | VMMR3_INT_DECL(int) PGMR3PhysMMIO2MapKernel(PVM pVM, PPDMDEVINS pDevIns, uint32_t iSubDev, uint32_t iRegion, RTGCPHYS off, RTGCPHYS cb, const char *pszDesc, PRTR0PTR pR0Ptr);
|
---|
843 |
|
---|
844 | /** @name PGMR3PhysRegisterRom flags.
|
---|
845 | * @{ */
|
---|
846 | /** Inidicates that ROM shadowing should be enabled. */
|
---|
847 | #define PGMPHYS_ROM_FLAGS_SHADOWED RT_BIT_32(0)
|
---|
848 | /** Indicates that what pvBinary points to won't go away
|
---|
849 | * and can be used for strictness checks. */
|
---|
850 | #define PGMPHYS_ROM_FLAGS_PERMANENT_BINARY RT_BIT_32(1)
|
---|
851 | /** @} */
|
---|
852 |
|
---|
853 | VMMR3DECL(int) PGMR3PhysRomRegister(PVM pVM, PPDMDEVINS pDevIns, RTGCPHYS GCPhys, RTGCPHYS cb,
|
---|
854 | const void *pvBinary, uint32_t cbBinary, uint32_t fFlags, const char *pszDesc);
|
---|
855 | VMMR3DECL(int) PGMR3PhysRomProtect(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cb, PGMROMPROT enmProt);
|
---|
856 | VMMR3DECL(int) PGMR3PhysRegister(PVM pVM, void *pvRam, RTGCPHYS GCPhys, size_t cb, unsigned fFlags, const SUPPAGE *paPages, const char *pszDesc);
|
---|
857 | VMMDECL(void) PGMR3PhysSetA20(PVMCPU pVCpu, bool fEnable);
|
---|
858 | /** @name PGMR3MapPT flags.
|
---|
859 | * @{ */
|
---|
860 | /** The mapping may be unmapped later. The default is permanent mappings. */
|
---|
861 | #define PGMR3MAPPT_FLAGS_UNMAPPABLE RT_BIT(0)
|
---|
862 | /** @} */
|
---|
863 | VMMR3DECL(int) PGMR3MapPT(PVM pVM, RTGCPTR GCPtr, uint32_t cb, uint32_t fFlags, PFNPGMRELOCATE pfnRelocate, void *pvUser, const char *pszDesc);
|
---|
864 | VMMR3DECL(int) PGMR3UnmapPT(PVM pVM, RTGCPTR GCPtr);
|
---|
865 | VMMR3DECL(int) PGMR3FinalizeMappings(PVM pVM);
|
---|
866 | VMMR3DECL(int) PGMR3MappingsSize(PVM pVM, uint32_t *pcb);
|
---|
867 | VMMR3DECL(int) PGMR3MappingsFix(PVM pVM, RTGCPTR GCPtrBase, uint32_t cb);
|
---|
868 | VMMR3DECL(int) PGMR3MappingsUnfix(PVM pVM);
|
---|
869 | VMMR3DECL(bool) PGMR3MappingsNeedReFixing(PVM pVM);
|
---|
870 | #if defined(VBOX_WITH_RAW_MODE) || HC_ARCH_BITS == 32 /* (latter for 64-bit guests on 32-bit hosts) */
|
---|
871 | VMMR3DECL(int) PGMR3MapIntermediate(PVM pVM, RTUINTPTR Addr, RTHCPHYS HCPhys, unsigned cbPages);
|
---|
872 | #endif
|
---|
873 | VMMR3DECL(int) PGMR3MapRead(PVM pVM, void *pvDst, RTGCPTR GCPtrSrc, size_t cb);
|
---|
874 |
|
---|
875 | VMMR3_INT_DECL(int) PGMR3HandlerPhysicalTypeRegisterEx(PVM pVM, PGMPHYSHANDLERKIND enmKind,
|
---|
876 | PFNPGMPHYSHANDLER pfnHandlerR3,
|
---|
877 | R0PTRTYPE(PFNPGMPHYSHANDLER) pfnHandlerR0,
|
---|
878 | R0PTRTYPE(PFNPGMRZPHYSPFHANDLER) pfnPfHandlerR0,
|
---|
879 | RCPTRTYPE(PFNPGMPHYSHANDLER) pfnHandlerRC,
|
---|
880 | RCPTRTYPE(PFNPGMRZPHYSPFHANDLER) pfnPfHandlerRC,
|
---|
881 | const char *pszDesc, PPGMPHYSHANDLERTYPE phType);
|
---|
882 | VMMR3DECL(int) PGMR3HandlerPhysicalTypeRegister(PVM pVM, PGMPHYSHANDLERKIND enmKind,
|
---|
883 | R3PTRTYPE(PFNPGMPHYSHANDLER) pfnHandlerR3,
|
---|
884 | const char *pszModR0, const char *pszHandlerR0, const char *pszPfHandlerR0,
|
---|
885 | const char *pszModRC, const char *pszHandlerRC, const char *pszPfHandlerRC,
|
---|
886 | const char *pszDesc,
|
---|
887 | PPGMPHYSHANDLERTYPE phType);
|
---|
888 | #ifdef VBOX_WITH_RAW_MODE
|
---|
889 | VMMR3_INT_DECL(int) PGMR3HandlerVirtualTypeRegisterEx(PVM pVM, PGMVIRTHANDLERKIND enmKind, bool fRelocUserRC,
|
---|
890 | PFNPGMR3VIRTINVALIDATE pfnInvalidateR3,
|
---|
891 | PFNPGMVIRTHANDLER pfnHandlerR3,
|
---|
892 | RCPTRTYPE(FNPGMVIRTHANDLER) pfnHandlerRC,
|
---|
893 | RCPTRTYPE(FNPGMRCVIRTPFHANDLER) pfnPfHandlerRC,
|
---|
894 | const char *pszDesc, PPGMVIRTHANDLERTYPE phType);
|
---|
895 | VMMR3_INT_DECL(int) PGMR3HandlerVirtualTypeRegister(PVM pVM, PGMVIRTHANDLERKIND enmKind, bool fRelocUserRC,
|
---|
896 | PFNPGMR3VIRTINVALIDATE pfnInvalidateR3,
|
---|
897 | PFNPGMVIRTHANDLER pfnHandlerR3,
|
---|
898 | const char *pszHandlerRC, const char *pszPfHandlerRC, const char *pszDesc,
|
---|
899 | PPGMVIRTHANDLERTYPE phType);
|
---|
900 | VMMR3_INT_DECL(int) PGMR3HandlerVirtualRegister(PVM pVM, PVMCPU pVCpu, PGMVIRTHANDLERTYPE hType, RTGCPTR GCPtr,
|
---|
901 | RTGCPTR GCPtrLast, void *pvUserR3, RTRCPTR pvUserRC, const char *pszDesc);
|
---|
902 | VMMR3_INT_DECL(int) PGMHandlerVirtualChangeType(PVM pVM, RTGCPTR GCPtr, PGMVIRTHANDLERTYPE hNewType);
|
---|
903 | VMMR3_INT_DECL(int) PGMHandlerVirtualDeregister(PVM pVM, PVMCPU pVCpu, RTGCPTR GCPtr, bool fHypervisor);
|
---|
904 | #endif
|
---|
905 | VMMR3DECL(int) PGMR3PoolGrow(PVM pVM);
|
---|
906 |
|
---|
907 | VMMR3DECL(int) PGMR3PhysTlbGCPhys2Ptr(PVM pVM, RTGCPHYS GCPhys, bool fWritable, void **ppv);
|
---|
908 | VMMR3DECL(uint8_t) PGMR3PhysReadU8(PVM pVM, RTGCPHYS GCPhys, PGMACCESSORIGIN enmOrigin);
|
---|
909 | VMMR3DECL(uint16_t) PGMR3PhysReadU16(PVM pVM, RTGCPHYS GCPhys, PGMACCESSORIGIN enmOrigin);
|
---|
910 | VMMR3DECL(uint32_t) PGMR3PhysReadU32(PVM pVM, RTGCPHYS GCPhys, PGMACCESSORIGIN enmOrigin);
|
---|
911 | VMMR3DECL(uint64_t) PGMR3PhysReadU64(PVM pVM, RTGCPHYS GCPhys, PGMACCESSORIGIN enmOrigin);
|
---|
912 | VMMR3DECL(void) PGMR3PhysWriteU8(PVM pVM, RTGCPHYS GCPhys, uint8_t Value, PGMACCESSORIGIN enmOrigin);
|
---|
913 | VMMR3DECL(void) PGMR3PhysWriteU16(PVM pVM, RTGCPHYS GCPhys, uint16_t Value, PGMACCESSORIGIN enmOrigin);
|
---|
914 | VMMR3DECL(void) PGMR3PhysWriteU32(PVM pVM, RTGCPHYS GCPhys, uint32_t Value, PGMACCESSORIGIN enmOrigin);
|
---|
915 | VMMR3DECL(void) PGMR3PhysWriteU64(PVM pVM, RTGCPHYS GCPhys, uint64_t Value, PGMACCESSORIGIN enmOrigin);
|
---|
916 | VMMR3DECL(int) PGMR3PhysReadExternal(PVM pVM, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead, PGMACCESSORIGIN enmOrigin);
|
---|
917 | VMMR3DECL(int) PGMR3PhysWriteExternal(PVM pVM, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite, PGMACCESSORIGIN enmOrigin);
|
---|
918 | VMMR3DECL(int) PGMR3PhysGCPhys2CCPtrExternal(PVM pVM, RTGCPHYS GCPhys, void **ppv, PPGMPAGEMAPLOCK pLock);
|
---|
919 | VMMR3DECL(int) PGMR3PhysGCPhys2CCPtrReadOnlyExternal(PVM pVM, RTGCPHYS GCPhys, void const **ppv, PPGMPAGEMAPLOCK pLock);
|
---|
920 | VMMR3DECL(int) PGMR3PhysChunkMap(PVM pVM, uint32_t idChunk);
|
---|
921 | VMMR3DECL(void) PGMR3PhysChunkInvalidateTLB(PVM pVM);
|
---|
922 | VMMR3DECL(int) PGMR3PhysAllocateHandyPages(PVM pVM);
|
---|
923 | VMMR3DECL(int) PGMR3PhysAllocateLargeHandyPage(PVM pVM, RTGCPHYS GCPhys);
|
---|
924 |
|
---|
925 | VMMR3DECL(int) PGMR3CheckIntegrity(PVM pVM);
|
---|
926 |
|
---|
927 | VMMR3DECL(int) PGMR3DbgR3Ptr2GCPhys(PUVM pUVM, RTR3PTR R3Ptr, PRTGCPHYS pGCPhys);
|
---|
928 | VMMR3DECL(int) PGMR3DbgR3Ptr2HCPhys(PUVM pUVM, RTR3PTR R3Ptr, PRTHCPHYS pHCPhys);
|
---|
929 | VMMR3DECL(int) PGMR3DbgHCPhys2GCPhys(PUVM pUVM, RTHCPHYS HCPhys, PRTGCPHYS pGCPhys);
|
---|
930 | VMMR3_INT_DECL(int) PGMR3DbgReadGCPhys(PVM pVM, void *pvDst, RTGCPHYS GCPhysSrc, size_t cb, uint32_t fFlags, size_t *pcbRead);
|
---|
931 | VMMR3_INT_DECL(int) PGMR3DbgWriteGCPhys(PVM pVM, RTGCPHYS GCPhysDst, const void *pvSrc, size_t cb, uint32_t fFlags, size_t *pcbWritten);
|
---|
932 | VMMR3_INT_DECL(int) PGMR3DbgReadGCPtr(PVM pVM, void *pvDst, RTGCPTR GCPtrSrc, size_t cb, uint32_t fFlags, size_t *pcbRead);
|
---|
933 | VMMR3_INT_DECL(int) PGMR3DbgWriteGCPtr(PVM pVM, RTGCPTR GCPtrDst, void const *pvSrc, size_t cb, uint32_t fFlags, size_t *pcbWritten);
|
---|
934 | VMMR3_INT_DECL(int) PGMR3DbgScanPhysical(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cbRange, RTGCPHYS GCPhysAlign, const uint8_t *pabNeedle, size_t cbNeedle, PRTGCPHYS pGCPhysHit);
|
---|
935 | VMMR3_INT_DECL(int) PGMR3DbgScanVirtual(PVM pVM, PVMCPU pVCpu, RTGCPTR GCPtr, RTGCPTR cbRange, RTGCPTR GCPtrAlign, const uint8_t *pabNeedle, size_t cbNeedle, PRTGCUINTPTR pGCPhysHit);
|
---|
936 | VMMR3_INT_DECL(int) PGMR3DumpHierarchyShw(PVM pVM, uint64_t cr3, uint32_t fFlags, uint64_t u64FirstAddr, uint64_t u64LastAddr, uint32_t cMaxDepth, PCDBGFINFOHLP pHlp);
|
---|
937 | VMMR3_INT_DECL(int) PGMR3DumpHierarchyGst(PVM pVM, uint64_t cr3, uint32_t fFlags, RTGCPTR FirstAddr, RTGCPTR LastAddr, uint32_t cMaxDepth, PCDBGFINFOHLP pHlp);
|
---|
938 |
|
---|
939 |
|
---|
940 | /** @name Page sharing
|
---|
941 | * @{ */
|
---|
942 | VMMR3DECL(int) PGMR3SharedModuleRegister(PVM pVM, VBOXOSFAMILY enmGuestOS, char *pszModuleName, char *pszVersion,
|
---|
943 | RTGCPTR GCBaseAddr, uint32_t cbModule,
|
---|
944 | uint32_t cRegions, VMMDEVSHAREDREGIONDESC const *paRegions);
|
---|
945 | VMMR3DECL(int) PGMR3SharedModuleUnregister(PVM pVM, char *pszModuleName, char *pszVersion,
|
---|
946 | RTGCPTR GCBaseAddr, uint32_t cbModule);
|
---|
947 | VMMR3DECL(int) PGMR3SharedModuleCheckAll(PVM pVM);
|
---|
948 | VMMR3DECL(int) PGMR3SharedModuleGetPageState(PVM pVM, RTGCPTR GCPtrPage, bool *pfShared, uint64_t *pfPageFlags);
|
---|
949 | /** @} */
|
---|
950 |
|
---|
951 | /** @} */
|
---|
952 | #endif /* IN_RING3 */
|
---|
953 |
|
---|
954 | RT_C_DECLS_END
|
---|
955 |
|
---|
956 | /** @} */
|
---|
957 | #endif /* !VBOX_INCLUDED_vmm_pgm_h */
|
---|
958 |
|
---|