VirtualBox

source: vbox/trunk/include/VBox/gmm.h@ 28434

Last change on this file since 28434 was 28434, checked in by vboxsync, 15 years ago

*: whitespace cleanups by scm and two manually picked nits.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 20.4 KB
Line 
1/** @file
2 * GMM - The Global Memory Manager. (VMM)
3 */
4
5/*
6 * Copyright (C) 2007 Sun Microsystems, Inc.
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 * 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.
28 */
29
30#ifndef ___VBox_gmm_h
31#define ___VBox_gmm_h
32
33#include <VBox/types.h>
34#include <VBox/gvmm.h>
35#include <VBox/sup.h>
36#include <VBox/VMMDev.h> /* for VMMDEVSHAREDREGIONDESC */
37
38RT_C_DECLS_BEGIN
39
40/** @defgroup grp_gmm GMM - The Global Memory Manager
41 * @{
42 */
43
44/** @def IN_GMM_R0
45 * Used to indicate whether we're inside the same link module as the ring 0
46 * part of the Global Memory Manager or not.
47 */
48#ifdef DOXYGEN_RUNNING
49# define IN_GMM_R0
50#endif
51/** @def GMMR0DECL
52 * Ring 0 GMM export or import declaration.
53 * @param type The return type of the function declaration.
54 */
55#ifdef IN_GMM_R0
56# define GMMR0DECL(type) DECLEXPORT(type) VBOXCALL
57#else
58# define GMMR0DECL(type) DECLIMPORT(type) VBOXCALL
59#endif
60
61/** @def IN_GMM_R3
62 * Used to indicate whether we're inside the same link module as the ring 3
63 * part of the Global Memory Manager or not.
64 */
65#ifdef DOXYGEN_RUNNING
66# define IN_GMM_R3
67#endif
68/** @def GMMR3DECL
69 * Ring 3 GMM export or import declaration.
70 * @param type The return type of the function declaration.
71 */
72#ifdef IN_GMM_R3
73# define GMMR3DECL(type) DECLEXPORT(type) VBOXCALL
74#else
75# define GMMR3DECL(type) DECLIMPORT(type) VBOXCALL
76#endif
77
78
79/** The chunk shift. (2^21 = 2 MB) */
80#define GMM_CHUNK_SHIFT 21
81/** The allocation chunk size. */
82#define GMM_CHUNK_SIZE (1U << GMM_CHUNK_SHIFT)
83/** The allocation chunk size in pages. */
84#define GMM_CHUNK_NUM_PAGES (1U << (GMM_CHUNK_SHIFT - PAGE_SHIFT))
85/** The shift factor for converting a page id into a chunk id. */
86#define GMM_CHUNKID_SHIFT (GMM_CHUNK_SHIFT - PAGE_SHIFT)
87/** The last valid Chunk ID value. */
88#define GMM_CHUNKID_LAST (GMM_PAGEID_LAST >> GMM_CHUNKID_SHIFT)
89/** The last valid Page ID value.
90 * The current limit is 2^28 - 1, or almost 1TB if you like.
91 * The constraints are currently dictated by PGMPAGE. */
92#define GMM_PAGEID_LAST (RT_BIT_32(28) - 1)
93/** Mask out the page index from the Page ID. */
94#define GMM_PAGEID_IDX_MASK ((1U << GMM_CHUNKID_SHIFT) - 1)
95/** The NIL Chunk ID value. */
96#define NIL_GMM_CHUNKID 0
97/** The NIL Page ID value. */
98#define NIL_GMM_PAGEID 0
99
100#if 0 /* wrong - these are guest page pfns and not page ids! */
101/** Special Page ID used by unassigned pages. */
102#define GMM_PAGEID_UNASSIGNED 0x0fffffffU
103/** Special Page ID used by unsharable pages.
104 * Like MMIO2, shadow and heap. This is for later, obviously. */
105#define GMM_PAGEID_UNSHARABLE 0x0ffffffeU
106/** The end of the valid Page IDs. This is the first special one. */
107#define GMM_PAGEID_END 0x0ffffff0U
108#endif
109
110
111/** @def GMM_GCPHYS_LAST
112 * The last of the valid guest physical address as it applies to GMM pages.
113 *
114 * This must reflect the constraints imposed by the RTGCPHYS type and
115 * the guest page frame number used internally in GMMPAGE.
116 *
117 * @note Note this corresponds to GMM_PAGE_PFN_LAST. */
118#if HC_ARCH_BITS == 64
119# define GMM_GCPHYS_LAST UINT64_C(0x00000fffffff0000) /* 2^44 (16TB) - 0x10000 */
120#else
121# define GMM_GCPHYS_LAST UINT64_C(0x0000000fffff0000) /* 2^36 (64GB) - 0x10000 */
122#endif
123
124/**
125 * Over-commitment policy.
126 */
127typedef enum GMMOCPOLICY
128{
129 /** The usual invalid 0 value. */
130 GMMOCPOLICY_INVALID = 0,
131 /** No over-commitment, fully backed.
132 * The GMM guarantees that it will be able to allocate all of the
133 * guest RAM for a VM with OC policy. */
134 GMMOCPOLICY_NO_OC,
135 /** to-be-determined. */
136 GMMOCPOLICY_TBD,
137 /** The end of the valid policy range. */
138 GMMOCPOLICY_END,
139 /** The usual 32-bit hack. */
140 GMMOCPOLICY_32BIT_HACK = 0x7fffffff
141} GMMOCPOLICY;
142
143/**
144 * VM / Memory priority.
145 */
146typedef enum GMMPRIORITY
147{
148 /** The usual invalid 0 value. */
149 GMMPRIORITY_INVALID = 0,
150 /** High.
151 * When ballooning, ask these VMs last.
152 * When running out of memory, try not to interrupt these VMs. */
153 GMMPRIORITY_HIGH,
154 /** Normal.
155 * When ballooning, don't wait to ask these.
156 * When running out of memory, pause, save and/or kill these VMs. */
157 GMMPRIORITY_NORMAL,
158 /** Low.
159 * When ballooning, maximize these first.
160 * When running out of memory, save or kill these VMs. */
161 GMMPRIORITY_LOW,
162 /** The end of the valid priority range. */
163 GMMPRIORITY_END,
164 /** The custom 32-bit type blowup. */
165 GMMPRIORITY_32BIT_HACK = 0x7fffffff
166} GMMPRIORITY;
167
168
169/**
170 * GMM Memory Accounts.
171 */
172typedef enum GMMACCOUNT
173{
174 /** The customary invalid zero entry. */
175 GMMACCOUNT_INVALID = 0,
176 /** Account with the base allocations. */
177 GMMACCOUNT_BASE,
178 /** Account with the shadow allocations. */
179 GMMACCOUNT_SHADOW,
180 /** Account with the fixed allocations. */
181 GMMACCOUNT_FIXED,
182 /** The end of the valid values. */
183 GMMACCOUNT_END,
184 /** The usual 32-bit value to finish it off. */
185 GMMACCOUNT_32BIT_HACK = 0x7fffffff
186} GMMACCOUNT;
187
188
189/**
190 * Balloon actions.
191 */
192typedef enum
193{
194 /** Invalid zero entry. */
195 GMMBALLOONACTION_INVALID = 0,
196 /** Inflate the balloon. */
197 GMMBALLOONACTION_INFLATE,
198 /** Deflate the balloon. */
199 GMMBALLOONACTION_DEFLATE,
200 /** Puncture the balloon because of VM reset. */
201 GMMBALLOONACTION_RESET,
202 /** End of the valid actions. */
203 GMMBALLOONACTION_END,
204 /** hack forcing the size of the enum to 32-bits. */
205 GMMBALLOONACTION_MAKE_32BIT_HACK = 0x7fffffff
206} GMMBALLOONACTION;
207
208
209/**
210 * A page descriptor for use when freeing pages.
211 * See GMMR0FreePages, GMMR0BalloonedPages.
212 */
213typedef struct GMMFREEPAGEDESC
214{
215 /** The Page ID of the page to be freed. */
216 uint32_t idPage;
217} GMMFREEPAGEDESC;
218/** Pointer to a page descriptor for freeing pages. */
219typedef GMMFREEPAGEDESC *PGMMFREEPAGEDESC;
220
221
222/**
223 * A page descriptor for use when updating and allocating pages.
224 *
225 * This is a bit complicated because we want to do as much as possible
226 * with the same structure.
227 */
228typedef struct GMMPAGEDESC
229{
230 /** The physical address of the page.
231 *
232 * @input GMMR0AllocateHandyPages expects the guest physical address
233 * to update the GMMPAGE structure with. Pass GMM_GCPHYS_UNSHAREABLE
234 * when appropriate and NIL_RTHCPHYS when the page wasn't used
235 * for any specific guest address.
236 *
237 * GMMR0AllocatePage expects the guest physical address to put in
238 * the GMMPAGE structure for the page it allocates for this entry.
239 * Pass NIL_RTHCPHYS and GMM_GCPHYS_UNSHAREABLE as above.
240 *
241 * @output The host physical address of the allocated page.
242 * NIL_RTHCPHYS on allocation failure.
243 *
244 * ASSUMES: sizeof(RTHCPHYS) >= sizeof(RTGCPHYS).
245 */
246 RTHCPHYS HCPhysGCPhys;
247
248 /** The Page ID.
249 *
250 * @intput GMMR0AllocateHandyPages expects the Page ID of the page to
251 * update here. NIL_GMM_PAGEID means no page should be updated.
252 *
253 * GMMR0AllocatePages requires this to be initialized to
254 * NIL_GMM_PAGEID currently.
255 *
256 * @output The ID of the page, NIL_GMM_PAGEID if the allocation failed.
257 */
258 uint32_t idPage;
259
260 /** The Page ID of the shared page was replaced by this page.
261 *
262 * @input GMMR0AllocateHandyPages expects this to indicate a shared
263 * page that has been replaced by this page and should have its
264 * reference counter decremented and perhaps be freed up. Use
265 * NIL_GMM_PAGEID if no shared page was involved.
266 *
267 * All other APIs expects NIL_GMM_PAGEID here.
268 *
269 * @output All APIs sets this to NIL_GMM_PAGEID.
270 */
271 uint32_t idSharedPage;
272} GMMPAGEDESC;
273AssertCompileSize(GMMPAGEDESC, 16);
274/** Pointer to a page allocation. */
275typedef GMMPAGEDESC *PGMMPAGEDESC;
276
277/** GMMPAGEDESC::HCPhysGCPhys value that indicates that the page is unsharable.
278 * @note This corresponds to GMM_PAGE_PFN_UNSHAREABLE. */
279#if HC_ARCH_BITS == 64
280# define GMM_GCPHYS_UNSHAREABLE UINT64_C(0x00000fffffff1000)
281#else
282# define GMM_GCPHYS_UNSHAREABLE UINT64_C(0x0000000fffff1000)
283#endif
284
285GMMR0DECL(int) GMMR0Init(void);
286GMMR0DECL(void) GMMR0Term(void);
287GMMR0DECL(void) GMMR0InitPerVMData(PGVM pGVM);
288GMMR0DECL(void) GMMR0CleanupVM(PGVM pGVM);
289GMMR0DECL(int) GMMR0InitialReservation(PVM pVM, VMCPUID idCpu, uint64_t cBasePages, uint32_t cShadowPages, uint32_t cFixedPages,
290 GMMOCPOLICY enmPolicy, GMMPRIORITY enmPriority);
291GMMR0DECL(int) GMMR0UpdateReservation(PVM pVM, VMCPUID idCpu, uint64_t cBasePages, uint32_t cShadowPages, uint32_t cFixedPages);
292GMMR0DECL(int) GMMR0AllocateHandyPages(PVM pVM, VMCPUID idCpu, uint32_t cPagesToUpdate, uint32_t cPagesToAlloc, PGMMPAGEDESC paPages);
293GMMR0DECL(int) GMMR0AllocatePages(PVM pVM, VMCPUID idCpu, uint32_t cPages, PGMMPAGEDESC paPages, GMMACCOUNT enmAccount);
294GMMR0DECL(int) GMMR0AllocateLargePage(PVM pVM, VMCPUID idCpu, uint32_t cbPage, uint32_t *pIdPage, RTHCPHYS *pHCPhys);
295GMMR0DECL(int) GMMR0FreePages(PVM pVM, VMCPUID idCpu, uint32_t cPages, PGMMFREEPAGEDESC paPages, GMMACCOUNT enmAccount);
296GMMR0DECL(int) GMMR0FreeLargePage(PVM pVM, VMCPUID idCpu, uint32_t idPage);
297GMMR0DECL(int) GMMR0BalloonedPages(PVM pVM, VMCPUID idCpu, GMMBALLOONACTION enmAction, uint32_t cBalloonedPages);
298GMMR0DECL(int) GMMR0MapUnmapChunk(PVM pVM, VMCPUID idCpu, uint32_t idChunkMap, uint32_t idChunkUnmap, PRTR3PTR ppvR3);
299GMMR0DECL(int) GMMR0SeedChunk(PVM pVM, VMCPUID idCpu, RTR3PTR pvR3);
300GMMR0DECL(int) GMMR0RegisterSharedModule(PVM pVM, VMCPUID idCpu, char *pszModuleName, char *pszVersion, RTGCPTR GCBaseAddr, uint32_t cbModule, unsigned cRegions, VMMDEVSHAREDREGIONDESC *pRegions);
301GMMR0DECL(int) GMMR0UnregisterSharedModule(PVM pVM, VMCPUID idCpu, char *pszModuleName, char *pszVersion, RTGCPTR GCBaseAddr, uint32_t cbModule);
302GMMR0DECL(int) GMMR0CheckSharedModules(PVM pVM, VMCPUID idCpu);
303
304
305
306/**
307 * Request buffer for GMMR0InitialReservationReq / VMMR0_DO_GMM_INITIAL_RESERVATION.
308 * @see GMMR0InitialReservation
309 */
310typedef struct GMMINITIALRESERVATIONREQ
311{
312 /** The header. */
313 SUPVMMR0REQHDR Hdr;
314 uint64_t cBasePages; /**< @see GMMR0InitialReservation */
315 uint32_t cShadowPages; /**< @see GMMR0InitialReservation */
316 uint32_t cFixedPages; /**< @see GMMR0InitialReservation */
317 GMMOCPOLICY enmPolicy; /**< @see GMMR0InitialReservation */
318 GMMPRIORITY enmPriority; /**< @see GMMR0InitialReservation */
319} GMMINITIALRESERVATIONREQ;
320/** Pointer to a GMMR0InitialReservationReq / VMMR0_DO_GMM_INITIAL_RESERVATION request buffer. */
321typedef GMMINITIALRESERVATIONREQ *PGMMINITIALRESERVATIONREQ;
322
323GMMR0DECL(int) GMMR0InitialReservationReq(PVM pVM, VMCPUID idCpu, PGMMINITIALRESERVATIONREQ pReq);
324
325
326/**
327 * Request buffer for GMMR0UpdateReservationReq / VMMR0_DO_GMM_UPDATE_RESERVATION.
328 * @see GMMR0UpdateReservation
329 */
330typedef struct GMMUPDATERESERVATIONREQ
331{
332 /** The header. */
333 SUPVMMR0REQHDR Hdr;
334 uint64_t cBasePages; /**< @see GMMR0UpdateReservation */
335 uint32_t cShadowPages; /**< @see GMMR0UpdateReservation */
336 uint32_t cFixedPages; /**< @see GMMR0UpdateReservation */
337} GMMUPDATERESERVATIONREQ;
338/** Pointer to a GMMR0InitialReservationReq / VMMR0_DO_GMM_INITIAL_RESERVATION request buffer. */
339typedef GMMUPDATERESERVATIONREQ *PGMMUPDATERESERVATIONREQ;
340
341GMMR0DECL(int) GMMR0UpdateReservationReq(PVM pVM, VMCPUID idCpu, PGMMUPDATERESERVATIONREQ pReq);
342
343
344/**
345 * Request buffer for GMMR0AllocatePagesReq / VMMR0_DO_GMM_ALLOCATE_PAGES.
346 * @see GMMR0AllocatePages.
347 */
348typedef struct GMMALLOCATEPAGESREQ
349{
350 /** The header. */
351 SUPVMMR0REQHDR Hdr;
352 /** The account to charge the allocation to. */
353 GMMACCOUNT enmAccount;
354 /** The number of pages to allocate. */
355 uint32_t cPages;
356 /** Array of page descriptors. */
357 GMMPAGEDESC aPages[1];
358} GMMALLOCATEPAGESREQ;
359/** Pointer to a GMMR0AllocatePagesReq / VMMR0_DO_GMM_ALLOCATE_PAGES request buffer. */
360typedef GMMALLOCATEPAGESREQ *PGMMALLOCATEPAGESREQ;
361
362GMMR0DECL(int) GMMR0AllocatePagesReq(PVM pVM, VMCPUID idCpu, PGMMALLOCATEPAGESREQ pReq);
363
364
365/**
366 * Request buffer for GMMR0FreePagesReq / VMMR0_DO_GMM_FREE_PAGES.
367 * @see GMMR0FreePages.
368 */
369typedef struct GMMFREEPAGESREQ
370{
371 /** The header. */
372 SUPVMMR0REQHDR Hdr;
373 /** The account this relates to. */
374 GMMACCOUNT enmAccount;
375 /** The number of pages to free. */
376 uint32_t cPages;
377 /** Array of free page descriptors. */
378 GMMFREEPAGEDESC aPages[1];
379} GMMFREEPAGESREQ;
380/** Pointer to a GMMR0FreePagesReq / VMMR0_DO_GMM_FREE_PAGES request buffer. */
381typedef GMMFREEPAGESREQ *PGMMFREEPAGESREQ;
382
383GMMR0DECL(int) GMMR0FreePagesReq(PVM pVM, VMCPUID idCpu, PGMMFREEPAGESREQ pReq);
384
385/**
386 * Request buffer for GMMR0BalloonedPagesReq / VMMR0_DO_GMM_BALLOONED_PAGES.
387 * @see GMMR0BalloonedPages.
388 */
389typedef struct GMMBALLOONEDPAGESREQ
390{
391 /** The header. */
392 SUPVMMR0REQHDR Hdr;
393 /** The number of ballooned pages. */
394 uint32_t cBalloonedPages;
395 /** Inflate or deflate the balloon. */
396 GMMBALLOONACTION enmAction;
397} GMMBALLOONEDPAGESREQ;
398/** Pointer to a GMMR0BalloonedPagesReq / VMMR0_DO_GMM_BALLOONED_PAGES request buffer. */
399typedef GMMBALLOONEDPAGESREQ *PGMMBALLOONEDPAGESREQ;
400
401GMMR0DECL(int) GMMR0BalloonedPagesReq(PVM pVM, VMCPUID idCpu, PGMMBALLOONEDPAGESREQ pReq);
402
403
404/**
405 * Request buffer for GMMR0QueryVMMMemoryStatsReq / VMMR0_DO_GMM_QUERY_VMM_MEM_STATS.
406 * @see GMMR0QueryVMMMemoryStatsReq.
407 */
408typedef struct GMMMEMSTATSREQ
409{
410 /** The header. */
411 SUPVMMR0REQHDR Hdr;
412 /** The number of allocated pages (out). */
413 uint64_t cAllocPages;
414 /** The number of free pages (out). */
415 uint64_t cFreePages;
416 /** The number of ballooned pages (out). */
417 uint64_t cBalloonedPages;
418} GMMMEMSTATSREQ;
419/** Pointer to a GMMR0QueryVMMMemoryStatsReq / VMMR0_DO_GMM_QUERY_VMM_MEM_STATS request buffer. */
420typedef GMMMEMSTATSREQ *PGMMMEMSTATSREQ;
421
422GMMR0DECL(int) GMMR0QueryVMMMemoryStatsReq(PVM pVM, PGMMMEMSTATSREQ pReq);
423
424/**
425 * Request buffer for GMMR0MapUnmapChunkReq / VMMR0_DO_GMM_MAP_UNMAP_CHUNK.
426 * @see GMMR0MapUnmapChunk
427 */
428typedef struct GMMMAPUNMAPCHUNKREQ
429{
430 /** The header. */
431 SUPVMMR0REQHDR Hdr;
432 /** The chunk to map, NIL_GMM_CHUNKID if unmap only. (IN) */
433 uint32_t idChunkMap;
434 /** The chunk to unmap, NIL_GMM_CHUNKID if map only. (IN) */
435 uint32_t idChunkUnmap;
436 /** Where the mapping address is returned. (OUT) */
437 RTR3PTR pvR3;
438} GMMMAPUNMAPCHUNKREQ;
439/** Pointer to a GMMR0MapUnmapChunkReq / VMMR0_DO_GMM_MAP_UNMAP_CHUNK request buffer. */
440typedef GMMMAPUNMAPCHUNKREQ *PGMMMAPUNMAPCHUNKREQ;
441
442GMMR0DECL(int) GMMR0MapUnmapChunkReq(PVM pVM, VMCPUID idCpu, PGMMMAPUNMAPCHUNKREQ pReq);
443
444
445/**
446 * Request buffer for GMMR0FreeLargePageReq / VMMR0_DO_GMM_FREE_LARGE_PAGE.
447 * @see GMMR0FreeLargePage.
448 */
449typedef struct GMMFREELARGEPAGEREQ
450{
451 /** The header. */
452 SUPVMMR0REQHDR Hdr;
453 /** The Page ID. */
454 uint32_t idPage;
455} GMMFREELARGEPAGEREQ;
456/** Pointer to a GMMR0FreePagesReq / VMMR0_DO_GMM_FREE_PAGES request buffer. */
457typedef GMMFREELARGEPAGEREQ *PGMMFREELARGEPAGEREQ;
458
459GMMR0DECL(int) GMMR0FreeLargePageReq(PVM pVM, VMCPUID idCpu, PGMMFREELARGEPAGEREQ pReq);
460
461/**
462 * Request buffer for GMMR0RegisterSharedModuleReq / VMMR0_DO_GMM_REGISTER_SHARED_MODULE.
463 * @see GMMR0RegisterSharedModule.
464 */
465typedef struct GMMREGISTERSHAREDMODULEREQ
466{
467 /** The header. */
468 SUPVMMR0REQHDR Hdr;
469 /** Shared module size. */
470 uint32_t cbModule;
471 /** Number of included region descriptors */
472 uint32_t cRegions;
473 /** Base address of the shared module. */
474 RTGCPTR64 GCBaseAddr;
475 /** Module name */
476 char szName[128];
477 /** Module version */
478 char szVersion[16];
479 /** Shared region descriptor(s). */
480 VMMDEVSHAREDREGIONDESC aRegions[1];
481} GMMREGISTERSHAREDMODULEREQ;
482/** Pointer to a GMMR0RegisterSharedModuleReq / VMMR0_DO_GMM_REGISTER_SHARED_MODULE request buffer. */
483typedef GMMREGISTERSHAREDMODULEREQ *PGMMREGISTERSHAREDMODULEREQ;
484
485GMMR0DECL(int) GMMR0RegisterSharedModuleReq(PVM pVM, VMCPUID idCpu, PGMMREGISTERSHAREDMODULEREQ pReq);
486
487
488/**
489 * Request buffer for GMMR0UnregisterSharedModuleReq / VMMR0_DO_GMM_UNREGISTER_SHARED_MODULE.
490 * @see GMMR0UnregisterSharedModule.
491 */
492typedef struct GMMUNREGISTERSHAREDMODULEREQ
493{
494 /** The header. */
495 SUPVMMR0REQHDR Hdr;
496 /** Shared module size. */
497 uint32_t cbModule;
498 /** Align at 8 byte boundary. */
499 uint32_t u32Alignment;
500 /** Base address of the shared module. */
501 RTGCPTR64 GCBaseAddr;
502 /** Module name */
503 char szName[128];
504 /** Module version */
505 char szVersion[16];
506} GMMUNREGISTERSHAREDMODULEREQ;
507/** Pointer to a GMMR0UnregisterSharedModuleReq / VMMR0_DO_GMM_UNREGISTER_SHARED_MODULE request buffer. */
508typedef GMMUNREGISTERSHAREDMODULEREQ *PGMMUNREGISTERSHAREDMODULEREQ;
509
510GMMR0DECL(int) GMMR0UnregisterSharedModuleReq(PVM pVM, VMCPUID idCpu, PGMMUNREGISTERSHAREDMODULEREQ pReq);
511
512
513#ifdef IN_RING3
514/** @defgroup grp_gmm_r3 The Global Memory Manager Ring-3 API Wrappers
515 * @ingroup grp_gmm
516 * @{
517 */
518GMMR3DECL(int) GMMR3InitialReservation(PVM pVM, uint64_t cBasePages, uint32_t cShadowPages, uint32_t cFixedPages,
519 GMMOCPOLICY enmPolicy, GMMPRIORITY enmPriority);
520GMMR3DECL(int) GMMR3UpdateReservation(PVM pVM, uint64_t cBasePages, uint32_t cShadowPages, uint32_t cFixedPages);
521GMMR3DECL(int) GMMR3AllocatePagesPrepare(PVM pVM, PGMMALLOCATEPAGESREQ *ppReq, uint32_t cPages, GMMACCOUNT enmAccount);
522GMMR3DECL(int) GMMR3AllocatePagesPerform(PVM pVM, PGMMALLOCATEPAGESREQ pReq);
523GMMR3DECL(void) GMMR3AllocatePagesCleanup(PGMMALLOCATEPAGESREQ pReq);
524GMMR3DECL(int) GMMR3FreePagesPrepare(PVM pVM, PGMMFREEPAGESREQ *ppReq, uint32_t cPages, GMMACCOUNT enmAccount);
525GMMR3DECL(void) GMMR3FreePagesRePrep(PVM pVM, PGMMFREEPAGESREQ pReq, uint32_t cPages, GMMACCOUNT enmAccount);
526GMMR3DECL(int) GMMR3FreePagesPerform(PVM pVM, PGMMFREEPAGESREQ pReq, uint32_t cActualPages);
527GMMR3DECL(void) GMMR3FreePagesCleanup(PGMMFREEPAGESREQ pReq);
528GMMR3DECL(void) GMMR3FreeAllocatedPages(PVM pVM, GMMALLOCATEPAGESREQ const *pAllocReq);
529GMMR3DECL(int) GMMR3AllocateLargePage(PVM pVM, uint32_t cbPage);
530GMMR3DECL(int) GMMR3FreeLargePage(PVM pVM, uint32_t idPage);
531GMMR3DECL(int) GMMR3MapUnmapChunk(PVM pVM, uint32_t idChunkMap, uint32_t idChunkUnmap, PRTR3PTR ppvR3);
532GMMR3DECL(int) GMMR3SeedChunk(PVM pVM, RTR3PTR pvR3);
533GMMR3DECL(int) GMMR3BalloonedPages(PVM pVM, GMMBALLOONACTION enmAction, uint32_t cBalloonedPages);
534GMMR3DECL(int) GMMR3QueryVMMMemoryStats(PVM pVM, uint64_t *pcTotalAllocPages, uint64_t *pcTotalFreePages, uint64_t *pcTotalBalloonPages);
535GMMR3DECL(int) GMMR3RegisterSharedModule(PVM pVM, char *pszModuleName, char *pszVersion, RTGCPTR GCBaseAddr, uint32_t cbModule,
536 unsigned cRegions, VMMDEVSHAREDREGIONDESC *pRegions);
537GMMR3DECL(int) GMMR3UnregisterSharedModule(PVM pVM, char *pszModuleName, char *pszVersion, RTGCPTR GCBaseAddr, uint32_t cbModule);
538GMMR3DECL(int) GMMR3CheckSharedModules(PVM pVM);
539/** @} */
540#endif /* IN_RING3 */
541
542/** @} */
543
544RT_C_DECLS_END
545
546#endif
547
Note: See TracBrowser for help on using the repository browser.

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