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 | VMMDECL(void) PGMPhysBulkReleasePageMappingLocks(PVM pVM, uint32_t cPages, PPGMPAGEMAPLOCK paLock);
|
---|
561 |
|
---|
562 | /** @def PGM_PHYS_RW_IS_SUCCESS
|
---|
563 | * Check whether a PGMPhysRead, PGMPhysWrite, PGMPhysReadGCPtr or
|
---|
564 | * PGMPhysWriteGCPtr call completed the given task.
|
---|
565 | *
|
---|
566 | * @returns true if completed, false if not.
|
---|
567 | * @param a_rcStrict The status code.
|
---|
568 | * @sa IOM_SUCCESS
|
---|
569 | */
|
---|
570 | #ifdef IN_RING3
|
---|
571 | # define PGM_PHYS_RW_IS_SUCCESS(a_rcStrict) \
|
---|
572 | ( (a_rcStrict) == VINF_SUCCESS \
|
---|
573 | || (a_rcStrict) == VINF_EM_DBG_STOP \
|
---|
574 | || (a_rcStrict) == VINF_EM_DBG_EVENT \
|
---|
575 | || (a_rcStrict) == VINF_EM_DBG_BREAKPOINT \
|
---|
576 | )
|
---|
577 | #elif defined(IN_RING0)
|
---|
578 | # define PGM_PHYS_RW_IS_SUCCESS(a_rcStrict) \
|
---|
579 | ( (a_rcStrict) == VINF_SUCCESS \
|
---|
580 | || (a_rcStrict) == VINF_IOM_R3_MMIO_COMMIT_WRITE \
|
---|
581 | || (a_rcStrict) == VINF_EM_OFF \
|
---|
582 | || (a_rcStrict) == VINF_EM_SUSPEND \
|
---|
583 | || (a_rcStrict) == VINF_EM_RESET \
|
---|
584 | || (a_rcStrict) == VINF_EM_HALT \
|
---|
585 | || (a_rcStrict) == VINF_EM_DBG_STOP \
|
---|
586 | || (a_rcStrict) == VINF_EM_DBG_EVENT \
|
---|
587 | || (a_rcStrict) == VINF_EM_DBG_BREAKPOINT \
|
---|
588 | )
|
---|
589 | #elif defined(IN_RC)
|
---|
590 | # define PGM_PHYS_RW_IS_SUCCESS(a_rcStrict) \
|
---|
591 | ( (a_rcStrict) == VINF_SUCCESS \
|
---|
592 | || (a_rcStrict) == VINF_IOM_R3_MMIO_COMMIT_WRITE \
|
---|
593 | || (a_rcStrict) == VINF_EM_OFF \
|
---|
594 | || (a_rcStrict) == VINF_EM_SUSPEND \
|
---|
595 | || (a_rcStrict) == VINF_EM_RESET \
|
---|
596 | || (a_rcStrict) == VINF_EM_HALT \
|
---|
597 | || (a_rcStrict) == VINF_SELM_SYNC_GDT \
|
---|
598 | || (a_rcStrict) == VINF_EM_RAW_EMULATE_INSTR_GDT_FAULT \
|
---|
599 | || (a_rcStrict) == VINF_EM_DBG_STOP \
|
---|
600 | || (a_rcStrict) == VINF_EM_DBG_EVENT \
|
---|
601 | || (a_rcStrict) == VINF_EM_DBG_BREAKPOINT \
|
---|
602 | )
|
---|
603 | #endif
|
---|
604 | /** @def PGM_PHYS_RW_DO_UPDATE_STRICT_RC
|
---|
605 | * Updates the return code with a new result.
|
---|
606 | *
|
---|
607 | * Both status codes must be successes according to PGM_PHYS_RW_IS_SUCCESS.
|
---|
608 | *
|
---|
609 | * @param a_rcStrict The current return code, to be updated.
|
---|
610 | * @param a_rcStrict2 The new return code to merge in.
|
---|
611 | */
|
---|
612 | #ifdef IN_RING3
|
---|
613 | # define PGM_PHYS_RW_DO_UPDATE_STRICT_RC(a_rcStrict, a_rcStrict2) \
|
---|
614 | do { \
|
---|
615 | Assert(rcStrict == VINF_SUCCESS); \
|
---|
616 | Assert(rcStrict2 == VINF_SUCCESS); \
|
---|
617 | } while (0)
|
---|
618 | #elif defined(IN_RING0)
|
---|
619 | # define PGM_PHYS_RW_DO_UPDATE_STRICT_RC(a_rcStrict, a_rcStrict2) \
|
---|
620 | do { \
|
---|
621 | Assert(PGM_PHYS_RW_IS_SUCCESS(rcStrict)); \
|
---|
622 | Assert(PGM_PHYS_RW_IS_SUCCESS(rcStrict2)); \
|
---|
623 | AssertCompile(VINF_IOM_R3_MMIO_COMMIT_WRITE > VINF_EM_LAST); \
|
---|
624 | if ((a_rcStrict2) == VINF_SUCCESS || (a_rcStrict) == (a_rcStrict2)) \
|
---|
625 | { /* likely */ } \
|
---|
626 | else if ( (a_rcStrict) == VINF_SUCCESS \
|
---|
627 | || (a_rcStrict) > (a_rcStrict2)) \
|
---|
628 | (a_rcStrict) = (a_rcStrict2); \
|
---|
629 | } while (0)
|
---|
630 | #elif defined(IN_RC)
|
---|
631 | # define PGM_PHYS_RW_DO_UPDATE_STRICT_RC(a_rcStrict, a_rcStrict2) \
|
---|
632 | do { \
|
---|
633 | Assert(PGM_PHYS_RW_IS_SUCCESS(rcStrict)); \
|
---|
634 | Assert(PGM_PHYS_RW_IS_SUCCESS(rcStrict2)); \
|
---|
635 | AssertCompile(VINF_SELM_SYNC_GDT > VINF_EM_LAST); \
|
---|
636 | AssertCompile(VINF_EM_RAW_EMULATE_INSTR_GDT_FAULT > VINF_EM_LAST); \
|
---|
637 | AssertCompile(VINF_EM_RAW_EMULATE_INSTR_GDT_FAULT < VINF_SELM_SYNC_GDT); \
|
---|
638 | AssertCompile(VINF_IOM_R3_MMIO_COMMIT_WRITE > VINF_EM_LAST); \
|
---|
639 | AssertCompile(VINF_IOM_R3_MMIO_COMMIT_WRITE > VINF_SELM_SYNC_GDT); \
|
---|
640 | AssertCompile(VINF_IOM_R3_MMIO_COMMIT_WRITE > VINF_EM_RAW_EMULATE_INSTR_GDT_FAULT); \
|
---|
641 | if ((a_rcStrict2) == VINF_SUCCESS || (a_rcStrict) == (a_rcStrict2)) \
|
---|
642 | { /* likely */ } \
|
---|
643 | else if ((a_rcStrict) == VINF_SUCCESS) \
|
---|
644 | (a_rcStrict) = (a_rcStrict2); \
|
---|
645 | else if ( ( (a_rcStrict) > (a_rcStrict2) \
|
---|
646 | && ( (a_rcStrict2) <= VINF_EM_RESET \
|
---|
647 | || (a_rcStrict) != VINF_EM_RAW_EMULATE_INSTR_GDT_FAULT) ) \
|
---|
648 | || ( (a_rcStrict2) == VINF_EM_RAW_EMULATE_INSTR_GDT_FAULT \
|
---|
649 | && (a_rcStrict) > VINF_EM_RESET) ) \
|
---|
650 | (a_rcStrict) = (a_rcStrict2); \
|
---|
651 | } while (0)
|
---|
652 | #endif
|
---|
653 |
|
---|
654 | VMMDECL(VBOXSTRICTRC) PGMPhysRead(PVM pVM, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead, PGMACCESSORIGIN enmOrigin);
|
---|
655 | VMMDECL(VBOXSTRICTRC) PGMPhysWrite(PVM pVM, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite, PGMACCESSORIGIN enmOrigin);
|
---|
656 | VMMDECL(VBOXSTRICTRC) PGMPhysReadGCPtr(PVMCPU pVCpu, void *pvDst, RTGCPTR GCPtrSrc, size_t cb, PGMACCESSORIGIN enmOrigin);
|
---|
657 | VMMDECL(VBOXSTRICTRC) PGMPhysWriteGCPtr(PVMCPU pVCpu, RTGCPTR GCPtrDst, const void *pvSrc, size_t cb, PGMACCESSORIGIN enmOrigin);
|
---|
658 |
|
---|
659 | VMMDECL(int) PGMPhysSimpleReadGCPhys(PVM pVM, void *pvDst, RTGCPHYS GCPhysSrc, size_t cb);
|
---|
660 | VMMDECL(int) PGMPhysSimpleWriteGCPhys(PVM pVM, RTGCPHYS GCPhysDst, const void *pvSrc, size_t cb);
|
---|
661 | VMMDECL(int) PGMPhysSimpleReadGCPtr(PVMCPU pVCpu, void *pvDst, RTGCPTR GCPtrSrc, size_t cb);
|
---|
662 | VMMDECL(int) PGMPhysSimpleWriteGCPtr(PVMCPU pVCpu, RTGCPTR GCPtrDst, const void *pvSrc, size_t cb);
|
---|
663 | VMMDECL(int) PGMPhysSimpleDirtyWriteGCPtr(PVMCPU pVCpu, RTGCPTR GCPtrDst, const void *pvSrc, size_t cb);
|
---|
664 | VMMDECL(int) PGMPhysInterpretedRead(PVMCPU pVCpu, PCPUMCTXCORE pCtxCore, void *pvDst, RTGCPTR GCPtrSrc, size_t cb);
|
---|
665 | VMMDECL(int) PGMPhysInterpretedReadNoHandlers(PVMCPU pVCpu, PCPUMCTXCORE pCtxCore, void *pvDst, RTGCUINTPTR GCPtrSrc, size_t cb, bool fRaiseTrap);
|
---|
666 | VMMDECL(int) PGMPhysInterpretedWriteNoHandlers(PVMCPU pVCpu, PCPUMCTXCORE pCtxCore, RTGCPTR GCPtrDst, void const *pvSrc, size_t cb, bool fRaiseTrap);
|
---|
667 |
|
---|
668 | VMM_INT_DECL(int) PGMPhysIemGCPhys2Ptr(PVM pVM, PVMCPU pVCpu, RTGCPHYS GCPhys, bool fWritable, bool fByPassHandlers, void **ppv, PPGMPAGEMAPLOCK pLock);
|
---|
669 | VMM_INT_DECL(int) PGMPhysIemQueryAccess(PVM pVM, RTGCPHYS GCPhys, bool fWritable, bool fByPassHandlers);
|
---|
670 | VMM_INT_DECL(int) PGMPhysIemGCPhys2PtrNoLock(PVM pVM, PVMCPU pVCpu, RTGCPHYS GCPhys, uint64_t const volatile *puTlbPhysRev,
|
---|
671 | #if defined(IN_RC) || defined(VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0)
|
---|
672 | R3PTRTYPE(uint8_t *) *ppb,
|
---|
673 | #else
|
---|
674 | R3R0PTRTYPE(uint8_t *) *ppb,
|
---|
675 | #endif
|
---|
676 | uint64_t *pfTlb);
|
---|
677 | /** @name Flags returned by PGMPhysIemGCPhys2PtrNoLock
|
---|
678 | * @{ */
|
---|
679 | #define PGMIEMGCPHYS2PTR_F_NO_WRITE RT_BIT_32(3) /**< Not writable (IEMTLBE_F_PG_NO_WRITE). */
|
---|
680 | #define PGMIEMGCPHYS2PTR_F_NO_READ RT_BIT_32(4) /**< Not readable (IEMTLBE_F_PG_NO_READ). */
|
---|
681 | #define PGMIEMGCPHYS2PTR_F_NO_MAPPINGR3 RT_BIT_32(7) /**< No ring-3 mapping (IEMTLBE_F_NO_MAPPINGR3). */
|
---|
682 | /** @} */
|
---|
683 |
|
---|
684 | /** Information returned by PGMPhysNemQueryPageInfo. */
|
---|
685 | typedef struct PGMPHYSNEMPAGEINFO
|
---|
686 | {
|
---|
687 | /** The host physical address of the page, NIL_HCPHYS if invalid page. */
|
---|
688 | RTHCPHYS HCPhys;
|
---|
689 | /** The NEM access mode for the page, NEM_PAGE_PROT_XXX */
|
---|
690 | uint32_t fNemProt : 8;
|
---|
691 | /** The NEM state associated with the PAGE. */
|
---|
692 | uint32_t u2NemState : 2;
|
---|
693 | /** The NEM state associated with the PAGE before pgmPhysPageMakeWritable was called. */
|
---|
694 | uint32_t u2OldNemState : 2;
|
---|
695 | /** Set if the page has handler. */
|
---|
696 | uint32_t fHasHandlers : 1;
|
---|
697 | /** Set if is the zero page backing it. */
|
---|
698 | uint32_t fZeroPage : 1;
|
---|
699 | /** Set if the page has handler. */
|
---|
700 | PGMPAGETYPE enmType;
|
---|
701 | } PGMPHYSNEMPAGEINFO;
|
---|
702 | /** Pointer to page information for NEM. */
|
---|
703 | typedef PGMPHYSNEMPAGEINFO *PPGMPHYSNEMPAGEINFO;
|
---|
704 | /**
|
---|
705 | * Callback for checking that the page is in sync while under the PGM lock.
|
---|
706 | *
|
---|
707 | * NEM passes this callback to PGMPhysNemQueryPageInfo to check that the page is
|
---|
708 | * in-sync between PGM and the native hypervisor API in an atomic fashion.
|
---|
709 | *
|
---|
710 | * @returns VBox status code.
|
---|
711 | * @param pVM The cross context VM structure.
|
---|
712 | * @param pVCpu The cross context per virtual CPU structure. Optional,
|
---|
713 | * see PGMPhysNemQueryPageInfo.
|
---|
714 | * @param GCPhys The guest physical address (not A20 masked).
|
---|
715 | * @param pInfo The page info structure. This function updates the
|
---|
716 | * u2NemState memory and the caller will update the PGMPAGE
|
---|
717 | * copy accordingly.
|
---|
718 | * @param pvUser Callback user argument.
|
---|
719 | */
|
---|
720 | typedef DECLCALLBACK(int) FNPGMPHYSNEMCHECKPAGE(PVM pVM, PVMCPU pVCpu, RTGCPHYS GCPhys, PPGMPHYSNEMPAGEINFO pInfo, void *pvUser);
|
---|
721 | /** Pointer to a FNPGMPHYSNEMCHECKPAGE function. */
|
---|
722 | typedef FNPGMPHYSNEMCHECKPAGE *PFNPGMPHYSNEMCHECKPAGE;
|
---|
723 |
|
---|
724 | VMM_INT_DECL(int) PGMPhysNemPageInfoChecker(PVM pVM, PVMCPU pVCpu, RTGCPHYS GCPhys, bool fMakeWritable,
|
---|
725 | PPGMPHYSNEMPAGEINFO pInfo, PFNPGMPHYSNEMCHECKPAGE pfnChecker, void *pvUser);
|
---|
726 |
|
---|
727 | /**
|
---|
728 | * Callback for use with PGMPhysNemEnumPagesByState.
|
---|
729 | * @returns VBox status code.
|
---|
730 | * Failure status will stop enumeration immediately and return.
|
---|
731 | * @param pVM The cross context VM structure.
|
---|
732 | * @param pVCpu The cross context per virtual CPU structure. Optional,
|
---|
733 | * see PGMPhysNemEnumPagesByState.
|
---|
734 | * @param GCPhys The guest physical address (not A20 masked).
|
---|
735 | * @param pu2NemState Pointer to variable with the NEM state. This can be
|
---|
736 | * update.
|
---|
737 | * @param pvUser The user argument.
|
---|
738 | */
|
---|
739 | typedef DECLCALLBACK(int) FNPGMPHYSNEMENUMCALLBACK(PVM pVM, PVMCPU pVCpu, RTGCPHYS GCPhys, uint8_t *pu2NemState, void *pvUser);
|
---|
740 | /** Pointer to a FNPGMPHYSNEMENUMCALLBACK function. */
|
---|
741 | typedef FNPGMPHYSNEMENUMCALLBACK *PFNPGMPHYSNEMENUMCALLBACK;
|
---|
742 | VMM_INT_DECL(int) PGMPhysNemEnumPagesByState(PVM pVM, PVMCPU VCpu, uint8_t uMinState,
|
---|
743 | PFNPGMPHYSNEMENUMCALLBACK pfnCallback, void *pvUser);
|
---|
744 |
|
---|
745 |
|
---|
746 | #ifdef VBOX_STRICT
|
---|
747 | VMMDECL(unsigned) PGMAssertHandlerAndFlagsInSync(PVM pVM);
|
---|
748 | VMMDECL(unsigned) PGMAssertNoMappingConflicts(PVM pVM);
|
---|
749 | VMMDECL(unsigned) PGMAssertCR3(PVM pVM, PVMCPU pVCpu, uint64_t cr3, uint64_t cr4);
|
---|
750 | #endif /* VBOX_STRICT */
|
---|
751 |
|
---|
752 | #if defined(IN_RC) || defined(VBOX_WITH_2X_4GB_ADDR_SPACE)
|
---|
753 | VMMDECL(void) PGMRZDynMapStartAutoSet(PVMCPU pVCpu);
|
---|
754 | VMMDECL(void) PGMRZDynMapReleaseAutoSet(PVMCPU pVCpu);
|
---|
755 | VMMDECL(void) PGMRZDynMapFlushAutoSet(PVMCPU pVCpu);
|
---|
756 | VMMDECL(uint32_t) PGMRZDynMapPushAutoSubset(PVMCPU pVCpu);
|
---|
757 | VMMDECL(void) PGMRZDynMapPopAutoSubset(PVMCPU pVCpu, uint32_t iPrevSubset);
|
---|
758 | #endif
|
---|
759 |
|
---|
760 | VMMDECL(int) PGMSetLargePageUsage(PVM pVM, bool fUseLargePages);
|
---|
761 |
|
---|
762 | /**
|
---|
763 | * Query large page usage state
|
---|
764 | *
|
---|
765 | * @returns 0 - disabled, 1 - enabled
|
---|
766 | * @param pVM The cross context VM structure.
|
---|
767 | */
|
---|
768 | #define PGMIsUsingLargePages(pVM) ((pVM)->fUseLargePages)
|
---|
769 |
|
---|
770 |
|
---|
771 | #ifdef IN_RC
|
---|
772 | /** @defgroup grp_pgm_gc The PGM Guest Context API
|
---|
773 | * @{
|
---|
774 | */
|
---|
775 | VMMRCDECL(int) PGMRCDynMapInit(PVM pVM);
|
---|
776 | /** @} */
|
---|
777 | #endif /* IN_RC */
|
---|
778 |
|
---|
779 |
|
---|
780 | #ifdef IN_RING0
|
---|
781 | /** @defgroup grp_pgm_r0 The PGM Host Context Ring-0 API
|
---|
782 | * @{
|
---|
783 | */
|
---|
784 | VMMR0_INT_DECL(int) PGMR0PhysAllocateHandyPages(PGVM pGVM, PVM pVM, VMCPUID idCpu);
|
---|
785 | VMMR0_INT_DECL(int) PGMR0PhysFlushHandyPages(PGVM pGVM, PVM pVM, VMCPUID idCpu);
|
---|
786 | VMMR0_INT_DECL(int) PGMR0PhysAllocateLargeHandyPage(PGVM pGVM, PVM pVM, VMCPUID idCpu);
|
---|
787 | VMMR0_INT_DECL(int) PGMR0PhysSetupIoMmu(PGVM pGVM, PVM pVM);
|
---|
788 | VMMR0DECL(int) PGMR0SharedModuleCheck(PVM pVM, PGVM pGVM, VMCPUID idCpu, PGMMSHAREDMODULE pModule, PCRTGCPTR64 paRegionsGCPtrs);
|
---|
789 | VMMR0DECL(int) PGMR0Trap0eHandlerNestedPaging(PVM pVM, PVMCPU pVCpu, PGMMODE enmShwPagingMode, RTGCUINT uErr, PCPUMCTXCORE pRegFrame, RTGCPHYS pvFault);
|
---|
790 | VMMR0DECL(VBOXSTRICTRC) PGMR0Trap0eHandlerNPMisconfig(PVM pVM, PVMCPU pVCpu, PGMMODE enmShwPagingMode, PCPUMCTXCORE pRegFrame, RTGCPHYS GCPhysFault, uint32_t uErr);
|
---|
791 | # ifdef VBOX_WITH_2X_4GB_ADDR_SPACE
|
---|
792 | VMMR0DECL(int) PGMR0DynMapInit(void);
|
---|
793 | VMMR0DECL(void) PGMR0DynMapTerm(void);
|
---|
794 | VMMR0DECL(int) PGMR0DynMapInitVM(PVM pVM);
|
---|
795 | VMMR0DECL(void) PGMR0DynMapTermVM(PVM pVM);
|
---|
796 | VMMR0DECL(int) PGMR0DynMapAssertIntegrity(void);
|
---|
797 | VMMR0DECL(bool) PGMR0DynMapStartOrMigrateAutoSet(PVMCPU pVCpu);
|
---|
798 | VMMR0DECL(void) PGMR0DynMapMigrateAutoSet(PVMCPU pVCpu);
|
---|
799 | # endif
|
---|
800 | /** @} */
|
---|
801 | #endif /* IN_RING0 */
|
---|
802 |
|
---|
803 |
|
---|
804 |
|
---|
805 | #ifdef IN_RING3
|
---|
806 | /** @defgroup grp_pgm_r3 The PGM Host Context Ring-3 API
|
---|
807 | * @{
|
---|
808 | */
|
---|
809 | VMMR3DECL(int) PGMR3Init(PVM pVM);
|
---|
810 | VMMR3DECL(int) PGMR3InitDynMap(PVM pVM);
|
---|
811 | VMMR3DECL(int) PGMR3InitFinalize(PVM pVM);
|
---|
812 | VMMR3_INT_DECL(int) PGMR3InitCompleted(PVM pVM, VMINITCOMPLETED enmWhat);
|
---|
813 | VMMR3DECL(void) PGMR3Relocate(PVM pVM, RTGCINTPTR offDelta);
|
---|
814 | VMMR3DECL(void) PGMR3ResetCpu(PVM pVM, PVMCPU pVCpu);
|
---|
815 | VMMR3_INT_DECL(void) PGMR3Reset(PVM pVM);
|
---|
816 | VMMR3_INT_DECL(void) PGMR3ResetNoMorePhysWritesFlag(PVM pVM);
|
---|
817 | VMMR3_INT_DECL(void) PGMR3MemSetup(PVM pVM, bool fReset);
|
---|
818 | VMMR3DECL(int) PGMR3Term(PVM pVM);
|
---|
819 | VMMR3DECL(int) PGMR3LockCall(PVM pVM);
|
---|
820 |
|
---|
821 | VMMR3DECL(int) PGMR3PhysRegisterRam(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cb, const char *pszDesc);
|
---|
822 | VMMR3DECL(int) PGMR3PhysChangeMemBalloon(PVM pVM, bool fInflate, unsigned cPages, RTGCPHYS *paPhysPage);
|
---|
823 | VMMR3DECL(int) PGMR3PhysWriteProtectRAM(PVM pVM);
|
---|
824 | VMMR3DECL(int) PGMR3PhysEnumDirtyFTPages(PVM pVM, PFNPGMENUMDIRTYFTPAGES pfnEnum, void *pvUser);
|
---|
825 | VMMR3DECL(uint32_t) PGMR3PhysGetRamRangeCount(PVM pVM);
|
---|
826 | VMMR3DECL(int) PGMR3PhysGetRange(PVM pVM, uint32_t iRange, PRTGCPHYS pGCPhysStart, PRTGCPHYS pGCPhysLast,
|
---|
827 | const char **ppszDesc, bool *pfIsMmio);
|
---|
828 | VMMR3DECL(int) PGMR3QueryMemoryStats(PUVM pUVM, uint64_t *pcbTotalMem, uint64_t *pcbPrivateMem, uint64_t *pcbSharedMem, uint64_t *pcbZeroMem);
|
---|
829 | VMMR3DECL(int) PGMR3QueryGlobalMemoryStats(PUVM pUVM, uint64_t *pcbAllocMem, uint64_t *pcbFreeMem, uint64_t *pcbBallonedMem, uint64_t *pcbSharedMem);
|
---|
830 |
|
---|
831 | VMMR3DECL(int) PGMR3PhysMMIORegister(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cb, PGMPHYSHANDLERTYPE hType,
|
---|
832 | RTR3PTR pvUserR3, RTR0PTR pvUserR0, RTRCPTR pvUserRC, const char *pszDesc);
|
---|
833 | VMMR3DECL(int) PGMR3PhysMMIODeregister(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cb);
|
---|
834 | VMMR3DECL(int) PGMR3PhysMMIO2Register(PVM pVM, PPDMDEVINS pDevIns, uint32_t iSubDev, uint32_t iRegion, RTGCPHYS cb, uint32_t fFlags, void **ppv, const char *pszDesc);
|
---|
835 | VMMR3DECL(int) PGMR3PhysMMIOExPreRegister(PVM pVM, PPDMDEVINS pDevIns, uint32_t iSubDev, uint32_t iRegion, RTGCPHYS cbRegion, PGMPHYSHANDLERTYPE hType,
|
---|
836 | RTR3PTR pvUserR3, RTR0PTR pvUserR0, RTRCPTR pvUserRC, const char *pszDesc);
|
---|
837 | VMMR3DECL(int) PGMR3PhysMMIOExDeregister(PVM pVM, PPDMDEVINS pDevIns, uint32_t iSubDev, uint32_t iRegion);
|
---|
838 | VMMR3DECL(int) PGMR3PhysMMIOExMap(PVM pVM, PPDMDEVINS pDevIns, uint32_t iSubDev, uint32_t iRegion, RTGCPHYS GCPhys);
|
---|
839 | VMMR3DECL(int) PGMR3PhysMMIOExUnmap(PVM pVM, PPDMDEVINS pDevIns, uint32_t iSubDev, uint32_t iRegion, RTGCPHYS GCPhys);
|
---|
840 | VMMR3_INT_DECL(int) PGMR3PhysMMIOExReduce(PVM pVM, PPDMDEVINS pDevIns, uint32_t iSubDev, uint32_t iRegion, RTGCPHYS cbRegion);
|
---|
841 | VMMR3DECL(bool) PGMR3PhysMMIOExIsBase(PVM pVM, PPDMDEVINS pDevIns, RTGCPHYS GCPhys);
|
---|
842 | VMMR3_INT_DECL(int) PGMR3PhysMMIO2GetHCPhys(PVM pVM, PPDMDEVINS pDevIns, uint32_t iSubDev, uint32_t iRegion, RTGCPHYS off, PRTHCPHYS pHCPhys);
|
---|
843 | VMMR3_INT_DECL(int) PGMR3PhysMMIO2MapKernel(PVM pVM, PPDMDEVINS pDevIns, uint32_t iSubDev, uint32_t iRegion, RTGCPHYS off, RTGCPHYS cb, const char *pszDesc, PRTR0PTR pR0Ptr);
|
---|
844 | VMMR3_INT_DECL(int) PGMR3PhysMMIOExChangeRegionNo(PVM pVM, PPDMDEVINS pDevIns, uint32_t iSubDev, uint32_t iRegion, uint32_t iNewRegion);
|
---|
845 |
|
---|
846 |
|
---|
847 | /** @name PGMR3PhysRegisterRom flags.
|
---|
848 | * @{ */
|
---|
849 | /** Inidicates that ROM shadowing should be enabled. */
|
---|
850 | #define PGMPHYS_ROM_FLAGS_SHADOWED RT_BIT_32(0)
|
---|
851 | /** Indicates that what pvBinary points to won't go away
|
---|
852 | * and can be used for strictness checks. */
|
---|
853 | #define PGMPHYS_ROM_FLAGS_PERMANENT_BINARY RT_BIT_32(1)
|
---|
854 | /** @} */
|
---|
855 |
|
---|
856 | VMMR3DECL(int) PGMR3PhysRomRegister(PVM pVM, PPDMDEVINS pDevIns, RTGCPHYS GCPhys, RTGCPHYS cb,
|
---|
857 | const void *pvBinary, uint32_t cbBinary, uint32_t fFlags, const char *pszDesc);
|
---|
858 | VMMR3DECL(int) PGMR3PhysRomProtect(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cb, PGMROMPROT enmProt);
|
---|
859 | VMMR3DECL(int) PGMR3PhysRegister(PVM pVM, void *pvRam, RTGCPHYS GCPhys, size_t cb, unsigned fFlags, const SUPPAGE *paPages, const char *pszDesc);
|
---|
860 | VMMDECL(void) PGMR3PhysSetA20(PVMCPU pVCpu, bool fEnable);
|
---|
861 | /** @name PGMR3MapPT flags.
|
---|
862 | * @{ */
|
---|
863 | /** The mapping may be unmapped later. The default is permanent mappings. */
|
---|
864 | #define PGMR3MAPPT_FLAGS_UNMAPPABLE RT_BIT(0)
|
---|
865 | /** @} */
|
---|
866 | VMMR3DECL(int) PGMR3MapPT(PVM pVM, RTGCPTR GCPtr, uint32_t cb, uint32_t fFlags, PFNPGMRELOCATE pfnRelocate, void *pvUser, const char *pszDesc);
|
---|
867 | VMMR3DECL(int) PGMR3UnmapPT(PVM pVM, RTGCPTR GCPtr);
|
---|
868 | VMMR3DECL(int) PGMR3FinalizeMappings(PVM pVM);
|
---|
869 | VMMR3DECL(int) PGMR3MappingsSize(PVM pVM, uint32_t *pcb);
|
---|
870 | VMMR3DECL(int) PGMR3MappingsFix(PVM pVM, RTGCPTR GCPtrBase, uint32_t cb);
|
---|
871 | VMMR3DECL(int) PGMR3MappingsUnfix(PVM pVM);
|
---|
872 | VMMR3DECL(bool) PGMR3MappingsNeedReFixing(PVM pVM);
|
---|
873 | #if defined(VBOX_WITH_RAW_MODE) || HC_ARCH_BITS == 32 /* (latter for 64-bit guests on 32-bit hosts) */
|
---|
874 | VMMR3DECL(int) PGMR3MapIntermediate(PVM pVM, RTUINTPTR Addr, RTHCPHYS HCPhys, unsigned cbPages);
|
---|
875 | #endif
|
---|
876 | VMMR3DECL(int) PGMR3MapRead(PVM pVM, void *pvDst, RTGCPTR GCPtrSrc, size_t cb);
|
---|
877 |
|
---|
878 | VMMR3_INT_DECL(int) PGMR3HandlerPhysicalTypeRegisterEx(PVM pVM, PGMPHYSHANDLERKIND enmKind,
|
---|
879 | PFNPGMPHYSHANDLER pfnHandlerR3,
|
---|
880 | R0PTRTYPE(PFNPGMPHYSHANDLER) pfnHandlerR0,
|
---|
881 | R0PTRTYPE(PFNPGMRZPHYSPFHANDLER) pfnPfHandlerR0,
|
---|
882 | RCPTRTYPE(PFNPGMPHYSHANDLER) pfnHandlerRC,
|
---|
883 | RCPTRTYPE(PFNPGMRZPHYSPFHANDLER) pfnPfHandlerRC,
|
---|
884 | const char *pszDesc, PPGMPHYSHANDLERTYPE phType);
|
---|
885 | VMMR3DECL(int) PGMR3HandlerPhysicalTypeRegister(PVM pVM, PGMPHYSHANDLERKIND enmKind,
|
---|
886 | R3PTRTYPE(PFNPGMPHYSHANDLER) pfnHandlerR3,
|
---|
887 | const char *pszModR0, const char *pszHandlerR0, const char *pszPfHandlerR0,
|
---|
888 | const char *pszModRC, const char *pszHandlerRC, const char *pszPfHandlerRC,
|
---|
889 | const char *pszDesc,
|
---|
890 | PPGMPHYSHANDLERTYPE phType);
|
---|
891 | #ifdef VBOX_WITH_RAW_MODE
|
---|
892 | VMMR3_INT_DECL(int) PGMR3HandlerVirtualTypeRegisterEx(PVM pVM, PGMVIRTHANDLERKIND enmKind, bool fRelocUserRC,
|
---|
893 | PFNPGMR3VIRTINVALIDATE pfnInvalidateR3,
|
---|
894 | PFNPGMVIRTHANDLER pfnHandlerR3,
|
---|
895 | RCPTRTYPE(FNPGMVIRTHANDLER) pfnHandlerRC,
|
---|
896 | RCPTRTYPE(FNPGMRCVIRTPFHANDLER) pfnPfHandlerRC,
|
---|
897 | const char *pszDesc, PPGMVIRTHANDLERTYPE phType);
|
---|
898 | VMMR3_INT_DECL(int) PGMR3HandlerVirtualTypeRegister(PVM pVM, PGMVIRTHANDLERKIND enmKind, bool fRelocUserRC,
|
---|
899 | PFNPGMR3VIRTINVALIDATE pfnInvalidateR3,
|
---|
900 | PFNPGMVIRTHANDLER pfnHandlerR3,
|
---|
901 | const char *pszHandlerRC, const char *pszPfHandlerRC, const char *pszDesc,
|
---|
902 | PPGMVIRTHANDLERTYPE phType);
|
---|
903 | VMMR3_INT_DECL(int) PGMR3HandlerVirtualRegister(PVM pVM, PVMCPU pVCpu, PGMVIRTHANDLERTYPE hType, RTGCPTR GCPtr,
|
---|
904 | RTGCPTR GCPtrLast, void *pvUserR3, RTRCPTR pvUserRC, const char *pszDesc);
|
---|
905 | VMMR3_INT_DECL(int) PGMHandlerVirtualChangeType(PVM pVM, RTGCPTR GCPtr, PGMVIRTHANDLERTYPE hNewType);
|
---|
906 | VMMR3_INT_DECL(int) PGMHandlerVirtualDeregister(PVM pVM, PVMCPU pVCpu, RTGCPTR GCPtr, bool fHypervisor);
|
---|
907 | #endif
|
---|
908 | VMMR3DECL(int) PGMR3PoolGrow(PVM pVM);
|
---|
909 |
|
---|
910 | VMMR3DECL(int) PGMR3PhysTlbGCPhys2Ptr(PVM pVM, RTGCPHYS GCPhys, bool fWritable, void **ppv);
|
---|
911 | VMMR3DECL(uint8_t) PGMR3PhysReadU8(PVM pVM, RTGCPHYS GCPhys, PGMACCESSORIGIN enmOrigin);
|
---|
912 | VMMR3DECL(uint16_t) PGMR3PhysReadU16(PVM pVM, RTGCPHYS GCPhys, PGMACCESSORIGIN enmOrigin);
|
---|
913 | VMMR3DECL(uint32_t) PGMR3PhysReadU32(PVM pVM, RTGCPHYS GCPhys, PGMACCESSORIGIN enmOrigin);
|
---|
914 | VMMR3DECL(uint64_t) PGMR3PhysReadU64(PVM pVM, RTGCPHYS GCPhys, PGMACCESSORIGIN enmOrigin);
|
---|
915 | VMMR3DECL(void) PGMR3PhysWriteU8(PVM pVM, RTGCPHYS GCPhys, uint8_t Value, PGMACCESSORIGIN enmOrigin);
|
---|
916 | VMMR3DECL(void) PGMR3PhysWriteU16(PVM pVM, RTGCPHYS GCPhys, uint16_t Value, PGMACCESSORIGIN enmOrigin);
|
---|
917 | VMMR3DECL(void) PGMR3PhysWriteU32(PVM pVM, RTGCPHYS GCPhys, uint32_t Value, PGMACCESSORIGIN enmOrigin);
|
---|
918 | VMMR3DECL(void) PGMR3PhysWriteU64(PVM pVM, RTGCPHYS GCPhys, uint64_t Value, PGMACCESSORIGIN enmOrigin);
|
---|
919 | VMMR3DECL(int) PGMR3PhysReadExternal(PVM pVM, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead, PGMACCESSORIGIN enmOrigin);
|
---|
920 | VMMR3DECL(int) PGMR3PhysWriteExternal(PVM pVM, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite, PGMACCESSORIGIN enmOrigin);
|
---|
921 | VMMR3DECL(int) PGMR3PhysGCPhys2CCPtrExternal(PVM pVM, RTGCPHYS GCPhys, void **ppv, PPGMPAGEMAPLOCK pLock);
|
---|
922 | VMMR3DECL(int) PGMR3PhysGCPhys2CCPtrReadOnlyExternal(PVM pVM, RTGCPHYS GCPhys, void const **ppv, PPGMPAGEMAPLOCK pLock);
|
---|
923 | VMMR3DECL(int) PGMR3PhysBulkGCPhys2CCPtrExternal(PVM pVM, uint32_t cPages, PCRTGCPHYS paGCPhysPages,
|
---|
924 | void **papvPages, PPGMPAGEMAPLOCK paLocks);
|
---|
925 | VMMR3DECL(int) PGMR3PhysBulkGCPhys2CCPtrReadOnlyExternal(PVM pVM, uint32_t cPages, PCRTGCPHYS paGCPhysPages,
|
---|
926 | void const **papvPages, PPGMPAGEMAPLOCK paLocks);
|
---|
927 | VMMR3DECL(int) PGMR3PhysChunkMap(PVM pVM, uint32_t idChunk);
|
---|
928 | VMMR3DECL(void) PGMR3PhysChunkInvalidateTLB(PVM pVM);
|
---|
929 | VMMR3DECL(int) PGMR3PhysAllocateHandyPages(PVM pVM);
|
---|
930 | VMMR3DECL(int) PGMR3PhysAllocateLargeHandyPage(PVM pVM, RTGCPHYS GCPhys);
|
---|
931 |
|
---|
932 | VMMR3DECL(int) PGMR3CheckIntegrity(PVM pVM);
|
---|
933 |
|
---|
934 | VMMR3DECL(int) PGMR3DbgR3Ptr2GCPhys(PUVM pUVM, RTR3PTR R3Ptr, PRTGCPHYS pGCPhys);
|
---|
935 | VMMR3DECL(int) PGMR3DbgR3Ptr2HCPhys(PUVM pUVM, RTR3PTR R3Ptr, PRTHCPHYS pHCPhys);
|
---|
936 | VMMR3DECL(int) PGMR3DbgHCPhys2GCPhys(PUVM pUVM, RTHCPHYS HCPhys, PRTGCPHYS pGCPhys);
|
---|
937 | VMMR3_INT_DECL(int) PGMR3DbgReadGCPhys(PVM pVM, void *pvDst, RTGCPHYS GCPhysSrc, size_t cb, uint32_t fFlags, size_t *pcbRead);
|
---|
938 | VMMR3_INT_DECL(int) PGMR3DbgWriteGCPhys(PVM pVM, RTGCPHYS GCPhysDst, const void *pvSrc, size_t cb, uint32_t fFlags, size_t *pcbWritten);
|
---|
939 | VMMR3_INT_DECL(int) PGMR3DbgReadGCPtr(PVM pVM, void *pvDst, RTGCPTR GCPtrSrc, size_t cb, uint32_t fFlags, size_t *pcbRead);
|
---|
940 | VMMR3_INT_DECL(int) PGMR3DbgWriteGCPtr(PVM pVM, RTGCPTR GCPtrDst, void const *pvSrc, size_t cb, uint32_t fFlags, size_t *pcbWritten);
|
---|
941 | VMMR3_INT_DECL(int) PGMR3DbgScanPhysical(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cbRange, RTGCPHYS GCPhysAlign, const uint8_t *pabNeedle, size_t cbNeedle, PRTGCPHYS pGCPhysHit);
|
---|
942 | VMMR3_INT_DECL(int) PGMR3DbgScanVirtual(PVM pVM, PVMCPU pVCpu, RTGCPTR GCPtr, RTGCPTR cbRange, RTGCPTR GCPtrAlign, const uint8_t *pabNeedle, size_t cbNeedle, PRTGCUINTPTR pGCPhysHit);
|
---|
943 | VMMR3_INT_DECL(int) PGMR3DumpHierarchyShw(PVM pVM, uint64_t cr3, uint32_t fFlags, uint64_t u64FirstAddr, uint64_t u64LastAddr, uint32_t cMaxDepth, PCDBGFINFOHLP pHlp);
|
---|
944 | VMMR3_INT_DECL(int) PGMR3DumpHierarchyGst(PVM pVM, uint64_t cr3, uint32_t fFlags, RTGCPTR FirstAddr, RTGCPTR LastAddr, uint32_t cMaxDepth, PCDBGFINFOHLP pHlp);
|
---|
945 |
|
---|
946 |
|
---|
947 | /** @name Page sharing
|
---|
948 | * @{ */
|
---|
949 | VMMR3DECL(int) PGMR3SharedModuleRegister(PVM pVM, VBOXOSFAMILY enmGuestOS, char *pszModuleName, char *pszVersion,
|
---|
950 | RTGCPTR GCBaseAddr, uint32_t cbModule,
|
---|
951 | uint32_t cRegions, VMMDEVSHAREDREGIONDESC const *paRegions);
|
---|
952 | VMMR3DECL(int) PGMR3SharedModuleUnregister(PVM pVM, char *pszModuleName, char *pszVersion,
|
---|
953 | RTGCPTR GCBaseAddr, uint32_t cbModule);
|
---|
954 | VMMR3DECL(int) PGMR3SharedModuleCheckAll(PVM pVM);
|
---|
955 | VMMR3DECL(int) PGMR3SharedModuleGetPageState(PVM pVM, RTGCPTR GCPtrPage, bool *pfShared, uint64_t *pfPageFlags);
|
---|
956 | /** @} */
|
---|
957 |
|
---|
958 | /** @} */
|
---|
959 | #endif /* IN_RING3 */
|
---|
960 |
|
---|
961 | RT_C_DECLS_END
|
---|
962 |
|
---|
963 | /** @} */
|
---|
964 | #endif /* !VBOX_INCLUDED_vmm_pgm_h */
|
---|
965 |
|
---|