1 | /** @file
|
---|
2 | * MM - The Memory Manager.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006-2007 innotek GmbH
|
---|
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_mm_h
|
---|
27 | #define ___VBox_mm_h
|
---|
28 |
|
---|
29 | #include <VBox/cdefs.h>
|
---|
30 | #include <VBox/types.h>
|
---|
31 | #include <VBox/x86.h>
|
---|
32 | #include <VBox/sup.h>
|
---|
33 |
|
---|
34 |
|
---|
35 | __BEGIN_DECLS
|
---|
36 |
|
---|
37 | /** @defgroup grp_mm The Memory Manager API
|
---|
38 | * @{
|
---|
39 | */
|
---|
40 |
|
---|
41 | /** @name RAM Page Flags
|
---|
42 | * Since internal ranges have a byte granularity it's possible for a
|
---|
43 | * page be flagged for several uses. The access virtualization in PGM
|
---|
44 | * will choose the most restricted one and use EM to emulate access to
|
---|
45 | * the less restricted areas of the page.
|
---|
46 | *
|
---|
47 | * Bits 0-11 only since they are fitted into the offset part of a physical memory address.
|
---|
48 | * @{
|
---|
49 | */
|
---|
50 | /** Reserved - Not RAM, ROM nor MMIO2.
|
---|
51 | * If this bit is cleared the memory is assumed to be some kind of RAM.
|
---|
52 | * Normal MMIO may set it but that depends on whether the RAM range was
|
---|
53 | * created specially for the MMIO or not.
|
---|
54 | *
|
---|
55 | * @remarks The current implementation will always reserve backing
|
---|
56 | * memory for reserved ranges to simplify things.
|
---|
57 | */
|
---|
58 | #define MM_RAM_FLAGS_RESERVED RT_BIT(0)
|
---|
59 | /** ROM - Read Only Memory.
|
---|
60 | * The page have a HC physical address which contains the BIOS code. All write
|
---|
61 | * access is trapped and ignored.
|
---|
62 | *
|
---|
63 | * HACK: Writable shadow ROM is indicated by both ROM and MMIO2 being
|
---|
64 | * set. (We're out of bits.)
|
---|
65 | */
|
---|
66 | #define MM_RAM_FLAGS_ROM RT_BIT(1)
|
---|
67 | /** MMIO - Memory Mapped I/O.
|
---|
68 | * All access is trapped and emulated. No physical backing is required, but
|
---|
69 | * might for various reasons be present.
|
---|
70 | */
|
---|
71 | #define MM_RAM_FLAGS_MMIO RT_BIT(2)
|
---|
72 | /** MMIO2 - Memory Mapped I/O, variation 2.
|
---|
73 | * The virtualization is performed using real memory and only catching
|
---|
74 | * a few accesses for like keeping track for dirty pages.
|
---|
75 | * @remark Involved in the shadow ROM hack.
|
---|
76 | */
|
---|
77 | #define MM_RAM_FLAGS_MMIO2 RT_BIT(3)
|
---|
78 |
|
---|
79 | /** PGM has virtual page access handler(s) defined for pages with this flag. */
|
---|
80 | #define MM_RAM_FLAGS_VIRTUAL_HANDLER RT_BIT(4)
|
---|
81 | /** PGM has virtual page access handler(s) for write access. */
|
---|
82 | #define MM_RAM_FLAGS_VIRTUAL_WRITE RT_BIT(5)
|
---|
83 | /** PGM has virtual page access handler(s) for all access. */
|
---|
84 | #define MM_RAM_FLAGS_VIRTUAL_ALL RT_BIT(6)
|
---|
85 | /** PGM has physical page access handler(s) defined for pages with this flag. */
|
---|
86 | #define MM_RAM_FLAGS_PHYSICAL_HANDLER RT_BIT(7)
|
---|
87 | /** PGM has physical page access handler(s) for write access. */
|
---|
88 | #define MM_RAM_FLAGS_PHYSICAL_WRITE RT_BIT(8)
|
---|
89 | /** PGM has physical page access handler(s) for all access. */
|
---|
90 | #define MM_RAM_FLAGS_PHYSICAL_ALL RT_BIT(9)
|
---|
91 | /** PGM has physical page access handler(s) for this page and has temporarily disabled it. */
|
---|
92 | #define MM_RAM_FLAGS_PHYSICAL_TEMP_OFF RT_BIT(10)
|
---|
93 | #ifndef NEW_PHYS_CODE
|
---|
94 | /** Physical backing memory is allocated dynamically. Not set implies a one time static allocation. */
|
---|
95 | #define MM_RAM_FLAGS_DYNAMIC_ALLOC RT_BIT(11)
|
---|
96 | #endif /* !NEW_PHYS_CODE */
|
---|
97 |
|
---|
98 | /** The shift used to get the reference count. */
|
---|
99 | #define MM_RAM_FLAGS_CREFS_SHIFT 62
|
---|
100 | /** The mask applied to the the page pool idx after using MM_RAM_FLAGS_CREFS_SHIFT to shift it down. */
|
---|
101 | #define MM_RAM_FLAGS_CREFS_MASK 0x3
|
---|
102 | /** The (shifted) cRef value used to indiciate that the idx is the head of a
|
---|
103 | * physical cross reference extent list. */
|
---|
104 | #define MM_RAM_FLAGS_CREFS_PHYSEXT MM_RAM_FLAGS_CREFS_MASK
|
---|
105 | /** The shift used to get the page pool idx. (Apply MM_RAM_FLAGS_IDX_MASK to the result when shifting down). */
|
---|
106 | #define MM_RAM_FLAGS_IDX_SHIFT 48
|
---|
107 | /** The mask applied to the the page pool idx after using MM_RAM_FLAGS_IDX_SHIFT to shift it down. */
|
---|
108 | #define MM_RAM_FLAGS_IDX_MASK 0x3fff
|
---|
109 | /** The idx value when we're out of of extents or there are simply too many mappings of this page. */
|
---|
110 | #define MM_RAM_FLAGS_IDX_OVERFLOWED MM_RAM_FLAGS_IDX_MASK
|
---|
111 |
|
---|
112 | /** Mask for masking off any references to the page. */
|
---|
113 | #define MM_RAM_FLAGS_NO_REFS_MASK UINT64_C(0x0000ffffffffffff)
|
---|
114 | /** @} */
|
---|
115 |
|
---|
116 | /** @name MMR3PhysRegisterEx registration type
|
---|
117 | * @{
|
---|
118 | */
|
---|
119 | typedef enum
|
---|
120 | {
|
---|
121 | /** Normal physical region (flags specify exact page type) */
|
---|
122 | MM_PHYS_TYPE_NORMAL = 0,
|
---|
123 | /** Allocate part of a dynamically allocated physical region */
|
---|
124 | MM_PHYS_TYPE_DYNALLOC_CHUNK,
|
---|
125 |
|
---|
126 | MM_PHYS_TYPE_32BIT_HACK = 0x7fffffff
|
---|
127 | } MMPHYSREG;
|
---|
128 | /** @} */
|
---|
129 |
|
---|
130 | /**
|
---|
131 | * Memory Allocation Tags.
|
---|
132 | * For use with MMHyperAlloc(), MMR3HeapAlloc(), MMR3HeapAllocEx(),
|
---|
133 | * MMR3HeapAllocZ() and MMR3HeapAllocZEx().
|
---|
134 | *
|
---|
135 | * @remark Don't forget to update the dump command in MMHeap.cpp!
|
---|
136 | */
|
---|
137 | typedef enum MMTAG
|
---|
138 | {
|
---|
139 | MM_TAG_INVALID = 0,
|
---|
140 |
|
---|
141 | MM_TAG_CFGM,
|
---|
142 | MM_TAG_CFGM_BYTES,
|
---|
143 | MM_TAG_CFGM_STRING,
|
---|
144 | MM_TAG_CFGM_USER,
|
---|
145 |
|
---|
146 | MM_TAG_CSAM,
|
---|
147 | MM_TAG_CSAM_PATCH,
|
---|
148 |
|
---|
149 | MM_TAG_DBGF,
|
---|
150 | MM_TAG_DBGF_INFO,
|
---|
151 | MM_TAG_DBGF_LINE,
|
---|
152 | MM_TAG_DBGF_LINE_DUP,
|
---|
153 | MM_TAG_DBGF_STACK,
|
---|
154 | MM_TAG_DBGF_SYMBOL,
|
---|
155 | MM_TAG_DBGF_SYMBOL_DUP,
|
---|
156 | MM_TAG_DBGF_MODULE,
|
---|
157 |
|
---|
158 | MM_TAG_EM,
|
---|
159 |
|
---|
160 | MM_TAG_IOM,
|
---|
161 | MM_TAG_IOM_STATS,
|
---|
162 |
|
---|
163 | MM_TAG_MM,
|
---|
164 | MM_TAG_MM_LOOKUP_GUEST,
|
---|
165 | MM_TAG_MM_LOOKUP_PHYS,
|
---|
166 | MM_TAG_MM_LOOKUP_VIRT,
|
---|
167 | MM_TAG_MM_PAGE,
|
---|
168 |
|
---|
169 | MM_TAG_PATM,
|
---|
170 | MM_TAG_PATM_PATCH,
|
---|
171 |
|
---|
172 | MM_TAG_PDM,
|
---|
173 | MM_TAG_PDM_ASYNC_COMPLETION,
|
---|
174 | MM_TAG_PDM_DEVICE,
|
---|
175 | MM_TAG_PDM_DEVICE_USER,
|
---|
176 | MM_TAG_PDM_DRIVER,
|
---|
177 | MM_TAG_PDM_DRIVER_USER,
|
---|
178 | MM_TAG_PDM_USB,
|
---|
179 | MM_TAG_PDM_USB_USER,
|
---|
180 | MM_TAG_PDM_LUN,
|
---|
181 | MM_TAG_PDM_QUEUE,
|
---|
182 | MM_TAG_PDM_THREAD,
|
---|
183 |
|
---|
184 | MM_TAG_PGM,
|
---|
185 | MM_TAG_PGM_CHUNK_MAPPING,
|
---|
186 | MM_TAG_PGM_HANDLERS,
|
---|
187 | MM_TAG_PGM_POOL,
|
---|
188 |
|
---|
189 | MM_TAG_REM,
|
---|
190 |
|
---|
191 | MM_TAG_SELM,
|
---|
192 |
|
---|
193 | MM_TAG_SSM,
|
---|
194 |
|
---|
195 | MM_TAG_STAM,
|
---|
196 |
|
---|
197 | MM_TAG_TM,
|
---|
198 |
|
---|
199 | MM_TAG_TRPM,
|
---|
200 |
|
---|
201 | MM_TAG_VM,
|
---|
202 | MM_TAG_VM_REQ,
|
---|
203 |
|
---|
204 | MM_TAG_VMM,
|
---|
205 |
|
---|
206 | MM_TAG_HWACCM,
|
---|
207 |
|
---|
208 | MM_TAG_32BIT_HACK = 0x7fffffff
|
---|
209 | } MMTAG;
|
---|
210 |
|
---|
211 |
|
---|
212 |
|
---|
213 |
|
---|
214 | /** @defgroup grp_mm_hyper Hypervisor Memory Management
|
---|
215 | * @ingroup grp_mm
|
---|
216 | * @{ */
|
---|
217 |
|
---|
218 | /**
|
---|
219 | * Converts a ring-0 host context address in the Hypervisor memory region to a ring-3 host context address.
|
---|
220 | *
|
---|
221 | * @returns ring-3 host context address.
|
---|
222 | * @param pVM The VM to operate on.
|
---|
223 | * @param R0Ptr The ring-0 host context address.
|
---|
224 | * You'll be damned if this is not in the HMA! :-)
|
---|
225 | * @thread The Emulation Thread.
|
---|
226 | */
|
---|
227 | MMDECL(RTR3PTR) MMHyperR0ToR3(PVM pVM, RTR0PTR R0Ptr);
|
---|
228 |
|
---|
229 | /**
|
---|
230 | * Converts a ring-0 host context address in the Hypervisor memory region to a guest context address.
|
---|
231 | *
|
---|
232 | * @returns guest context address.
|
---|
233 | * @param pVM The VM to operate on.
|
---|
234 | * @param R0Ptr The ring-0 host context address.
|
---|
235 | * You'll be damned if this is not in the HMA! :-)
|
---|
236 | * @thread The Emulation Thread.
|
---|
237 | */
|
---|
238 | MMDECL(RTGCPTR) MMHyperR0ToGC(PVM pVM, RTR0PTR R0Ptr);
|
---|
239 |
|
---|
240 | /**
|
---|
241 | * Converts a ring-0 host context address in the Hypervisor memory region to a current context address.
|
---|
242 | *
|
---|
243 | * @returns current context address.
|
---|
244 | * @param pVM The VM to operate on.
|
---|
245 | * @param R0Ptr The ring-0 host context address.
|
---|
246 | * You'll be damned if this is not in the HMA! :-)
|
---|
247 | * @thread The Emulation Thread.
|
---|
248 | */
|
---|
249 | #ifndef IN_RING0
|
---|
250 | MMDECL(void *) MMHyperR0ToCC(PVM pVM, RTR0PTR R0Ptr);
|
---|
251 | #endif
|
---|
252 |
|
---|
253 |
|
---|
254 | /**
|
---|
255 | * Converts a ring-3 host context address in the Hypervisor memory region to a ring-0 host context address.
|
---|
256 | *
|
---|
257 | * @returns ring-0 host context address.
|
---|
258 | * @param pVM The VM to operate on.
|
---|
259 | * @param R3Ptr The ring-3 host context address.
|
---|
260 | * You'll be damned if this is not in the HMA! :-)
|
---|
261 | * @thread The Emulation Thread.
|
---|
262 | */
|
---|
263 | MMDECL(RTR0PTR) MMHyperR3ToR0(PVM pVM, RTR3PTR R3Ptr);
|
---|
264 |
|
---|
265 | /**
|
---|
266 | * Converts a ring-3 host context address in the Hypervisor memory region to a guest context address.
|
---|
267 | *
|
---|
268 | * @returns guest context address.
|
---|
269 | * @param pVM The VM to operate on.
|
---|
270 | * @param R3Ptr The ring-3 host context address.
|
---|
271 | * You'll be damned if this is not in the HMA! :-)
|
---|
272 | * @thread The Emulation Thread.
|
---|
273 | */
|
---|
274 | MMDECL(RTGCPTR) MMHyperR3ToGC(PVM pVM, RTR3PTR R3Ptr);
|
---|
275 |
|
---|
276 | /**
|
---|
277 | * Converts a ring-3 host context address in the Hypervisor memory region to a current context address.
|
---|
278 | *
|
---|
279 | * @returns current context address.
|
---|
280 | * @param pVM The VM to operate on.
|
---|
281 | * @param R3Ptr The ring-3 host context address.
|
---|
282 | * You'll be damned if this is not in the HMA! :-)
|
---|
283 | * @thread The Emulation Thread.
|
---|
284 | */
|
---|
285 | #ifndef IN_RING3
|
---|
286 | MMDECL(void *) MMHyperR3ToCC(PVM pVM, RTR3PTR R3Ptr);
|
---|
287 | #else
|
---|
288 | DECLINLINE(void *) MMHyperR3ToCC(PVM pVM, RTR3PTR R3Ptr)
|
---|
289 | {
|
---|
290 | NOREF(pVM);
|
---|
291 | return R3Ptr;
|
---|
292 | }
|
---|
293 | #endif
|
---|
294 |
|
---|
295 |
|
---|
296 | /**
|
---|
297 | * Converts a guest context address in the Hypervisor memory region to a ring-3 context address.
|
---|
298 | *
|
---|
299 | * @returns ring-3 host context address.
|
---|
300 | * @param pVM The VM to operate on.
|
---|
301 | * @param GCPtr The guest context address.
|
---|
302 | * You'll be damned if this is not in the HMA! :-)
|
---|
303 | * @thread The Emulation Thread.
|
---|
304 | */
|
---|
305 | MMDECL(RTR3PTR) MMHyperGCToR3(PVM pVM, RTGCPTR GCPtr);
|
---|
306 |
|
---|
307 | /**
|
---|
308 | * Converts a guest context address in the Hypervisor memory region to a ring-0 host context address.
|
---|
309 | *
|
---|
310 | * @returns ring-0 host context address.
|
---|
311 | * @param pVM The VM to operate on.
|
---|
312 | * @param GCPtr The guest context address.
|
---|
313 | * You'll be damned if this is not in the HMA! :-)
|
---|
314 | * @thread The Emulation Thread.
|
---|
315 | */
|
---|
316 | MMDECL(RTR0PTR) MMHyperGCToR0(PVM pVM, RTGCPTR GCPtr);
|
---|
317 |
|
---|
318 | /**
|
---|
319 | * Converts a guest context address in the Hypervisor memory region to a current context address.
|
---|
320 | *
|
---|
321 | * @returns current context address.
|
---|
322 | * @param pVM The VM to operate on.
|
---|
323 | * @param GCPtr The guest host context address.
|
---|
324 | * You'll be damned if this is not in the HMA! :-)
|
---|
325 | * @thread The Emulation Thread.
|
---|
326 | */
|
---|
327 | #ifndef IN_GC
|
---|
328 | MMDECL(void *) MMHyperGCToCC(PVM pVM, RTGCPTR GCPtr);
|
---|
329 | #else
|
---|
330 | DECLINLINE(void *) MMHyperGCToCC(PVM pVM, RTGCPTR GCPtr)
|
---|
331 | {
|
---|
332 | NOREF(pVM);
|
---|
333 | return GCPtr;
|
---|
334 | }
|
---|
335 | #endif
|
---|
336 |
|
---|
337 |
|
---|
338 |
|
---|
339 | /**
|
---|
340 | * Converts a current context address in the Hypervisor memory region to a ring-3 host context address.
|
---|
341 | *
|
---|
342 | * @returns ring-3 host context address.
|
---|
343 | * @param pVM The VM to operate on.
|
---|
344 | * @param pv The current context address.
|
---|
345 | * You'll be damned if this is not in the HMA! :-)
|
---|
346 | * @thread The Emulation Thread.
|
---|
347 | */
|
---|
348 | #ifndef IN_RING3
|
---|
349 | MMDECL(RTR3PTR) MMHyperCCToR3(PVM pVM, void *pv);
|
---|
350 | #else
|
---|
351 | DECLINLINE(RTR3PTR) MMHyperCCToR3(PVM pVM, void *pv)
|
---|
352 | {
|
---|
353 | NOREF(pVM);
|
---|
354 | return pv;
|
---|
355 | }
|
---|
356 | #endif
|
---|
357 |
|
---|
358 | /**
|
---|
359 | * Converts a current context address in the Hypervisor memory region to a ring-0 host context address.
|
---|
360 | *
|
---|
361 | * @returns ring-0 host context address.
|
---|
362 | * @param pVM The VM to operate on.
|
---|
363 | * @param pv The current context address.
|
---|
364 | * You'll be damned if this is not in the HMA! :-)
|
---|
365 | * @thread The Emulation Thread.
|
---|
366 | */
|
---|
367 | #ifndef IN_RING0
|
---|
368 | MMDECL(RTR0PTR) MMHyperCCToR0(PVM pVM, void *pv);
|
---|
369 | #else
|
---|
370 | DECLINLINE(RTR0PTR) MMHyperCCToR0(PVM pVM, void *pv)
|
---|
371 | {
|
---|
372 | NOREF(pVM);
|
---|
373 | return pv;
|
---|
374 | }
|
---|
375 | #endif
|
---|
376 |
|
---|
377 | /**
|
---|
378 | * Converts a current context address in the Hypervisor memory region to a guest context address.
|
---|
379 | *
|
---|
380 | * @returns guest context address.
|
---|
381 | * @param pVM The VM to operate on.
|
---|
382 | * @param pv The current context address.
|
---|
383 | * You'll be damned if this is not in the HMA! :-)
|
---|
384 | * @thread The Emulation Thread.
|
---|
385 | */
|
---|
386 | #ifndef IN_GC
|
---|
387 | MMDECL(RTGCPTR) MMHyperCCToGC(PVM pVM, void *pv);
|
---|
388 | #else
|
---|
389 | DECLINLINE(RTGCPTR) MMHyperCCToGC(PVM pVM, void *pv)
|
---|
390 | {
|
---|
391 | NOREF(pVM);
|
---|
392 | return pv;
|
---|
393 | }
|
---|
394 | #endif
|
---|
395 |
|
---|
396 |
|
---|
397 |
|
---|
398 | /**
|
---|
399 | * Converts a current context address in the Hypervisor memory region to a HC address.
|
---|
400 | * The memory must have been allocated with MMHyperAlloc().
|
---|
401 | *
|
---|
402 | * @returns HC address.
|
---|
403 | * @param pVM The VM to operate on.
|
---|
404 | * @param Ptr The current context address.
|
---|
405 | * @thread The Emulation Thread.
|
---|
406 | * @deprecated
|
---|
407 | */
|
---|
408 | #ifdef IN_GC
|
---|
409 | MMDECL(RTHCPTR) MMHyper2HC(PVM pVM, uintptr_t Ptr);
|
---|
410 | #else
|
---|
411 | DECLINLINE(RTHCPTR) MMHyper2HC(PVM pVM, uintptr_t Ptr)
|
---|
412 | {
|
---|
413 | NOREF(pVM);
|
---|
414 | return (RTHCPTR)Ptr;
|
---|
415 | }
|
---|
416 | #endif
|
---|
417 |
|
---|
418 | /**
|
---|
419 | * Converts a current context address in the Hypervisor memory region to a GC address.
|
---|
420 | * The memory must have been allocated with MMHyperAlloc().
|
---|
421 | *
|
---|
422 | * @returns HC address.
|
---|
423 | * @param pVM The VM to operate on.
|
---|
424 | * @param Ptr The current context address.
|
---|
425 | * @thread The Emulation Thread.
|
---|
426 | */
|
---|
427 | #ifndef IN_GC
|
---|
428 | MMDECL(RTGCPTR) MMHyper2GC(PVM pVM, uintptr_t Ptr);
|
---|
429 | #else
|
---|
430 | DECLINLINE(RTGCPTR) MMHyper2GC(PVM pVM, uintptr_t Ptr)
|
---|
431 | {
|
---|
432 | NOREF(pVM);
|
---|
433 | return (RTGCPTR)Ptr;
|
---|
434 | }
|
---|
435 | #endif
|
---|
436 |
|
---|
437 | /**
|
---|
438 | * Converts a HC address in the Hypervisor memory region to a GC address.
|
---|
439 | * The memory must have been allocated with MMGCHyperAlloc() or MMR3HyperAlloc().
|
---|
440 | *
|
---|
441 | * @returns GC address.
|
---|
442 | * @param pVM The VM to operate on.
|
---|
443 | * @param HCPtr The host context address.
|
---|
444 | * You'll be damned if this is not in the HMA! :-)
|
---|
445 | * @thread The Emulation Thread.
|
---|
446 | * @deprecated
|
---|
447 | */
|
---|
448 | MMDECL(RTGCPTR) MMHyperHC2GC(PVM pVM, RTHCPTR HCPtr);
|
---|
449 |
|
---|
450 | /**
|
---|
451 | * Converts a GC address in the Hypervisor memory region to a HC address.
|
---|
452 | * The memory must have been allocated with MMGCHyperAlloc() or MMR3HyperAlloc().
|
---|
453 | *
|
---|
454 | * @returns HC address.
|
---|
455 | * @param pVM The VM to operate on.
|
---|
456 | * @param GCPtr The guest context address.
|
---|
457 | * You'll be damned if this is not in the HMA! :-)
|
---|
458 | * @thread The Emulation Thread.
|
---|
459 | * @deprecated
|
---|
460 | */
|
---|
461 | MMDECL(RTHCPTR) MMHyperGC2HC(PVM pVM, RTGCPTR GCPtr);
|
---|
462 |
|
---|
463 |
|
---|
464 | /**
|
---|
465 | * Allocates memory in the Hypervisor (GC VMM) area.
|
---|
466 | * The returned memory is of course zeroed.
|
---|
467 | *
|
---|
468 | * @returns VBox status code.
|
---|
469 | * @param pVM The VM to operate on.
|
---|
470 | * @param cb Number of bytes to allocate.
|
---|
471 | * @param uAlignment Required memory alignment in bytes.
|
---|
472 | * Values are 0,8,16,32 and PAGE_SIZE.
|
---|
473 | * 0 -> default alignment, i.e. 8 bytes.
|
---|
474 | * @param enmTag The statistics tag.
|
---|
475 | * @param ppv Where to store the address to the allocated
|
---|
476 | * memory.
|
---|
477 | * @remark This is assumed not to be used at times when serialization is required.
|
---|
478 | */
|
---|
479 | MMDECL(int) MMHyperAlloc(PVM pVM, size_t cb, uint32_t uAlignment, MMTAG enmTag, void **ppv);
|
---|
480 |
|
---|
481 | /**
|
---|
482 | * Free memory allocated using MMHyperAlloc().
|
---|
483 | *
|
---|
484 | * It's not possible to free memory which is page aligned!
|
---|
485 | *
|
---|
486 | * @returns VBox status code.
|
---|
487 | * @param pVM The VM to operate on.
|
---|
488 | * @param pv The memory to free.
|
---|
489 | * @remark Try avoid freeing hyper memory.
|
---|
490 | * @thread The Emulation Thread.
|
---|
491 | */
|
---|
492 | MMDECL(int) MMHyperFree(PVM pVM, void *pv);
|
---|
493 |
|
---|
494 | #ifdef DEBUG
|
---|
495 | /**
|
---|
496 | * Dumps the hypervisor heap to Log.
|
---|
497 | * @param pVM VM Handle.
|
---|
498 | * @thread The Emulation Thread.
|
---|
499 | */
|
---|
500 | MMDECL(void) MMHyperHeapDump(PVM pVM);
|
---|
501 | #endif
|
---|
502 |
|
---|
503 | /**
|
---|
504 | * Query the amount of free memory in the hypervisor heap.
|
---|
505 | *
|
---|
506 | * @returns Number of free bytes in the hypervisor heap.
|
---|
507 | * @thread Any.
|
---|
508 | */
|
---|
509 | MMDECL(size_t) MMHyperHeapGetFreeSize(PVM pVM);
|
---|
510 |
|
---|
511 | /**
|
---|
512 | * Query the size the hypervisor heap.
|
---|
513 | *
|
---|
514 | * @returns The size of the hypervisor heap in bytes.
|
---|
515 | * @thread Any.
|
---|
516 | */
|
---|
517 | MMDECL(size_t) MMHyperHeapGetSize(PVM pVM);
|
---|
518 |
|
---|
519 |
|
---|
520 | /**
|
---|
521 | * Query the address and size the hypervisor memory area.
|
---|
522 | *
|
---|
523 | * @returns Base address of the hypervisor area.
|
---|
524 | * @param pVM VM Handle.
|
---|
525 | * @param pcb Where to store the size of the hypervisor area. (out)
|
---|
526 | * @thread Any.
|
---|
527 | */
|
---|
528 | MMDECL(RTGCPTR) MMHyperGetArea(PVM pVM, size_t *pcb);
|
---|
529 |
|
---|
530 | /**
|
---|
531 | * Checks if an address is within the hypervisor memory area.
|
---|
532 | *
|
---|
533 | * @returns true if inside.
|
---|
534 | * @returns false if outside.
|
---|
535 | * @param pVM VM handle.
|
---|
536 | * @param GCPtr The pointer to check.
|
---|
537 | * @thread The Emulation Thread.
|
---|
538 | */
|
---|
539 | MMDECL(bool) MMHyperIsInsideArea(PVM pVM, RTGCPTR GCPtr);
|
---|
540 |
|
---|
541 | /**
|
---|
542 | * Convert a page in the page pool to a HC physical address.
|
---|
543 | * This works for pages allocated by MMR3PageAlloc(), MMR3PageAllocPhys()
|
---|
544 | * and MMR3PageAllocLow().
|
---|
545 | *
|
---|
546 | * @returns Physical address for the specified page table.
|
---|
547 | * @param pVM VM handle.
|
---|
548 | * @param pvPage Page which physical address we query.
|
---|
549 | * @thread The Emulation Thread.
|
---|
550 | */
|
---|
551 | MMDECL(RTHCPHYS) MMPage2Phys(PVM pVM, void *pvPage);
|
---|
552 |
|
---|
553 | /**
|
---|
554 | * Convert physical address of a page to a HC virtual address.
|
---|
555 | * This works for pages allocated by MMR3PageAlloc(), MMR3PageAllocPhys()
|
---|
556 | * and MMR3PageAllocLow().
|
---|
557 | *
|
---|
558 | * @returns Pointer to the page at that physical address.
|
---|
559 | * @param pVM VM handle.
|
---|
560 | * @param HCPhysPage The physical address of a page.
|
---|
561 | * @thread The Emulation Thread.
|
---|
562 | */
|
---|
563 | MMDECL(void *) MMPagePhys2Page(PVM pVM, RTHCPHYS HCPhysPage);
|
---|
564 |
|
---|
565 |
|
---|
566 | /**
|
---|
567 | * Convert physical address of a page to a HC virtual address.
|
---|
568 | * This works for pages allocated by MMR3PageAlloc(), MMR3PageAllocPhys()
|
---|
569 | * and MMR3PageAllocLow().
|
---|
570 | *
|
---|
571 | * @returns VBox status code.
|
---|
572 | * @param pVM VM handle.
|
---|
573 | * @param HCPhysPage The physical address of a page.
|
---|
574 | * @param ppvPage Where to store the address corresponding to HCPhysPage.
|
---|
575 | * @thread The Emulation Thread.
|
---|
576 | */
|
---|
577 | MMDECL(int) MMPagePhys2PageEx(PVM pVM, RTHCPHYS HCPhysPage, void **ppvPage);
|
---|
578 |
|
---|
579 |
|
---|
580 | /**
|
---|
581 | * Try convert physical address of a page to a HC virtual address.
|
---|
582 | * This works for pages allocated by MMR3PageAlloc(), MMR3PageAllocPhys()
|
---|
583 | * and MMR3PageAllocLow().
|
---|
584 | *
|
---|
585 | * @returns VBox status code.
|
---|
586 | * @param pVM VM handle.
|
---|
587 | * @param HCPhysPage The physical address of a page.
|
---|
588 | * @param ppvPage Where to store the address corresponding to HCPhysPage.
|
---|
589 | * @thread The Emulation Thread.
|
---|
590 | */
|
---|
591 | MMDECL(int) MMPagePhys2PageTry(PVM pVM, RTHCPHYS HCPhysPage, void **ppvPage);
|
---|
592 |
|
---|
593 | /**
|
---|
594 | * Convert GC physical address to HC virtual address.
|
---|
595 | *
|
---|
596 | * @returns HC virtual address.
|
---|
597 | * @param pVM VM Handle
|
---|
598 | * @param GCPhys Guest context physical address.
|
---|
599 | * @param cbRange Physical range
|
---|
600 | * @thread The Emulation Thread.
|
---|
601 | * @deprecated
|
---|
602 | */
|
---|
603 | MMDECL(void *) MMPhysGCPhys2HCVirt(PVM pVM, RTGCPHYS GCPhys, RTUINT cbRange);
|
---|
604 |
|
---|
605 |
|
---|
606 | /** @def MMHYPER_GC_ASSERT_GCPTR
|
---|
607 | * Asserts that an address is either NULL or inside the hypervisor memory area.
|
---|
608 | * This assertion only works while IN_GC, it's a NOP everywhere else.
|
---|
609 | * @thread The Emulation Thread.
|
---|
610 | */
|
---|
611 | #ifdef IN_GC
|
---|
612 | # define MMHYPER_GC_ASSERT_GCPTR(pVM, GCPtr) Assert(MMHyperIsInsideArea((pVM), (GCPtr)) || !(GCPtr))
|
---|
613 | #else
|
---|
614 | # define MMHYPER_GC_ASSERT_GCPTR(pVM, GCPtr) do { } while (0)
|
---|
615 | #endif
|
---|
616 |
|
---|
617 | /** @} */
|
---|
618 |
|
---|
619 |
|
---|
620 | #ifdef IN_RING3
|
---|
621 | /** @defgroup grp_mm_r3 The MM Host Context Ring-3 API
|
---|
622 | * @ingroup grp_mm
|
---|
623 | * @{
|
---|
624 | */
|
---|
625 |
|
---|
626 | /**
|
---|
627 | * Initialization of MM (save anything depending on PGM).
|
---|
628 | *
|
---|
629 | * @returns VBox status code.
|
---|
630 | * @param pVM The VM to operate on.
|
---|
631 | * @thread The Emulation Thread.
|
---|
632 | */
|
---|
633 | MMR3DECL(int) MMR3Init(PVM pVM);
|
---|
634 |
|
---|
635 | /**
|
---|
636 | * Initializes the MM parts which depends on PGM being initialized.
|
---|
637 | *
|
---|
638 | * @returns VBox status code.
|
---|
639 | * @param pVM The VM to operate on.
|
---|
640 | * @thread The Emulation Thread.
|
---|
641 | */
|
---|
642 | MMR3DECL(int) MMR3InitPaging(PVM pVM);
|
---|
643 |
|
---|
644 | /**
|
---|
645 | * Finalizes the HMA mapping.
|
---|
646 | *
|
---|
647 | * This is called later during init, most (all) HMA allocations should be done
|
---|
648 | * by the time this function is called.
|
---|
649 | *
|
---|
650 | * @returns VBox status.
|
---|
651 | */
|
---|
652 | MMR3DECL(int) MMR3HyperInitFinalize(PVM pVM);
|
---|
653 |
|
---|
654 | /**
|
---|
655 | * Terminates the MM.
|
---|
656 | *
|
---|
657 | * Termination means cleaning up and freeing all resources,
|
---|
658 | * the VM it self is at this point powered off or suspended.
|
---|
659 | *
|
---|
660 | * @returns VBox status code.
|
---|
661 | * @param pVM The VM to operate on.
|
---|
662 | * @thread The Emulation Thread.
|
---|
663 | */
|
---|
664 | MMR3DECL(int) MMR3Term(PVM pVM);
|
---|
665 |
|
---|
666 | /**
|
---|
667 | * Reset notification.
|
---|
668 | *
|
---|
669 | * MM will reload shadow ROMs into RAM at this point and make
|
---|
670 | * the ROM writable.
|
---|
671 | *
|
---|
672 | * @param pVM The VM handle.
|
---|
673 | */
|
---|
674 | MMR3DECL(void) MMR3Reset(PVM pVM);
|
---|
675 |
|
---|
676 | /**
|
---|
677 | * Convert HC Physical address to HC Virtual address.
|
---|
678 | *
|
---|
679 | * @returns VBox status.
|
---|
680 | * @param pVM VM handle.
|
---|
681 | * @param HCPhys The host context virtual address.
|
---|
682 | * @param ppv Where to store the resulting address.
|
---|
683 | * @thread The Emulation Thread.
|
---|
684 | */
|
---|
685 | MMR3DECL(int) MMR3HCPhys2HCVirt(PVM pVM, RTHCPHYS HCPhys, void **ppv);
|
---|
686 |
|
---|
687 | /**
|
---|
688 | * Read memory from GC virtual address using the current guest CR3.
|
---|
689 | *
|
---|
690 | * @returns VBox status.
|
---|
691 | * @param pVM VM handle.
|
---|
692 | * @param pvDst Destination address (HC of course).
|
---|
693 | * @param GCPtr GC virtual address.
|
---|
694 | * @param cb Number of bytes to read.
|
---|
695 | * @thread The Emulation Thread.
|
---|
696 | */
|
---|
697 | MMR3DECL(int) MMR3ReadGCVirt(PVM pVM, void *pvDst, RTGCPTR GCPtr, size_t cb);
|
---|
698 |
|
---|
699 | /**
|
---|
700 | * Write to memory at GC virtual address translated using the current guest CR3.
|
---|
701 | *
|
---|
702 | * @returns VBox status.
|
---|
703 | * @param pVM VM handle.
|
---|
704 | * @param GCPtrDst GC virtual address.
|
---|
705 | * @param pvSrc The source address (HC of course).
|
---|
706 | * @param cb Number of bytes to read.
|
---|
707 | */
|
---|
708 | MMR3DECL(int) MMR3WriteGCVirt(PVM pVM, RTGCPTR GCPtrDst, const void *pvSrc, size_t cb);
|
---|
709 |
|
---|
710 |
|
---|
711 | /** @defgroup grp_mm_r3_hyper Hypervisor Memory Manager (HC R3 Portion)
|
---|
712 | * @ingroup grp_mm_r3
|
---|
713 | * @{ */
|
---|
714 | /**
|
---|
715 | * Allocates memory in the Hypervisor (GC VMM) area which never will
|
---|
716 | * be freed and don't have any offset based relation to other heap blocks.
|
---|
717 | *
|
---|
718 | * The latter means that two blocks allocated by this API will not have the
|
---|
719 | * same relative position to each other in GC and HC. In short, never use
|
---|
720 | * this API for allocating nodes for an offset based AVL tree!
|
---|
721 | *
|
---|
722 | * The returned memory is of course zeroed.
|
---|
723 | *
|
---|
724 | * @returns VBox status code.
|
---|
725 | * @param pVM The VM to operate on.
|
---|
726 | * @param cb Number of bytes to allocate.
|
---|
727 | * @param uAlignment Required memory alignment in bytes.
|
---|
728 | * Values are 0,8,16,32 and PAGE_SIZE.
|
---|
729 | * 0 -> default alignment, i.e. 8 bytes.
|
---|
730 | * @param enmTag The statistics tag.
|
---|
731 | * @param ppv Where to store the address to the allocated
|
---|
732 | * memory.
|
---|
733 | * @remark This is assumed not to be used at times when serialization is required.
|
---|
734 | */
|
---|
735 | MMDECL(int) MMR3HyperAllocOnceNoRel(PVM pVM, size_t cb, uint32_t uAlignment, MMTAG enmTag, void **ppv);
|
---|
736 |
|
---|
737 | /**
|
---|
738 | * Maps contiguous HC physical memory into the hypervisor region in the GC.
|
---|
739 | *
|
---|
740 | * @return VBox status code.
|
---|
741 | *
|
---|
742 | * @param pVM VM handle.
|
---|
743 | * @param pvHC Host context address of the memory. Must be page aligned!
|
---|
744 | * @param HCPhys Host context physical address of the memory to be mapped. Must be page aligned!
|
---|
745 | * @param cb Size of the memory. Will be rounded up to nearest page.
|
---|
746 | * @param pszDesc Description.
|
---|
747 | * @param pGCPtr Where to store the GC address.
|
---|
748 | * @thread The Emulation Thread.
|
---|
749 | */
|
---|
750 | MMR3DECL(int) MMR3HyperMapHCPhys(PVM pVM, void *pvHC, RTHCPHYS HCPhys, size_t cb, const char *pszDesc, PRTGCPTR pGCPtr);
|
---|
751 |
|
---|
752 | /**
|
---|
753 | * Maps contiguous GC physical memory into the hypervisor region in the GC.
|
---|
754 | *
|
---|
755 | * @return VBox status code.
|
---|
756 | *
|
---|
757 | * @param pVM VM handle.
|
---|
758 | * @param GCPhys Guest context physical address of the memory to be mapped. Must be page aligned!
|
---|
759 | * @param cb Size of the memory. Will be rounded up to nearest page.
|
---|
760 | * @param pszDesc Mapping description.
|
---|
761 | * @param pGCPtr Where to store the GC address.
|
---|
762 | * @thread The Emulation Thread.
|
---|
763 | */
|
---|
764 | MMR3DECL(int) MMR3HyperMapGCPhys(PVM pVM, RTGCPHYS GCPhys, size_t cb, const char *pszDesc, PRTGCPTR pGCPtr);
|
---|
765 |
|
---|
766 | /**
|
---|
767 | * Locks and Maps HC virtual memory into the hypervisor region in the GC.
|
---|
768 | *
|
---|
769 | * @return VBox status code.
|
---|
770 | *
|
---|
771 | * @param pVM VM handle.
|
---|
772 | * @param pvHC Host context address of the memory (may be not page aligned).
|
---|
773 | * @param cb Size of the memory. Will be rounded up to nearest page.
|
---|
774 | * @param fFree Set this if MM is responsible for freeing the memory using SUPPageFree.
|
---|
775 | * @param pszDesc Mapping description.
|
---|
776 | * @param pGCPtr Where to store the GC address corresponding to pvHC.
|
---|
777 | * @thread The Emulation Thread.
|
---|
778 | */
|
---|
779 | MMR3DECL(int) MMR3HyperMapHCRam(PVM pVM, void *pvHC, size_t cb, bool fFree, const char *pszDesc, PRTGCPTR pGCPtr);
|
---|
780 |
|
---|
781 | /**
|
---|
782 | * Maps locked R3 virtual memory into the hypervisor region in the GC.
|
---|
783 | *
|
---|
784 | * @return VBox status code.
|
---|
785 | *
|
---|
786 | * @param pVM VM handle.
|
---|
787 | * @param pvR3 The ring-3 address of the memory, must be page aligned.
|
---|
788 | * @param pvR0 The ring-0 address of the memory, must be page aligned. (optional)
|
---|
789 | * @param cPages The number of pages.
|
---|
790 | * @param paPages The page descriptors.
|
---|
791 | * @param pszDesc Mapping description.
|
---|
792 | * @param pGCPtr Where to store the GC address corresponding to pvHC.
|
---|
793 | */
|
---|
794 | MMR3DECL(int) MMR3HyperMapPages(PVM pVM, void *pvR3, RTR0PTR pvR0, size_t cPages, PCSUPPAGE paPages, const char *pszDesc, PRTGCPTR pGCPtr);
|
---|
795 |
|
---|
796 | /**
|
---|
797 | * Reserves a hypervisor memory area.
|
---|
798 | * Most frequent usage is fence pages and dynamically mappings like the guest PD and PDPTR.
|
---|
799 | *
|
---|
800 | * @return VBox status code.
|
---|
801 | *
|
---|
802 | * @param pVM VM handle.
|
---|
803 | * @param cb Size of the memory. Will be rounded up to nearest page.
|
---|
804 | * @param pszDesc Mapping description.
|
---|
805 | * @param pGCPtr Where to store the assigned GC address. Optional.
|
---|
806 | * @thread The Emulation Thread.
|
---|
807 | */
|
---|
808 | MMR3DECL(int) MMR3HyperReserve(PVM pVM, unsigned cb, const char *pszDesc, PRTGCPTR pGCPtr);
|
---|
809 |
|
---|
810 |
|
---|
811 | /**
|
---|
812 | * Convert hypervisor HC virtual address to HC physical address.
|
---|
813 | *
|
---|
814 | * @returns HC physical address.
|
---|
815 | * @param pVM VM Handle
|
---|
816 | * @param pvHC Host context physical address.
|
---|
817 | * @thread The Emulation Thread.
|
---|
818 | */
|
---|
819 | MMR3DECL(RTHCPHYS) MMR3HyperHCVirt2HCPhys(PVM pVM, void *pvHC);
|
---|
820 | /**
|
---|
821 | * Convert hypervisor HC virtual address to HC physical address.
|
---|
822 | *
|
---|
823 | * @returns HC physical address.
|
---|
824 | * @param pVM VM Handle
|
---|
825 | * @param pvHC Host context physical address.
|
---|
826 | * @param pHCPhys Where to store the HC physical address.
|
---|
827 | * @thread The Emulation Thread.
|
---|
828 | */
|
---|
829 | MMR3DECL(int) MMR3HyperHCVirt2HCPhysEx(PVM pVM, void *pvHC, PRTHCPHYS pHCPhys);
|
---|
830 | /**
|
---|
831 | * Convert hypervisor HC physical address to HC virtual address.
|
---|
832 | *
|
---|
833 | * @returns HC virtual address.
|
---|
834 | * @param pVM VM Handle
|
---|
835 | * @param HCPhys Host context physical address.
|
---|
836 | * @thread The Emulation Thread.
|
---|
837 | */
|
---|
838 | MMR3DECL(void *) MMR3HyperHCPhys2HCVirt(PVM pVM, RTHCPHYS HCPhys);
|
---|
839 | /**
|
---|
840 | * Convert hypervisor HC physical address to HC virtual address.
|
---|
841 | *
|
---|
842 | * @returns VBox status.
|
---|
843 | * @param pVM VM Handle
|
---|
844 | * @param HCPhys Host context physical address.
|
---|
845 | * @param ppv Where to store the HC virtual address.
|
---|
846 | * @thread The Emulation Thread.
|
---|
847 | */
|
---|
848 | MMR3DECL(int) MMR3HyperHCPhys2HCVirtEx(PVM pVM, RTHCPHYS HCPhys, void **ppv);
|
---|
849 |
|
---|
850 | /**
|
---|
851 | * Read hypervisor memory from GC virtual address.
|
---|
852 | *
|
---|
853 | * @returns VBox status.
|
---|
854 | * @param pVM VM handle.
|
---|
855 | * @param pvDst Destination address (HC of course).
|
---|
856 | * @param GCPtr GC virtual address.
|
---|
857 | * @param cb Number of bytes to read.
|
---|
858 | * @thread The Emulation Thread.
|
---|
859 | */
|
---|
860 | MMR3DECL(int) MMR3HyperReadGCVirt(PVM pVM, void *pvDst, RTGCPTR GCPtr, size_t cb);
|
---|
861 |
|
---|
862 | /** @} */
|
---|
863 |
|
---|
864 |
|
---|
865 | /** @defgroup grp_mm_phys Guest Physical Memory Manager
|
---|
866 | * @ingroup grp_mm_r3
|
---|
867 | * @{ */
|
---|
868 |
|
---|
869 | /**
|
---|
870 | * Register externally allocated RAM for the virtual machine.
|
---|
871 | *
|
---|
872 | * The memory registered with the VM thru this interface must not be freed
|
---|
873 | * before the virtual machine has been destroyed. Bad things may happen... :-)
|
---|
874 | *
|
---|
875 | * @return VBox status code.
|
---|
876 | * @param pVM VM handle.
|
---|
877 | * @param pvRam Virtual address of the guest's physical memory range Must be page aligned.
|
---|
878 | * @param GCPhys The physical address the ram shall be registered at.
|
---|
879 | * @param cb Size of the memory. Must be page aligend.
|
---|
880 | * @param fFlags Flags of the MM_RAM_FLAGS_* defines.
|
---|
881 | * @param pszDesc Description of the memory.
|
---|
882 | * @thread The Emulation Thread.
|
---|
883 | */
|
---|
884 | MMR3DECL(int) MMR3PhysRegister(PVM pVM, void *pvRam, RTGCPHYS GCPhys, unsigned cb, unsigned fFlags, const char *pszDesc);
|
---|
885 |
|
---|
886 | /**
|
---|
887 | * Register externally allocated RAM for the virtual machine.
|
---|
888 | *
|
---|
889 | * The memory registered with the VM thru this interface must not be freed
|
---|
890 | * before the virtual machine has been destroyed. Bad things may happen... :-)
|
---|
891 | *
|
---|
892 | * @return VBox status code.
|
---|
893 | * @param pVM VM handle.
|
---|
894 | * @param pvRam Virtual address of the guest's physical memory range Must be page aligned.
|
---|
895 | * @param GCPhys The physical address the ram shall be registered at.
|
---|
896 | * @param cb Size of the memory. Must be page aligend.
|
---|
897 | * @param fFlags Flags of the MM_RAM_FLAGS_* defines.
|
---|
898 | * @param enmType Physical range type (MM_PHYS_TYPE_*)
|
---|
899 | * @param pszDesc Description of the memory.
|
---|
900 | * @thread The Emulation Thread.
|
---|
901 | * @todo update this description.
|
---|
902 | */
|
---|
903 | MMR3DECL(int) MMR3PhysRegisterEx(PVM pVM, void *pvRam, RTGCPHYS GCPhys, unsigned cb, unsigned fFlags, MMPHYSREG enmType, const char *pszDesc);
|
---|
904 |
|
---|
905 | /**
|
---|
906 | * Register previously registered externally allocated RAM for the virtual machine.
|
---|
907 | *
|
---|
908 | * Use this only for MMIO ranges or the guest will become very confused.
|
---|
909 | * The memory registered with the VM thru this interface must not be freed
|
---|
910 | * before the virtual machine has been destroyed. Bad things may happen... :-)
|
---|
911 | *
|
---|
912 | * @return VBox status code.
|
---|
913 | * @param pVM VM handle.
|
---|
914 | * @param GCPhysOld The physical address the ram was registered at.
|
---|
915 | * @param GCPhysNew The physical address the ram shall be registered at.
|
---|
916 | * @param cb Size of the memory. Must be page aligend.
|
---|
917 | * @thread The Emulation Thread.
|
---|
918 | */
|
---|
919 | MMR3DECL(int) MMR3PhysRelocate(PVM pVM, RTGCPHYS GCPhysOld, RTGCPHYS GCPhysNew, unsigned cb);
|
---|
920 |
|
---|
921 | /**
|
---|
922 | * Register a ROM (BIOS) region.
|
---|
923 | *
|
---|
924 | * It goes without saying that this is read-only memory. The memory region must be
|
---|
925 | * in unassigned memory. I.e. from the top of the address space or on the PC in
|
---|
926 | * the 0xa0000-0xfffff range.
|
---|
927 | *
|
---|
928 | * @returns VBox status.
|
---|
929 | * @param pVM VM Handle.
|
---|
930 | * @param pDevIns The device instance owning the ROM region.
|
---|
931 | * @param GCPhys First physical address in the range.
|
---|
932 | * Must be page aligned!
|
---|
933 | * @param cbRange The size of the range (in bytes).
|
---|
934 | * Must be page aligned!
|
---|
935 | * @param pvBinary Pointer to the binary data backing the ROM image.
|
---|
936 | * This must be cbRange bytes big.
|
---|
937 | * It will be copied and doesn't have to stick around.
|
---|
938 | * It will be copied and doesn't have to stick around if fShadow is clear.
|
---|
939 | * @param fShadow Whether to emulate ROM shadowing. This involves leaving
|
---|
940 | * the ROM writable for a while during the POST and refreshing
|
---|
941 | * it at reset. When this flag is set, the memory pointed to by
|
---|
942 | * pvBinary has to stick around for the lifespan of the VM.
|
---|
943 | * @param pszDesc Pointer to description string. This must not be freed.
|
---|
944 | * @remark There is no way to remove the rom, automatically on device cleanup or
|
---|
945 | * manually from the device yet. At present I doubt we need such features...
|
---|
946 | * @thread The Emulation Thread.
|
---|
947 | */
|
---|
948 | MMR3DECL(int) MMR3PhysRomRegister(PVM pVM, PPDMDEVINS pDevIns, RTGCPHYS GCPhys, RTUINT cbRange, const void *pvBinary, bool fShadow, const char *pszDesc);
|
---|
949 |
|
---|
950 | /**
|
---|
951 | * Write-protects a shadow ROM range.
|
---|
952 | *
|
---|
953 | * This is called late in the POST for shadow ROM ranges.
|
---|
954 | *
|
---|
955 | * @returns VBox status code.
|
---|
956 | * @param pVM The VM handle.
|
---|
957 | * @param GCPhys Start of the registered shadow ROM range
|
---|
958 | * @param cbRange The length of the registered shadow ROM range.
|
---|
959 | * This can be NULL (not sure about the BIOS interface yet).
|
---|
960 | */
|
---|
961 | MMR3DECL(int) MMR3PhysRomProtect(PVM pVM, RTGCPHYS GCPhys, RTUINT cbRange);
|
---|
962 |
|
---|
963 | /**
|
---|
964 | * Reserve physical address space for ROM and MMIO ranges.
|
---|
965 | *
|
---|
966 | * @returns VBox status code.
|
---|
967 | * @param pVM VM Handle.
|
---|
968 | * @param GCPhys Start physical address.
|
---|
969 | * @param cbRange The size of the range.
|
---|
970 | * @param pszDesc Description string.
|
---|
971 | * @thread The Emulation Thread.
|
---|
972 | */
|
---|
973 | MMR3DECL(int) MMR3PhysReserve(PVM pVM, RTGCPHYS GCPhys, RTUINT cbRange, const char *pszDesc);
|
---|
974 |
|
---|
975 | /**
|
---|
976 | * Get the size of the base RAM.
|
---|
977 | * This usually means the size of the first contigous block of physical memory.
|
---|
978 | *
|
---|
979 | * @returns
|
---|
980 | * @param pVM
|
---|
981 | * @thread Any.
|
---|
982 | */
|
---|
983 | MMR3DECL(uint64_t) MMR3PhysGetRamSize(PVM pVM);
|
---|
984 |
|
---|
985 |
|
---|
986 | /** @} */
|
---|
987 |
|
---|
988 |
|
---|
989 | /** @defgroup grp_mm_page Physical Page Pool
|
---|
990 | * @ingroup grp_mm_r3
|
---|
991 | * @{ */
|
---|
992 | /**
|
---|
993 | * Allocates a page from the page pool.
|
---|
994 | *
|
---|
995 | * This function may returns pages which has physical addresses any
|
---|
996 | * where. If you require a page to be within the first 4GB of physical
|
---|
997 | * memory, use MMR3PageAllocLow().
|
---|
998 | *
|
---|
999 | * @returns Pointer to the allocated page page.
|
---|
1000 | * @returns NULL on failure.
|
---|
1001 | * @param pVM VM handle.
|
---|
1002 | * @thread The Emulation Thread.
|
---|
1003 | */
|
---|
1004 | MMR3DECL(void *) MMR3PageAlloc(PVM pVM);
|
---|
1005 |
|
---|
1006 | /**
|
---|
1007 | * Allocates a page from the page pool and return its physical address.
|
---|
1008 | *
|
---|
1009 | * This function may returns pages which has physical addresses any
|
---|
1010 | * where. If you require a page to be within the first 4GB of physical
|
---|
1011 | * memory, use MMR3PageAllocLow().
|
---|
1012 | *
|
---|
1013 | * @returns Pointer to the allocated page page.
|
---|
1014 | * @returns NIL_RTHCPHYS on failure.
|
---|
1015 | * @param pVM VM handle.
|
---|
1016 | * @thread The Emulation Thread.
|
---|
1017 | */
|
---|
1018 | MMR3DECL(RTHCPHYS) MMR3PageAllocPhys(PVM pVM);
|
---|
1019 |
|
---|
1020 | /**
|
---|
1021 | * Frees a page allocated from the page pool by MMR3PageAlloc() and MMR3PageAllocPhys().
|
---|
1022 | *
|
---|
1023 | * @param pVM VM handle.
|
---|
1024 | * @param pvPage Pointer to the page.
|
---|
1025 | * @thread The Emulation Thread.
|
---|
1026 | */
|
---|
1027 | MMR3DECL(void) MMR3PageFree(PVM pVM, void *pvPage);
|
---|
1028 |
|
---|
1029 | /**
|
---|
1030 | * Allocates a page from the low page pool.
|
---|
1031 | *
|
---|
1032 | * @returns Pointer to the allocated page.
|
---|
1033 | * @returns NULL on failure.
|
---|
1034 | * @param pVM VM handle.
|
---|
1035 | * @thread The Emulation Thread.
|
---|
1036 | */
|
---|
1037 | MMR3DECL(void *) MMR3PageAllocLow(PVM pVM);
|
---|
1038 |
|
---|
1039 | /**
|
---|
1040 | * Frees a page allocated from the page pool by MMR3PageAllocLow().
|
---|
1041 | *
|
---|
1042 | * @param pVM VM handle.
|
---|
1043 | * @param pvPage Pointer to the page.
|
---|
1044 | * @thread The Emulation Thread.
|
---|
1045 | */
|
---|
1046 | MMR3DECL(void) MMR3PageFreeLow(PVM pVM, void *pvPage);
|
---|
1047 |
|
---|
1048 | /**
|
---|
1049 | * Free a page allocated from the page pool by physical address.
|
---|
1050 | * This works for pages allocated by MMR3PageAlloc(), MMR3PageAllocPhys()
|
---|
1051 | * and MMR3PageAllocLow().
|
---|
1052 | *
|
---|
1053 | * @param pVM VM handle.
|
---|
1054 | * @param HCPhysPage The physical address of the page to be freed.
|
---|
1055 | * @thread The Emulation Thread.
|
---|
1056 | */
|
---|
1057 | MMR3DECL(void) MMR3PageFreeByPhys(PVM pVM, RTHCPHYS HCPhysPage);
|
---|
1058 |
|
---|
1059 | /**
|
---|
1060 | * Gets the HC pointer to the dummy page.
|
---|
1061 | *
|
---|
1062 | * The dummy page is used as a place holder to prevent potential bugs
|
---|
1063 | * from doing really bad things to the system.
|
---|
1064 | *
|
---|
1065 | * @returns Pointer to the dummy page.
|
---|
1066 | * @param pVM VM handle.
|
---|
1067 | * @thread The Emulation Thread.
|
---|
1068 | */
|
---|
1069 | MMR3DECL(void *) MMR3PageDummyHCPtr(PVM pVM);
|
---|
1070 |
|
---|
1071 | /**
|
---|
1072 | * Gets the HC Phys to the dummy page.
|
---|
1073 | *
|
---|
1074 | * The dummy page is used as a place holder to prevent potential bugs
|
---|
1075 | * from doing really bad things to the system.
|
---|
1076 | *
|
---|
1077 | * @returns Pointer to the dummy page.
|
---|
1078 | * @param pVM VM handle.
|
---|
1079 | * @thread The Emulation Thread.
|
---|
1080 | */
|
---|
1081 | MMR3DECL(RTHCPHYS) MMR3PageDummyHCPhys(PVM pVM);
|
---|
1082 |
|
---|
1083 |
|
---|
1084 | #if 1 /* these are temporary wrappers and will be removed soon */
|
---|
1085 | /**
|
---|
1086 | * Allocates a Page Table.
|
---|
1087 | *
|
---|
1088 | * @returns Pointer to page table.
|
---|
1089 | * @returns NULL on failure.
|
---|
1090 | * @param pVM VM handle.
|
---|
1091 | * @deprecated Use MMR3PageAlloc().
|
---|
1092 | */
|
---|
1093 | DECLINLINE(PVBOXPT) MMR3PTAlloc(PVM pVM)
|
---|
1094 | {
|
---|
1095 | return (PVBOXPT)MMR3PageAlloc(pVM);
|
---|
1096 | }
|
---|
1097 |
|
---|
1098 | /**
|
---|
1099 | * Free a Page Table.
|
---|
1100 | *
|
---|
1101 | * @param pVM VM handle.
|
---|
1102 | * @param pPT Pointer to the page table as returned by MMR3PTAlloc().
|
---|
1103 | * @deprecated Use MMR3PageFree().
|
---|
1104 | */
|
---|
1105 | DECLINLINE(void) MMR3PTFree(PVM pVM, PVBOXPT pPT)
|
---|
1106 | {
|
---|
1107 | MMR3PageFree(pVM, pPT);
|
---|
1108 | }
|
---|
1109 |
|
---|
1110 | /**
|
---|
1111 | * Free a Page Table by physical address.
|
---|
1112 | *
|
---|
1113 | * @param pVM VM handle.
|
---|
1114 | * @param HCPhysPT The physical address of the page table to be freed.
|
---|
1115 | * @deprecated Use MMR3PageFreeByPhys().
|
---|
1116 | */
|
---|
1117 | DECLINLINE(void) MMR3PTFreeByPhys(PVM pVM, RTHCPHYS HCPhysPT)
|
---|
1118 | {
|
---|
1119 | MMR3PageFreeByPhys(pVM, HCPhysPT);
|
---|
1120 | }
|
---|
1121 |
|
---|
1122 | /**
|
---|
1123 | * Convert a Page Table address to a HC physical address.
|
---|
1124 | *
|
---|
1125 | * @returns Physical address for the specified page table.
|
---|
1126 | * @param pVM VM handle.
|
---|
1127 | * @param pPT Page table which physical address we query.
|
---|
1128 | * @deprecated Use MMR3Page2Phys().
|
---|
1129 | */
|
---|
1130 | DECLINLINE(RTHCPHYS) MMR3PT2Phys(PVM pVM, PVBOXPT pPT)
|
---|
1131 | {
|
---|
1132 | return MMPage2Phys(pVM, pPT);
|
---|
1133 | }
|
---|
1134 |
|
---|
1135 | /**
|
---|
1136 | * Convert a physical address to a page table address
|
---|
1137 | *
|
---|
1138 | * @returns Pointer to the page table at that physical address.
|
---|
1139 | * @param pVM VM handle.
|
---|
1140 | * @param PhysPT Page table which physical address we query.
|
---|
1141 | * @deprecated Use MMR3PagePhys2Page().
|
---|
1142 | */
|
---|
1143 | DECLINLINE(PVBOXPT) MMR3Phys2PT(PVM pVM, RTHCPHYS PhysPT)
|
---|
1144 | {
|
---|
1145 | return (PVBOXPT)MMPagePhys2Page(pVM, PhysPT);
|
---|
1146 | }
|
---|
1147 |
|
---|
1148 | /**
|
---|
1149 | * Allocate a Page Directory.
|
---|
1150 | *
|
---|
1151 | * @returns Pointer to the page directory.
|
---|
1152 | * @returns NULL on failure.
|
---|
1153 | * @param pVM VM handle.
|
---|
1154 | * @deprecated Use MMR3PageAlloc().
|
---|
1155 | */
|
---|
1156 | DECLINLINE(PVBOXPD) MMR3PDAlloc(PVM pVM)
|
---|
1157 | {
|
---|
1158 | return (PVBOXPD)MMR3PageAlloc(pVM);
|
---|
1159 | }
|
---|
1160 |
|
---|
1161 | /**
|
---|
1162 | * Free a Page Directory.
|
---|
1163 | *
|
---|
1164 | * @param pVM VM handle.
|
---|
1165 | * @param pPD Pointer to the page directory allocated by MMR3PDAlloc().
|
---|
1166 | * @deprecated Use MMR3PageFree().
|
---|
1167 | */
|
---|
1168 | DECLINLINE(void) MMR3PDFree(PVM pVM, PVBOXPD pPD)
|
---|
1169 | {
|
---|
1170 | MMR3PageFree(pVM, pPD);
|
---|
1171 | }
|
---|
1172 |
|
---|
1173 | /**
|
---|
1174 | * Convert a Page Directory address to a physical address.
|
---|
1175 | *
|
---|
1176 | * @returns Physical address for the specified page directory.
|
---|
1177 | * @param pVM VM handle.
|
---|
1178 | * @param pPD Page directory which physical address we query.
|
---|
1179 | * Allocated by MMR3PDAlloc().
|
---|
1180 | * @deprecated Use MMR3Page2Phys().
|
---|
1181 | */
|
---|
1182 | DECLINLINE(RTHCPHYS) MMR3PD2Phys(PVM pVM, PVBOXPD pPD)
|
---|
1183 | {
|
---|
1184 | return MMPage2Phys(pVM, pPD);
|
---|
1185 | }
|
---|
1186 |
|
---|
1187 | /**
|
---|
1188 | * Convert a physical address to a page directory address
|
---|
1189 | *
|
---|
1190 | * @returns Pointer to the page directory at that physical address.
|
---|
1191 | * @param pVM VM handle.
|
---|
1192 | * @param PhysPD Physical address of page directory.
|
---|
1193 | * Allocated by MMR3PDAlloc().
|
---|
1194 | * @deprecated Use MMR3PageAlloc().
|
---|
1195 | */
|
---|
1196 | DECLINLINE(PVBOXPD) MMR3Phys2PD(PVM pVM, RTHCPHYS PhysPD)
|
---|
1197 | {
|
---|
1198 | return (PVBOXPD)MMPagePhys2Page(pVM, PhysPD);
|
---|
1199 | }
|
---|
1200 |
|
---|
1201 | /** @deprecated */
|
---|
1202 | DECLINLINE(void *) MMR3DummyPageHCPtr(PVM pVM) { return MMR3PageDummyHCPtr(pVM); }
|
---|
1203 | /** @deprecated */
|
---|
1204 | DECLINLINE(RTHCPHYS) MMR3DummyPageHCPhys(PVM pVM) { return MMR3PageDummyHCPhys(pVM); }
|
---|
1205 |
|
---|
1206 | #endif /* will be removed */
|
---|
1207 |
|
---|
1208 | /** @} */
|
---|
1209 |
|
---|
1210 |
|
---|
1211 | /** @defgroup grp_mm_heap Heap Manager
|
---|
1212 | * @ingroup grp_mm_r3
|
---|
1213 | * @{ */
|
---|
1214 |
|
---|
1215 | /**
|
---|
1216 | * Allocate memory associating it with the VM for collective cleanup.
|
---|
1217 | *
|
---|
1218 | * The memory will be allocated from the default heap but a header
|
---|
1219 | * is added in which we keep track of which VM it belongs to and chain
|
---|
1220 | * all the allocations together so they can be freed in a one go.
|
---|
1221 | *
|
---|
1222 | * This interface is typically used for memory block which will not be
|
---|
1223 | * freed during the life of the VM.
|
---|
1224 | *
|
---|
1225 | * @returns Pointer to allocated memory.
|
---|
1226 | * @param pVM VM handle.
|
---|
1227 | * @param enmTag Statistics tag. Statistics are collected on a per tag
|
---|
1228 | * basis in addition to a global one. Thus we can easily
|
---|
1229 | * identify how memory is used by the VM.
|
---|
1230 | * @param cbSize Size of the block.
|
---|
1231 | * @thread Any thread.
|
---|
1232 | */
|
---|
1233 | MMR3DECL(void *) MMR3HeapAlloc(PVM pVM, MMTAG enmTag, size_t cbSize);
|
---|
1234 |
|
---|
1235 | /**
|
---|
1236 | * Same as MMR3HeapAlloc().
|
---|
1237 | *
|
---|
1238 | *
|
---|
1239 | * @returns Pointer to allocated memory.
|
---|
1240 | * @param pVM VM handle.
|
---|
1241 | * @param enmTag Statistics tag. Statistics are collected on a per tag
|
---|
1242 | * basis in addition to a global one. Thus we can easily
|
---|
1243 | * identify how memory is used by the VM.
|
---|
1244 | * @param cbSize Size of the block.
|
---|
1245 | * @param ppv Where to store the pointer to the allocated memory on success.
|
---|
1246 | * @thread Any thread.
|
---|
1247 | */
|
---|
1248 | MMR3DECL(int) MMR3HeapAllocEx(PVM pVM, MMTAG enmTag, size_t cbSize, void **ppv);
|
---|
1249 |
|
---|
1250 | /**
|
---|
1251 | * Same as MMR3HeapAlloc() only the memory is zeroed.
|
---|
1252 | *
|
---|
1253 | *
|
---|
1254 | * @returns Pointer to allocated memory.
|
---|
1255 | * @param pVM VM handle.
|
---|
1256 | * @param enmTag Statistics tag. Statistics are collected on a per tag
|
---|
1257 | * basis in addition to a global one. Thus we can easily
|
---|
1258 | * identify how memory is used by the VM.
|
---|
1259 | * @param cbSize Size of the block.
|
---|
1260 | * @thread Any thread.
|
---|
1261 | */
|
---|
1262 | MMR3DECL(void *) MMR3HeapAllocZ(PVM pVM, MMTAG enmTag, size_t cbSize);
|
---|
1263 |
|
---|
1264 | /**
|
---|
1265 | * Same as MMR3HeapAllocZ().
|
---|
1266 | *
|
---|
1267 | *
|
---|
1268 | * @returns Pointer to allocated memory.
|
---|
1269 | * @param pVM VM handle.
|
---|
1270 | * @param enmTag Statistics tag. Statistics are collected on a per tag
|
---|
1271 | * basis in addition to a global one. Thus we can easily
|
---|
1272 | * identify how memory is used by the VM.
|
---|
1273 | * @param cbSize Size of the block.
|
---|
1274 | * @param ppv Where to store the pointer to the allocated memory on success.
|
---|
1275 | * @thread Any thread.
|
---|
1276 | */
|
---|
1277 | MMR3DECL(int) MMR3HeapAllocZEx(PVM pVM, MMTAG enmTag, size_t cbSize, void **ppv);
|
---|
1278 |
|
---|
1279 | /**
|
---|
1280 | * Reallocate memory allocated with MMR3HeapAlloc() or MMR3HeapRealloc().
|
---|
1281 | *
|
---|
1282 | * @returns Pointer to reallocated memory.
|
---|
1283 | * @param pv Pointer to the memory block to reallocate.
|
---|
1284 | * Must not be NULL!
|
---|
1285 | * @param cbNewSize New block size.
|
---|
1286 | * @thread Any thread.
|
---|
1287 | */
|
---|
1288 | MMR3DECL(void *) MMR3HeapRealloc(void *pv, size_t cbNewSize);
|
---|
1289 |
|
---|
1290 | /**
|
---|
1291 | * Duplicates the specified string.
|
---|
1292 | *
|
---|
1293 | * @returns Pointer to the duplicate.
|
---|
1294 | * @returns NULL on failure or when input NULL.
|
---|
1295 | * @param pVM The VM handle.
|
---|
1296 | * @param enmTag Statistics tag. Statistics are collected on a per tag
|
---|
1297 | * basis in addition to a global one. Thus we can easily
|
---|
1298 | * identify how memory is used by the VM.
|
---|
1299 | * @param psz The string to duplicate. NULL is allowed.
|
---|
1300 | */
|
---|
1301 | MMR3DECL(char *) MMR3HeapStrDup(PVM pVM, MMTAG enmTag, const char *psz);
|
---|
1302 |
|
---|
1303 | /**
|
---|
1304 | * Releases memory allocated with MMR3HeapAlloc() or MMR3HeapRealloc().
|
---|
1305 | *
|
---|
1306 | * @param pv Pointer to the memory block to free.
|
---|
1307 | * @thread Any thread.
|
---|
1308 | */
|
---|
1309 | MMR3DECL(void) MMR3HeapFree(void *pv);
|
---|
1310 |
|
---|
1311 | /** @} */
|
---|
1312 |
|
---|
1313 | /** @} */
|
---|
1314 | #endif
|
---|
1315 |
|
---|
1316 |
|
---|
1317 |
|
---|
1318 | #ifdef IN_GC
|
---|
1319 | /** @defgroup grp_mm_gc The MM Guest Context API
|
---|
1320 | * @ingroup grp_mm
|
---|
1321 | * @{
|
---|
1322 | */
|
---|
1323 |
|
---|
1324 | /**
|
---|
1325 | * Install MMGCRam Hypervisor page fault handler for normal working
|
---|
1326 | * of MMGCRamRead and MMGCRamWrite calls.
|
---|
1327 | * This handler will be automatically removed at page fault.
|
---|
1328 | * In other case it must be removed by MMGCRamDeregisterTrapHandler call.
|
---|
1329 | *
|
---|
1330 | * @param pVM VM handle.
|
---|
1331 | */
|
---|
1332 | MMGCDECL(void) MMGCRamRegisterTrapHandler(PVM pVM);
|
---|
1333 |
|
---|
1334 | /**
|
---|
1335 | * Remove MMGCRam Hypervisor page fault handler.
|
---|
1336 | * See description of MMGCRamRegisterTrapHandler call.
|
---|
1337 | *
|
---|
1338 | * @param pVM VM handle.
|
---|
1339 | */
|
---|
1340 | MMGCDECL(void) MMGCRamDeregisterTrapHandler(PVM pVM);
|
---|
1341 |
|
---|
1342 | /**
|
---|
1343 | * Read data in guest context with \#PF control.
|
---|
1344 | * MMRamGC page fault handler must be installed prior this call for safe operation.
|
---|
1345 | * Use MMGCRamRegisterTrapHandler() call for this task.
|
---|
1346 | *
|
---|
1347 | * @returns VBox status.
|
---|
1348 | * @param pDst Where to store the readed data.
|
---|
1349 | * @param pSrc Pointer to the data to read.
|
---|
1350 | * @param cb Size of data to read, only 1/2/4/8 is valid.
|
---|
1351 | */
|
---|
1352 | MMGCDECL(int) MMGCRamReadNoTrapHandler(void *pDst, void *pSrc, size_t cb);
|
---|
1353 |
|
---|
1354 | /**
|
---|
1355 | * Write data in guest context with \#PF control.
|
---|
1356 | * MMRamGC page fault handler must be installed prior this call for safe operation.
|
---|
1357 | * Use MMGCRamRegisterTrapHandler() call for this task.
|
---|
1358 | *
|
---|
1359 | * @returns VBox status.
|
---|
1360 | * @param pDst Where to write the data.
|
---|
1361 | * @param pSrc Pointer to the data to write.
|
---|
1362 | * @param cb Size of data to write, only 1/2/4 is valid.
|
---|
1363 | */
|
---|
1364 | MMGCDECL(int) MMGCRamWriteNoTrapHandler(void *pDst, void *pSrc, size_t cb);
|
---|
1365 |
|
---|
1366 | /**
|
---|
1367 | * Read data in guest context with \#PF control.
|
---|
1368 | *
|
---|
1369 | * @returns VBox status.
|
---|
1370 | * @param pVM The VM handle.
|
---|
1371 | * @param pDst Where to store the readed data.
|
---|
1372 | * @param pSrc Pointer to the data to read.
|
---|
1373 | * @param cb Size of data to read, only 1/2/4/8 is valid.
|
---|
1374 | */
|
---|
1375 | MMGCDECL(int) MMGCRamRead(PVM pVM, void *pDst, void *pSrc, size_t cb);
|
---|
1376 |
|
---|
1377 | /**
|
---|
1378 | * Write data in guest context with \#PF control.
|
---|
1379 | *
|
---|
1380 | * @returns VBox status.
|
---|
1381 | * @param pVM The VM handle.
|
---|
1382 | * @param pDst Where to write the data.
|
---|
1383 | * @param pSrc Pointer to the data to write.
|
---|
1384 | * @param cb Size of data to write, only 1/2/4 is valid.
|
---|
1385 | */
|
---|
1386 | MMGCDECL(int) MMGCRamWrite(PVM pVM, void *pDst, void *pSrc, size_t cb);
|
---|
1387 |
|
---|
1388 | /** @} */
|
---|
1389 | #endif
|
---|
1390 |
|
---|
1391 | /** @} */
|
---|
1392 | __END_DECLS
|
---|
1393 |
|
---|
1394 |
|
---|
1395 | #endif
|
---|
1396 |
|
---|