VirtualBox

source: vbox/trunk/src/VBox/HostDrivers/Support/SUPDrvIOC.h@ 33944

Last change on this file since 33944 was 33540, checked in by vboxsync, 14 years ago

*: spelling fixes, thanks Timeless!

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 40.8 KB
Line 
1/* $Revision: 33540 $ */
2/** @file
3 * VirtualBox Support Driver - IOCtl definitions.
4 */
5
6/*
7 * Copyright (C) 2006-2010 Oracle Corporation
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/types.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#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_SPARC64)
42# define SUP_IOCTL_FLAG 128
43#elif defined(RT_ARCH_X86) || defined(RT_ARCH_SPARC)
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 *
181 * Update rules:
182 * -# Only update the major number when incompatible changes have been made to
183 * the IOC interface or the ABI provided via the functions returned by
184 * SUPQUERYFUNCS.
185 * -# When adding new features (new IOC number, new flags, new exports, ++)
186 * only update the minor number and change SUPLib.cpp to require the
187 * new IOC version.
188 * -# When incrementing the major number, clear the minor part and reset
189 * any IOC version requirements in SUPLib.cpp.
190 * -# When increment the major number, execute all pending work.
191 *
192 * @todo Pending work on next major version change:
193 * - Remove SUPSEMOP and SUPSEMCREATE.
194 */
195#define SUPDRV_IOC_VERSION 0x00150004
196
197/** SUP_IOCTL_COOKIE. */
198typedef struct SUPCOOKIE
199{
200 /** The header.
201 * u32Cookie must be set to SUPCOOKIE_INITIAL_COOKIE.
202 * u32SessionCookie should be set to some random value. */
203 SUPREQHDR Hdr;
204 union
205 {
206 struct
207 {
208 /** Magic word. */
209 char szMagic[16];
210 /** The requested interface version number. */
211 uint32_t u32ReqVersion;
212 /** The minimum interface version number. */
213 uint32_t u32MinVersion;
214 } In;
215 struct
216 {
217 /** Cookie. */
218 uint32_t u32Cookie;
219 /** Session cookie. */
220 uint32_t u32SessionCookie;
221 /** Interface version for this session. */
222 uint32_t u32SessionVersion;
223 /** The actual interface version in the driver. */
224 uint32_t u32DriverVersion;
225 /** Number of functions available for the SUP_IOCTL_QUERY_FUNCS request. */
226 uint32_t cFunctions;
227 /** Session handle. */
228 R0PTRTYPE(PSUPDRVSESSION) pSession;
229 } Out;
230 } u;
231} SUPCOOKIE, *PSUPCOOKIE;
232/** @} */
233
234
235/** @name SUP_IOCTL_QUERY_FUNCS
236 * Query SUPR0 functions.
237 * @{
238 */
239#define SUP_IOCTL_QUERY_FUNCS(cFuncs) SUP_CTL_CODE_BIG(2)
240#define SUP_IOCTL_QUERY_FUNCS_SIZE(cFuncs) RT_UOFFSETOF(SUPQUERYFUNCS, u.Out.aFunctions[(cFuncs)])
241#define SUP_IOCTL_QUERY_FUNCS_SIZE_IN sizeof(SUPREQHDR)
242#define SUP_IOCTL_QUERY_FUNCS_SIZE_OUT(cFuncs) SUP_IOCTL_QUERY_FUNCS_SIZE(cFuncs)
243
244/** A function. */
245typedef struct SUPFUNC
246{
247 /** Name - mangled. */
248 char szName[32];
249 /** Address. */
250 RTR0PTR pfn;
251} SUPFUNC, *PSUPFUNC;
252
253typedef struct SUPQUERYFUNCS
254{
255 /** The header. */
256 SUPREQHDR Hdr;
257 union
258 {
259 struct
260 {
261 /** Number of functions returned. */
262 uint32_t cFunctions;
263 /** Array of functions. */
264 SUPFUNC aFunctions[1];
265 } Out;
266 } u;
267} SUPQUERYFUNCS, *PSUPQUERYFUNCS;
268/** @} */
269
270
271/** @name SUP_IOCTL_LDR_OPEN
272 * Open an image.
273 * @{
274 */
275#define SUP_IOCTL_LDR_OPEN SUP_CTL_CODE_SIZE(3, SUP_IOCTL_LDR_OPEN_SIZE)
276#define SUP_IOCTL_LDR_OPEN_SIZE sizeof(SUPLDROPEN)
277#define SUP_IOCTL_LDR_OPEN_SIZE_IN sizeof(SUPLDROPEN)
278#define SUP_IOCTL_LDR_OPEN_SIZE_OUT (sizeof(SUPREQHDR) + RT_SIZEOFMEMB(SUPLDROPEN, u.Out))
279typedef struct SUPLDROPEN
280{
281 /** The header. */
282 SUPREQHDR Hdr;
283 union
284 {
285 struct
286 {
287 /** Size of the image we'll be loading (including tables). */
288 uint32_t cbImageWithTabs;
289 /** The size of the image bits. (Less or equal to cbImageWithTabs.) */
290 uint32_t cbImageBits;
291 /** Image name.
292 * This is the NAME of the image, not the file name. It is used
293 * to share code with other processes. (Max len is 32 chars!) */
294 char szName[32];
295 /** Image file name.
296 * This can be used to load the image using a native loader. */
297 char szFilename[196];
298 } In;
299 struct
300 {
301 /** The base address of the image. */
302 RTR0PTR pvImageBase;
303 /** Indicate whether or not the image requires loading. */
304 bool fNeedsLoading;
305 /** Indicates that we're using the native ring-0 loader. */
306 bool fNativeLoader;
307 } Out;
308 } u;
309} SUPLDROPEN, *PSUPLDROPEN;
310/** @} */
311
312
313/** @name SUP_IOCTL_LDR_LOAD
314 * Upload the image bits.
315 * @{
316 */
317#define SUP_IOCTL_LDR_LOAD SUP_CTL_CODE_BIG(4)
318#define SUP_IOCTL_LDR_LOAD_SIZE(cbImage) RT_UOFFSETOF(SUPLDRLOAD, u.In.abImage[cbImage])
319#define SUP_IOCTL_LDR_LOAD_SIZE_IN(cbImage) RT_UOFFSETOF(SUPLDRLOAD, u.In.abImage[cbImage])
320#define SUP_IOCTL_LDR_LOAD_SIZE_OUT sizeof(SUPREQHDR)
321
322/**
323 * Module initialization callback function.
324 * This is called once after the module has been loaded.
325 *
326 * @returns 0 on success.
327 * @returns Appropriate error code on failure.
328 */
329typedef DECLCALLBACK(int) FNR0MODULEINIT(void);
330/** Pointer to a FNR0MODULEINIT(). */
331typedef R0PTRTYPE(FNR0MODULEINIT *) PFNR0MODULEINIT;
332
333/**
334 * Module termination callback function.
335 * This is called once right before the module is being unloaded.
336 */
337typedef DECLCALLBACK(void) FNR0MODULETERM(void);
338/** Pointer to a FNR0MODULETERM(). */
339typedef R0PTRTYPE(FNR0MODULETERM *) PFNR0MODULETERM;
340
341/**
342 * Symbol table entry.
343 */
344typedef struct SUPLDRSYM
345{
346 /** Offset into of the string table. */
347 uint32_t offName;
348 /** Offset of the symbol relative to the image load address. */
349 uint32_t offSymbol;
350} SUPLDRSYM;
351/** Pointer to a symbol table entry. */
352typedef SUPLDRSYM *PSUPLDRSYM;
353/** Pointer to a const symbol table entry. */
354typedef SUPLDRSYM const *PCSUPLDRSYM;
355
356/**
357 * SUPLDRLOAD::u::In::EP type.
358 */
359typedef enum SUPLDRLOADEP
360{
361 SUPLDRLOADEP_NOTHING = 0,
362 SUPLDRLOADEP_VMMR0,
363 SUPLDRLOADEP_SERVICE,
364 SUPLDRLOADEP_32BIT_HACK = 0x7fffffff
365} SUPLDRLOADEP;
366
367typedef struct SUPLDRLOAD
368{
369 /** The header. */
370 SUPREQHDR Hdr;
371 union
372 {
373 struct
374 {
375 /** The address of module initialization function. Similar to _DLL_InitTerm(hmod, 0). */
376 PFNR0MODULEINIT pfnModuleInit;
377 /** The address of module termination function. Similar to _DLL_InitTerm(hmod, 1). */
378 PFNR0MODULETERM pfnModuleTerm;
379 /** Special entry points. */
380 union
381 {
382 /** SUPLDRLOADEP_VMMR0. */
383 struct
384 {
385 /** The module handle (i.e. address). */
386 RTR0PTR pvVMMR0;
387 /** Address of VMMR0EntryInt function. */
388 RTR0PTR pvVMMR0EntryInt;
389 /** Address of VMMR0EntryFast function. */
390 RTR0PTR pvVMMR0EntryFast;
391 /** Address of VMMR0EntryEx function. */
392 RTR0PTR pvVMMR0EntryEx;
393 } VMMR0;
394 /** SUPLDRLOADEP_SERVICE. */
395 struct
396 {
397 /** The service request handler.
398 * (PFNR0SERVICEREQHANDLER isn't defined yet.) */
399 RTR0PTR pfnServiceReq;
400 /** Reserved, must be NIL. */
401 RTR0PTR apvReserved[3];
402 } Service;
403 } EP;
404 /** Address. */
405 RTR0PTR pvImageBase;
406 /** Entry point type. */
407 SUPLDRLOADEP eEPType;
408 /** The size of the image bits (starting at offset 0 and
409 * approaching offSymbols). */
410 uint32_t cbImageBits;
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 data in achImage. */
420 uint32_t cbImageWithTabs;
421 /** The image data. */
422 uint8_t abImage[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(5, 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(6, 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(7, SUP_IOCTL_CALL_VMMR0_SIZE(cbReq))
491#define SUP_IOCTL_CALL_VMMR0_SIZE(cbReq) RT_UOFFSETOF(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 /** VCPU id. */
505 uint32_t idCpu;
506 /** Which operation to execute. */
507 uint32_t uOperation;
508 /** Argument to use when no request packet is supplied. */
509 uint64_t u64Arg;
510 } In;
511 } u;
512 /** The VMMR0Entry request packet. */
513 uint8_t abReqPkt[1];
514} SUPCALLVMMR0, *PSUPCALLVMMR0;
515/** @} */
516
517
518/** @name SUP_IOCTL_LOW_ALLOC
519 * Allocate memory below 4GB (physically).
520 * @{
521 */
522#define SUP_IOCTL_LOW_ALLOC SUP_CTL_CODE_BIG(8)
523#define SUP_IOCTL_LOW_ALLOC_SIZE(cPages) ((uint32_t)RT_UOFFSETOF(SUPLOWALLOC, u.Out.aPages[cPages]))
524#define SUP_IOCTL_LOW_ALLOC_SIZE_IN (sizeof(SUPREQHDR) + RT_SIZEOFMEMB(SUPLOWALLOC, u.In))
525#define SUP_IOCTL_LOW_ALLOC_SIZE_OUT(cPages) SUP_IOCTL_LOW_ALLOC_SIZE(cPages)
526typedef struct SUPLOWALLOC
527{
528 /** The header. */
529 SUPREQHDR Hdr;
530 union
531 {
532 struct
533 {
534 /** Number of pages to allocate. */
535 uint32_t cPages;
536 } In;
537 struct
538 {
539 /** The ring-3 address of the allocated memory. */
540 RTR3PTR pvR3;
541 /** The ring-0 address of the allocated memory. */
542 RTR0PTR pvR0;
543 /** Array of pages. */
544 RTHCPHYS aPages[1];
545 } Out;
546 } u;
547} SUPLOWALLOC, *PSUPLOWALLOC;
548/** @} */
549
550
551/** @name SUP_IOCTL_LOW_FREE
552 * Free low memory.
553 * @{
554 */
555#define SUP_IOCTL_LOW_FREE SUP_CTL_CODE_SIZE(9, SUP_IOCTL_LOW_FREE_SIZE)
556#define SUP_IOCTL_LOW_FREE_SIZE sizeof(SUPLOWFREE)
557#define SUP_IOCTL_LOW_FREE_SIZE_IN sizeof(SUPLOWFREE)
558#define SUP_IOCTL_LOW_FREE_SIZE_OUT sizeof(SUPREQHDR)
559typedef struct SUPLOWFREE
560{
561 /** The header. */
562 SUPREQHDR Hdr;
563 union
564 {
565 struct
566 {
567 /** The ring-3 address of the memory to free. */
568 RTR3PTR pvR3;
569 } In;
570 } u;
571} SUPLOWFREE, *PSUPLOWFREE;
572/** @} */
573
574
575/** @name SUP_IOCTL_PAGE_ALLOC_EX
576 * Allocate memory and map it into kernel and/or user space. The memory is of
577 * course locked. The result should be freed using SUP_IOCTL_PAGE_FREE.
578 *
579 * @remarks Allocations without a kernel mapping may fail with
580 * VERR_NOT_SUPPORTED on some platforms.
581 *
582 * @{
583 */
584#define SUP_IOCTL_PAGE_ALLOC_EX SUP_CTL_CODE_BIG(10)
585#define SUP_IOCTL_PAGE_ALLOC_EX_SIZE(cPages) RT_UOFFSETOF(SUPPAGEALLOCEX, u.Out.aPages[cPages])
586#define SUP_IOCTL_PAGE_ALLOC_EX_SIZE_IN (sizeof(SUPREQHDR) + RT_SIZEOFMEMB(SUPPAGEALLOCEX, u.In))
587#define SUP_IOCTL_PAGE_ALLOC_EX_SIZE_OUT(cPages) SUP_IOCTL_PAGE_ALLOC_EX_SIZE(cPages)
588typedef struct SUPPAGEALLOCEX
589{
590 /** The header. */
591 SUPREQHDR Hdr;
592 union
593 {
594 struct
595 {
596 /** Number of pages to allocate */
597 uint32_t cPages;
598 /** Whether it should have kernel mapping. */
599 bool fKernelMapping;
600 /** Whether it should have a user mapping. */
601 bool fUserMapping;
602 /** Reserved. Must be false. */
603 bool fReserved0;
604 /** Reserved. Must be false. */
605 bool fReserved1;
606 } In;
607 struct
608 {
609 /** Returned ring-3 address. */
610 RTR3PTR pvR3;
611 /** Returned ring-0 address. */
612 RTR0PTR pvR0;
613 /** The physical addresses of the allocated pages. */
614 RTHCPHYS aPages[1];
615 } Out;
616 } u;
617} SUPPAGEALLOCEX, *PSUPPAGEALLOCEX;
618/** @} */
619
620
621/** @name SUP_IOCTL_PAGE_MAP_KERNEL
622 * Maps a portion of memory allocated by SUP_IOCTL_PAGE_ALLOC_EX /
623 * SUPR0PageAllocEx into kernel space for use by a device or similar.
624 *
625 * The mapping will be freed together with the ring-3 mapping when
626 * SUP_IOCTL_PAGE_FREE or SUPR0PageFree is called.
627 *
628 * @remarks Not necessarily supported on all platforms.
629 *
630 * @{
631 */
632#define SUP_IOCTL_PAGE_MAP_KERNEL SUP_CTL_CODE_SIZE(11, SUP_IOCTL_PAGE_MAP_KERNEL_SIZE)
633#define SUP_IOCTL_PAGE_MAP_KERNEL_SIZE sizeof(SUPPAGEMAPKERNEL)
634#define SUP_IOCTL_PAGE_MAP_KERNEL_SIZE_IN sizeof(SUPPAGEMAPKERNEL)
635#define SUP_IOCTL_PAGE_MAP_KERNEL_SIZE_OUT sizeof(SUPPAGEMAPKERNEL)
636typedef struct SUPPAGEMAPKERNEL
637{
638 /** The header. */
639 SUPREQHDR Hdr;
640 union
641 {
642 struct
643 {
644 /** The pointer of to the previously allocated memory. */
645 RTR3PTR pvR3;
646 /** The offset to start mapping from. */
647 uint32_t offSub;
648 /** Size of the section to map. */
649 uint32_t cbSub;
650 /** Flags reserved for future fun. */
651 uint32_t fFlags;
652 } In;
653 struct
654 {
655 /** The ring-0 address corresponding to pvR3 + offSub. */
656 RTR0PTR pvR0;
657 } Out;
658 } u;
659} SUPPAGEMAPKERNEL, *PSUPPAGEMAPKERNEL;
660/** @} */
661
662
663/** @name SUP_IOCTL_PAGE_PROTECT
664 * Changes the page level protection of the user and/or kernel mappings of
665 * memory previously allocated by SUPR0PageAllocEx.
666 *
667 * @remarks Not necessarily supported on all platforms.
668 *
669 * @{
670 */
671#define SUP_IOCTL_PAGE_PROTECT SUP_CTL_CODE_SIZE(12, SUP_IOCTL_PAGE_PROTECT_SIZE)
672#define SUP_IOCTL_PAGE_PROTECT_SIZE sizeof(SUPPAGEPROTECT)
673#define SUP_IOCTL_PAGE_PROTECT_SIZE_IN sizeof(SUPPAGEPROTECT)
674#define SUP_IOCTL_PAGE_PROTECT_SIZE_OUT sizeof(SUPPAGEPROTECT)
675typedef struct SUPPAGEPROTECT
676{
677 /** The header. */
678 SUPREQHDR Hdr;
679 union
680 {
681 struct
682 {
683 /** The pointer of to the previously allocated memory.
684 * Pass NIL_RTR3PTR if the ring-0 mapping should remain unaffected. */
685 RTR3PTR pvR3;
686 /** The pointer of to the previously allocated memory.
687 * Pass NIL_RTR0PTR if the ring-0 mapping should remain unaffected. */
688 RTR0PTR pvR0;
689 /** The offset to start changing protection at. */
690 uint32_t offSub;
691 /** Size of the portion that should be changed. */
692 uint32_t cbSub;
693 /** Protection flags, RTMEM_PROT_*. */
694 uint32_t fProt;
695 } In;
696 } u;
697} SUPPAGEPROTECT, *PSUPPAGEPROTECT;
698/** @} */
699
700
701/** @name SUP_IOCTL_PAGE_FREE
702 * Free memory allocated with SUP_IOCTL_PAGE_ALLOC_EX.
703 * @{
704 */
705#define SUP_IOCTL_PAGE_FREE SUP_CTL_CODE_SIZE(13, SUP_IOCTL_PAGE_FREE_SIZE_IN)
706#define SUP_IOCTL_PAGE_FREE_SIZE sizeof(SUPPAGEFREE)
707#define SUP_IOCTL_PAGE_FREE_SIZE_IN sizeof(SUPPAGEFREE)
708#define SUP_IOCTL_PAGE_FREE_SIZE_OUT sizeof(SUPREQHDR)
709typedef struct SUPPAGEFREE
710{
711 /** The header. */
712 SUPREQHDR Hdr;
713 union
714 {
715 struct
716 {
717 /** Address of memory range to free. */
718 RTR3PTR pvR3;
719 } In;
720 } u;
721} SUPPAGEFREE, *PSUPPAGEFREE;
722/** @} */
723
724
725
726
727/** @name SUP_IOCTL_PAGE_LOCK
728 * Pin down physical pages.
729 * @{
730 */
731#define SUP_IOCTL_PAGE_LOCK SUP_CTL_CODE_BIG(14)
732#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)))
733#define SUP_IOCTL_PAGE_LOCK_SIZE_IN (sizeof(SUPREQHDR) + RT_SIZEOFMEMB(SUPPAGELOCK, u.In))
734#define SUP_IOCTL_PAGE_LOCK_SIZE_OUT(cPages) RT_UOFFSETOF(SUPPAGELOCK, u.Out.aPages[cPages])
735typedef struct SUPPAGELOCK
736{
737 /** The header. */
738 SUPREQHDR Hdr;
739 union
740 {
741 struct
742 {
743 /** Start of page range. Must be PAGE aligned. */
744 RTR3PTR pvR3;
745 /** The range size given as a page count. */
746 uint32_t cPages;
747 } In;
748
749 struct
750 {
751 /** Array of pages. */
752 RTHCPHYS aPages[1];
753 } Out;
754 } u;
755} SUPPAGELOCK, *PSUPPAGELOCK;
756/** @} */
757
758
759/** @name SUP_IOCTL_PAGE_UNLOCK
760 * Unpin physical pages.
761 * @{ */
762#define SUP_IOCTL_PAGE_UNLOCK SUP_CTL_CODE_SIZE(15, SUP_IOCTL_PAGE_UNLOCK_SIZE)
763#define SUP_IOCTL_PAGE_UNLOCK_SIZE sizeof(SUPPAGEUNLOCK)
764#define SUP_IOCTL_PAGE_UNLOCK_SIZE_IN sizeof(SUPPAGEUNLOCK)
765#define SUP_IOCTL_PAGE_UNLOCK_SIZE_OUT sizeof(SUPREQHDR)
766typedef struct SUPPAGEUNLOCK
767{
768 /** The header. */
769 SUPREQHDR Hdr;
770 union
771 {
772 struct
773 {
774 /** Start of page range of a range previously pinned. */
775 RTR3PTR pvR3;
776 } In;
777 } u;
778} SUPPAGEUNLOCK, *PSUPPAGEUNLOCK;
779/** @} */
780
781
782/** @name SUP_IOCTL_CONT_ALLOC
783 * Allocate continuous memory.
784 * @{
785 */
786#define SUP_IOCTL_CONT_ALLOC SUP_CTL_CODE_SIZE(16, SUP_IOCTL_CONT_ALLOC_SIZE)
787#define SUP_IOCTL_CONT_ALLOC_SIZE sizeof(SUPCONTALLOC)
788#define SUP_IOCTL_CONT_ALLOC_SIZE_IN (sizeof(SUPREQHDR) + RT_SIZEOFMEMB(SUPCONTALLOC, u.In))
789#define SUP_IOCTL_CONT_ALLOC_SIZE_OUT sizeof(SUPCONTALLOC)
790typedef struct SUPCONTALLOC
791{
792 /** The header. */
793 SUPREQHDR Hdr;
794 union
795 {
796 struct
797 {
798 /** The allocation size given as a page count. */
799 uint32_t cPages;
800 } In;
801
802 struct
803 {
804 /** The address of the ring-0 mapping of the allocated memory. */
805 RTR0PTR pvR0;
806 /** The address of the ring-3 mapping of the allocated memory. */
807 RTR3PTR pvR3;
808 /** The physical address of the allocation. */
809 RTHCPHYS HCPhys;
810 } Out;
811 } u;
812} SUPCONTALLOC, *PSUPCONTALLOC;
813/** @} */
814
815
816/** @name SUP_IOCTL_CONT_FREE Input.
817 * @{
818 */
819/** Free continuous memory. */
820#define SUP_IOCTL_CONT_FREE SUP_CTL_CODE_SIZE(17, SUP_IOCTL_CONT_FREE_SIZE)
821#define SUP_IOCTL_CONT_FREE_SIZE sizeof(SUPCONTFREE)
822#define SUP_IOCTL_CONT_FREE_SIZE_IN sizeof(SUPCONTFREE)
823#define SUP_IOCTL_CONT_FREE_SIZE_OUT sizeof(SUPREQHDR)
824typedef struct SUPCONTFREE
825{
826 /** The header. */
827 SUPREQHDR Hdr;
828 union
829 {
830 struct
831 {
832 /** The ring-3 address of the memory to free. */
833 RTR3PTR pvR3;
834 } In;
835 } u;
836} SUPCONTFREE, *PSUPCONTFREE;
837/** @} */
838
839
840/** @name SUP_IOCTL_GET_PAGING_MODE
841 * Get the host paging mode.
842 * @{
843 */
844#define SUP_IOCTL_GET_PAGING_MODE SUP_CTL_CODE_SIZE(18, SUP_IOCTL_GET_PAGING_MODE_SIZE)
845#define SUP_IOCTL_GET_PAGING_MODE_SIZE sizeof(SUPGETPAGINGMODE)
846#define SUP_IOCTL_GET_PAGING_MODE_SIZE_IN sizeof(SUPREQHDR)
847#define SUP_IOCTL_GET_PAGING_MODE_SIZE_OUT sizeof(SUPGETPAGINGMODE)
848typedef struct SUPGETPAGINGMODE
849{
850 /** The header. */
851 SUPREQHDR Hdr;
852 union
853 {
854 struct
855 {
856 /** The paging mode. */
857 SUPPAGINGMODE enmMode;
858 } Out;
859 } u;
860} SUPGETPAGINGMODE, *PSUPGETPAGINGMODE;
861/** @} */
862
863
864/** @name SUP_IOCTL_SET_VM_FOR_FAST
865 * Set the VM handle for doing fast call ioctl calls.
866 * @{
867 */
868#define SUP_IOCTL_SET_VM_FOR_FAST SUP_CTL_CODE_SIZE(19, SUP_IOCTL_SET_VM_FOR_FAST_SIZE)
869#define SUP_IOCTL_SET_VM_FOR_FAST_SIZE sizeof(SUPSETVMFORFAST)
870#define SUP_IOCTL_SET_VM_FOR_FAST_SIZE_IN sizeof(SUPSETVMFORFAST)
871#define SUP_IOCTL_SET_VM_FOR_FAST_SIZE_OUT sizeof(SUPREQHDR)
872typedef struct SUPSETVMFORFAST
873{
874 /** The header. */
875 SUPREQHDR Hdr;
876 union
877 {
878 struct
879 {
880 /** The ring-0 VM handle (pointer). */
881 PVMR0 pVMR0;
882 } In;
883 } u;
884} SUPSETVMFORFAST, *PSUPSETVMFORFAST;
885/** @} */
886
887
888/** @name SUP_IOCTL_GIP_MAP
889 * Map the GIP into user space.
890 * @{
891 */
892#define SUP_IOCTL_GIP_MAP SUP_CTL_CODE_SIZE(20, SUP_IOCTL_GIP_MAP_SIZE)
893#define SUP_IOCTL_GIP_MAP_SIZE sizeof(SUPGIPMAP)
894#define SUP_IOCTL_GIP_MAP_SIZE_IN sizeof(SUPREQHDR)
895#define SUP_IOCTL_GIP_MAP_SIZE_OUT sizeof(SUPGIPMAP)
896typedef struct SUPGIPMAP
897{
898 /** The header. */
899 SUPREQHDR Hdr;
900 union
901 {
902 struct
903 {
904 /** The physical address of the GIP. */
905 RTHCPHYS HCPhysGip;
906 /** Pointer to the read-only usermode GIP mapping for this session. */
907 R3PTRTYPE(PSUPGLOBALINFOPAGE) pGipR3;
908 /** Pointer to the supervisor mode GIP mapping. */
909 R0PTRTYPE(PSUPGLOBALINFOPAGE) pGipR0;
910 } Out;
911 } u;
912} SUPGIPMAP, *PSUPGIPMAP;
913/** @} */
914
915
916/** @name SUP_IOCTL_GIP_UNMAP
917 * Unmap the GIP.
918 * @{
919 */
920#define SUP_IOCTL_GIP_UNMAP SUP_CTL_CODE_SIZE(21, SUP_IOCTL_GIP_UNMAP_SIZE)
921#define SUP_IOCTL_GIP_UNMAP_SIZE sizeof(SUPGIPUNMAP)
922#define SUP_IOCTL_GIP_UNMAP_SIZE_IN sizeof(SUPGIPUNMAP)
923#define SUP_IOCTL_GIP_UNMAP_SIZE_OUT sizeof(SUPGIPUNMAP)
924typedef struct SUPGIPUNMAP
925{
926 /** The header. */
927 SUPREQHDR Hdr;
928} SUPGIPUNMAP, *PSUPGIPUNMAP;
929/** @} */
930
931
932/** @name SUP_IOCTL_CALL_SERVICE
933 * Call the a ring-0 service.
934 *
935 * @todo Might have to convert this to a big request, just like
936 * SUP_IOCTL_CALL_VMMR0
937 * @{
938 */
939#define SUP_IOCTL_CALL_SERVICE(cbReq) SUP_CTL_CODE_SIZE(22, SUP_IOCTL_CALL_SERVICE_SIZE(cbReq))
940#define SUP_IOCTL_CALL_SERVICE_SIZE(cbReq) RT_UOFFSETOF(SUPCALLSERVICE, abReqPkt[cbReq])
941#define SUP_IOCTL_CALL_SERVICE_SIZE_IN(cbReq) SUP_IOCTL_CALL_SERVICE_SIZE(cbReq)
942#define SUP_IOCTL_CALL_SERVICE_SIZE_OUT(cbReq) SUP_IOCTL_CALL_SERVICE_SIZE(cbReq)
943typedef struct SUPCALLSERVICE
944{
945 /** The header. */
946 SUPREQHDR Hdr;
947 union
948 {
949 struct
950 {
951 /** The service name. */
952 char szName[28];
953 /** Which operation to execute. */
954 uint32_t uOperation;
955 /** Argument to use when no request packet is supplied. */
956 uint64_t u64Arg;
957 } In;
958 } u;
959 /** The request packet passed to SUP. */
960 uint8_t abReqPkt[1];
961} SUPCALLSERVICE, *PSUPCALLSERVICE;
962/** @} */
963
964
965/** @name SUP_IOCTL_LOGGER_SETTINGS
966 * Changes the ring-0 release or debug logger settings.
967 * @{
968 */
969#define SUP_IOCTL_LOGGER_SETTINGS(cbStrTab) SUP_CTL_CODE_SIZE(23, SUP_IOCTL_LOGGER_SETTINGS_SIZE(cbStrTab))
970#define SUP_IOCTL_LOGGER_SETTINGS_SIZE(cbStrTab) RT_UOFFSETOF(SUPLOGGERSETTINGS, u.In.szStrings[cbStrTab])
971#define SUP_IOCTL_LOGGER_SETTINGS_SIZE_IN(cbStrTab) RT_UOFFSETOF(SUPLOGGERSETTINGS, u.In.szStrings[cbStrTab])
972#define SUP_IOCTL_LOGGER_SETTINGS_SIZE_OUT sizeof(SUPREQHDR)
973typedef struct SUPLOGGERSETTINGS
974{
975 /** The header. */
976 SUPREQHDR Hdr;
977 union
978 {
979 struct
980 {
981 /** Which logger. */
982 uint32_t fWhich;
983 /** What to do with it. */
984 uint32_t fWhat;
985 /** Offset of the flags setting string. */
986 uint32_t offFlags;
987 /** Offset of the groups setting string. */
988 uint32_t offGroups;
989 /** Offset of the destination setting string. */
990 uint32_t offDestination;
991 /** The string table. */
992 char szStrings[1];
993 } In;
994 } u;
995} SUPLOGGERSETTINGS, *PSUPLOGGERSETTINGS;
996
997/** Debug logger. */
998#define SUPLOGGERSETTINGS_WHICH_DEBUG 0
999/** Release logger. */
1000#define SUPLOGGERSETTINGS_WHICH_RELEASE 1
1001
1002/** Change the settings. */
1003#define SUPLOGGERSETTINGS_WHAT_SETTINGS 0
1004/** Create the logger instance. */
1005#define SUPLOGGERSETTINGS_WHAT_CREATE 1
1006/** Destroy the logger instance. */
1007#define SUPLOGGERSETTINGS_WHAT_DESTROY 2
1008
1009/** @} */
1010
1011
1012/** @name Semaphore Types
1013 * @{ */
1014#define SUP_SEM_TYPE_EVENT 0
1015#define SUP_SEM_TYPE_EVENT_MULTI 1
1016/** @} */
1017
1018
1019/** @name SUP_IOCTL_SEM_CREATE
1020 * Create a semaphore
1021 * @todo remove this interface with the next major version change.
1022 * @{
1023 */
1024#define SUP_IOCTL_SEM_CREATE SUP_CTL_CODE_SIZE(24, SUP_IOCTL_SEM_CREATE_SIZE)
1025#define SUP_IOCTL_SEM_CREATE_SIZE sizeof(SUPSEMCREATE)
1026#define SUP_IOCTL_SEM_CREATE_SIZE_IN sizeof(SUPSEMCREATE)
1027#define SUP_IOCTL_SEM_CREATE_SIZE_OUT sizeof(SUPSEMCREATE)
1028typedef struct SUPSEMCREATE
1029{
1030 /** The header. */
1031 SUPREQHDR Hdr;
1032 union
1033 {
1034 struct
1035 {
1036 /** The semaphore type. */
1037 uint32_t uType;
1038 } In;
1039 struct
1040 {
1041 /** The handle of the created semaphore. */
1042 uint32_t hSem;
1043 } Out;
1044 } u;
1045} SUPSEMCREATE, *PSUPSEMCREATE;
1046
1047/** @} */
1048
1049
1050/** @name SUP_IOCTL_SEM_OP
1051 * Semaphore operations.
1052 * @todo remove this interface with the next major version change.
1053 * @{
1054 */
1055#define SUP_IOCTL_SEM_OP SUP_CTL_CODE_SIZE(25, SUP_IOCTL_SEM_OP_SIZE)
1056#define SUP_IOCTL_SEM_OP_SIZE sizeof(SUPSEMOP)
1057#define SUP_IOCTL_SEM_OP_SIZE_IN sizeof(SUPSEMOP)
1058#define SUP_IOCTL_SEM_OP_SIZE_OUT sizeof(SUPREQHDR)
1059typedef struct SUPSEMOP
1060{
1061 /** The header. */
1062 SUPREQHDR Hdr;
1063 union
1064 {
1065 struct
1066 {
1067 /** The semaphore type. */
1068 uint32_t uType;
1069 /** The semaphore handle. */
1070 uint32_t hSem;
1071 /** The operation. */
1072 uint32_t uOp;
1073 /** The number of milliseconds to wait if it's a wait operation. */
1074 uint32_t cMillies;
1075 } In;
1076 } u;
1077} SUPSEMOP, *PSUPSEMOP;
1078
1079/** Wait for a number of milliseconds. */
1080#define SUPSEMOP_WAIT 0
1081/** Signal the semaphore. */
1082#define SUPSEMOP_SIGNAL 1
1083/** Reset the semaphore (only applicable to SUP_SEM_TYPE_EVENT_MULTI). */
1084#define SUPSEMOP_RESET 2
1085/** Close the semaphore handle. */
1086#define SUPSEMOP_CLOSE 3
1087
1088/** @} */
1089
1090/** @name SUP_IOCTL_SEM_OP2
1091 * Semaphore operations.
1092 * @remarks This replaces the old SUP_IOCTL_SEM_OP interface.
1093 * @{
1094 */
1095#define SUP_IOCTL_SEM_OP2 SUP_CTL_CODE_SIZE(27, SUP_IOCTL_SEM_OP2_SIZE)
1096#define SUP_IOCTL_SEM_OP2_SIZE sizeof(SUPSEMOP2)
1097#define SUP_IOCTL_SEM_OP2_SIZE_IN sizeof(SUPSEMOP2)
1098#define SUP_IOCTL_SEM_OP2_SIZE_OUT sizeof(SUPREQHDR)
1099typedef struct SUPSEMOP2
1100{
1101 /** The header. */
1102 SUPREQHDR Hdr;
1103 union
1104 {
1105 struct
1106 {
1107 /** The semaphore type. */
1108 uint32_t uType;
1109 /** The semaphore handle. */
1110 uint32_t hSem;
1111 /** The operation. */
1112 uint32_t uOp;
1113 /** Reserved, must be zero. */
1114 uint32_t uReserved;
1115 /** The number of milliseconds to wait if it's a wait operation. */
1116 union
1117 {
1118 /** Absolute timeout (RTTime[System]NanoTS).
1119 * Used by SUPSEMOP2_WAIT_NS_ABS. */
1120 uint64_t uAbsNsTimeout;
1121 /** Relative nanosecond timeout.
1122 * Used by SUPSEMOP2_WAIT_NS_REL. */
1123 uint64_t cRelNsTimeout;
1124 /** Relative millisecond timeout.
1125 * Used by SUPSEMOP2_WAIT_MS_REL. */
1126 uint32_t cRelMsTimeout;
1127 /** Generic 64-bit accessor.
1128 * ASSUMES little endian! */
1129 uint64_t u64;
1130 } uArg;
1131 } In;
1132 } u;
1133} SUPSEMOP2, *PSUPSEMOP2;
1134
1135/** Wait for a number of milliseconds. */
1136#define SUPSEMOP2_WAIT_MS_REL 0
1137/** Wait until the specified deadline is reached. */
1138#define SUPSEMOP2_WAIT_NS_ABS 1
1139/** Wait for a number of nanoseconds. */
1140#define SUPSEMOP2_WAIT_NS_REL 2
1141/** Signal the semaphore. */
1142#define SUPSEMOP2_SIGNAL 3
1143/** Reset the semaphore (only applicable to SUP_SEM_TYPE_EVENT_MULTI). */
1144#define SUPSEMOP2_RESET 4
1145/** Close the semaphore handle. */
1146#define SUPSEMOP2_CLOSE 5
1147/** @} */
1148
1149/** @name SUP_IOCTL_SEM_OP3
1150 * Semaphore operations.
1151 * @{
1152 */
1153#define SUP_IOCTL_SEM_OP3 SUP_CTL_CODE_SIZE(28, SUP_IOCTL_SEM_OP3_SIZE)
1154#define SUP_IOCTL_SEM_OP3_SIZE sizeof(SUPSEMOP3)
1155#define SUP_IOCTL_SEM_OP3_SIZE_IN sizeof(SUPSEMOP3)
1156#define SUP_IOCTL_SEM_OP3_SIZE_OUT sizeof(SUPSEMOP3)
1157typedef struct SUPSEMOP3
1158{
1159 /** The header. */
1160 SUPREQHDR Hdr;
1161 union
1162 {
1163 struct
1164 {
1165 /** The semaphore type. */
1166 uint32_t uType;
1167 /** The semaphore handle. */
1168 uint32_t hSem;
1169 /** The operation. */
1170 uint32_t uOp;
1171 /** Reserved, must be zero. */
1172 uint32_t u32Reserved;
1173 /** Reserved for future use. */
1174 uint64_t u64Reserved;
1175 } In;
1176 union
1177 {
1178 /** The handle of the created semaphore.
1179 * Used by SUPSEMOP3_CREATE. */
1180 uint32_t hSem;
1181 /** The semaphore resolution in nano seconds.
1182 * Used by SUPSEMOP3_GET_RESOLUTION. */
1183 uint32_t cNsResolution;
1184 /** The 32-bit view. */
1185 uint32_t u32;
1186 /** Reserved some space for later expansion. */
1187 uint64_t u64Reserved;
1188 } Out;
1189 } u;
1190} SUPSEMOP3, *PSUPSEMOP3;
1191
1192/** Get the wait resolution. */
1193#define SUPSEMOP3_CREATE 0
1194/** Get the wait resolution. */
1195#define SUPSEMOP3_GET_RESOLUTION 1
1196/** @} */
1197
1198/** @name SUP_IOCTL_VT_CAPS
1199 * Get the VT-x/AMD-V capabilities.
1200 *
1201 * @todo Intended for main, which means we need to relax the privilege requires
1202 * when accessing certain vboxdrv functions.
1203 *
1204 * @{
1205 */
1206#define SUP_IOCTL_VT_CAPS SUP_CTL_CODE_SIZE(26, SUP_IOCTL_VT_CAPS_SIZE)
1207#define SUP_IOCTL_VT_CAPS_SIZE sizeof(SUPVTCAPS)
1208#define SUP_IOCTL_VT_CAPS_SIZE_IN sizeof(SUPREQHDR)
1209#define SUP_IOCTL_VT_CAPS_SIZE_OUT sizeof(SUPVTCAPS)
1210typedef struct SUPVTCAPS
1211{
1212 /** The header. */
1213 SUPREQHDR Hdr;
1214 union
1215 {
1216 struct
1217 {
1218 /** The VT capability dword. */
1219 uint32_t Caps;
1220 } Out;
1221 } u;
1222} SUPVTCAPS, *PSUPVTCAPS;
1223/** @} */
1224
1225#pragma pack() /* paranoia */
1226
1227#endif
1228
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