VirtualBox

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

Last change on this file since 56323 was 56323, checked in by vboxsync, 9 years ago

whitespace

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 37.7 KB
Line 
1/** @file
2 * PGM - Page Monitor / Monitor.
3 */
4
5/*
6 * Copyright (C) 2006-2015 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_vmm_pgm_h
27#define ___VBox_vmm_pgm_h
28
29#include <VBox/types.h>
30#include <VBox/sup.h>
31#include <VBox/vmm/vmapi.h>
32#include <VBox/vmm/gmm.h> /* for PGMMREGISTERSHAREDMODULEREQ */
33#include <iprt/x86.h>
34#include <VBox/VMMDev.h> /* for VMMDEVSHAREDREGIONDESC */
35#include <VBox/param.h>
36
37RT_C_DECLS_BEGIN
38
39/** @defgroup grp_pgm The Page Monitor / Manager API
40 * @{
41 */
42
43/**
44 * FNPGMRELOCATE callback mode.
45 */
46typedef enum PGMRELOCATECALL
47{
48 /** The callback is for checking if the suggested address is suitable. */
49 PGMRELOCATECALL_SUGGEST = 1,
50 /** The callback is for executing the relocation. */
51 PGMRELOCATECALL_RELOCATE
52} PGMRELOCATECALL;
53
54
55/**
56 * Callback function which will be called when PGM is trying to find
57 * a new location for the mapping.
58 *
59 * The callback is called in two modes, 1) the check mode and 2) the relocate mode.
60 * In 1) the callback should say if it objects to a suggested new location. If it
61 * accepts the new location, it is called again for doing it's relocation.
62 *
63 *
64 * @returns true if the location is ok.
65 * @returns false if another location should be found.
66 * @param GCPtrOld The old virtual address.
67 * @param GCPtrNew The new virtual address.
68 * @param enmMode Used to indicate the callback mode.
69 * @param pvUser User argument.
70 * @remark The return value is no a failure indicator, it's an acceptance
71 * indicator. Relocation can not fail!
72 */
73typedef DECLCALLBACK(bool) FNPGMRELOCATE(PVM pVM, RTGCPTR GCPtrOld, RTGCPTR GCPtrNew, PGMRELOCATECALL enmMode, void *pvUser);
74/** Pointer to a relocation callback function. */
75typedef FNPGMRELOCATE *PFNPGMRELOCATE;
76
77
78/**
79 * Memory access origin.
80 */
81typedef enum PGMACCESSORIGIN
82{
83 /** Invalid zero value. */
84 PGMACCESSORIGIN_INVALID = 0,
85 /** IEM is access memory. */
86 PGMACCESSORIGIN_IEM,
87 /** HM is access memory. */
88 PGMACCESSORIGIN_HM,
89 /** Some device is access memory. */
90 PGMACCESSORIGIN_DEVICE,
91 /** Someone debugging is access memory. */
92 PGMACCESSORIGIN_DEBUGGER,
93 /** SELM is access memory. */
94 PGMACCESSORIGIN_SELM,
95 /** FTM is access memory. */
96 PGMACCESSORIGIN_FTM,
97 /** REM is access memory. */
98 PGMACCESSORIGIN_REM,
99 /** IOM is access memory. */
100 PGMACCESSORIGIN_IOM,
101 /** End of valid values. */
102 PGMACCESSORIGIN_END,
103 /** Type size hack. */
104 PGMACCESSORIGIN_32BIT_HACK = 0x7fffffff
105} PGMACCESSORIGIN;
106
107
108/**
109 * Physical page access handler kind.
110 */
111typedef enum PGMPHYSHANDLERKIND
112{
113 /** MMIO range. Pages are not present, all access is done in interpreter or recompiler. */
114 PGMPHYSHANDLERKIND_MMIO = 1,
115 /** Handler all write access to a physical page range. */
116 PGMPHYSHANDLERKIND_WRITE,
117 /** Handler all access to a physical page range. */
118 PGMPHYSHANDLERKIND_ALL
119
120} PGMPHYSHANDLERKIND;
121
122/**
123 * Guest Access type
124 */
125typedef enum PGMACCESSTYPE
126{
127 /** Read access. */
128 PGMACCESSTYPE_READ = 1,
129 /** Write access. */
130 PGMACCESSTYPE_WRITE
131} PGMACCESSTYPE;
132
133
134/** @def PGM_ALL_CB_DECL
135 * Macro for declaring a handler callback for all contexts. The handler
136 * callback is static in ring-3, and exported in RC and R0.
137 * @sa PGM_ALL_CB2_DECL.
138 */
139#if defined(IN_RC) || defined(IN_RING0)
140# ifdef __cplusplus
141# define PGM_ALL_CB_DECL(type) extern "C" DECLEXPORT(type)
142# else
143# define PGM_ALL_CB_DECL(type) DECLEXPORT(type)
144# endif
145#else
146# define PGM_ALL_CB_DECL(type) static type
147#endif
148
149/** @def PGM_ALL_CB2_DECL
150 * Macro for declaring a handler callback for all contexts. The handler
151 * callback is hidden in ring-3, and exported in RC and R0.
152 * @sa PGM_ALL_CB2_DECL.
153 */
154#if defined(IN_RC) || defined(IN_RING0)
155# ifdef __cplusplus
156# define PGM_ALL_CB2_DECL(type) extern "C" DECLEXPORT(type)
157# else
158# define PGM_ALL_CB2_DECL(type) DECLEXPORT(type)
159# endif
160#else
161# define PGM_ALL_CB2_DECL(type) DECLHIDDEN(type)
162#endif
163
164
165/**
166 * \#PF Handler callback for physical access handler ranges in RC and R0.
167 *
168 * @returns Strict VBox status code (appropriate for ring-0 and raw-mode).
169 * @param pVM VM Handle.
170 * @param pVCpu Pointer to the cross context CPU context for the
171 * calling EMT.
172 * @param uErrorCode CPU Error code.
173 * @param pRegFrame Trap register frame.
174 * NULL on DMA and other non CPU access.
175 * @param pvFault The fault address (cr2).
176 * @param GCPhysFault The GC physical address corresponding to pvFault.
177 * @param pvUser User argument.
178 * @thread EMT(pVCpu)
179 */
180typedef DECLCALLBACK(VBOXSTRICTRC) FNPGMRZPHYSPFHANDLER(PVM pVM, PVMCPU pVCpu, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame,
181 RTGCPTR pvFault, RTGCPHYS GCPhysFault, void *pvUser);
182/** Pointer to PGM access callback. */
183typedef FNPGMRZPHYSPFHANDLER *PFNPGMRZPHYSPFHANDLER;
184
185
186/**
187 * Access handler callback for physical access handler ranges.
188 *
189 * The handler can not raise any faults, it's mainly for monitoring write access
190 * to certain pages (like MMIO).
191 *
192 * @returns Strict VBox status code in ring-0 and raw-mode context, in ring-3
193 * the only supported informational status code is
194 * VINF_PGM_HANDLER_DO_DEFAULT.
195 * @retval VINF_SUCCESS if the handler have carried out the operation.
196 * @retval VINF_PGM_HANDLER_DO_DEFAULT if the caller should carry out the
197 * access operation.
198 * @retval VINF_EM_XXX in ring-0 and raw-mode context.
199 *
200 * @param pVM VM Handle.
201 * @param pVCpu Pointer to the cross context CPU context for the
202 * calling EMT.
203 * @param GCPhys The physical address the guest is writing to.
204 * @param pvPhys The HC mapping of that address.
205 * @param pvBuf What the guest is reading/writing.
206 * @param cbBuf How much it's reading/writing.
207 * @param enmAccessType The access type.
208 * @param enmOrigin The origin of this call.
209 * @param pvUser User argument.
210 * @thread EMT(pVCpu)
211 */
212typedef DECLCALLBACK(VBOXSTRICTRC) FNPGMPHYSHANDLER(PVM pVM, PVMCPU pVCpu, RTGCPHYS GCPhys, void *pvPhys, void *pvBuf, size_t cbBuf,
213 PGMACCESSTYPE enmAccessType, PGMACCESSORIGIN enmOrigin, void *pvUser);
214/** Pointer to PGM access callback. */
215typedef FNPGMPHYSHANDLER *PFNPGMPHYSHANDLER;
216
217
218/**
219 * Virtual access handler type.
220 */
221typedef enum PGMVIRTHANDLERKIND
222{
223 /** Write access handled. */
224 PGMVIRTHANDLERKIND_WRITE = 1,
225 /** All access handled. */
226 PGMVIRTHANDLERKIND_ALL,
227 /** Hypervisor write access handled.
228 * This is used to catch the guest trying to write to LDT, TSS and any other
229 * system structure which the brain dead intel guys let unprivilegde code find. */
230 PGMVIRTHANDLERKIND_HYPERVISOR
231} PGMVIRTHANDLERKIND;
232
233/**
234 * \#PF handler callback for virtual access handler ranges, RC.
235 *
236 * Important to realize that a physical page in a range can have aliases, and
237 * for ALL and WRITE handlers these will also trigger.
238 *
239 * @returns Strict VBox status code (appropriate for raw-mode).
240 * @param pVM VM Handle.
241 * @param pVCpu Pointer to the cross context CPU context for the
242 * calling EMT.
243 * @param uErrorCode CPU Error code (X86_TRAP_PF_XXX).
244 * @param pRegFrame Trap register frame.
245 * @param pvFault The fault address (cr2).
246 * @param pvRange The base address of the handled virtual range.
247 * @param offRange The offset of the access into this range.
248 * (If it's a EIP range this is the EIP, if not it's pvFault.)
249 * @param pvUser User argument.
250 * @thread EMT(pVCpu)
251 */
252typedef DECLCALLBACK(VBOXSTRICTRC) FNPGMRCVIRTPFHANDLER(PVM pVM, PVMCPU pVCpu, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame,
253 RTGCPTR pvFault, RTGCPTR pvRange, uintptr_t offRange, void *pvUser);
254/** Pointer to PGM access callback. */
255typedef FNPGMRCVIRTPFHANDLER *PFNPGMRCVIRTPFHANDLER;
256
257/**
258 * Access handler callback for virtual access handler ranges.
259 *
260 * Important to realize that a physical page in a range can have aliases, and
261 * for ALL and WRITE handlers these will also trigger.
262 *
263 * @returns VINF_SUCCESS if the handler have carried out the operation.
264 * @returns VINF_PGM_HANDLER_DO_DEFAULT if the caller should carry out the access operation.
265 * @param pVM VM Handle.
266 * @param pVCpu Pointer to the cross context CPU context for the
267 * calling EMT.
268 * @param GCPtr The virtual address the guest is writing to. This
269 * is the registered address corresponding to the
270 * access, so no aliasing trouble here.
271 * @param pvPtr The HC mapping of that address.
272 * @param pvBuf What the guest is reading/writing.
273 * @param cbBuf How much it's reading/writing.
274 * @param enmAccessType The access type.
275 * @param enmOrigin Who is calling.
276 * @param pvUser User argument.
277 * @thread EMT(pVCpu)
278 */
279typedef DECLCALLBACK(VBOXSTRICTRC) FNPGMVIRTHANDLER(PVM pVM, PVMCPU pVCpu, RTGCPTR GCPtr, void *pvPtr, void *pvBuf, size_t cbBuf,
280 PGMACCESSTYPE enmAccessType, PGMACCESSORIGIN enmOrigin, void *pvUser);
281/** Pointer to PGM access callback. */
282typedef FNPGMVIRTHANDLER *PFNPGMVIRTHANDLER;
283
284/**
285 * \#PF Handler callback for invalidation of virtual access handler ranges.
286 *
287 * @param pVM VM Handle.
288 * @param pVCpu Pointer to the cross context CPU context for the
289 * calling EMT.
290 * @param GCPtr The virtual address the guest has changed.
291 * @param pvUser User argument.
292 * @thread EMT(pVCpu)
293 *
294 * @todo FNPGMR3VIRTINVALIDATE will not actually be called! It was introduced
295 * in r13179 (1.1) and stopped working with r13806 (PGMPool merge,
296 * v1.2), exactly a month later.
297 */
298typedef DECLCALLBACK(int) FNPGMR3VIRTINVALIDATE(PVM pVM, PVMCPU pVCpu, RTGCPTR GCPtr, void *pvUser);
299/** Pointer to PGM invalidation callback. */
300typedef FNPGMR3VIRTINVALIDATE *PFNPGMR3VIRTINVALIDATE;
301
302
303/**
304 * PGMR3PhysEnumDirtyFTPages callback for syncing dirty physical pages
305 *
306 * @param pVM VM Handle.
307 * @param GCPhys GC physical address
308 * @param pRange HC virtual address of the page(s)
309 * @param cbRange Size of the dirty range in bytes.
310 * @param pvUser User argument.
311 */
312typedef DECLCALLBACK(int) FNPGMENUMDIRTYFTPAGES(PVM pVM, RTGCPHYS GCPhys, uint8_t *pRange, unsigned cbRange, void *pvUser);
313/** Pointer to PGMR3PhysEnumDirtyFTPages callback. */
314typedef FNPGMENUMDIRTYFTPAGES *PFNPGMENUMDIRTYFTPAGES;
315
316
317/**
318 * Paging mode.
319 */
320typedef enum PGMMODE
321{
322 /** The usual invalid value. */
323 PGMMODE_INVALID = 0,
324 /** Real mode. */
325 PGMMODE_REAL,
326 /** Protected mode, no paging. */
327 PGMMODE_PROTECTED,
328 /** 32-bit paging. */
329 PGMMODE_32_BIT,
330 /** PAE paging. */
331 PGMMODE_PAE,
332 /** PAE paging with NX enabled. */
333 PGMMODE_PAE_NX,
334 /** 64-bit AMD paging (long mode). */
335 PGMMODE_AMD64,
336 /** 64-bit AMD paging (long mode) with NX enabled. */
337 PGMMODE_AMD64_NX,
338 /** Nested paging mode (shadow only; guest physical to host physical). */
339 PGMMODE_NESTED,
340 /** Extended paging (Intel) mode. */
341 PGMMODE_EPT,
342 /** The max number of modes */
343 PGMMODE_MAX,
344 /** 32bit hackishness. */
345 PGMMODE_32BIT_HACK = 0x7fffffff
346} PGMMODE;
347
348/** Macro for checking if the guest is using paging.
349 * @param enmMode PGMMODE_*.
350 * @remark ASSUMES certain order of the PGMMODE_* values.
351 */
352#define PGMMODE_WITH_PAGING(enmMode) ((enmMode) >= PGMMODE_32_BIT)
353
354/** Macro for checking if it's one of the long mode modes.
355 * @param enmMode PGMMODE_*.
356 */
357#define PGMMODE_IS_LONG_MODE(enmMode) ((enmMode) == PGMMODE_AMD64_NX || (enmMode) == PGMMODE_AMD64)
358
359/**
360 * Is the ROM mapped (true) or is the shadow RAM mapped (false).
361 *
362 * @returns boolean.
363 * @param enmProt The PGMROMPROT value, must be valid.
364 */
365#define PGMROMPROT_IS_ROM(enmProt) \
366 ( (enmProt) == PGMROMPROT_READ_ROM_WRITE_IGNORE \
367 || (enmProt) == PGMROMPROT_READ_ROM_WRITE_RAM )
368
369
370
371VMMDECL(bool) PGMIsLockOwner(PVM pVM);
372
373VMMDECL(int) PGMRegisterStringFormatTypes(void);
374VMMDECL(void) PGMDeregisterStringFormatTypes(void);
375VMMDECL(RTHCPHYS) PGMGetHyperCR3(PVMCPU pVCpu);
376VMMDECL(RTHCPHYS) PGMGetNestedCR3(PVMCPU pVCpu, PGMMODE enmShadowMode);
377VMMDECL(RTHCPHYS) PGMGetInterHCCR3(PVM pVM);
378VMMDECL(RTHCPHYS) PGMGetInterRCCR3(PVM pVM, PVMCPU pVCpu);
379VMMDECL(RTHCPHYS) PGMGetInter32BitCR3(PVM pVM);
380VMMDECL(RTHCPHYS) PGMGetInterPaeCR3(PVM pVM);
381VMMDECL(RTHCPHYS) PGMGetInterAmd64CR3(PVM pVM);
382VMMDECL(int) PGMTrap0eHandler(PVMCPU pVCpu, RTGCUINT uErr, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault);
383VMMDECL(int) PGMPrefetchPage(PVMCPU pVCpu, RTGCPTR GCPtrPage);
384VMMDECL(int) PGMVerifyAccess(PVMCPU pVCpu, RTGCPTR Addr, uint32_t cbSize, uint32_t fAccess);
385VMMDECL(int) PGMIsValidAccess(PVMCPU pVCpu, RTGCPTR Addr, uint32_t cbSize, uint32_t fAccess);
386VMMDECL(VBOXSTRICTRC) PGMInterpretInstruction(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault);
387VMMDECL(int) PGMMap(PVM pVM, RTGCPTR GCPtr, RTHCPHYS HCPhys, uint32_t cbPages, unsigned fFlags);
388VMMDECL(int) PGMMapGetPage(PVM pVM, RTGCPTR GCPtr, uint64_t *pfFlags, PRTHCPHYS pHCPhys);
389VMMDECL(int) PGMMapSetPage(PVM pVM, RTGCPTR GCPtr, uint64_t cb, uint64_t fFlags);
390VMMDECL(int) PGMMapModifyPage(PVM pVM, RTGCPTR GCPtr, size_t cb, uint64_t fFlags, uint64_t fMask);
391#ifndef IN_RING0
392VMMDECL(bool) PGMMapHasConflicts(PVM pVM);
393#endif
394#ifdef VBOX_STRICT
395VMMDECL(void) PGMMapCheck(PVM pVM);
396#endif
397VMMDECL(int) PGMShwGetPage(PVMCPU pVCpu, RTGCPTR GCPtr, uint64_t *pfFlags, PRTHCPHYS pHCPhys);
398VMMDECL(int) PGMShwMakePageReadonly(PVMCPU pVCpu, RTGCPTR GCPtr, uint32_t fFlags);
399VMMDECL(int) PGMShwMakePageWritable(PVMCPU pVCpu, RTGCPTR GCPtr, uint32_t fFlags);
400VMMDECL(int) PGMShwMakePageNotPresent(PVMCPU pVCpu, RTGCPTR GCPtr, uint32_t fFlags);
401/** @name Flags for PGMShwMakePageReadonly, PGMShwMakePageWritable and
402 * PGMShwMakePageNotPresent
403 * @{ */
404/** The call is from an access handler for dealing with the a faulting write
405 * operation. The virtual address is within the same page. */
406#define PGM_MK_PG_IS_WRITE_FAULT RT_BIT(0)
407/** The page is an MMIO2. */
408#define PGM_MK_PG_IS_MMIO2 RT_BIT(1)
409/** @}*/
410VMMDECL(int) PGMGstGetPage(PVMCPU pVCpu, RTGCPTR GCPtr, uint64_t *pfFlags, PRTGCPHYS pGCPhys);
411VMMDECL(bool) PGMGstIsPagePresent(PVMCPU pVCpu, RTGCPTR GCPtr);
412VMMDECL(int) PGMGstSetPage(PVMCPU pVCpu, RTGCPTR GCPtr, size_t cb, uint64_t fFlags);
413VMMDECL(int) PGMGstModifyPage(PVMCPU pVCpu, RTGCPTR GCPtr, size_t cb, uint64_t fFlags, uint64_t fMask);
414VMM_INT_DECL(int) PGMGstGetPaePdpes(PVMCPU pVCpu, PX86PDPE paPdpes);
415VMM_INT_DECL(void) PGMGstUpdatePaePdpes(PVMCPU pVCpu, PCX86PDPE paPdpes);
416
417VMMDECL(int) PGMInvalidatePage(PVMCPU pVCpu, RTGCPTR GCPtrPage);
418VMMDECL(int) PGMFlushTLB(PVMCPU pVCpu, uint64_t cr3, bool fGlobal);
419VMMDECL(int) PGMSyncCR3(PVMCPU pVCpu, uint64_t cr0, uint64_t cr3, uint64_t cr4, bool fGlobal);
420VMMDECL(int) PGMUpdateCR3(PVMCPU pVCpu, uint64_t cr3);
421VMMDECL(int) PGMChangeMode(PVMCPU pVCpu, uint64_t cr0, uint64_t cr4, uint64_t efer);
422VMMDECL(void) PGMCr0WpEnabled(PVMCPU pVCpu);
423VMMDECL(PGMMODE) PGMGetGuestMode(PVMCPU pVCpu);
424VMMDECL(PGMMODE) PGMGetShadowMode(PVMCPU pVCpu);
425VMMDECL(PGMMODE) PGMGetHostMode(PVM pVM);
426VMMDECL(const char *) PGMGetModeName(PGMMODE enmMode);
427VMM_INT_DECL(void) PGMNotifyNxeChanged(PVMCPU pVCpu, bool fNxe);
428VMMDECL(bool) PGMHasDirtyPages(PVM pVM);
429
430/** PGM physical access handler type registration handle (heap offset, valid
431 * cross contexts without needing fixing up). Callbacks and handler type is
432 * associated with this and it is shared by all handler registrations. */
433typedef uint32_t PGMPHYSHANDLERTYPE;
434/** Pointer to a PGM physical handler type registration handle. */
435typedef PGMPHYSHANDLERTYPE *PPGMPHYSHANDLERTYPE;
436/** NIL value for PGM physical access handler type handle. */
437#define NIL_PGMPHYSHANDLERTYPE UINT32_MAX
438VMMDECL(uint32_t) PGMHandlerPhysicalTypeRelease(PVM pVM, PGMPHYSHANDLERTYPE hType);
439VMMDECL(uint32_t) PGMHandlerPhysicalTypeRetain(PVM pVM, PGMPHYSHANDLERTYPE hType);
440
441VMMDECL(int) PGMHandlerPhysicalRegister(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS GCPhysLast, PGMPHYSHANDLERTYPE hType,
442 RTR3PTR pvUserR3, RTR0PTR pvUserR0, RTRCPTR pvUserRC,
443 R3PTRTYPE(const char *) pszDesc);
444VMMDECL(int) PGMHandlerPhysicalModify(PVM pVM, RTGCPHYS GCPhysCurrent, RTGCPHYS GCPhys, RTGCPHYS GCPhysLast);
445VMMDECL(int) PGMHandlerPhysicalDeregister(PVM pVM, RTGCPHYS GCPhys);
446VMMDECL(int) PGMHandlerPhysicalChangeUserArgs(PVM pVM, RTGCPHYS GCPhys, RTR3PTR pvUserR3, RTR0PTR pvUserR0, RTRCPTR pvUserRC);
447VMMDECL(int) PGMHandlerPhysicalSplit(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS GCPhysSplit);
448VMMDECL(int) PGMHandlerPhysicalJoin(PVM pVM, RTGCPHYS GCPhys1, RTGCPHYS GCPhys2);
449VMMDECL(int) PGMHandlerPhysicalPageTempOff(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS GCPhysPage);
450VMMDECL(int) PGMHandlerPhysicalPageAlias(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS GCPhysPage, RTGCPHYS GCPhysPageRemap);
451VMMDECL(int) PGMHandlerPhysicalPageAliasHC(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS GCPhysPage, RTHCPHYS HCPhysPageRemap);
452VMMDECL(int) PGMHandlerPhysicalReset(PVM pVM, RTGCPHYS GCPhys);
453VMMDECL(bool) PGMHandlerPhysicalIsRegistered(PVM pVM, RTGCPHYS GCPhys);
454
455/** PGM virtual access handler type registration handle (heap offset, valid
456 * cross contexts without needing fixing up). Callbacks and handler type is
457 * associated with this and it is shared by all handler registrations. */
458typedef uint32_t PGMVIRTHANDLERTYPE;
459/** Pointer to a PGM virtual handler type registration handle. */
460typedef PGMVIRTHANDLERTYPE *PPGMVIRTHANDLERTYPE;
461/** NIL value for PGM virtual access handler type handle. */
462#define NIL_PGMVIRTHANDLERTYPE UINT32_MAX
463VMM_INT_DECL(uint32_t) PGMHandlerVirtualTypeRelease(PVM pVM, PGMVIRTHANDLERTYPE hType);
464VMM_INT_DECL(uint32_t) PGMHandlerVirtualTypeRetain(PVM pVM, PGMVIRTHANDLERTYPE hType);
465VMM_INT_DECL(bool) PGMHandlerVirtualIsRegistered(PVM pVM, RTGCPTR GCPtr);
466
467VMMDECL(bool) PGMPhysIsA20Enabled(PVMCPU pVCpu);
468VMMDECL(bool) PGMPhysIsGCPhysValid(PVM pVM, RTGCPHYS GCPhys);
469VMMDECL(bool) PGMPhysIsGCPhysNormal(PVM pVM, RTGCPHYS GCPhys);
470VMMDECL(int) PGMPhysGCPtr2GCPhys(PVMCPU pVCpu, RTGCPTR GCPtr, PRTGCPHYS pGCPhys);
471VMMDECL(void) PGMPhysReleasePageMappingLock(PVM pVM, PPGMPAGEMAPLOCK pLock);
472
473/** @def PGM_PHYS_RW_IS_SUCCESS
474 * Check whether a PGMPhysRead, PGMPhysWrite, PGMPhysReadGCPtr or
475 * PGMPhysWriteGCPtr call completed the given task.
476 *
477 * @returns true if completed, false if not.
478 * @param a_rcStrict The status code.
479 * @sa IOM_SUCCESS
480 */
481#ifdef IN_RING3
482# define PGM_PHYS_RW_IS_SUCCESS(a_rcStrict) \
483 ( (a_rcStrict) == VINF_SUCCESS )
484#elif defined(IN_RING0)
485# define PGM_PHYS_RW_IS_SUCCESS(a_rcStrict) \
486 ( (a_rcStrict) == VINF_SUCCESS \
487 || (a_rcStrict) == VINF_EM_OFF \
488 || (a_rcStrict) == VINF_EM_SUSPEND \
489 || (a_rcStrict) == VINF_EM_RESET \
490 || (a_rcStrict) == VINF_EM_HALT \
491 )
492#elif defined(IN_RC)
493# define PGM_PHYS_RW_IS_SUCCESS(a_rcStrict) \
494 ( (a_rcStrict) == VINF_SUCCESS \
495 || (a_rcStrict) == VINF_EM_OFF \
496 || (a_rcStrict) == VINF_EM_SUSPEND \
497 || (a_rcStrict) == VINF_EM_RESET \
498 || (a_rcStrict) == VINF_EM_HALT \
499 || (a_rcStrict) == VINF_SELM_SYNC_GDT \
500 || (a_rcStrict) == VINF_EM_RAW_EMULATE_INSTR_GDT_FAULT \
501 )
502#endif
503/** @def PGM_PHYS_RW_DO_UPDATE_STRICT_RC
504 * Updates the return code with a new result.
505 *
506 * Both status codes must be successes according to PGM_PHYS_RW_IS_SUCCESS.
507 *
508 * @param a_rcStrict The current return code, to be updated.
509 * @param a_rcStrict2 The new return code to merge in.
510 */
511#ifdef IN_RING3
512# define PGM_PHYS_RW_DO_UPDATE_STRICT_RC(a_rcStrict, a_rcStrict2) \
513 do { \
514 Assert(rcStrict == VINF_SUCCESS); \
515 Assert(rcStrict2 == VINF_SUCCESS); \
516 } while (0)
517#elif defined(IN_RING0)
518# define PGM_PHYS_RW_DO_UPDATE_STRICT_RC(a_rcStrict, a_rcStrict2) \
519 do { \
520 Assert(PGM_PHYS_RW_IS_SUCCESS(rcStrict)); \
521 Assert(PGM_PHYS_RW_IS_SUCCESS(rcStrict2)); \
522 if ((a_rcStrict2) == VINF_SUCCESS || (a_rcStrict) == (a_rcStrict2)) \
523 { /* likely */ } \
524 else if ( (a_rcStrict) == VINF_SUCCESS \
525 || (a_rcStrict) > (a_rcStrict2)) \
526 (a_rcStrict) = (a_rcStrict2); \
527 } while (0)
528#elif defined(IN_RC)
529# define PGM_PHYS_RW_DO_UPDATE_STRICT_RC(a_rcStrict, a_rcStrict2) \
530 do { \
531 Assert(PGM_PHYS_RW_IS_SUCCESS(rcStrict)); \
532 Assert(PGM_PHYS_RW_IS_SUCCESS(rcStrict2)); \
533 AssertCompile(VINF_SELM_SYNC_GDT > VINF_EM_LAST); \
534 AssertCompile(VINF_EM_RAW_EMULATE_INSTR_GDT_FAULT > VINF_EM_LAST); \
535 AssertCompile(VINF_EM_RAW_EMULATE_INSTR_GDT_FAULT < VINF_SELM_SYNC_GDT); \
536 if ((a_rcStrict2) == VINF_SUCCESS || (a_rcStrict) == (a_rcStrict2)) \
537 { /* likely */ } \
538 else if ( (a_rcStrict) == VINF_SUCCESS \
539 || ( (a_rcStrict) > (a_rcStrict2) \
540 && ( (a_rcStrict2) <= VINF_EM_RESET \
541 || (a_rcStrict) != VINF_EM_RAW_EMULATE_INSTR_GDT_FAULT) ) \
542 || ( (a_rcStrict2) == VINF_EM_RAW_EMULATE_INSTR_GDT_FAULT \
543 && (a_rcStrict) > VINF_EM_RESET) ) \
544 (a_rcStrict) = (a_rcStrict2); \
545 } while (0)
546#endif
547
548VMMDECL(VBOXSTRICTRC) PGMPhysRead(PVM pVM, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead, PGMACCESSORIGIN enmOrigin);
549VMMDECL(VBOXSTRICTRC) PGMPhysWrite(PVM pVM, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite, PGMACCESSORIGIN enmOrigin);
550VMMDECL(VBOXSTRICTRC) PGMPhysReadGCPtr(PVMCPU pVCpu, void *pvDst, RTGCPTR GCPtrSrc, size_t cb, PGMACCESSORIGIN enmOrigin);
551VMMDECL(VBOXSTRICTRC) PGMPhysWriteGCPtr(PVMCPU pVCpu, RTGCPTR GCPtrDst, const void *pvSrc, size_t cb, PGMACCESSORIGIN enmOrigin);
552
553VMMDECL(int) PGMPhysSimpleReadGCPhys(PVM pVM, void *pvDst, RTGCPHYS GCPhysSrc, size_t cb);
554VMMDECL(int) PGMPhysSimpleWriteGCPhys(PVM pVM, RTGCPHYS GCPhysDst, const void *pvSrc, size_t cb);
555VMMDECL(int) PGMPhysSimpleReadGCPtr(PVMCPU pVCpu, void *pvDst, RTGCPTR GCPtrSrc, size_t cb);
556VMMDECL(int) PGMPhysSimpleWriteGCPtr(PVMCPU pVCpu, RTGCPTR GCPtrDst, const void *pvSrc, size_t cb);
557VMMDECL(int) PGMPhysSimpleDirtyWriteGCPtr(PVMCPU pVCpu, RTGCPTR GCPtrDst, const void *pvSrc, size_t cb);
558VMMDECL(int) PGMPhysInterpretedRead(PVMCPU pVCpu, PCPUMCTXCORE pCtxCore, void *pvDst, RTGCPTR GCPtrSrc, size_t cb);
559VMMDECL(int) PGMPhysInterpretedReadNoHandlers(PVMCPU pVCpu, PCPUMCTXCORE pCtxCore, void *pvDst, RTGCUINTPTR GCPtrSrc, size_t cb, bool fRaiseTrap);
560VMMDECL(int) PGMPhysInterpretedWriteNoHandlers(PVMCPU pVCpu, PCPUMCTXCORE pCtxCore, RTGCPTR GCPtrDst, void const *pvSrc, size_t cb, bool fRaiseTrap);
561VMM_INT_DECL(int) PGMPhysIemGCPhys2Ptr(PVM pVM, PVMCPU pVCpu, RTGCPHYS GCPhys, bool fWritable, bool fByPassHandlers, void **ppv, PPGMPAGEMAPLOCK pLock);
562VMM_INT_DECL(int) PGMPhysIemQueryAccess(PVM pVM, RTGCPHYS GCPhys, bool fWritable, bool fByPassHandlers);
563
564#ifdef VBOX_STRICT
565VMMDECL(unsigned) PGMAssertHandlerAndFlagsInSync(PVM pVM);
566VMMDECL(unsigned) PGMAssertNoMappingConflicts(PVM pVM);
567VMMDECL(unsigned) PGMAssertCR3(PVM pVM, PVMCPU pVCpu, uint64_t cr3, uint64_t cr4);
568#endif /* VBOX_STRICT */
569
570#if defined(IN_RC) || defined(VBOX_WITH_2X_4GB_ADDR_SPACE)
571VMMDECL(void) PGMRZDynMapStartAutoSet(PVMCPU pVCpu);
572VMMDECL(void) PGMRZDynMapReleaseAutoSet(PVMCPU pVCpu);
573VMMDECL(void) PGMRZDynMapFlushAutoSet(PVMCPU pVCpu);
574VMMDECL(uint32_t) PGMRZDynMapPushAutoSubset(PVMCPU pVCpu);
575VMMDECL(void) PGMRZDynMapPopAutoSubset(PVMCPU pVCpu, uint32_t iPrevSubset);
576#endif
577
578VMMDECL(int) PGMSetLargePageUsage(PVM pVM, bool fUseLargePages);
579
580/**
581 * Query large page usage state
582 *
583 * @returns 0 - disabled, 1 - enabled
584 * @param pVM The VM to operate on.
585 */
586#define PGMIsUsingLargePages(pVM) ((pVM)->fUseLargePages)
587
588
589#ifdef IN_RC
590/** @defgroup grp_pgm_gc The PGM Guest Context API
591 * @{
592 */
593VMMRCDECL(int) PGMRCDynMapInit(PVM pVM);
594/** @} */
595#endif /* IN_RC */
596
597
598#ifdef IN_RING0
599/** @defgroup grp_pgm_r0 The PGM Host Context Ring-0 API
600 * @{
601 */
602VMMR0_INT_DECL(int) PGMR0PhysAllocateHandyPages(PVM pVM, PVMCPU pVCpu);
603VMMR0_INT_DECL(int) PGMR0PhysFlushHandyPages(PVM pVM, PVMCPU pVCpu);
604VMMR0_INT_DECL(int) PGMR0PhysAllocateLargeHandyPage(PVM pVM, PVMCPU pVCpu);
605VMMR0_INT_DECL(int) PGMR0PhysSetupIommu(PVM pVM);
606VMMR0DECL(int) PGMR0SharedModuleCheck(PVM pVM, PGVM pGVM, VMCPUID idCpu, PGMMSHAREDMODULE pModule, PCRTGCPTR64 paRegionsGCPtrs);
607VMMR0DECL(int) PGMR0Trap0eHandlerNestedPaging(PVM pVM, PVMCPU pVCpu, PGMMODE enmShwPagingMode, RTGCUINT uErr, PCPUMCTXCORE pRegFrame, RTGCPHYS pvFault);
608VMMR0DECL(VBOXSTRICTRC) PGMR0Trap0eHandlerNPMisconfig(PVM pVM, PVMCPU pVCpu, PGMMODE enmShwPagingMode, PCPUMCTXCORE pRegFrame, RTGCPHYS GCPhysFault, uint32_t uErr);
609# ifdef VBOX_WITH_2X_4GB_ADDR_SPACE
610VMMR0DECL(int) PGMR0DynMapInit(void);
611VMMR0DECL(void) PGMR0DynMapTerm(void);
612VMMR0DECL(int) PGMR0DynMapInitVM(PVM pVM);
613VMMR0DECL(void) PGMR0DynMapTermVM(PVM pVM);
614VMMR0DECL(int) PGMR0DynMapAssertIntegrity(void);
615VMMR0DECL(bool) PGMR0DynMapStartOrMigrateAutoSet(PVMCPU pVCpu);
616VMMR0DECL(void) PGMR0DynMapMigrateAutoSet(PVMCPU pVCpu);
617# endif
618/** @} */
619#endif /* IN_RING0 */
620
621
622
623#ifdef IN_RING3
624/** @defgroup grp_pgm_r3 The PGM Host Context Ring-3 API
625 * @{
626 */
627VMMR3DECL(int) PGMR3Init(PVM pVM);
628VMMR3DECL(int) PGMR3InitDynMap(PVM pVM);
629VMMR3DECL(int) PGMR3InitFinalize(PVM pVM);
630VMMR3_INT_DECL(int) PGMR3InitCompleted(PVM pVM, VMINITCOMPLETED enmWhat);
631VMMR3DECL(void) PGMR3Relocate(PVM pVM, RTGCINTPTR offDelta);
632VMMR3DECL(void) PGMR3ResetCpu(PVM pVM, PVMCPU pVCpu);
633VMMR3_INT_DECL(void) PGMR3Reset(PVM pVM);
634VMMR3_INT_DECL(void) PGMR3MemSetup(PVM pVM, bool fReset);
635VMMR3DECL(int) PGMR3Term(PVM pVM);
636VMMR3DECL(int) PGMR3LockCall(PVM pVM);
637VMMR3DECL(int) PGMR3ChangeMode(PVM pVM, PVMCPU pVCpu, PGMMODE enmGuestMode);
638
639VMMR3DECL(int) PGMR3PhysRegisterRam(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cb, const char *pszDesc);
640VMMR3DECL(int) PGMR3PhysChangeMemBalloon(PVM pVM, bool fInflate, unsigned cPages, RTGCPHYS *paPhysPage);
641VMMR3DECL(int) PGMR3PhysWriteProtectRAM(PVM pVM);
642VMMR3DECL(int) PGMR3PhysEnumDirtyFTPages(PVM pVM, PFNPGMENUMDIRTYFTPAGES pfnEnum, void *pvUser);
643VMMR3DECL(uint32_t) PGMR3PhysGetRamRangeCount(PVM pVM);
644VMMR3DECL(int) PGMR3PhysGetRange(PVM pVM, uint32_t iRange, PRTGCPHYS pGCPhysStart, PRTGCPHYS pGCPhysLast,
645 const char **ppszDesc, bool *pfIsMmio);
646VMMR3DECL(int) PGMR3QueryMemoryStats(PUVM pUVM, uint64_t *pcbTotalMem, uint64_t *pcbPrivateMem, uint64_t *pcbSharedMem, uint64_t *pcbZeroMem);
647VMMR3DECL(int) PGMR3QueryGlobalMemoryStats(PUVM pUVM, uint64_t *pcbAllocMem, uint64_t *pcbFreeMem, uint64_t *pcbBallonedMem, uint64_t *pcbSharedMem);
648
649VMMR3DECL(int) PGMR3PhysMMIORegister(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cb, PGMPHYSHANDLERTYPE hType,
650 RTR3PTR pvUserR3, RTR0PTR pvUserR0, RTRCPTR pvUserRC, const char *pszDesc);
651VMMR3DECL(int) PGMR3PhysMMIODeregister(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cb);
652VMMR3DECL(int) PGMR3PhysMMIO2Register(PVM pVM, PPDMDEVINS pDevIns, uint32_t iRegion, RTGCPHYS cb, uint32_t fFlags, void **ppv, const char *pszDesc);
653VMMR3DECL(int) PGMR3PhysMMIO2Deregister(PVM pVM, PPDMDEVINS pDevIns, uint32_t iRegion);
654VMMR3DECL(int) PGMR3PhysMMIO2Map(PVM pVM, PPDMDEVINS pDevIns, uint32_t iRegion, RTGCPHYS GCPhys);
655VMMR3DECL(int) PGMR3PhysMMIO2Unmap(PVM pVM, PPDMDEVINS pDevIns, uint32_t iRegion, RTGCPHYS GCPhys);
656VMMR3DECL(bool) PGMR3PhysMMIO2IsBase(PVM pVM, PPDMDEVINS pDevIns, RTGCPHYS GCPhys);
657VMMR3DECL(int) PGMR3PhysMMIO2GetHCPhys(PVM pVM, PPDMDEVINS pDevIns, uint32_t iRegion, RTGCPHYS off, PRTHCPHYS pHCPhys);
658VMMR3DECL(int) PGMR3PhysMMIO2MapKernel(PVM pVM, PPDMDEVINS pDevIns, uint32_t iRegion, RTGCPHYS off, RTGCPHYS cb, const char *pszDesc, PRTR0PTR pR0Ptr);
659
660/** @name PGMR3PhysRegisterRom flags.
661 * @{ */
662/** Inidicates that ROM shadowing should be enabled. */
663#define PGMPHYS_ROM_FLAGS_SHADOWED RT_BIT_32(0)
664/** Indicates that what pvBinary points to won't go away
665 * and can be used for strictness checks. */
666#define PGMPHYS_ROM_FLAGS_PERMANENT_BINARY RT_BIT_32(1)
667/** @} */
668
669VMMR3DECL(int) PGMR3PhysRomRegister(PVM pVM, PPDMDEVINS pDevIns, RTGCPHYS GCPhys, RTGCPHYS cb,
670 const void *pvBinary, uint32_t cbBinary, uint32_t fFlags, const char *pszDesc);
671VMMR3DECL(int) PGMR3PhysRomProtect(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cb, PGMROMPROT enmProt);
672VMMR3DECL(int) PGMR3PhysRegister(PVM pVM, void *pvRam, RTGCPHYS GCPhys, size_t cb, unsigned fFlags, const SUPPAGE *paPages, const char *pszDesc);
673VMMDECL(void) PGMR3PhysSetA20(PVMCPU pVCpu, bool fEnable);
674/** @name PGMR3MapPT flags.
675 * @{ */
676/** The mapping may be unmapped later. The default is permanent mappings. */
677#define PGMR3MAPPT_FLAGS_UNMAPPABLE RT_BIT(0)
678/** @} */
679VMMR3DECL(int) PGMR3MapPT(PVM pVM, RTGCPTR GCPtr, uint32_t cb, uint32_t fFlags, PFNPGMRELOCATE pfnRelocate, void *pvUser, const char *pszDesc);
680VMMR3DECL(int) PGMR3UnmapPT(PVM pVM, RTGCPTR GCPtr);
681VMMR3DECL(int) PGMR3FinalizeMappings(PVM pVM);
682VMMR3DECL(int) PGMR3MappingsSize(PVM pVM, uint32_t *pcb);
683VMMR3DECL(int) PGMR3MappingsFix(PVM pVM, RTGCPTR GCPtrBase, uint32_t cb);
684VMMR3DECL(int) PGMR3MappingsUnfix(PVM pVM);
685VMMR3DECL(bool) PGMR3MappingsNeedReFixing(PVM pVM);
686#if defined(VBOX_WITH_RAW_MODE) || (HC_ARCH_BITS != 64 && !defined(VBOX_WITH_HYBRID_32BIT_KERNEL))
687VMMR3DECL(int) PGMR3MapIntermediate(PVM pVM, RTUINTPTR Addr, RTHCPHYS HCPhys, unsigned cbPages);
688#endif
689VMMR3DECL(int) PGMR3MapRead(PVM pVM, void *pvDst, RTGCPTR GCPtrSrc, size_t cb);
690
691VMMR3_INT_DECL(int) PGMR3HandlerPhysicalTypeRegisterEx(PVM pVM, PGMPHYSHANDLERKIND enmKind,
692 PFNPGMPHYSHANDLER pfnHandlerR3,
693 R0PTRTYPE(PFNPGMPHYSHANDLER) pfnHandlerR0,
694 R0PTRTYPE(PFNPGMRZPHYSPFHANDLER) pfnPfHandlerR0,
695 RCPTRTYPE(PFNPGMPHYSHANDLER) pfnHandlerRC,
696 RCPTRTYPE(PFNPGMRZPHYSPFHANDLER) pfnPfHandlerRC,
697 const char *pszDesc, PPGMPHYSHANDLERTYPE phType);
698VMMR3DECL(int) PGMR3HandlerPhysicalTypeRegister(PVM pVM, PGMPHYSHANDLERKIND enmKind,
699 R3PTRTYPE(PFNPGMPHYSHANDLER) pfnHandlerR3,
700 const char *pszModR0, const char *pszHandlerR0, const char *pszPfHandlerR0,
701 const char *pszModRC, const char *pszHandlerRC, const char *pszPfHandlerRC,
702 const char *pszDesc,
703 PPGMPHYSHANDLERTYPE phType);
704VMMR3_INT_DECL(int) PGMR3HandlerVirtualTypeRegisterEx(PVM pVM, PGMVIRTHANDLERKIND enmKind, bool fRelocUserRC,
705 PFNPGMR3VIRTINVALIDATE pfnInvalidateR3,
706 PFNPGMVIRTHANDLER pfnHandlerR3,
707 RCPTRTYPE(FNPGMVIRTHANDLER) pfnHandlerRC,
708 RCPTRTYPE(FNPGMRCVIRTPFHANDLER) pfnPfHandlerRC,
709 const char *pszDesc, PPGMVIRTHANDLERTYPE phType);
710VMMR3_INT_DECL(int) PGMR3HandlerVirtualTypeRegister(PVM pVM, PGMVIRTHANDLERKIND enmKind, bool fRelocUserRC,
711 PFNPGMR3VIRTINVALIDATE pfnInvalidateR3,
712 PFNPGMVIRTHANDLER pfnHandlerR3,
713 const char *pszHandlerRC, const char *pszPfHandlerRC, const char *pszDesc,
714 PPGMVIRTHANDLERTYPE phType);
715VMMR3_INT_DECL(int) PGMR3HandlerVirtualRegister(PVM pVM, PVMCPU pVCpu, PGMVIRTHANDLERTYPE hType, RTGCPTR GCPtr,
716 RTGCPTR GCPtrLast, void *pvUserR3, RTRCPTR pvUserRC, const char *pszDesc);
717VMMR3_INT_DECL(int) PGMHandlerVirtualChangeType(PVM pVM, RTGCPTR GCPtr, PGMVIRTHANDLERTYPE hNewType);
718VMMR3_INT_DECL(int) PGMHandlerVirtualDeregister(PVM pVM, PVMCPU pVCpu, RTGCPTR GCPtr, bool fHypervisor);
719VMMR3DECL(int) PGMR3PoolGrow(PVM pVM);
720
721VMMR3DECL(int) PGMR3PhysTlbGCPhys2Ptr(PVM pVM, RTGCPHYS GCPhys, bool fWritable, void **ppv);
722VMMR3DECL(uint8_t) PGMR3PhysReadU8(PVM pVM, RTGCPHYS GCPhys, PGMACCESSORIGIN enmOrigin);
723VMMR3DECL(uint16_t) PGMR3PhysReadU16(PVM pVM, RTGCPHYS GCPhys, PGMACCESSORIGIN enmOrigin);
724VMMR3DECL(uint32_t) PGMR3PhysReadU32(PVM pVM, RTGCPHYS GCPhys, PGMACCESSORIGIN enmOrigin);
725VMMR3DECL(uint64_t) PGMR3PhysReadU64(PVM pVM, RTGCPHYS GCPhys, PGMACCESSORIGIN enmOrigin);
726VMMR3DECL(void) PGMR3PhysWriteU8(PVM pVM, RTGCPHYS GCPhys, uint8_t Value, PGMACCESSORIGIN enmOrigin);
727VMMR3DECL(void) PGMR3PhysWriteU16(PVM pVM, RTGCPHYS GCPhys, uint16_t Value, PGMACCESSORIGIN enmOrigin);
728VMMR3DECL(void) PGMR3PhysWriteU32(PVM pVM, RTGCPHYS GCPhys, uint32_t Value, PGMACCESSORIGIN enmOrigin);
729VMMR3DECL(void) PGMR3PhysWriteU64(PVM pVM, RTGCPHYS GCPhys, uint64_t Value, PGMACCESSORIGIN enmOrigin);
730VMMR3DECL(int) PGMR3PhysReadExternal(PVM pVM, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead, PGMACCESSORIGIN enmOrigin);
731VMMR3DECL(int) PGMR3PhysWriteExternal(PVM pVM, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite, PGMACCESSORIGIN enmOrigin);
732VMMR3DECL(int) PGMR3PhysGCPhys2CCPtrExternal(PVM pVM, RTGCPHYS GCPhys, void **ppv, PPGMPAGEMAPLOCK pLock);
733VMMR3DECL(int) PGMR3PhysGCPhys2CCPtrReadOnlyExternal(PVM pVM, RTGCPHYS GCPhys, void const **ppv, PPGMPAGEMAPLOCK pLock);
734VMMR3DECL(int) PGMR3PhysChunkMap(PVM pVM, uint32_t idChunk);
735VMMR3DECL(void) PGMR3PhysChunkInvalidateTLB(PVM pVM);
736VMMR3DECL(int) PGMR3PhysAllocateHandyPages(PVM pVM);
737VMMR3DECL(int) PGMR3PhysAllocateLargeHandyPage(PVM pVM, RTGCPHYS GCPhys);
738
739VMMR3DECL(int) PGMR3CheckIntegrity(PVM pVM);
740
741VMMR3DECL(int) PGMR3DbgR3Ptr2GCPhys(PUVM pUVM, RTR3PTR R3Ptr, PRTGCPHYS pGCPhys);
742VMMR3DECL(int) PGMR3DbgR3Ptr2HCPhys(PUVM pUVM, RTR3PTR R3Ptr, PRTHCPHYS pHCPhys);
743VMMR3DECL(int) PGMR3DbgHCPhys2GCPhys(PUVM pUVM, RTHCPHYS HCPhys, PRTGCPHYS pGCPhys);
744VMMR3_INT_DECL(int) PGMR3DbgReadGCPhys(PVM pVM, void *pvDst, RTGCPHYS GCPhysSrc, size_t cb, uint32_t fFlags, size_t *pcbRead);
745VMMR3_INT_DECL(int) PGMR3DbgWriteGCPhys(PVM pVM, RTGCPHYS GCPhysDst, const void *pvSrc, size_t cb, uint32_t fFlags, size_t *pcbWritten);
746VMMR3_INT_DECL(int) PGMR3DbgReadGCPtr(PVM pVM, void *pvDst, RTGCPTR GCPtrSrc, size_t cb, uint32_t fFlags, size_t *pcbRead);
747VMMR3_INT_DECL(int) PGMR3DbgWriteGCPtr(PVM pVM, RTGCPTR GCPtrDst, void const *pvSrc, size_t cb, uint32_t fFlags, size_t *pcbWritten);
748VMMR3_INT_DECL(int) PGMR3DbgScanPhysical(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cbRange, RTGCPHYS GCPhysAlign, const uint8_t *pabNeedle, size_t cbNeedle, PRTGCPHYS pGCPhysHit);
749VMMR3_INT_DECL(int) PGMR3DbgScanVirtual(PVM pVM, PVMCPU pVCpu, RTGCPTR GCPtr, RTGCPTR cbRange, RTGCPTR GCPtrAlign, const uint8_t *pabNeedle, size_t cbNeedle, PRTGCUINTPTR pGCPhysHit);
750VMMR3_INT_DECL(int) PGMR3DumpHierarchyShw(PVM pVM, uint64_t cr3, uint32_t fFlags, uint64_t u64FirstAddr, uint64_t u64LastAddr, uint32_t cMaxDepth, PCDBGFINFOHLP pHlp);
751VMMR3_INT_DECL(int) PGMR3DumpHierarchyGst(PVM pVM, uint64_t cr3, uint32_t fFlags, RTGCPTR FirstAddr, RTGCPTR LastAddr, uint32_t cMaxDepth, PCDBGFINFOHLP pHlp);
752
753
754/** @name Page sharing
755 * @{ */
756VMMR3DECL(int) PGMR3SharedModuleRegister(PVM pVM, VBOXOSFAMILY enmGuestOS, char *pszModuleName, char *pszVersion,
757 RTGCPTR GCBaseAddr, uint32_t cbModule,
758 uint32_t cRegions, VMMDEVSHAREDREGIONDESC const *paRegions);
759VMMR3DECL(int) PGMR3SharedModuleUnregister(PVM pVM, char *pszModuleName, char *pszVersion,
760 RTGCPTR GCBaseAddr, uint32_t cbModule);
761VMMR3DECL(int) PGMR3SharedModuleCheckAll(PVM pVM);
762VMMR3DECL(int) PGMR3SharedModuleGetPageState(PVM pVM, RTGCPTR GCPtrPage, bool *pfShared, uint64_t *pfPageFlags);
763/** @} */
764
765/** @} */
766#endif /* IN_RING3 */
767
768RT_C_DECLS_END
769
770/** @} */
771#endif
772
Note: See TracBrowser for help on using the repository browser.

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