[1] | 1 | /** @file
|
---|
| 2 | * MM - The Memory Manager.
|
---|
| 3 | */
|
---|
| 4 |
|
---|
| 5 | /*
|
---|
[8155] | 6 | * Copyright (C) 2006-2007 Sun Microsystems, Inc.
|
---|
[1] | 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
|
---|
[5999] | 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.
|
---|
[8155] | 24 | *
|
---|
| 25 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
| 26 | * Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
| 27 | * additional information or have any questions.
|
---|
[1] | 28 | */
|
---|
| 29 |
|
---|
[3632] | 30 | #ifndef ___VBox_mm_h
|
---|
| 31 | #define ___VBox_mm_h
|
---|
[1] | 32 |
|
---|
| 33 | #include <VBox/cdefs.h>
|
---|
| 34 | #include <VBox/types.h>
|
---|
| 35 | #include <VBox/x86.h>
|
---|
[1480] | 36 | #include <VBox/sup.h>
|
---|
[1] | 37 |
|
---|
| 38 |
|
---|
| 39 | __BEGIN_DECLS
|
---|
| 40 |
|
---|
| 41 | /** @defgroup grp_mm The Memory Manager API
|
---|
| 42 | * @{
|
---|
| 43 | */
|
---|
| 44 |
|
---|
| 45 | /** @name RAM Page Flags
|
---|
| 46 | * Since internal ranges have a byte granularity it's possible for a
|
---|
| 47 | * page be flagged for several uses. The access virtualization in PGM
|
---|
| 48 | * will choose the most restricted one and use EM to emulate access to
|
---|
| 49 | * the less restricted areas of the page.
|
---|
| 50 | *
|
---|
| 51 | * Bits 0-11 only since they are fitted into the offset part of a physical memory address.
|
---|
| 52 | * @{
|
---|
| 53 | */
|
---|
[7354] | 54 | #if 1
|
---|
[4388] | 55 | /** Reserved - Not RAM, ROM nor MMIO2.
|
---|
[1] | 56 | * If this bit is cleared the memory is assumed to be some kind of RAM.
|
---|
[4388] | 57 | * Normal MMIO may set it but that depends on whether the RAM range was
|
---|
| 58 | * created specially for the MMIO or not.
|
---|
[5525] | 59 | *
|
---|
| 60 | * @remarks The current implementation will always reserve backing
|
---|
[4388] | 61 | * memory for reserved ranges to simplify things.
|
---|
[1] | 62 | */
|
---|
[5605] | 63 | #define MM_RAM_FLAGS_RESERVED RT_BIT(0)
|
---|
[1] | 64 | /** ROM - Read Only Memory.
|
---|
| 65 | * The page have a HC physical address which contains the BIOS code. All write
|
---|
| 66 | * access is trapped and ignored.
|
---|
[5525] | 67 | *
|
---|
| 68 | * HACK: Writable shadow ROM is indicated by both ROM and MMIO2 being
|
---|
[4388] | 69 | * set. (We're out of bits.)
|
---|
[1] | 70 | */
|
---|
[5605] | 71 | #define MM_RAM_FLAGS_ROM RT_BIT(1)
|
---|
[1] | 72 | /** MMIO - Memory Mapped I/O.
|
---|
| 73 | * All access is trapped and emulated. No physical backing is required, but
|
---|
| 74 | * might for various reasons be present.
|
---|
| 75 | */
|
---|
[5605] | 76 | #define MM_RAM_FLAGS_MMIO RT_BIT(2)
|
---|
[1] | 77 | /** MMIO2 - Memory Mapped I/O, variation 2.
|
---|
| 78 | * The virtualization is performed using real memory and only catching
|
---|
| 79 | * a few accesses for like keeping track for dirty pages.
|
---|
[4388] | 80 | * @remark Involved in the shadow ROM hack.
|
---|
[1] | 81 | */
|
---|
[5605] | 82 | #define MM_RAM_FLAGS_MMIO2 RT_BIT(3)
|
---|
[7354] | 83 | #endif
|
---|
[1] | 84 |
|
---|
[6528] | 85 | #ifndef VBOX_WITH_NEW_PHYS_CODE
|
---|
[1] | 86 | /** Physical backing memory is allocated dynamically. Not set implies a one time static allocation. */
|
---|
[5605] | 87 | #define MM_RAM_FLAGS_DYNAMIC_ALLOC RT_BIT(11)
|
---|
[6528] | 88 | #endif /* !VBOX_WITH_NEW_PHYS_CODE */
|
---|
[1] | 89 |
|
---|
| 90 | /** The shift used to get the reference count. */
|
---|
| 91 | #define MM_RAM_FLAGS_CREFS_SHIFT 62
|
---|
| 92 | /** The mask applied to the the page pool idx after using MM_RAM_FLAGS_CREFS_SHIFT to shift it down. */
|
---|
| 93 | #define MM_RAM_FLAGS_CREFS_MASK 0x3
|
---|
| 94 | /** The (shifted) cRef value used to indiciate that the idx is the head of a
|
---|
| 95 | * physical cross reference extent list. */
|
---|
| 96 | #define MM_RAM_FLAGS_CREFS_PHYSEXT MM_RAM_FLAGS_CREFS_MASK
|
---|
| 97 | /** The shift used to get the page pool idx. (Apply MM_RAM_FLAGS_IDX_MASK to the result when shifting down). */
|
---|
| 98 | #define MM_RAM_FLAGS_IDX_SHIFT 48
|
---|
| 99 | /** The mask applied to the the page pool idx after using MM_RAM_FLAGS_IDX_SHIFT to shift it down. */
|
---|
| 100 | #define MM_RAM_FLAGS_IDX_MASK 0x3fff
|
---|
| 101 | /** The idx value when we're out of of extents or there are simply too many mappings of this page. */
|
---|
| 102 | #define MM_RAM_FLAGS_IDX_OVERFLOWED MM_RAM_FLAGS_IDX_MASK
|
---|
| 103 |
|
---|
| 104 | /** Mask for masking off any references to the page. */
|
---|
| 105 | #define MM_RAM_FLAGS_NO_REFS_MASK UINT64_C(0x0000ffffffffffff)
|
---|
| 106 | /** @} */
|
---|
| 107 |
|
---|
[6546] | 108 | #ifndef VBOX_WITH_NEW_PHYS_CODE
|
---|
[1] | 109 | /** @name MMR3PhysRegisterEx registration type
|
---|
| 110 | * @{
|
---|
| 111 | */
|
---|
[5525] | 112 | typedef enum
|
---|
[1] | 113 | {
|
---|
| 114 | /** Normal physical region (flags specify exact page type) */
|
---|
| 115 | MM_PHYS_TYPE_NORMAL = 0,
|
---|
| 116 | /** Allocate part of a dynamically allocated physical region */
|
---|
| 117 | MM_PHYS_TYPE_DYNALLOC_CHUNK,
|
---|
| 118 |
|
---|
| 119 | MM_PHYS_TYPE_32BIT_HACK = 0x7fffffff
|
---|
| 120 | } MMPHYSREG;
|
---|
| 121 | /** @} */
|
---|
[6546] | 122 | #endif
|
---|
[1] | 123 |
|
---|
| 124 | /**
|
---|
| 125 | * Memory Allocation Tags.
|
---|
| 126 | * For use with MMHyperAlloc(), MMR3HeapAlloc(), MMR3HeapAllocEx(),
|
---|
| 127 | * MMR3HeapAllocZ() and MMR3HeapAllocZEx().
|
---|
| 128 | *
|
---|
| 129 | * @remark Don't forget to update the dump command in MMHeap.cpp!
|
---|
| 130 | */
|
---|
| 131 | typedef enum MMTAG
|
---|
| 132 | {
|
---|
| 133 | MM_TAG_INVALID = 0,
|
---|
| 134 |
|
---|
| 135 | MM_TAG_CFGM,
|
---|
| 136 | MM_TAG_CFGM_BYTES,
|
---|
| 137 | MM_TAG_CFGM_STRING,
|
---|
| 138 | MM_TAG_CFGM_USER,
|
---|
| 139 |
|
---|
| 140 | MM_TAG_CSAM,
|
---|
| 141 | MM_TAG_CSAM_PATCH,
|
---|
| 142 |
|
---|
| 143 | MM_TAG_DBGF,
|
---|
| 144 | MM_TAG_DBGF_INFO,
|
---|
| 145 | MM_TAG_DBGF_LINE,
|
---|
| 146 | MM_TAG_DBGF_LINE_DUP,
|
---|
| 147 | MM_TAG_DBGF_STACK,
|
---|
| 148 | MM_TAG_DBGF_SYMBOL,
|
---|
| 149 | MM_TAG_DBGF_SYMBOL_DUP,
|
---|
| 150 | MM_TAG_DBGF_MODULE,
|
---|
| 151 |
|
---|
| 152 | MM_TAG_EM,
|
---|
| 153 |
|
---|
| 154 | MM_TAG_IOM,
|
---|
| 155 | MM_TAG_IOM_STATS,
|
---|
| 156 |
|
---|
| 157 | MM_TAG_MM,
|
---|
| 158 | MM_TAG_MM_LOOKUP_GUEST,
|
---|
| 159 | MM_TAG_MM_LOOKUP_PHYS,
|
---|
| 160 | MM_TAG_MM_LOOKUP_VIRT,
|
---|
| 161 | MM_TAG_MM_PAGE,
|
---|
| 162 |
|
---|
| 163 | MM_TAG_PATM,
|
---|
| 164 | MM_TAG_PATM_PATCH,
|
---|
| 165 |
|
---|
| 166 | MM_TAG_PDM,
|
---|
[5811] | 167 | MM_TAG_PDM_ASYNC_COMPLETION,
|
---|
[1] | 168 | MM_TAG_PDM_DEVICE,
|
---|
| 169 | MM_TAG_PDM_DEVICE_USER,
|
---|
| 170 | MM_TAG_PDM_DRIVER,
|
---|
| 171 | MM_TAG_PDM_DRIVER_USER,
|
---|
[5525] | 172 | MM_TAG_PDM_USB,
|
---|
| 173 | MM_TAG_PDM_USB_USER,
|
---|
[1] | 174 | MM_TAG_PDM_LUN,
|
---|
| 175 | MM_TAG_PDM_QUEUE,
|
---|
[3519] | 176 | MM_TAG_PDM_THREAD,
|
---|
[1] | 177 |
|
---|
| 178 | MM_TAG_PGM,
|
---|
[4688] | 179 | MM_TAG_PGM_CHUNK_MAPPING,
|
---|
[1] | 180 | MM_TAG_PGM_HANDLERS,
|
---|
[6818] | 181 | MM_TAG_PGM_PHYS,
|
---|
[1] | 182 | MM_TAG_PGM_POOL,
|
---|
| 183 |
|
---|
| 184 | MM_TAG_REM,
|
---|
| 185 |
|
---|
| 186 | MM_TAG_SELM,
|
---|
| 187 |
|
---|
| 188 | MM_TAG_SSM,
|
---|
| 189 |
|
---|
| 190 | MM_TAG_STAM,
|
---|
| 191 |
|
---|
| 192 | MM_TAG_TM,
|
---|
| 193 |
|
---|
| 194 | MM_TAG_TRPM,
|
---|
| 195 |
|
---|
| 196 | MM_TAG_VM,
|
---|
| 197 | MM_TAG_VM_REQ,
|
---|
| 198 |
|
---|
| 199 | MM_TAG_VMM,
|
---|
| 200 |
|
---|
| 201 | MM_TAG_HWACCM,
|
---|
| 202 |
|
---|
| 203 | MM_TAG_32BIT_HACK = 0x7fffffff
|
---|
| 204 | } MMTAG;
|
---|
| 205 |
|
---|
| 206 |
|
---|
| 207 |
|
---|
| 208 |
|
---|
| 209 | /** @defgroup grp_mm_hyper Hypervisor Memory Management
|
---|
| 210 | * @ingroup grp_mm
|
---|
| 211 | * @{ */
|
---|
| 212 |
|
---|
[6626] | 213 | MMDECL(RTR3PTR) MMHyperR0ToR3(PVM pVM, RTR0PTR R0Ptr);
|
---|
| 214 | MMDECL(RTGCPTR) MMHyperR0ToGC(PVM pVM, RTR0PTR R0Ptr);
|
---|
[1] | 215 | #ifndef IN_RING0
|
---|
[6626] | 216 | MMDECL(void *) MMHyperR0ToCC(PVM pVM, RTR0PTR R0Ptr);
|
---|
[1] | 217 | #endif
|
---|
[6626] | 218 | MMDECL(RTR0PTR) MMHyperR3ToR0(PVM pVM, RTR3PTR R3Ptr);
|
---|
| 219 | MMDECL(RTGCPTR) MMHyperR3ToGC(PVM pVM, RTR3PTR R3Ptr);
|
---|
| 220 | MMDECL(RTR3PTR) MMHyperGCToR3(PVM pVM, RTGCPTR GCPtr);
|
---|
| 221 | MMDECL(RTR0PTR) MMHyperGCToR0(PVM pVM, RTGCPTR GCPtr);
|
---|
[1] | 222 |
|
---|
| 223 | #ifndef IN_RING3
|
---|
[6626] | 224 | MMDECL(void *) MMHyperR3ToCC(PVM pVM, RTR3PTR R3Ptr);
|
---|
[1] | 225 | #else
|
---|
[6626] | 226 | DECLINLINE(void *) MMHyperR3ToCC(PVM pVM, RTR3PTR R3Ptr)
|
---|
[1] | 227 | {
|
---|
| 228 | NOREF(pVM);
|
---|
| 229 | return R3Ptr;
|
---|
| 230 | }
|
---|
| 231 | #endif
|
---|
| 232 |
|
---|
| 233 |
|
---|
| 234 | #ifndef IN_GC
|
---|
[6626] | 235 | MMDECL(void *) MMHyperGCToCC(PVM pVM, RTGCPTR GCPtr);
|
---|
[1] | 236 | #else
|
---|
[6626] | 237 | DECLINLINE(void *) MMHyperGCToCC(PVM pVM, RTGCPTR GCPtr)
|
---|
[1] | 238 | {
|
---|
| 239 | NOREF(pVM);
|
---|
| 240 | return GCPtr;
|
---|
| 241 | }
|
---|
| 242 | #endif
|
---|
| 243 |
|
---|
| 244 | #ifndef IN_RING3
|
---|
[6626] | 245 | MMDECL(RTR3PTR) MMHyperCCToR3(PVM pVM, void *pv);
|
---|
[1] | 246 | #else
|
---|
| 247 | DECLINLINE(RTR3PTR) MMHyperCCToR3(PVM pVM, void *pv)
|
---|
| 248 | {
|
---|
| 249 | NOREF(pVM);
|
---|
| 250 | return pv;
|
---|
| 251 | }
|
---|
| 252 | #endif
|
---|
| 253 |
|
---|
| 254 | #ifndef IN_RING0
|
---|
[6626] | 255 | MMDECL(RTR0PTR) MMHyperCCToR0(PVM pVM, void *pv);
|
---|
[1] | 256 | #else
|
---|
| 257 | DECLINLINE(RTR0PTR) MMHyperCCToR0(PVM pVM, void *pv)
|
---|
| 258 | {
|
---|
| 259 | NOREF(pVM);
|
---|
| 260 | return pv;
|
---|
| 261 | }
|
---|
| 262 | #endif
|
---|
| 263 |
|
---|
| 264 | #ifndef IN_GC
|
---|
[6626] | 265 | MMDECL(RTGCPTR) MMHyperCCToGC(PVM pVM, void *pv);
|
---|
[1] | 266 | #else
|
---|
| 267 | DECLINLINE(RTGCPTR) MMHyperCCToGC(PVM pVM, void *pv)
|
---|
| 268 | {
|
---|
| 269 | NOREF(pVM);
|
---|
| 270 | return pv;
|
---|
| 271 | }
|
---|
| 272 | #endif
|
---|
| 273 |
|
---|
| 274 |
|
---|
| 275 | #ifdef IN_GC
|
---|
[6626] | 276 | MMDECL(RTHCPTR) MMHyper2HC(PVM pVM, uintptr_t Ptr);
|
---|
[1] | 277 | #else
|
---|
| 278 | DECLINLINE(RTHCPTR) MMHyper2HC(PVM pVM, uintptr_t Ptr)
|
---|
| 279 | {
|
---|
| 280 | NOREF(pVM);
|
---|
| 281 | return (RTHCPTR)Ptr;
|
---|
| 282 | }
|
---|
| 283 | #endif
|
---|
| 284 |
|
---|
| 285 | #ifndef IN_GC
|
---|
[6626] | 286 | MMDECL(RTGCPTR) MMHyper2GC(PVM pVM, uintptr_t Ptr);
|
---|
[1] | 287 | #else
|
---|
| 288 | DECLINLINE(RTGCPTR) MMHyper2GC(PVM pVM, uintptr_t Ptr)
|
---|
| 289 | {
|
---|
| 290 | NOREF(pVM);
|
---|
| 291 | return (RTGCPTR)Ptr;
|
---|
| 292 | }
|
---|
| 293 | #endif
|
---|
| 294 |
|
---|
[6626] | 295 | MMDECL(RTGCPTR) MMHyperHC2GC(PVM pVM, RTHCPTR HCPtr);
|
---|
| 296 | MMDECL(RTHCPTR) MMHyperGC2HC(PVM pVM, RTGCPTR GCPtr);
|
---|
| 297 | MMDECL(int) MMHyperAlloc(PVM pVM, size_t cb, uint32_t uAlignment, MMTAG enmTag, void **ppv);
|
---|
| 298 | MMDECL(int) MMHyperFree(PVM pVM, void *pv);
|
---|
[7635] | 299 | MMDECL(void) MMHyperHeapCheck(PVM pVM);
|
---|
[1] | 300 | #ifdef DEBUG
|
---|
[6626] | 301 | MMDECL(void) MMHyperHeapDump(PVM pVM);
|
---|
[1] | 302 | #endif
|
---|
[6626] | 303 | MMDECL(size_t) MMHyperHeapGetFreeSize(PVM pVM);
|
---|
| 304 | MMDECL(size_t) MMHyperHeapGetSize(PVM pVM);
|
---|
| 305 | MMDECL(RTGCPTR) MMHyperGetArea(PVM pVM, size_t *pcb);
|
---|
| 306 | MMDECL(bool) MMHyperIsInsideArea(PVM pVM, RTGCPTR GCPtr);
|
---|
[1] | 307 |
|
---|
| 308 |
|
---|
[6626] | 309 | MMDECL(RTHCPHYS) MMPage2Phys(PVM pVM, void *pvPage);
|
---|
| 310 | MMDECL(void *) MMPagePhys2Page(PVM pVM, RTHCPHYS HCPhysPage);
|
---|
| 311 | MMDECL(int) MMPagePhys2PageEx(PVM pVM, RTHCPHYS HCPhysPage, void **ppvPage);
|
---|
| 312 | MMDECL(int) MMPagePhys2PageTry(PVM pVM, RTHCPHYS HCPhysPage, void **ppvPage);
|
---|
| 313 | MMDECL(void *) MMPhysGCPhys2HCVirt(PVM pVM, RTGCPHYS GCPhys, RTUINT cbRange);
|
---|
[1] | 314 |
|
---|
| 315 |
|
---|
| 316 | /** @def MMHYPER_GC_ASSERT_GCPTR
|
---|
| 317 | * Asserts that an address is either NULL or inside the hypervisor memory area.
|
---|
| 318 | * This assertion only works while IN_GC, it's a NOP everywhere else.
|
---|
| 319 | * @thread The Emulation Thread.
|
---|
| 320 | */
|
---|
| 321 | #ifdef IN_GC
|
---|
| 322 | # define MMHYPER_GC_ASSERT_GCPTR(pVM, GCPtr) Assert(MMHyperIsInsideArea((pVM), (GCPtr)) || !(GCPtr))
|
---|
| 323 | #else
|
---|
| 324 | # define MMHYPER_GC_ASSERT_GCPTR(pVM, GCPtr) do { } while (0)
|
---|
| 325 | #endif
|
---|
| 326 |
|
---|
| 327 | /** @} */
|
---|
| 328 |
|
---|
| 329 |
|
---|
| 330 | #ifdef IN_RING3
|
---|
| 331 | /** @defgroup grp_mm_r3 The MM Host Context Ring-3 API
|
---|
| 332 | * @ingroup grp_mm
|
---|
| 333 | * @{
|
---|
| 334 | */
|
---|
| 335 |
|
---|
[6796] | 336 | MMR3DECL(int) MMR3InitUVM(PUVM pUVM);
|
---|
[6626] | 337 | MMR3DECL(int) MMR3Init(PVM pVM);
|
---|
| 338 | MMR3DECL(int) MMR3InitPaging(PVM pVM);
|
---|
| 339 | MMR3DECL(int) MMR3HyperInitFinalize(PVM pVM);
|
---|
| 340 | MMR3DECL(int) MMR3Term(PVM pVM);
|
---|
[6796] | 341 | MMR3DECL(void) MMR3TermUVM(PUVM pUVM);
|
---|
[6626] | 342 | MMR3DECL(void) MMR3Reset(PVM pVM);
|
---|
| 343 | MMR3DECL(int) MMR3IncreaseBaseReservation(PVM pVM, uint64_t cAddBasePages);
|
---|
[7635] | 344 | MMR3DECL(int) MMR3AdjustFixedReservation(PVM pVM, int32_t cDeltaFixedPages, const char *pszDesc);
|
---|
[6626] | 345 | MMR3DECL(int) MMR3UpdateShadowReservation(PVM pVM, uint32_t cShadowPages);
|
---|
[1] | 346 |
|
---|
[6626] | 347 | MMR3DECL(int) MMR3HCPhys2HCVirt(PVM pVM, RTHCPHYS HCPhys, void **ppv);
|
---|
| 348 | MMR3DECL(int) MMR3ReadGCVirt(PVM pVM, void *pvDst, RTGCPTR GCPtr, size_t cb);
|
---|
| 349 | MMR3DECL(int) MMR3WriteGCVirt(PVM pVM, RTGCPTR GCPtrDst, const void *pvSrc, size_t cb);
|
---|
[1] | 350 |
|
---|
| 351 |
|
---|
| 352 | /** @defgroup grp_mm_r3_hyper Hypervisor Memory Manager (HC R3 Portion)
|
---|
| 353 | * @ingroup grp_mm_r3
|
---|
| 354 | * @{ */
|
---|
[6626] | 355 | MMDECL(int) MMR3HyperAllocOnceNoRel(PVM pVM, size_t cb, uint32_t uAlignment, MMTAG enmTag, void **ppv);
|
---|
| 356 | MMR3DECL(int) MMR3HyperMapHCPhys(PVM pVM, void *pvHC, RTHCPHYS HCPhys, size_t cb, const char *pszDesc, PRTGCPTR pGCPtr);
|
---|
| 357 | MMR3DECL(int) MMR3HyperMapGCPhys(PVM pVM, RTGCPHYS GCPhys, size_t cb, const char *pszDesc, PRTGCPTR pGCPtr);
|
---|
[7635] | 358 | MMR3DECL(int) MMR3HyperMapMMIO2(PVM pVM, PPDMDEVINS pDevIns, uint32_t iRegion, RTGCPHYS off, RTGCPHYS cb, const char *pszDesc, PRTGCPTR pGCPtr);
|
---|
[6626] | 359 | MMR3DECL(int) MMR3HyperMapHCRam(PVM pVM, void *pvHC, size_t cb, bool fFree, const char *pszDesc, PRTGCPTR pGCPtr);
|
---|
| 360 | MMR3DECL(int) MMR3HyperMapPages(PVM pVM, void *pvR3, RTR0PTR pvR0, size_t cPages, PCSUPPAGE paPages, const char *pszDesc, PRTGCPTR pGCPtr);
|
---|
| 361 | MMR3DECL(int) MMR3HyperReserve(PVM pVM, unsigned cb, const char *pszDesc, PRTGCPTR pGCPtr);
|
---|
| 362 | MMR3DECL(RTHCPHYS) MMR3HyperHCVirt2HCPhys(PVM pVM, void *pvHC);
|
---|
| 363 | MMR3DECL(int) MMR3HyperHCVirt2HCPhysEx(PVM pVM, void *pvHC, PRTHCPHYS pHCPhys);
|
---|
| 364 | MMR3DECL(void *) MMR3HyperHCPhys2HCVirt(PVM pVM, RTHCPHYS HCPhys);
|
---|
| 365 | MMR3DECL(int) MMR3HyperHCPhys2HCVirtEx(PVM pVM, RTHCPHYS HCPhys, void **ppv);
|
---|
| 366 | MMR3DECL(int) MMR3HyperReadGCVirt(PVM pVM, void *pvDst, RTGCPTR GCPtr, size_t cb);
|
---|
[1] | 367 | /** @} */
|
---|
| 368 |
|
---|
| 369 |
|
---|
| 370 | /** @defgroup grp_mm_phys Guest Physical Memory Manager
|
---|
| 371 | * @ingroup grp_mm_r3
|
---|
| 372 | * @{ */
|
---|
[6626] | 373 | MMR3DECL(int) MMR3PhysRegister(PVM pVM, void *pvRam, RTGCPHYS GCPhys, unsigned cb, unsigned fFlags, const char *pszDesc);
|
---|
[6546] | 374 | #ifndef VBOX_WITH_NEW_PHYS_CODE
|
---|
[6626] | 375 | MMR3DECL(int) MMR3PhysRegisterEx(PVM pVM, void *pvRam, RTGCPHYS GCPhys, unsigned cb, unsigned fFlags, MMPHYSREG enmType, const char *pszDesc);
|
---|
| 376 | #endif
|
---|
| 377 | MMR3DECL(int) MMR3PhysRomRegister(PVM pVM, PPDMDEVINS pDevIns, RTGCPHYS GCPhys, RTUINT cbRange, const void *pvBinary, bool fShadow, const char *pszDesc);
|
---|
| 378 | MMR3DECL(int) MMR3PhysRomProtect(PVM pVM, RTGCPHYS GCPhys, RTUINT cbRange);
|
---|
| 379 | MMR3DECL(int) MMR3PhysReserve(PVM pVM, RTGCPHYS GCPhys, RTUINT cbRange, const char *pszDesc);
|
---|
| 380 | MMR3DECL(uint64_t) MMR3PhysGetRamSize(PVM pVM);
|
---|
[1] | 381 | /** @} */
|
---|
| 382 |
|
---|
| 383 |
|
---|
| 384 | /** @defgroup grp_mm_page Physical Page Pool
|
---|
| 385 | * @ingroup grp_mm_r3
|
---|
| 386 | * @{ */
|
---|
[6626] | 387 | MMR3DECL(void *) MMR3PageAlloc(PVM pVM);
|
---|
| 388 | MMR3DECL(RTHCPHYS) MMR3PageAllocPhys(PVM pVM);
|
---|
| 389 | MMR3DECL(void) MMR3PageFree(PVM pVM, void *pvPage);
|
---|
| 390 | MMR3DECL(void *) MMR3PageAllocLow(PVM pVM);
|
---|
| 391 | MMR3DECL(void) MMR3PageFreeLow(PVM pVM, void *pvPage);
|
---|
| 392 | MMR3DECL(void) MMR3PageFreeByPhys(PVM pVM, RTHCPHYS HCPhysPage);
|
---|
| 393 | MMR3DECL(void *) MMR3PageDummyHCPtr(PVM pVM);
|
---|
| 394 | MMR3DECL(RTHCPHYS) MMR3PageDummyHCPhys(PVM pVM);
|
---|
[1] | 395 | /** @} */
|
---|
| 396 |
|
---|
| 397 |
|
---|
| 398 | /** @defgroup grp_mm_heap Heap Manager
|
---|
| 399 | * @ingroup grp_mm_r3
|
---|
| 400 | * @{ */
|
---|
[6626] | 401 | MMR3DECL(void *) MMR3HeapAlloc(PVM pVM, MMTAG enmTag, size_t cbSize);
|
---|
[6796] | 402 | MMR3DECL(void *) MMR3HeapAllocU(PUVM pUVM, MMTAG enmTag, size_t cbSize);
|
---|
[6626] | 403 | MMR3DECL(int) MMR3HeapAllocEx(PVM pVM, MMTAG enmTag, size_t cbSize, void **ppv);
|
---|
[6796] | 404 | MMR3DECL(int) MMR3HeapAllocExU(PUVM pUVM, MMTAG enmTag, size_t cbSize, void **ppv);
|
---|
[6626] | 405 | MMR3DECL(void *) MMR3HeapAllocZ(PVM pVM, MMTAG enmTag, size_t cbSize);
|
---|
[6796] | 406 | MMR3DECL(void *) MMR3HeapAllocZU(PUVM pUVM, MMTAG enmTag, size_t cbSize);
|
---|
[6626] | 407 | MMR3DECL(int) MMR3HeapAllocZEx(PVM pVM, MMTAG enmTag, size_t cbSize, void **ppv);
|
---|
[6796] | 408 | MMR3DECL(int) MMR3HeapAllocZExU(PUVM pUVM, MMTAG enmTag, size_t cbSize, void **ppv);
|
---|
[6626] | 409 | MMR3DECL(void *) MMR3HeapRealloc(void *pv, size_t cbNewSize);
|
---|
| 410 | MMR3DECL(char *) MMR3HeapStrDup(PVM pVM, MMTAG enmTag, const char *psz);
|
---|
[6796] | 411 | MMR3DECL(char *) MMR3HeapStrDupU(PUVM pUVM, MMTAG enmTag, const char *psz);
|
---|
[6626] | 412 | MMR3DECL(void) MMR3HeapFree(void *pv);
|
---|
[1] | 413 | /** @} */
|
---|
| 414 |
|
---|
| 415 | /** @} */
|
---|
[6626] | 416 | #endif /* IN_RING3 */
|
---|
[1] | 417 |
|
---|
| 418 |
|
---|
| 419 |
|
---|
| 420 | #ifdef IN_GC
|
---|
| 421 | /** @defgroup grp_mm_gc The MM Guest Context API
|
---|
| 422 | * @ingroup grp_mm
|
---|
| 423 | * @{
|
---|
| 424 | */
|
---|
| 425 |
|
---|
[6626] | 426 | MMGCDECL(void) MMGCRamRegisterTrapHandler(PVM pVM);
|
---|
| 427 | MMGCDECL(void) MMGCRamDeregisterTrapHandler(PVM pVM);
|
---|
| 428 | MMGCDECL(int) MMGCRamReadNoTrapHandler(void *pDst, void *pSrc, size_t cb);
|
---|
| 429 | MMGCDECL(int) MMGCRamWriteNoTrapHandler(void *pDst, void *pSrc, size_t cb);
|
---|
| 430 | MMGCDECL(int) MMGCRamRead(PVM pVM, void *pDst, void *pSrc, size_t cb);
|
---|
| 431 | MMGCDECL(int) MMGCRamWrite(PVM pVM, void *pDst, void *pSrc, size_t cb);
|
---|
[1] | 432 |
|
---|
| 433 | /** @} */
|
---|
[6626] | 434 | #endif /* IN_GC */
|
---|
[1] | 435 |
|
---|
| 436 | /** @} */
|
---|
| 437 | __END_DECLS
|
---|
| 438 |
|
---|
| 439 |
|
---|
| 440 | #endif
|
---|
| 441 |
|
---|