VirtualBox

source: vbox/trunk/src/VBox/HostDrivers/Support/SUPDRVIOC.h@ 7193

Last change on this file since 7193 was 5999, checked in by vboxsync, 17 years ago

The Giant CDDL Dual-License Header Change.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 27.4 KB
Line 
1/* $Revision: 5999 $ */
2/** @file
3 * VirtualBox Support Driver - IOCtl definitions.
4 */
5
6/*
7 * Copyright (C) 2006-2007 innotek GmbH
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 *
17 * The contents of this file may alternatively be used under the terms
18 * of the Common Development and Distribution License Version 1.0
19 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
20 * VirtualBox OSE distribution, in which case the provisions of the
21 * CDDL are applicable instead of those of the GPL.
22 *
23 * You may elect to license modified versions of this file under the
24 * terms and conditions of either the GPL or the CDDL or both.
25 */
26
27#ifndef ___SUPDRVIOC_h___
28#define ___SUPDRVIOC_h___
29
30/*
31 * Basic types.
32 */
33#include <iprt/stdint.h>
34
35/*
36 * IOCtl numbers.
37 * We're using the Win32 type of numbers here, thus the macros below.
38 * The SUP_IOCTL_FLAG macro is used to separate requests from 32-bit
39 * and 64-bit processes.
40 */
41#ifdef RT_ARCH_AMD64
42# define SUP_IOCTL_FLAG 128
43#elif defined(RT_ARCH_X86)
44# define SUP_IOCTL_FLAG 0
45#else
46# error "dunno which arch this is!"
47#endif
48
49#ifdef RT_OS_WINDOWS
50# ifndef CTL_CODE
51# include <Windows.h>
52# endif
53 /* Automatic buffering, size not encoded. */
54# define SUP_CTL_CODE_SIZE(Function, Size) CTL_CODE(FILE_DEVICE_UNKNOWN, (Function) | SUP_IOCTL_FLAG, METHOD_BUFFERED, FILE_WRITE_ACCESS)
55# define SUP_CTL_CODE_BIG(Function) CTL_CODE(FILE_DEVICE_UNKNOWN, (Function) | SUP_IOCTL_FLAG, METHOD_BUFFERED, FILE_WRITE_ACCESS)
56# define SUP_CTL_CODE_FAST(Function) CTL_CODE(FILE_DEVICE_UNKNOWN, (Function) | SUP_IOCTL_FLAG, METHOD_NEITHER, FILE_WRITE_ACCESS)
57# define SUP_CTL_CODE_NO_SIZE(uIOCtl) (uIOCtl)
58
59#elif defined(RT_OS_SOLARIS)
60 /* No automatic buffering, size limited to 255 bytes. */
61# include <sys/ioccom.h>
62# define SUP_CTL_CODE_SIZE(Function, Size) _IOWRN('V', (Function) | SUP_IOCTL_FLAG, sizeof(SUPREQHDR))
63# define SUP_CTL_CODE_BIG(Function) _IOWRN('V', (Function) | SUP_IOCTL_FLAG, sizeof(SUPREQHDR))
64# define SUP_CTL_CODE_FAST(Function) _IO( 'V', (Function) | SUP_IOCTL_FLAG)
65# define SUP_CTL_CODE_NO_SIZE(uIOCtl) (uIOCtl)
66
67#elif defined(RT_OS_OS2)
68 /* No automatic buffering, size not encoded. */
69# define SUP_CTL_CATEGORY 0xc0
70# define SUP_CTL_CODE_SIZE(Function, Size) ((unsigned char)(Function))
71# define SUP_CTL_CODE_BIG(Function) ((unsigned char)(Function))
72# define SUP_CTL_CATEGORY_FAST 0xc1
73# define SUP_CTL_CODE_FAST(Function) ((unsigned char)(Function))
74# define SUP_CTL_CODE_NO_SIZE(uIOCtl) (uIOCtl)
75
76#elif defined(RT_OS_LINUX)
77 /* No automatic buffering, size limited to 16KB. */
78# include <linux/ioctl.h>
79# define SUP_CTL_CODE_SIZE(Function, Size) _IOC(_IOC_READ | _IOC_WRITE, 'V', (Function) | SUP_IOCTL_FLAG, (Size))
80# define SUP_CTL_CODE_BIG(Function) _IO('V', (Function) | SUP_IOCTL_FLAG)
81# define SUP_CTL_CODE_FAST(Function) _IO('V', (Function) | SUP_IOCTL_FLAG)
82# define SUP_CTL_CODE_NO_SIZE(uIOCtl) ((uIOCtl) & ~IOCSIZE_MASK)
83
84#elif defined(RT_OS_L4)
85 /* Implemented in suplib, no worries. */
86# define SUP_CTL_CODE_SIZE(Function, Size) (Function)
87# define SUP_CTL_CODE_BIG(Function) (Function)
88# define SUP_CTL_CODE_FAST(Function) (Function)
89# define SUP_CTL_CODE_NO_SIZE(uIOCtl) (uIOCtl)
90
91#else /* BSD Like */
92 /* Automatic buffering, size limited to 4KB on *BSD and 8KB on Darwin - commands the limit, 4KB. */
93# include <sys/ioccom.h>
94# define SUP_CTL_CODE_SIZE(Function, Size) _IOC(IOC_INOUT, 'V', (Function) | SUP_IOCTL_FLAG, (Size))
95# define SUP_CTL_CODE_BIG(Function) _IO('V', (Function) | SUP_IOCTL_FLAG)
96# define SUP_CTL_CODE_FAST(Function) _IO('V', (Function) | SUP_IOCTL_FLAG)
97# define SUP_CTL_CODE_NO_SIZE(uIOCtl) ( (uIOCtl) & ~_IOC(0,0,0,IOCPARM_MASK) )
98#endif
99
100/** Fast path IOCtl: VMMR0_DO_RAW_RUN */
101#define SUP_IOCTL_FAST_DO_RAW_RUN SUP_CTL_CODE_FAST(64)
102/** Fast path IOCtl: VMMR0_DO_HWACC_RUN */
103#define SUP_IOCTL_FAST_DO_HWACC_RUN SUP_CTL_CODE_FAST(65)
104/** Just a NOP call for profiling the latency of a fast ioctl call to VMMR0. */
105#define SUP_IOCTL_FAST_DO_NOP SUP_CTL_CODE_FAST(66)
106
107
108
109/*******************************************************************************
110* Structures and Typedefs *
111*******************************************************************************/
112#ifdef RT_ARCH_AMD64
113# pragma pack(8) /* paranoia. */
114#else
115# pragma pack(4) /* paranoia. */
116#endif
117
118
119/**
120 * Common In/Out header.
121 */
122typedef struct SUPREQHDR
123{
124 /** Cookie. */
125 uint32_t u32Cookie;
126 /** Session cookie. */
127 uint32_t u32SessionCookie;
128 /** The size of the input. */
129 uint32_t cbIn;
130 /** The size of the output. */
131 uint32_t cbOut;
132 /** Flags. See SUPREQHDR_FLAGS_* for details and values. */
133 uint32_t fFlags;
134 /** The VBox status code of the operation, out direction only. */
135 int32_t rc;
136} SUPREQHDR;
137/** Pointer to a IOC header. */
138typedef SUPREQHDR *PSUPREQHDR;
139
140/** @name SUPREQHDR::fFlags values
141 * @{ */
142/** Masks out the magic value. */
143#define SUPREQHDR_FLAGS_MAGIC_MASK UINT32_C(0xff0000ff)
144/** The generic mask. */
145#define SUPREQHDR_FLAGS_GEN_MASK UINT32_C(0x0000ff00)
146/** The request specific mask. */
147#define SUPREQHDR_FLAGS_REQ_MASK UINT32_C(0x00ff0000)
148
149/** There is extra input that needs copying on some platforms. */
150#define SUPREQHDR_FLAGS_EXTRA_IN UINT32_C(0x00000100)
151/** There is extra output that needs copying on some platforms. */
152#define SUPREQHDR_FLAGS_EXTRA_OUT UINT32_C(0x00000200)
153
154/** The magic value. */
155#define SUPREQHDR_FLAGS_MAGIC UINT32_C(0x42000042)
156/** The default value. Use this when no special stuff is requested. */
157#define SUPREQHDR_FLAGS_DEFAULT SUPREQHDR_FLAGS_MAGIC
158/** @} */
159
160
161/** @name SUP_IOCTL_COOKIE
162 * @{
163 */
164/** Negotiate cookie. */
165#define SUP_IOCTL_COOKIE SUP_CTL_CODE_SIZE(1, SUP_IOCTL_COOKIE_SIZE)
166/** The request size. */
167#define SUP_IOCTL_COOKIE_SIZE sizeof(SUPCOOKIE)
168/** The SUPREQHDR::cbIn value. */
169#define SUP_IOCTL_COOKIE_SIZE_IN sizeof(SUPREQHDR) + RT_SIZEOFMEMB(SUPCOOKIE, u.In)
170/** The SUPREQHDR::cbOut value. */
171#define SUP_IOCTL_COOKIE_SIZE_OUT sizeof(SUPREQHDR) + RT_SIZEOFMEMB(SUPCOOKIE, u.Out)
172/** SUPCOOKIE_IN magic word. */
173#define SUPCOOKIE_MAGIC "The Magic Word!"
174/** The initial cookie. */
175#define SUPCOOKIE_INITIAL_COOKIE 0x69726f74 /* 'tori' */
176
177/** Current interface version.
178 * The upper 16-bit is the major version, the the lower the minor version.
179 * When incompatible changes are made, the upper major number has to be changed. */
180#define SUPDRVIOC_VERSION 0x00060000
181
182/** SUP_IOCTL_COOKIE. */
183typedef struct SUPCOOKIE
184{
185 /** The header.
186 * u32Cookie must be set to SUPCOOKIE_INITIAL_COOKIE.
187 * u32SessionCookie should be set to some random value. */
188 SUPREQHDR Hdr;
189 union
190 {
191 struct
192 {
193 /** Magic word. */
194 char szMagic[16];
195 /** The requested interface version number. */
196 uint32_t u32ReqVersion;
197 /** The minimum interface version number. */
198 uint32_t u32MinVersion;
199 } In;
200 struct
201 {
202 /** Cookie. */
203 uint32_t u32Cookie;
204 /** Session cookie. */
205 uint32_t u32SessionCookie;
206 /** Interface version for this session. */
207 uint32_t u32SessionVersion;
208 /** The actual interface version in the driver. */
209 uint32_t u32DriverVersion;
210 /** Number of functions available for the SUP_IOCTL_QUERY_FUNCS request. */
211 uint32_t cFunctions;
212 /** Session handle. */
213 R0PTRTYPE(PSUPDRVSESSION) pSession;
214 } Out;
215 } u;
216} SUPCOOKIE, *PSUPCOOKIE;
217/** @} */
218
219
220/** @name SUP_IOCTL_QUERY_FUNCS
221 * Query SUPR0 functions.
222 * @{
223 */
224#define SUP_IOCTL_QUERY_FUNCS(cFuncs) SUP_CTL_CODE_SIZE(2, SUP_IOCTL_QUERY_FUNCS_SIZE(cFuncs))
225#define SUP_IOCTL_QUERY_FUNCS_SIZE(cFuncs) RT_OFFSETOF(SUPQUERYFUNCS, u.Out.aFunctions[(cFuncs)])
226#define SUP_IOCTL_QUERY_FUNCS_SIZE_IN sizeof(SUPREQHDR)
227#define SUP_IOCTL_QUERY_FUNCS_SIZE_OUT(cFuncs) SUP_IOCTL_QUERY_FUNCS_SIZE(cFuncs)
228
229/** A function. */
230typedef struct SUPFUNC
231{
232 /** Name - mangled. */
233 char szName[32];
234 /** Address. */
235 RTR0PTR pfn;
236} SUPFUNC, *PSUPFUNC;
237
238typedef struct SUPQUERYFUNCS
239{
240 /** The header. */
241 SUPREQHDR Hdr;
242 union
243 {
244 struct
245 {
246 /** Number of functions returned. */
247 uint32_t cFunctions;
248 /** Array of functions. */
249 SUPFUNC aFunctions[1];
250 } Out;
251 } u;
252} SUPQUERYFUNCS, *PSUPQUERYFUNCS;
253/** @} */
254
255
256/** @name SUP_IOCTL_IDT_INSTALL
257 * Install IDT patch for calling processor.
258 * @{
259 */
260#define SUP_IOCTL_IDT_INSTALL SUP_CTL_CODE_SIZE(3, SUP_IOCTL_IDT_INSTALL_SIZE)
261#define SUP_IOCTL_IDT_INSTALL_SIZE sizeof(SUPIDTINSTALL)
262#define SUP_IOCTL_IDT_INSTALL_SIZE_IN sizeof(SUPREQHDR)
263#define SUP_IOCTL_IDT_INSTALL_SIZE_OUT sizeof(SUPIDTINSTALL)
264typedef struct SUPIDTINSTALL
265{
266 /** The header. */
267 SUPREQHDR Hdr;
268 union
269 {
270 struct
271 {
272 /** The IDT entry number. */
273 uint8_t u8Idt;
274 } Out;
275 } u;
276} SUPIDTINSTALL, *PSUPIDTINSTALL;
277/** @} */
278
279
280/** @name SUP_IOCTL_IDT_REMOVE
281 * Remove IDT patch for calling processor.
282 * @{
283 */
284#define SUP_IOCTL_IDT_REMOVE SUP_CTL_CODE_SIZE(4, SUP_IOCTL_IDT_REMOVE_SIZE)
285#define SUP_IOCTL_IDT_REMOVE_SIZE sizeof(SUPIDTREMOVE)
286#define SUP_IOCTL_IDT_REMOVE_SIZE_IN sizeof(SUPIDTREMOVE)
287#define SUP_IOCTL_IDT_REMOVE_SIZE_OUT sizeof(SUPIDTREMOVE)
288typedef struct SUPIDTREMOVE
289{
290 /** The header. */
291 SUPREQHDR Hdr;
292} SUPIDTREMOVE, *PSUPIDTREMOVE;
293/** @}*/
294
295
296/** @name SUP_IOCTL_LDR_OPEN
297 * Open an image.
298 * @{
299 */
300#define SUP_IOCTL_LDR_OPEN SUP_CTL_CODE_SIZE(5, SUP_IOCTL_LDR_OPEN_SIZE)
301#define SUP_IOCTL_LDR_OPEN_SIZE sizeof(SUPLDROPEN)
302#define SUP_IOCTL_LDR_OPEN_SIZE_IN sizeof(SUPLDROPEN)
303#define SUP_IOCTL_LDR_OPEN_SIZE_OUT (sizeof(SUPREQHDR) + RT_SIZEOFMEMB(SUPLDROPEN, u.Out))
304typedef struct SUPLDROPEN
305{
306 /** The header. */
307 SUPREQHDR Hdr;
308 union
309 {
310 struct
311 {
312 /** Size of the image we'll be loading. */
313 uint32_t cbImage;
314 /** Image name.
315 * This is the NAME of the image, not the file name. It is used
316 * to share code with other processes. (Max len is 32 chars!) */
317 char szName[32];
318 } In;
319 struct
320 {
321 /** The base address of the image. */
322 RTR0PTR pvImageBase;
323 /** Indicate whether or not the image requires loading. */
324 bool fNeedsLoading;
325 } Out;
326 } u;
327} SUPLDROPEN, *PSUPLDROPEN;
328/** @} */
329
330
331/** @name SUP_IOCTL_LDR_LOAD
332 * Upload the image bits.
333 * @{
334 */
335#define SUP_IOCTL_LDR_LOAD SUP_CTL_CODE_BIG(6)
336#define SUP_IOCTL_LDR_LOAD_SIZE(cbImage) RT_OFFSETOF(SUPLDRLOAD, u.In.achImage[cbImage])
337#define SUP_IOCTL_LDR_LOAD_SIZE_IN(cbImage) RT_OFFSETOF(SUPLDRLOAD, u.In.achImage[cbImage])
338#define SUP_IOCTL_LDR_LOAD_SIZE_OUT sizeof(SUPREQHDR)
339
340/**
341 * Module initialization callback function.
342 * This is called once after the module has been loaded.
343 *
344 * @returns 0 on success.
345 * @returns Appropriate error code on failure.
346 */
347typedef DECLCALLBACK(int) FNR0MODULEINIT(void);
348/** Pointer to a FNR0MODULEINIT(). */
349typedef R0PTRTYPE(FNR0MODULEINIT *) PFNR0MODULEINIT;
350
351/**
352 * Module termination callback function.
353 * This is called once right before the module is being unloaded.
354 */
355typedef DECLCALLBACK(void) FNR0MODULETERM(void);
356/** Pointer to a FNR0MODULETERM(). */
357typedef R0PTRTYPE(FNR0MODULETERM *) PFNR0MODULETERM;
358
359/**
360 * Symbol table entry.
361 */
362typedef struct SUPLDRSYM
363{
364 /** Offset into of the string table. */
365 uint32_t offName;
366 /** Offset of the symbol relative to the image load address. */
367 uint32_t offSymbol;
368} SUPLDRSYM, *PSUPLDRSYM;
369
370/**
371 * SUPLDRLOAD::u::In::EP type.
372 */
373typedef enum SUPLDRLOADEP
374{
375 SUPLDRLOADEP_NOTHING = 0,
376 SUPLDRLOADEP_VMMR0,
377 SUPLDRLOADEP_32BIT_HACK = 0x7fffffff
378} SUPLDRLOADEP;
379
380typedef struct SUPLDRLOAD
381{
382 /** The header. */
383 SUPREQHDR Hdr;
384 union
385 {
386 struct
387 {
388 /** The address of module initialization function. Similar to _DLL_InitTerm(hmod, 0). */
389 PFNR0MODULEINIT pfnModuleInit;
390 /** The address of module termination function. Similar to _DLL_InitTerm(hmod, 1). */
391 PFNR0MODULETERM pfnModuleTerm;
392 /** Special entry points. */
393 union
394 {
395 struct
396 {
397 /** The module handle (i.e. address). */
398 RTR0PTR pvVMMR0;
399 /** Address of VMMR0EntryInt function. */
400 RTR0PTR pvVMMR0EntryInt;
401 /** Address of VMMR0EntryFast function. */
402 RTR0PTR pvVMMR0EntryFast;
403 /** Address of VMMR0EntryEx function. */
404 RTR0PTR pvVMMR0EntryEx;
405 } VMMR0;
406 } EP;
407 /** Address. */
408 RTR0PTR pvImageBase;
409 /** Entry point type. */
410 SUPLDRLOADEP eEPType;
411 /** The offset of the symbol table. */
412 uint32_t offSymbols;
413 /** The number of entries in the symbol table. */
414 uint32_t cSymbols;
415 /** The offset of the string table. */
416 uint32_t offStrTab;
417 /** Size of the string table. */
418 uint32_t cbStrTab;
419 /** Size of image (including string and symbol tables). */
420 uint32_t cbImage;
421 /** The image data. */
422 char achImage[1];
423 } In;
424 } u;
425} SUPLDRLOAD, *PSUPLDRLOAD;
426/** @} */
427
428
429/** @name SUP_IOCTL_LDR_FREE
430 * Free an image.
431 * @{
432 */
433#define SUP_IOCTL_LDR_FREE SUP_CTL_CODE_SIZE(7, SUP_IOCTL_LDR_FREE_SIZE)
434#define SUP_IOCTL_LDR_FREE_SIZE sizeof(SUPLDRFREE)
435#define SUP_IOCTL_LDR_FREE_SIZE_IN sizeof(SUPLDRFREE)
436#define SUP_IOCTL_LDR_FREE_SIZE_OUT sizeof(SUPREQHDR)
437typedef struct SUPLDRFREE
438{
439 /** The header. */
440 SUPREQHDR Hdr;
441 union
442 {
443 struct
444 {
445 /** Address. */
446 RTR0PTR pvImageBase;
447 } In;
448 } u;
449} SUPLDRFREE, *PSUPLDRFREE;
450/** @} */
451
452
453/** @name SUP_IOCTL_LDR_GET_SYMBOL
454 * Get address of a symbol within an image.
455 * @{
456 */
457#define SUP_IOCTL_LDR_GET_SYMBOL SUP_CTL_CODE_SIZE(8, SUP_IOCTL_LDR_GET_SYMBOL_SIZE)
458#define SUP_IOCTL_LDR_GET_SYMBOL_SIZE sizeof(SUPLDRGETSYMBOL)
459#define SUP_IOCTL_LDR_GET_SYMBOL_SIZE_IN sizeof(SUPLDRGETSYMBOL)
460#define SUP_IOCTL_LDR_GET_SYMBOL_SIZE_OUT (sizeof(SUPREQHDR) + RT_SIZEOFMEMB(SUPLDRGETSYMBOL, u.Out))
461typedef struct SUPLDRGETSYMBOL
462{
463 /** The header. */
464 SUPREQHDR Hdr;
465 union
466 {
467 struct
468 {
469 /** Address. */
470 RTR0PTR pvImageBase;
471 /** The symbol name. */
472 char szSymbol[64];
473 } In;
474 struct
475 {
476 /** The symbol address. */
477 RTR0PTR pvSymbol;
478 } Out;
479 } u;
480} SUPLDRGETSYMBOL, *PSUPLDRGETSYMBOL;
481/** @} */
482
483
484/** @name SUP_IOCTL_CALL_VMMR0
485 * Call the R0 VMM Entry point.
486 *
487 * @todo Might have to convert this to a big request...
488 * @{
489 */
490#define SUP_IOCTL_CALL_VMMR0(cbReq) SUP_CTL_CODE_SIZE(9, SUP_IOCTL_CALL_VMMR0_SIZE(cbReq))
491#define SUP_IOCTL_CALL_VMMR0_SIZE(cbReq) RT_OFFSETOF(SUPCALLVMMR0, abReqPkt[cbReq])
492#define SUP_IOCTL_CALL_VMMR0_SIZE_IN(cbReq) SUP_IOCTL_CALL_VMMR0_SIZE(cbReq)
493#define SUP_IOCTL_CALL_VMMR0_SIZE_OUT(cbReq) SUP_IOCTL_CALL_VMMR0_SIZE(cbReq)
494typedef struct SUPCALLVMMR0
495{
496 /** The header. */
497 SUPREQHDR Hdr;
498 union
499 {
500 struct
501 {
502 /** The VM handle. */
503 PVMR0 pVMR0;
504 /** Which operation to execute. */
505 uint32_t uOperation;
506#if R0_ARCH_BITS == 64
507 /** Alignment. */
508 uint32_t u32Reserved;
509#endif
510 /** Argument to use when no request packet is supplied. */
511 uint64_t u64Arg;
512 } In;
513 } u;
514 /** The VMMR0Entry request packet. */
515 uint8_t abReqPkt[1];
516} SUPCALLVMMR0, *PSUPCALLVMMR0;
517/** @} */
518
519
520/** @name SUP_IOCTL_LOW_ALLOC
521 * Allocate memory below 4GB (physically).
522 * @{
523 */
524#define SUP_IOCTL_LOW_ALLOC SUP_CTL_CODE_BIG(10)
525#define SUP_IOCTL_LOW_ALLOC_SIZE(cPages) ((uint32_t)RT_OFFSETOF(SUPLOWALLOC, u.Out.aPages[cPages]))
526#define SUP_IOCTL_LOW_ALLOC_SIZE_IN (sizeof(SUPREQHDR) + RT_SIZEOFMEMB(SUPLOWALLOC, u.In))
527#define SUP_IOCTL_LOW_ALLOC_SIZE_OUT(cPages) SUP_IOCTL_LOW_ALLOC_SIZE(cPages)
528typedef struct SUPLOWALLOC
529{
530 /** The header. */
531 SUPREQHDR Hdr;
532 union
533 {
534 struct
535 {
536 /** Number of pages to allocate. */
537 uint32_t cPages;
538 } In;
539 struct
540 {
541 /** The ring-3 address of the allocated memory. */
542 RTR3PTR pvR3;
543 /** The ring-0 address of the allocated memory. */
544 RTR0PTR pvR0;
545 /** Array of pages. */
546 RTHCPHYS aPages[1];
547 } Out;
548 } u;
549} SUPLOWALLOC, *PSUPLOWALLOC;
550/** @} */
551
552
553/** @name SUP_IOCTL_LOW_FREE
554 * Free low memory.
555 * @{
556 */
557#define SUP_IOCTL_LOW_FREE SUP_CTL_CODE_SIZE(11, SUP_IOCTL_LOW_FREE_SIZE)
558#define SUP_IOCTL_LOW_FREE_SIZE sizeof(SUPLOWFREE)
559#define SUP_IOCTL_LOW_FREE_SIZE_IN sizeof(SUPLOWFREE)
560#define SUP_IOCTL_LOW_FREE_SIZE_OUT sizeof(SUPREQHDR)
561typedef struct SUPLOWFREE
562{
563 /** The header. */
564 SUPREQHDR Hdr;
565 union
566 {
567 struct
568 {
569 /** The ring-3 address of the memory to free. */
570 RTR3PTR pvR3;
571 } In;
572 } u;
573} SUPLOWFREE, *PSUPLOWFREE;
574/** @} */
575
576
577/** @name SUP_IOCTL_PAGE_ALLOC
578 * Allocate memory and map into the user process.
579 * The memory is of course locked.
580 * @{
581 */
582#define SUP_IOCTL_PAGE_ALLOC SUP_CTL_CODE_BIG(12)
583#define SUP_IOCTL_PAGE_ALLOC_SIZE(cPages) RT_OFFSETOF(SUPPAGEALLOC, u.Out.aPages[cPages])
584#define SUP_IOCTL_PAGE_ALLOC_SIZE_IN (sizeof(SUPREQHDR) + RT_SIZEOFMEMB(SUPPAGEALLOC, u.In))
585#define SUP_IOCTL_PAGE_ALLOC_SIZE_OUT(cPages) SUP_IOCTL_PAGE_ALLOC_SIZE(cPages)
586typedef struct SUPPAGEALLOC
587{
588 /** The header. */
589 SUPREQHDR Hdr;
590 union
591 {
592 struct
593 {
594 /** Number of pages to allocate */
595 uint32_t cPages;
596 } In;
597 struct
598 {
599 /** Returned ring-3 address. */
600 RTR3PTR pvR3;
601 /** The physical addresses of the allocated pages. */
602 RTHCPHYS aPages[1];
603 } Out;
604 } u;
605} SUPPAGEALLOC, *PSUPPAGEALLOC;
606/** @} */
607
608
609/** @name SUP_IOCTL_PAGE_FREE
610 * Free memory allocated with SUP_IOCTL_PAGE_ALLOC.
611 * @{
612 */
613#define SUP_IOCTL_PAGE_FREE SUP_CTL_CODE_SIZE(13, SUP_IOCTL_PAGE_FREE_SIZE_IN)
614#define SUP_IOCTL_PAGE_FREE_SIZE sizeof(SUPPAGEFREE)
615#define SUP_IOCTL_PAGE_FREE_SIZE_IN sizeof(SUPPAGEFREE)
616#define SUP_IOCTL_PAGE_FREE_SIZE_OUT sizeof(SUPREQHDR)
617typedef struct SUPPAGEFREE
618{
619 /** The header. */
620 SUPREQHDR Hdr;
621 union
622 {
623 struct
624 {
625 /** Address of memory range to free. */
626 RTR3PTR pvR3;
627 } In;
628 } u;
629} SUPPAGEFREE, *PSUPPAGEFREE;
630/** @} */
631
632
633/** @name SUP_IOCTL_PAGE_LOCK
634 * Pin down physical pages.
635 * @{
636 */
637#define SUP_IOCTL_PAGE_LOCK SUP_CTL_CODE_BIG(14)
638#define SUP_IOCTL_PAGE_LOCK_SIZE(cPages) (RT_MAX((size_t)SUP_IOCTL_PAGE_LOCK_SIZE_IN, (size_t)SUP_IOCTL_PAGE_LOCK_SIZE_OUT(cPages)))
639#define SUP_IOCTL_PAGE_LOCK_SIZE_IN (sizeof(SUPREQHDR) + RT_SIZEOFMEMB(SUPPAGELOCK, u.In))
640#define SUP_IOCTL_PAGE_LOCK_SIZE_OUT(cPages) RT_OFFSETOF(SUPPAGELOCK, u.Out.aPages[cPages])
641typedef struct SUPPAGELOCK
642{
643 /** The header. */
644 SUPREQHDR Hdr;
645 union
646 {
647 struct
648 {
649 /** Start of page range. Must be PAGE aligned. */
650 RTR3PTR pvR3;
651 /** The range size given as a page count. */
652 uint32_t cPages;
653 } In;
654
655 struct
656 {
657 /** Array of pages. */
658 RTHCPHYS aPages[1];
659 } Out;
660 } u;
661} SUPPAGELOCK, *PSUPPAGELOCK;
662/** @} */
663
664
665/** @name SUP_IOCTL_PAGE_UNLOCK
666 * Unpin physical pages.
667 * @{ */
668#define SUP_IOCTL_PAGE_UNLOCK SUP_CTL_CODE_SIZE(15, SUP_IOCTL_PAGE_UNLOCK_SIZE)
669#define SUP_IOCTL_PAGE_UNLOCK_SIZE sizeof(SUPPAGEUNLOCK)
670#define SUP_IOCTL_PAGE_UNLOCK_SIZE_IN sizeof(SUPPAGEUNLOCK)
671#define SUP_IOCTL_PAGE_UNLOCK_SIZE_OUT sizeof(SUPREQHDR)
672typedef struct SUPPAGEUNLOCK
673{
674 /** The header. */
675 SUPREQHDR Hdr;
676 union
677 {
678 struct
679 {
680 /** Start of page range of a range previuosly pinned. */
681 RTR3PTR pvR3;
682 } In;
683 } u;
684} SUPPAGEUNLOCK, *PSUPPAGEUNLOCK;
685/** @} */
686
687
688/** @name SUP_IOCTL_CONT_ALLOC
689 * Allocate contious memory.
690 * @{
691 */
692#define SUP_IOCTL_CONT_ALLOC SUP_CTL_CODE_SIZE(16, SUP_IOCTL_CONT_ALLOC_SIZE)
693#define SUP_IOCTL_CONT_ALLOC_SIZE sizeof(SUPCONTALLOC)
694#define SUP_IOCTL_CONT_ALLOC_SIZE_IN (sizeof(SUPREQHDR) + RT_SIZEOFMEMB(SUPCONTALLOC, u.In))
695#define SUP_IOCTL_CONT_ALLOC_SIZE_OUT sizeof(SUPCONTALLOC)
696typedef struct SUPCONTALLOC
697{
698 /** The header. */
699 SUPREQHDR Hdr;
700 union
701 {
702 struct
703 {
704 /** The allocation size given as a page count. */
705 uint32_t cPages;
706 } In;
707
708 struct
709 {
710 /** The address of the ring-0 mapping of the allocated memory. */
711 RTR0PTR pvR0;
712 /** The address of the ring-3 mapping of the allocated memory. */
713 RTR3PTR pvR3;
714 /** The physical address of the allocation. */
715 RTHCPHYS HCPhys;
716 } Out;
717 } u;
718} SUPCONTALLOC, *PSUPCONTALLOC;
719/** @} */
720
721
722/** @name SUP_IOCTL_CONT_FREE Input.
723 * @{
724 */
725/** Free contious memory. */
726#define SUP_IOCTL_CONT_FREE SUP_CTL_CODE_SIZE(17, SUP_IOCTL_CONT_FREE_SIZE)
727#define SUP_IOCTL_CONT_FREE_SIZE sizeof(SUPCONTFREE)
728#define SUP_IOCTL_CONT_FREE_SIZE_IN sizeof(SUPCONTFREE)
729#define SUP_IOCTL_CONT_FREE_SIZE_OUT sizeof(SUPREQHDR)
730typedef struct SUPCONTFREE
731{
732 /** The header. */
733 SUPREQHDR Hdr;
734 union
735 {
736 struct
737 {
738 /** The ring-3 address of the memory to free. */
739 RTR3PTR pvR3;
740 } In;
741 } u;
742} SUPCONTFREE, *PSUPCONTFREE;
743/** @} */
744
745
746/** @name SUP_IOCTL_GET_PAGING_MODE
747 * Get the host paging mode.
748 * @{
749 */
750#define SUP_IOCTL_GET_PAGING_MODE SUP_CTL_CODE_SIZE(18, SUP_IOCTL_GET_PAGING_MODE_SIZE)
751#define SUP_IOCTL_GET_PAGING_MODE_SIZE sizeof(SUPGETPAGINGMODE)
752#define SUP_IOCTL_GET_PAGING_MODE_SIZE_IN sizeof(SUPREQHDR)
753#define SUP_IOCTL_GET_PAGING_MODE_SIZE_OUT sizeof(SUPGETPAGINGMODE)
754typedef struct SUPGETPAGINGMODE
755{
756 /** The header. */
757 SUPREQHDR Hdr;
758 union
759 {
760 struct
761 {
762 /** The paging mode. */
763 SUPPAGINGMODE enmMode;
764 } Out;
765 } u;
766} SUPGETPAGINGMODE, *PSUPGETPAGINGMODE;
767/** @} */
768
769
770/** @name SUP_IOCTL_SET_VM_FOR_FAST
771 * Set the VM handle for doing fast call ioctl calls.
772 * @{
773 */
774#define SUP_IOCTL_SET_VM_FOR_FAST SUP_CTL_CODE_SIZE(19, SUP_IOCTL_SET_VM_FOR_FAST_SIZE)
775#define SUP_IOCTL_SET_VM_FOR_FAST_SIZE sizeof(SUPSETVMFORFAST)
776#define SUP_IOCTL_SET_VM_FOR_FAST_SIZE_IN sizeof(SUPSETVMFORFAST)
777#define SUP_IOCTL_SET_VM_FOR_FAST_SIZE_OUT sizeof(SUPREQHDR)
778typedef struct SUPSETVMFORFAST
779{
780 /** The header. */
781 SUPREQHDR Hdr;
782 union
783 {
784 struct
785 {
786 /** The ring-0 VM handle (pointer). */
787 PVMR0 pVMR0;
788 } In;
789 } u;
790} SUPSETVMFORFAST, *PSUPSETVMFORFAST;
791/** @} */
792
793
794/** @name SUP_IOCTL_GIP_MAP
795 * Map the GIP into user space.
796 * @{
797 */
798#define SUP_IOCTL_GIP_MAP SUP_CTL_CODE_SIZE(20, SUP_IOCTL_GIP_MAP_SIZE)
799#define SUP_IOCTL_GIP_MAP_SIZE sizeof(SUPGIPMAP)
800#define SUP_IOCTL_GIP_MAP_SIZE_IN sizeof(SUPREQHDR)
801#define SUP_IOCTL_GIP_MAP_SIZE_OUT sizeof(SUPGIPMAP)
802typedef struct SUPGIPMAP
803{
804 /** The header. */
805 SUPREQHDR Hdr;
806 union
807 {
808 struct
809 {
810 /** The physical address of the GIP. */
811 RTHCPHYS HCPhysGip;
812 /** Pointer to the read-only usermode GIP mapping for this session. */
813 R3PTRTYPE(PSUPGLOBALINFOPAGE) pGipR3;
814 /** Pointer to the supervisor mode GIP mapping. */
815 R0PTRTYPE(PSUPGLOBALINFOPAGE) pGipR0;
816 } Out;
817 } u;
818} SUPGIPMAP, *PSUPGIPMAP;
819/** @} */
820
821
822/** @name SUP_IOCTL_GIP_UNMAP
823 * Unmap the GIP.
824 * @{
825 */
826#define SUP_IOCTL_GIP_UNMAP SUP_CTL_CODE_SIZE(21, SUP_IOCTL_GIP_UNMAP_SIZE)
827#define SUP_IOCTL_GIP_UNMAP_SIZE sizeof(SUPGIPUNMAP)
828#define SUP_IOCTL_GIP_UNMAP_SIZE_IN sizeof(SUPGIPUNMAP)
829#define SUP_IOCTL_GIP_UNMAP_SIZE_OUT sizeof(SUPGIPUNMAP)
830typedef struct SUPGIPUNMAP
831{
832 /** The header. */
833 SUPREQHDR Hdr;
834} SUPGIPUNMAP, *PSUPGIPUNMAP;
835/** @} */
836
837
838#pragma pack() /* paranoia */
839
840#endif
841
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