VirtualBox

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

Last change on this file since 56384 was 56384, checked in by vboxsync, 10 years ago

PGM: Disabled the virtual handler code for !VBOX_WITH_RAW_MODE.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 37.8 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
463#ifdef VBOX_WITH_RAW_MODE
464VMM_INT_DECL(uint32_t) PGMHandlerVirtualTypeRelease(PVM pVM, PGMVIRTHANDLERTYPE hType);
465VMM_INT_DECL(uint32_t) PGMHandlerVirtualTypeRetain(PVM pVM, PGMVIRTHANDLERTYPE hType);
466VMM_INT_DECL(bool) PGMHandlerVirtualIsRegistered(PVM pVM, RTGCPTR GCPtr);
467#endif
468
469VMMDECL(bool) PGMPhysIsA20Enabled(PVMCPU pVCpu);
470VMMDECL(bool) PGMPhysIsGCPhysValid(PVM pVM, RTGCPHYS GCPhys);
471VMMDECL(bool) PGMPhysIsGCPhysNormal(PVM pVM, RTGCPHYS GCPhys);
472VMMDECL(int) PGMPhysGCPtr2GCPhys(PVMCPU pVCpu, RTGCPTR GCPtr, PRTGCPHYS pGCPhys);
473VMMDECL(void) PGMPhysReleasePageMappingLock(PVM pVM, PPGMPAGEMAPLOCK pLock);
474
475/** @def PGM_PHYS_RW_IS_SUCCESS
476 * Check whether a PGMPhysRead, PGMPhysWrite, PGMPhysReadGCPtr or
477 * PGMPhysWriteGCPtr call completed the given task.
478 *
479 * @returns true if completed, false if not.
480 * @param a_rcStrict The status code.
481 * @sa IOM_SUCCESS
482 */
483#ifdef IN_RING3
484# define PGM_PHYS_RW_IS_SUCCESS(a_rcStrict) \
485 ( (a_rcStrict) == VINF_SUCCESS )
486#elif defined(IN_RING0)
487# define PGM_PHYS_RW_IS_SUCCESS(a_rcStrict) \
488 ( (a_rcStrict) == VINF_SUCCESS \
489 || (a_rcStrict) == VINF_EM_OFF \
490 || (a_rcStrict) == VINF_EM_SUSPEND \
491 || (a_rcStrict) == VINF_EM_RESET \
492 || (a_rcStrict) == VINF_EM_HALT \
493 )
494#elif defined(IN_RC)
495# define PGM_PHYS_RW_IS_SUCCESS(a_rcStrict) \
496 ( (a_rcStrict) == VINF_SUCCESS \
497 || (a_rcStrict) == VINF_EM_OFF \
498 || (a_rcStrict) == VINF_EM_SUSPEND \
499 || (a_rcStrict) == VINF_EM_RESET \
500 || (a_rcStrict) == VINF_EM_HALT \
501 || (a_rcStrict) == VINF_SELM_SYNC_GDT \
502 || (a_rcStrict) == VINF_EM_RAW_EMULATE_INSTR_GDT_FAULT \
503 )
504#endif
505/** @def PGM_PHYS_RW_DO_UPDATE_STRICT_RC
506 * Updates the return code with a new result.
507 *
508 * Both status codes must be successes according to PGM_PHYS_RW_IS_SUCCESS.
509 *
510 * @param a_rcStrict The current return code, to be updated.
511 * @param a_rcStrict2 The new return code to merge in.
512 */
513#ifdef IN_RING3
514# define PGM_PHYS_RW_DO_UPDATE_STRICT_RC(a_rcStrict, a_rcStrict2) \
515 do { \
516 Assert(rcStrict == VINF_SUCCESS); \
517 Assert(rcStrict2 == VINF_SUCCESS); \
518 } while (0)
519#elif defined(IN_RING0)
520# define PGM_PHYS_RW_DO_UPDATE_STRICT_RC(a_rcStrict, a_rcStrict2) \
521 do { \
522 Assert(PGM_PHYS_RW_IS_SUCCESS(rcStrict)); \
523 Assert(PGM_PHYS_RW_IS_SUCCESS(rcStrict2)); \
524 if ((a_rcStrict2) == VINF_SUCCESS || (a_rcStrict) == (a_rcStrict2)) \
525 { /* likely */ } \
526 else if ( (a_rcStrict) == VINF_SUCCESS \
527 || (a_rcStrict) > (a_rcStrict2)) \
528 (a_rcStrict) = (a_rcStrict2); \
529 } while (0)
530#elif defined(IN_RC)
531# define PGM_PHYS_RW_DO_UPDATE_STRICT_RC(a_rcStrict, a_rcStrict2) \
532 do { \
533 Assert(PGM_PHYS_RW_IS_SUCCESS(rcStrict)); \
534 Assert(PGM_PHYS_RW_IS_SUCCESS(rcStrict2)); \
535 AssertCompile(VINF_SELM_SYNC_GDT > VINF_EM_LAST); \
536 AssertCompile(VINF_EM_RAW_EMULATE_INSTR_GDT_FAULT > VINF_EM_LAST); \
537 AssertCompile(VINF_EM_RAW_EMULATE_INSTR_GDT_FAULT < VINF_SELM_SYNC_GDT); \
538 if ((a_rcStrict2) == VINF_SUCCESS || (a_rcStrict) == (a_rcStrict2)) \
539 { /* likely */ } \
540 else if ( (a_rcStrict) == VINF_SUCCESS \
541 || ( (a_rcStrict) > (a_rcStrict2) \
542 && ( (a_rcStrict2) <= VINF_EM_RESET \
543 || (a_rcStrict) != VINF_EM_RAW_EMULATE_INSTR_GDT_FAULT) ) \
544 || ( (a_rcStrict2) == VINF_EM_RAW_EMULATE_INSTR_GDT_FAULT \
545 && (a_rcStrict) > VINF_EM_RESET) ) \
546 (a_rcStrict) = (a_rcStrict2); \
547 } while (0)
548#endif
549
550VMMDECL(VBOXSTRICTRC) PGMPhysRead(PVM pVM, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead, PGMACCESSORIGIN enmOrigin);
551VMMDECL(VBOXSTRICTRC) PGMPhysWrite(PVM pVM, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite, PGMACCESSORIGIN enmOrigin);
552VMMDECL(VBOXSTRICTRC) PGMPhysReadGCPtr(PVMCPU pVCpu, void *pvDst, RTGCPTR GCPtrSrc, size_t cb, PGMACCESSORIGIN enmOrigin);
553VMMDECL(VBOXSTRICTRC) PGMPhysWriteGCPtr(PVMCPU pVCpu, RTGCPTR GCPtrDst, const void *pvSrc, size_t cb, PGMACCESSORIGIN enmOrigin);
554
555VMMDECL(int) PGMPhysSimpleReadGCPhys(PVM pVM, void *pvDst, RTGCPHYS GCPhysSrc, size_t cb);
556VMMDECL(int) PGMPhysSimpleWriteGCPhys(PVM pVM, RTGCPHYS GCPhysDst, const void *pvSrc, size_t cb);
557VMMDECL(int) PGMPhysSimpleReadGCPtr(PVMCPU pVCpu, void *pvDst, RTGCPTR GCPtrSrc, size_t cb);
558VMMDECL(int) PGMPhysSimpleWriteGCPtr(PVMCPU pVCpu, RTGCPTR GCPtrDst, const void *pvSrc, size_t cb);
559VMMDECL(int) PGMPhysSimpleDirtyWriteGCPtr(PVMCPU pVCpu, RTGCPTR GCPtrDst, const void *pvSrc, size_t cb);
560VMMDECL(int) PGMPhysInterpretedRead(PVMCPU pVCpu, PCPUMCTXCORE pCtxCore, void *pvDst, RTGCPTR GCPtrSrc, size_t cb);
561VMMDECL(int) PGMPhysInterpretedReadNoHandlers(PVMCPU pVCpu, PCPUMCTXCORE pCtxCore, void *pvDst, RTGCUINTPTR GCPtrSrc, size_t cb, bool fRaiseTrap);
562VMMDECL(int) PGMPhysInterpretedWriteNoHandlers(PVMCPU pVCpu, PCPUMCTXCORE pCtxCore, RTGCPTR GCPtrDst, void const *pvSrc, size_t cb, bool fRaiseTrap);
563VMM_INT_DECL(int) PGMPhysIemGCPhys2Ptr(PVM pVM, PVMCPU pVCpu, RTGCPHYS GCPhys, bool fWritable, bool fByPassHandlers, void **ppv, PPGMPAGEMAPLOCK pLock);
564VMM_INT_DECL(int) PGMPhysIemQueryAccess(PVM pVM, RTGCPHYS GCPhys, bool fWritable, bool fByPassHandlers);
565
566#ifdef VBOX_STRICT
567VMMDECL(unsigned) PGMAssertHandlerAndFlagsInSync(PVM pVM);
568VMMDECL(unsigned) PGMAssertNoMappingConflicts(PVM pVM);
569VMMDECL(unsigned) PGMAssertCR3(PVM pVM, PVMCPU pVCpu, uint64_t cr3, uint64_t cr4);
570#endif /* VBOX_STRICT */
571
572#if defined(IN_RC) || defined(VBOX_WITH_2X_4GB_ADDR_SPACE)
573VMMDECL(void) PGMRZDynMapStartAutoSet(PVMCPU pVCpu);
574VMMDECL(void) PGMRZDynMapReleaseAutoSet(PVMCPU pVCpu);
575VMMDECL(void) PGMRZDynMapFlushAutoSet(PVMCPU pVCpu);
576VMMDECL(uint32_t) PGMRZDynMapPushAutoSubset(PVMCPU pVCpu);
577VMMDECL(void) PGMRZDynMapPopAutoSubset(PVMCPU pVCpu, uint32_t iPrevSubset);
578#endif
579
580VMMDECL(int) PGMSetLargePageUsage(PVM pVM, bool fUseLargePages);
581
582/**
583 * Query large page usage state
584 *
585 * @returns 0 - disabled, 1 - enabled
586 * @param pVM The VM to operate on.
587 */
588#define PGMIsUsingLargePages(pVM) ((pVM)->fUseLargePages)
589
590
591#ifdef IN_RC
592/** @defgroup grp_pgm_gc The PGM Guest Context API
593 * @{
594 */
595VMMRCDECL(int) PGMRCDynMapInit(PVM pVM);
596/** @} */
597#endif /* IN_RC */
598
599
600#ifdef IN_RING0
601/** @defgroup grp_pgm_r0 The PGM Host Context Ring-0 API
602 * @{
603 */
604VMMR0_INT_DECL(int) PGMR0PhysAllocateHandyPages(PVM pVM, PVMCPU pVCpu);
605VMMR0_INT_DECL(int) PGMR0PhysFlushHandyPages(PVM pVM, PVMCPU pVCpu);
606VMMR0_INT_DECL(int) PGMR0PhysAllocateLargeHandyPage(PVM pVM, PVMCPU pVCpu);
607VMMR0_INT_DECL(int) PGMR0PhysSetupIommu(PVM pVM);
608VMMR0DECL(int) PGMR0SharedModuleCheck(PVM pVM, PGVM pGVM, VMCPUID idCpu, PGMMSHAREDMODULE pModule, PCRTGCPTR64 paRegionsGCPtrs);
609VMMR0DECL(int) PGMR0Trap0eHandlerNestedPaging(PVM pVM, PVMCPU pVCpu, PGMMODE enmShwPagingMode, RTGCUINT uErr, PCPUMCTXCORE pRegFrame, RTGCPHYS pvFault);
610VMMR0DECL(VBOXSTRICTRC) PGMR0Trap0eHandlerNPMisconfig(PVM pVM, PVMCPU pVCpu, PGMMODE enmShwPagingMode, PCPUMCTXCORE pRegFrame, RTGCPHYS GCPhysFault, uint32_t uErr);
611# ifdef VBOX_WITH_2X_4GB_ADDR_SPACE
612VMMR0DECL(int) PGMR0DynMapInit(void);
613VMMR0DECL(void) PGMR0DynMapTerm(void);
614VMMR0DECL(int) PGMR0DynMapInitVM(PVM pVM);
615VMMR0DECL(void) PGMR0DynMapTermVM(PVM pVM);
616VMMR0DECL(int) PGMR0DynMapAssertIntegrity(void);
617VMMR0DECL(bool) PGMR0DynMapStartOrMigrateAutoSet(PVMCPU pVCpu);
618VMMR0DECL(void) PGMR0DynMapMigrateAutoSet(PVMCPU pVCpu);
619# endif
620/** @} */
621#endif /* IN_RING0 */
622
623
624
625#ifdef IN_RING3
626/** @defgroup grp_pgm_r3 The PGM Host Context Ring-3 API
627 * @{
628 */
629VMMR3DECL(int) PGMR3Init(PVM pVM);
630VMMR3DECL(int) PGMR3InitDynMap(PVM pVM);
631VMMR3DECL(int) PGMR3InitFinalize(PVM pVM);
632VMMR3_INT_DECL(int) PGMR3InitCompleted(PVM pVM, VMINITCOMPLETED enmWhat);
633VMMR3DECL(void) PGMR3Relocate(PVM pVM, RTGCINTPTR offDelta);
634VMMR3DECL(void) PGMR3ResetCpu(PVM pVM, PVMCPU pVCpu);
635VMMR3_INT_DECL(void) PGMR3Reset(PVM pVM);
636VMMR3_INT_DECL(void) PGMR3MemSetup(PVM pVM, bool fReset);
637VMMR3DECL(int) PGMR3Term(PVM pVM);
638VMMR3DECL(int) PGMR3LockCall(PVM pVM);
639VMMR3DECL(int) PGMR3ChangeMode(PVM pVM, PVMCPU pVCpu, PGMMODE enmGuestMode);
640
641VMMR3DECL(int) PGMR3PhysRegisterRam(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cb, const char *pszDesc);
642VMMR3DECL(int) PGMR3PhysChangeMemBalloon(PVM pVM, bool fInflate, unsigned cPages, RTGCPHYS *paPhysPage);
643VMMR3DECL(int) PGMR3PhysWriteProtectRAM(PVM pVM);
644VMMR3DECL(int) PGMR3PhysEnumDirtyFTPages(PVM pVM, PFNPGMENUMDIRTYFTPAGES pfnEnum, void *pvUser);
645VMMR3DECL(uint32_t) PGMR3PhysGetRamRangeCount(PVM pVM);
646VMMR3DECL(int) PGMR3PhysGetRange(PVM pVM, uint32_t iRange, PRTGCPHYS pGCPhysStart, PRTGCPHYS pGCPhysLast,
647 const char **ppszDesc, bool *pfIsMmio);
648VMMR3DECL(int) PGMR3QueryMemoryStats(PUVM pUVM, uint64_t *pcbTotalMem, uint64_t *pcbPrivateMem, uint64_t *pcbSharedMem, uint64_t *pcbZeroMem);
649VMMR3DECL(int) PGMR3QueryGlobalMemoryStats(PUVM pUVM, uint64_t *pcbAllocMem, uint64_t *pcbFreeMem, uint64_t *pcbBallonedMem, uint64_t *pcbSharedMem);
650
651VMMR3DECL(int) PGMR3PhysMMIORegister(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cb, PGMPHYSHANDLERTYPE hType,
652 RTR3PTR pvUserR3, RTR0PTR pvUserR0, RTRCPTR pvUserRC, const char *pszDesc);
653VMMR3DECL(int) PGMR3PhysMMIODeregister(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cb);
654VMMR3DECL(int) PGMR3PhysMMIO2Register(PVM pVM, PPDMDEVINS pDevIns, uint32_t iRegion, RTGCPHYS cb, uint32_t fFlags, void **ppv, const char *pszDesc);
655VMMR3DECL(int) PGMR3PhysMMIO2Deregister(PVM pVM, PPDMDEVINS pDevIns, uint32_t iRegion);
656VMMR3DECL(int) PGMR3PhysMMIO2Map(PVM pVM, PPDMDEVINS pDevIns, uint32_t iRegion, RTGCPHYS GCPhys);
657VMMR3DECL(int) PGMR3PhysMMIO2Unmap(PVM pVM, PPDMDEVINS pDevIns, uint32_t iRegion, RTGCPHYS GCPhys);
658VMMR3DECL(bool) PGMR3PhysMMIO2IsBase(PVM pVM, PPDMDEVINS pDevIns, RTGCPHYS GCPhys);
659VMMR3DECL(int) PGMR3PhysMMIO2GetHCPhys(PVM pVM, PPDMDEVINS pDevIns, uint32_t iRegion, RTGCPHYS off, PRTHCPHYS pHCPhys);
660VMMR3DECL(int) PGMR3PhysMMIO2MapKernel(PVM pVM, PPDMDEVINS pDevIns, uint32_t iRegion, RTGCPHYS off, RTGCPHYS cb, const char *pszDesc, PRTR0PTR pR0Ptr);
661
662/** @name PGMR3PhysRegisterRom flags.
663 * @{ */
664/** Inidicates that ROM shadowing should be enabled. */
665#define PGMPHYS_ROM_FLAGS_SHADOWED RT_BIT_32(0)
666/** Indicates that what pvBinary points to won't go away
667 * and can be used for strictness checks. */
668#define PGMPHYS_ROM_FLAGS_PERMANENT_BINARY RT_BIT_32(1)
669/** @} */
670
671VMMR3DECL(int) PGMR3PhysRomRegister(PVM pVM, PPDMDEVINS pDevIns, RTGCPHYS GCPhys, RTGCPHYS cb,
672 const void *pvBinary, uint32_t cbBinary, uint32_t fFlags, const char *pszDesc);
673VMMR3DECL(int) PGMR3PhysRomProtect(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cb, PGMROMPROT enmProt);
674VMMR3DECL(int) PGMR3PhysRegister(PVM pVM, void *pvRam, RTGCPHYS GCPhys, size_t cb, unsigned fFlags, const SUPPAGE *paPages, const char *pszDesc);
675VMMDECL(void) PGMR3PhysSetA20(PVMCPU pVCpu, bool fEnable);
676/** @name PGMR3MapPT flags.
677 * @{ */
678/** The mapping may be unmapped later. The default is permanent mappings. */
679#define PGMR3MAPPT_FLAGS_UNMAPPABLE RT_BIT(0)
680/** @} */
681VMMR3DECL(int) PGMR3MapPT(PVM pVM, RTGCPTR GCPtr, uint32_t cb, uint32_t fFlags, PFNPGMRELOCATE pfnRelocate, void *pvUser, const char *pszDesc);
682VMMR3DECL(int) PGMR3UnmapPT(PVM pVM, RTGCPTR GCPtr);
683VMMR3DECL(int) PGMR3FinalizeMappings(PVM pVM);
684VMMR3DECL(int) PGMR3MappingsSize(PVM pVM, uint32_t *pcb);
685VMMR3DECL(int) PGMR3MappingsFix(PVM pVM, RTGCPTR GCPtrBase, uint32_t cb);
686VMMR3DECL(int) PGMR3MappingsUnfix(PVM pVM);
687VMMR3DECL(bool) PGMR3MappingsNeedReFixing(PVM pVM);
688#if defined(VBOX_WITH_RAW_MODE) || (HC_ARCH_BITS != 64 && !defined(VBOX_WITH_HYBRID_32BIT_KERNEL))
689VMMR3DECL(int) PGMR3MapIntermediate(PVM pVM, RTUINTPTR Addr, RTHCPHYS HCPhys, unsigned cbPages);
690#endif
691VMMR3DECL(int) PGMR3MapRead(PVM pVM, void *pvDst, RTGCPTR GCPtrSrc, size_t cb);
692
693VMMR3_INT_DECL(int) PGMR3HandlerPhysicalTypeRegisterEx(PVM pVM, PGMPHYSHANDLERKIND enmKind,
694 PFNPGMPHYSHANDLER pfnHandlerR3,
695 R0PTRTYPE(PFNPGMPHYSHANDLER) pfnHandlerR0,
696 R0PTRTYPE(PFNPGMRZPHYSPFHANDLER) pfnPfHandlerR0,
697 RCPTRTYPE(PFNPGMPHYSHANDLER) pfnHandlerRC,
698 RCPTRTYPE(PFNPGMRZPHYSPFHANDLER) pfnPfHandlerRC,
699 const char *pszDesc, PPGMPHYSHANDLERTYPE phType);
700VMMR3DECL(int) PGMR3HandlerPhysicalTypeRegister(PVM pVM, PGMPHYSHANDLERKIND enmKind,
701 R3PTRTYPE(PFNPGMPHYSHANDLER) pfnHandlerR3,
702 const char *pszModR0, const char *pszHandlerR0, const char *pszPfHandlerR0,
703 const char *pszModRC, const char *pszHandlerRC, const char *pszPfHandlerRC,
704 const char *pszDesc,
705 PPGMPHYSHANDLERTYPE phType);
706#ifdef VBOX_WITH_RAW_MODE
707VMMR3_INT_DECL(int) PGMR3HandlerVirtualTypeRegisterEx(PVM pVM, PGMVIRTHANDLERKIND enmKind, bool fRelocUserRC,
708 PFNPGMR3VIRTINVALIDATE pfnInvalidateR3,
709 PFNPGMVIRTHANDLER pfnHandlerR3,
710 RCPTRTYPE(FNPGMVIRTHANDLER) pfnHandlerRC,
711 RCPTRTYPE(FNPGMRCVIRTPFHANDLER) pfnPfHandlerRC,
712 const char *pszDesc, PPGMVIRTHANDLERTYPE phType);
713VMMR3_INT_DECL(int) PGMR3HandlerVirtualTypeRegister(PVM pVM, PGMVIRTHANDLERKIND enmKind, bool fRelocUserRC,
714 PFNPGMR3VIRTINVALIDATE pfnInvalidateR3,
715 PFNPGMVIRTHANDLER pfnHandlerR3,
716 const char *pszHandlerRC, const char *pszPfHandlerRC, const char *pszDesc,
717 PPGMVIRTHANDLERTYPE phType);
718VMMR3_INT_DECL(int) PGMR3HandlerVirtualRegister(PVM pVM, PVMCPU pVCpu, PGMVIRTHANDLERTYPE hType, RTGCPTR GCPtr,
719 RTGCPTR GCPtrLast, void *pvUserR3, RTRCPTR pvUserRC, const char *pszDesc);
720VMMR3_INT_DECL(int) PGMHandlerVirtualChangeType(PVM pVM, RTGCPTR GCPtr, PGMVIRTHANDLERTYPE hNewType);
721VMMR3_INT_DECL(int) PGMHandlerVirtualDeregister(PVM pVM, PVMCPU pVCpu, RTGCPTR GCPtr, bool fHypervisor);
722#endif
723VMMR3DECL(int) PGMR3PoolGrow(PVM pVM);
724
725VMMR3DECL(int) PGMR3PhysTlbGCPhys2Ptr(PVM pVM, RTGCPHYS GCPhys, bool fWritable, void **ppv);
726VMMR3DECL(uint8_t) PGMR3PhysReadU8(PVM pVM, RTGCPHYS GCPhys, PGMACCESSORIGIN enmOrigin);
727VMMR3DECL(uint16_t) PGMR3PhysReadU16(PVM pVM, RTGCPHYS GCPhys, PGMACCESSORIGIN enmOrigin);
728VMMR3DECL(uint32_t) PGMR3PhysReadU32(PVM pVM, RTGCPHYS GCPhys, PGMACCESSORIGIN enmOrigin);
729VMMR3DECL(uint64_t) PGMR3PhysReadU64(PVM pVM, RTGCPHYS GCPhys, PGMACCESSORIGIN enmOrigin);
730VMMR3DECL(void) PGMR3PhysWriteU8(PVM pVM, RTGCPHYS GCPhys, uint8_t Value, PGMACCESSORIGIN enmOrigin);
731VMMR3DECL(void) PGMR3PhysWriteU16(PVM pVM, RTGCPHYS GCPhys, uint16_t Value, PGMACCESSORIGIN enmOrigin);
732VMMR3DECL(void) PGMR3PhysWriteU32(PVM pVM, RTGCPHYS GCPhys, uint32_t Value, PGMACCESSORIGIN enmOrigin);
733VMMR3DECL(void) PGMR3PhysWriteU64(PVM pVM, RTGCPHYS GCPhys, uint64_t Value, PGMACCESSORIGIN enmOrigin);
734VMMR3DECL(int) PGMR3PhysReadExternal(PVM pVM, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead, PGMACCESSORIGIN enmOrigin);
735VMMR3DECL(int) PGMR3PhysWriteExternal(PVM pVM, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite, PGMACCESSORIGIN enmOrigin);
736VMMR3DECL(int) PGMR3PhysGCPhys2CCPtrExternal(PVM pVM, RTGCPHYS GCPhys, void **ppv, PPGMPAGEMAPLOCK pLock);
737VMMR3DECL(int) PGMR3PhysGCPhys2CCPtrReadOnlyExternal(PVM pVM, RTGCPHYS GCPhys, void const **ppv, PPGMPAGEMAPLOCK pLock);
738VMMR3DECL(int) PGMR3PhysChunkMap(PVM pVM, uint32_t idChunk);
739VMMR3DECL(void) PGMR3PhysChunkInvalidateTLB(PVM pVM);
740VMMR3DECL(int) PGMR3PhysAllocateHandyPages(PVM pVM);
741VMMR3DECL(int) PGMR3PhysAllocateLargeHandyPage(PVM pVM, RTGCPHYS GCPhys);
742
743VMMR3DECL(int) PGMR3CheckIntegrity(PVM pVM);
744
745VMMR3DECL(int) PGMR3DbgR3Ptr2GCPhys(PUVM pUVM, RTR3PTR R3Ptr, PRTGCPHYS pGCPhys);
746VMMR3DECL(int) PGMR3DbgR3Ptr2HCPhys(PUVM pUVM, RTR3PTR R3Ptr, PRTHCPHYS pHCPhys);
747VMMR3DECL(int) PGMR3DbgHCPhys2GCPhys(PUVM pUVM, RTHCPHYS HCPhys, PRTGCPHYS pGCPhys);
748VMMR3_INT_DECL(int) PGMR3DbgReadGCPhys(PVM pVM, void *pvDst, RTGCPHYS GCPhysSrc, size_t cb, uint32_t fFlags, size_t *pcbRead);
749VMMR3_INT_DECL(int) PGMR3DbgWriteGCPhys(PVM pVM, RTGCPHYS GCPhysDst, const void *pvSrc, size_t cb, uint32_t fFlags, size_t *pcbWritten);
750VMMR3_INT_DECL(int) PGMR3DbgReadGCPtr(PVM pVM, void *pvDst, RTGCPTR GCPtrSrc, size_t cb, uint32_t fFlags, size_t *pcbRead);
751VMMR3_INT_DECL(int) PGMR3DbgWriteGCPtr(PVM pVM, RTGCPTR GCPtrDst, void const *pvSrc, size_t cb, uint32_t fFlags, size_t *pcbWritten);
752VMMR3_INT_DECL(int) PGMR3DbgScanPhysical(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cbRange, RTGCPHYS GCPhysAlign, const uint8_t *pabNeedle, size_t cbNeedle, PRTGCPHYS pGCPhysHit);
753VMMR3_INT_DECL(int) PGMR3DbgScanVirtual(PVM pVM, PVMCPU pVCpu, RTGCPTR GCPtr, RTGCPTR cbRange, RTGCPTR GCPtrAlign, const uint8_t *pabNeedle, size_t cbNeedle, PRTGCUINTPTR pGCPhysHit);
754VMMR3_INT_DECL(int) PGMR3DumpHierarchyShw(PVM pVM, uint64_t cr3, uint32_t fFlags, uint64_t u64FirstAddr, uint64_t u64LastAddr, uint32_t cMaxDepth, PCDBGFINFOHLP pHlp);
755VMMR3_INT_DECL(int) PGMR3DumpHierarchyGst(PVM pVM, uint64_t cr3, uint32_t fFlags, RTGCPTR FirstAddr, RTGCPTR LastAddr, uint32_t cMaxDepth, PCDBGFINFOHLP pHlp);
756
757
758/** @name Page sharing
759 * @{ */
760VMMR3DECL(int) PGMR3SharedModuleRegister(PVM pVM, VBOXOSFAMILY enmGuestOS, char *pszModuleName, char *pszVersion,
761 RTGCPTR GCBaseAddr, uint32_t cbModule,
762 uint32_t cRegions, VMMDEVSHAREDREGIONDESC const *paRegions);
763VMMR3DECL(int) PGMR3SharedModuleUnregister(PVM pVM, char *pszModuleName, char *pszVersion,
764 RTGCPTR GCBaseAddr, uint32_t cbModule);
765VMMR3DECL(int) PGMR3SharedModuleCheckAll(PVM pVM);
766VMMR3DECL(int) PGMR3SharedModuleGetPageState(PVM pVM, RTGCPTR GCPtrPage, bool *pfShared, uint64_t *pfPageFlags);
767/** @} */
768
769/** @} */
770#endif /* IN_RING3 */
771
772RT_C_DECLS_END
773
774/** @} */
775#endif
776
Note: See TracBrowser for help on using the repository browser.

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