VirtualBox

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

Last change on this file since 43394 was 43394, checked in by vboxsync, 12 years ago

VMM: HM cleanup.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 44.5 KB
Line 
1/* $Revision: 43394 $ */
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#include <VBox/sup.h>
35
36/*
37 * IOCtl numbers.
38 * We're using the Win32 type of numbers here, thus the macros below.
39 * The SUP_IOCTL_FLAG macro is used to separate requests from 32-bit
40 * and 64-bit processes.
41 */
42#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_SPARC64)
43# define SUP_IOCTL_FLAG 128
44#elif defined(RT_ARCH_X86) || defined(RT_ARCH_SPARC)
45# define SUP_IOCTL_FLAG 0
46#else
47# error "dunno which arch this is!"
48#endif
49
50#ifdef RT_OS_WINDOWS
51# ifndef CTL_CODE
52# include <Windows.h>
53# endif
54 /* Automatic buffering, size not encoded. */
55# define SUP_CTL_CODE_SIZE(Function, Size) CTL_CODE(FILE_DEVICE_UNKNOWN, (Function) | SUP_IOCTL_FLAG, METHOD_BUFFERED, FILE_WRITE_ACCESS)
56# define SUP_CTL_CODE_BIG(Function) CTL_CODE(FILE_DEVICE_UNKNOWN, (Function) | SUP_IOCTL_FLAG, METHOD_BUFFERED, FILE_WRITE_ACCESS)
57# define SUP_CTL_CODE_FAST(Function) CTL_CODE(FILE_DEVICE_UNKNOWN, (Function) | SUP_IOCTL_FLAG, METHOD_NEITHER, FILE_WRITE_ACCESS)
58# define SUP_CTL_CODE_NO_SIZE(uIOCtl) (uIOCtl)
59
60#elif defined(RT_OS_SOLARIS)
61 /* No automatic buffering, size limited to 255 bytes. */
62# include <sys/ioccom.h>
63# define SUP_CTL_CODE_SIZE(Function, Size) _IOWRN('V', (Function) | SUP_IOCTL_FLAG, sizeof(SUPREQHDR))
64# define SUP_CTL_CODE_BIG(Function) _IOWRN('V', (Function) | SUP_IOCTL_FLAG, sizeof(SUPREQHDR))
65# define SUP_CTL_CODE_FAST(Function) _IO( 'V', (Function) | SUP_IOCTL_FLAG)
66# define SUP_CTL_CODE_NO_SIZE(uIOCtl) (uIOCtl)
67
68#elif defined(RT_OS_OS2)
69 /* No automatic buffering, size not encoded. */
70# define SUP_CTL_CATEGORY 0xc0
71# define SUP_CTL_CODE_SIZE(Function, Size) ((unsigned char)(Function))
72# define SUP_CTL_CODE_BIG(Function) ((unsigned char)(Function))
73# define SUP_CTL_CATEGORY_FAST 0xc1
74# define SUP_CTL_CODE_FAST(Function) ((unsigned char)(Function))
75# define SUP_CTL_CODE_NO_SIZE(uIOCtl) (uIOCtl)
76
77#elif defined(RT_OS_LINUX)
78 /* No automatic buffering, size limited to 16KB. */
79# include <linux/ioctl.h>
80# define SUP_CTL_CODE_SIZE(Function, Size) _IOC(_IOC_READ | _IOC_WRITE, 'V', (Function) | SUP_IOCTL_FLAG, (Size))
81# define SUP_CTL_CODE_BIG(Function) _IO('V', (Function) | SUP_IOCTL_FLAG)
82# define SUP_CTL_CODE_FAST(Function) _IO('V', (Function) | SUP_IOCTL_FLAG)
83# define SUP_CTL_CODE_NO_SIZE(uIOCtl) ((uIOCtl) & ~IOCSIZE_MASK)
84
85#elif defined(RT_OS_L4)
86 /* Implemented in suplib, no worries. */
87# define SUP_CTL_CODE_SIZE(Function, Size) (Function)
88# define SUP_CTL_CODE_BIG(Function) (Function)
89# define SUP_CTL_CODE_FAST(Function) (Function)
90# define SUP_CTL_CODE_NO_SIZE(uIOCtl) (uIOCtl)
91
92#else /* BSD Like */
93 /* Automatic buffering, size limited to 4KB on *BSD and 8KB on Darwin - commands the limit, 4KB. */
94# include <sys/ioccom.h>
95# define SUP_CTL_CODE_SIZE(Function, Size) _IOC(IOC_INOUT, 'V', (Function) | SUP_IOCTL_FLAG, (Size))
96# define SUP_CTL_CODE_BIG(Function) _IO('V', (Function) | SUP_IOCTL_FLAG)
97# define SUP_CTL_CODE_FAST(Function) _IO('V', (Function) | SUP_IOCTL_FLAG)
98# define SUP_CTL_CODE_NO_SIZE(uIOCtl) ( (uIOCtl) & ~_IOC(0,0,0,IOCPARM_MASK) )
99#endif
100
101/** Fast path IOCtl: VMMR0_DO_RAW_RUN */
102#define SUP_IOCTL_FAST_DO_RAW_RUN SUP_CTL_CODE_FAST(64)
103/** Fast path IOCtl: VMMR0_DO_HM_RUN */
104#define SUP_IOCTL_FAST_DO_HM_RUN SUP_CTL_CODE_FAST(65)
105/** Just a NOP call for profiling the latency of a fast ioctl call to VMMR0. */
106#define SUP_IOCTL_FAST_DO_NOP SUP_CTL_CODE_FAST(66)
107
108
109
110/*******************************************************************************
111* Structures and Typedefs *
112*******************************************************************************/
113#ifdef RT_ARCH_AMD64
114# pragma pack(8) /* paranoia. */
115#else
116# pragma pack(4) /* paranoia. */
117#endif
118
119
120/**
121 * Common In/Out header.
122 */
123typedef struct SUPREQHDR
124{
125 /** Cookie. */
126 uint32_t u32Cookie;
127 /** Session cookie. */
128 uint32_t u32SessionCookie;
129 /** The size of the input. */
130 uint32_t cbIn;
131 /** The size of the output. */
132 uint32_t cbOut;
133 /** Flags. See SUPREQHDR_FLAGS_* for details and values. */
134 uint32_t fFlags;
135 /** The VBox status code of the operation, out direction only. */
136 int32_t rc;
137} SUPREQHDR;
138/** Pointer to a IOC header. */
139typedef SUPREQHDR *PSUPREQHDR;
140
141/** @name SUPREQHDR::fFlags values
142 * @{ */
143/** Masks out the magic value. */
144#define SUPREQHDR_FLAGS_MAGIC_MASK UINT32_C(0xff0000ff)
145/** The generic mask. */
146#define SUPREQHDR_FLAGS_GEN_MASK UINT32_C(0x0000ff00)
147/** The request specific mask. */
148#define SUPREQHDR_FLAGS_REQ_MASK UINT32_C(0x00ff0000)
149
150/** There is extra input that needs copying on some platforms. */
151#define SUPREQHDR_FLAGS_EXTRA_IN UINT32_C(0x00000100)
152/** There is extra output that needs copying on some platforms. */
153#define SUPREQHDR_FLAGS_EXTRA_OUT UINT32_C(0x00000200)
154
155/** The magic value. */
156#define SUPREQHDR_FLAGS_MAGIC UINT32_C(0x42000042)
157/** The default value. Use this when no special stuff is requested. */
158#define SUPREQHDR_FLAGS_DEFAULT SUPREQHDR_FLAGS_MAGIC
159/** @} */
160
161
162/** @name SUP_IOCTL_COOKIE
163 * @{
164 */
165/** Negotiate cookie. */
166#define SUP_IOCTL_COOKIE SUP_CTL_CODE_SIZE(1, SUP_IOCTL_COOKIE_SIZE)
167/** The request size. */
168#define SUP_IOCTL_COOKIE_SIZE sizeof(SUPCOOKIE)
169/** The SUPREQHDR::cbIn value. */
170#define SUP_IOCTL_COOKIE_SIZE_IN sizeof(SUPREQHDR) + RT_SIZEOFMEMB(SUPCOOKIE, u.In)
171/** The SUPREQHDR::cbOut value. */
172#define SUP_IOCTL_COOKIE_SIZE_OUT sizeof(SUPREQHDR) + RT_SIZEOFMEMB(SUPCOOKIE, u.Out)
173/** SUPCOOKIE_IN magic word. */
174#define SUPCOOKIE_MAGIC "The Magic Word!"
175/** The initial cookie. */
176#define SUPCOOKIE_INITIAL_COOKIE 0x69726f74 /* 'tori' */
177
178/** Current interface version.
179 * The upper 16-bit is the major version, the lower the minor version.
180 * When incompatible changes are made, the upper major number has to be changed.
181 *
182 * Update rules:
183 * -# Only update the major number when incompatible changes have been made to
184 * the IOC interface or the ABI provided via the functions returned by
185 * SUPQUERYFUNCS.
186 * -# When adding new features (new IOC number, new flags, new exports, ++)
187 * only update the minor number and change SUPLib.cpp to require the
188 * new IOC version.
189 * -# When incrementing the major number, clear the minor part and reset
190 * any IOC version requirements in SUPLib.cpp.
191 * -# When increment the major number, execute all pending work.
192 *
193 * @todo Pending work on next major version change:
194 * - Remove RTSpinlockReleaseNoInts.
195 */
196#define SUPDRV_IOC_VERSION 0x001a0005
197
198/** SUP_IOCTL_COOKIE. */
199typedef struct SUPCOOKIE
200{
201 /** The header.
202 * u32Cookie must be set to SUPCOOKIE_INITIAL_COOKIE.
203 * u32SessionCookie should be set to some random value. */
204 SUPREQHDR Hdr;
205 union
206 {
207 struct
208 {
209 /** Magic word. */
210 char szMagic[16];
211 /** The requested interface version number. */
212 uint32_t u32ReqVersion;
213 /** The minimum interface version number. */
214 uint32_t u32MinVersion;
215 } In;
216 struct
217 {
218 /** Cookie. */
219 uint32_t u32Cookie;
220 /** Session cookie. */
221 uint32_t u32SessionCookie;
222 /** Interface version for this session. */
223 uint32_t u32SessionVersion;
224 /** The actual interface version in the driver. */
225 uint32_t u32DriverVersion;
226 /** Number of functions available for the SUP_IOCTL_QUERY_FUNCS request. */
227 uint32_t cFunctions;
228 /** Session handle. */
229 R0PTRTYPE(PSUPDRVSESSION) pSession;
230 } Out;
231 } u;
232} SUPCOOKIE, *PSUPCOOKIE;
233/** @} */
234
235
236/** @name SUP_IOCTL_QUERY_FUNCS
237 * Query SUPR0 functions.
238 * @{
239 */
240#define SUP_IOCTL_QUERY_FUNCS(cFuncs) SUP_CTL_CODE_BIG(2)
241#define SUP_IOCTL_QUERY_FUNCS_SIZE(cFuncs) RT_UOFFSETOF(SUPQUERYFUNCS, u.Out.aFunctions[(cFuncs)])
242#define SUP_IOCTL_QUERY_FUNCS_SIZE_IN sizeof(SUPREQHDR)
243#define SUP_IOCTL_QUERY_FUNCS_SIZE_OUT(cFuncs) SUP_IOCTL_QUERY_FUNCS_SIZE(cFuncs)
244
245/** A function. */
246typedef struct SUPFUNC
247{
248 /** Name - mangled. */
249 char szName[32];
250 /** Address. */
251 RTR0PTR pfn;
252} SUPFUNC, *PSUPFUNC;
253
254typedef struct SUPQUERYFUNCS
255{
256 /** The header. */
257 SUPREQHDR Hdr;
258 union
259 {
260 struct
261 {
262 /** Number of functions returned. */
263 uint32_t cFunctions;
264 /** Array of functions. */
265 SUPFUNC aFunctions[1];
266 } Out;
267 } u;
268} SUPQUERYFUNCS, *PSUPQUERYFUNCS;
269/** @} */
270
271
272/** @name SUP_IOCTL_LDR_OPEN
273 * Open an image.
274 * @{
275 */
276#define SUP_IOCTL_LDR_OPEN SUP_CTL_CODE_SIZE(3, SUP_IOCTL_LDR_OPEN_SIZE)
277#define SUP_IOCTL_LDR_OPEN_SIZE sizeof(SUPLDROPEN)
278#define SUP_IOCTL_LDR_OPEN_SIZE_IN sizeof(SUPLDROPEN)
279#define SUP_IOCTL_LDR_OPEN_SIZE_OUT (sizeof(SUPREQHDR) + RT_SIZEOFMEMB(SUPLDROPEN, u.Out))
280typedef struct SUPLDROPEN
281{
282 /** The header. */
283 SUPREQHDR Hdr;
284 union
285 {
286 struct
287 {
288 /** Size of the image we'll be loading (including tables). */
289 uint32_t cbImageWithTabs;
290 /** The size of the image bits. (Less or equal to cbImageWithTabs.) */
291 uint32_t cbImageBits;
292 /** Image name.
293 * This is the NAME of the image, not the file name. It is used
294 * to share code with other processes. (Max len is 32 chars!) */
295 char szName[32];
296 /** Image file name.
297 * This can be used to load the image using a native loader. */
298 char szFilename[260];
299 } In;
300 struct
301 {
302 /** The base address of the image. */
303 RTR0PTR pvImageBase;
304 /** Indicate whether or not the image requires loading. */
305 bool fNeedsLoading;
306 /** Indicates that we're using the native ring-0 loader. */
307 bool fNativeLoader;
308 } Out;
309 } u;
310} SUPLDROPEN, *PSUPLDROPEN;
311/** @} */
312
313
314/** @name SUP_IOCTL_LDR_LOAD
315 * Upload the image bits.
316 * @{
317 */
318#define SUP_IOCTL_LDR_LOAD SUP_CTL_CODE_BIG(4)
319#define SUP_IOCTL_LDR_LOAD_SIZE(cbImage) RT_UOFFSETOF(SUPLDRLOAD, u.In.abImage[cbImage])
320#define SUP_IOCTL_LDR_LOAD_SIZE_IN(cbImage) RT_UOFFSETOF(SUPLDRLOAD, u.In.abImage[cbImage])
321#define SUP_IOCTL_LDR_LOAD_SIZE_OUT sizeof(SUPREQHDR)
322
323/**
324 * Module initialization callback function.
325 * This is called once after the module has been loaded.
326 *
327 * @returns 0 on success.
328 * @returns Appropriate error code on failure.
329 * @param hMod Image handle for use in APIs.
330 */
331typedef DECLCALLBACK(int) FNR0MODULEINIT(void *hMod);
332/** Pointer to a FNR0MODULEINIT(). */
333typedef R0PTRTYPE(FNR0MODULEINIT *) PFNR0MODULEINIT;
334
335/**
336 * Module termination callback function.
337 * This is called once right before the module is being unloaded.
338 *
339 * @param hMod Image handle for use in APIs.
340 */
341typedef DECLCALLBACK(void) FNR0MODULETERM(void *hMod);
342/** Pointer to a FNR0MODULETERM(). */
343typedef R0PTRTYPE(FNR0MODULETERM *) PFNR0MODULETERM;
344
345/**
346 * Symbol table entry.
347 */
348typedef struct SUPLDRSYM
349{
350 /** Offset into of the string table. */
351 uint32_t offName;
352 /** Offset of the symbol relative to the image load address.
353 * @remarks When used inside the SUPDrv to calculate real addresses, it
354 * must be cast to int32_t for the sake of native loader support
355 * on Solaris. (The loader puts the and data in different
356 * memory areans, and the text one is generally higher.) */
357 uint32_t offSymbol;
358} SUPLDRSYM;
359/** Pointer to a symbol table entry. */
360typedef SUPLDRSYM *PSUPLDRSYM;
361/** Pointer to a const symbol table entry. */
362typedef SUPLDRSYM const *PCSUPLDRSYM;
363
364/**
365 * SUPLDRLOAD::u::In::EP type.
366 */
367typedef enum SUPLDRLOADEP
368{
369 SUPLDRLOADEP_NOTHING = 0,
370 SUPLDRLOADEP_VMMR0,
371 SUPLDRLOADEP_SERVICE,
372 SUPLDRLOADEP_32BIT_HACK = 0x7fffffff
373} SUPLDRLOADEP;
374
375typedef struct SUPLDRLOAD
376{
377 /** The header. */
378 SUPREQHDR Hdr;
379 union
380 {
381 struct
382 {
383 /** The address of module initialization function. Similar to _DLL_InitTerm(hmod, 0). */
384 PFNR0MODULEINIT pfnModuleInit;
385 /** The address of module termination function. Similar to _DLL_InitTerm(hmod, 1). */
386 PFNR0MODULETERM pfnModuleTerm;
387 /** Special entry points. */
388 union
389 {
390 /** SUPLDRLOADEP_VMMR0. */
391 struct
392 {
393 /** The module handle (i.e. address). */
394 RTR0PTR pvVMMR0;
395 /** Address of VMMR0EntryInt function. */
396 RTR0PTR pvVMMR0EntryInt;
397 /** Address of VMMR0EntryFast function. */
398 RTR0PTR pvVMMR0EntryFast;
399 /** Address of VMMR0EntryEx function. */
400 RTR0PTR pvVMMR0EntryEx;
401 } VMMR0;
402 /** SUPLDRLOADEP_SERVICE. */
403 struct
404 {
405 /** The service request handler.
406 * (PFNR0SERVICEREQHANDLER isn't defined yet.) */
407 RTR0PTR pfnServiceReq;
408 /** Reserved, must be NIL. */
409 RTR0PTR apvReserved[3];
410 } Service;
411 } EP;
412 /** Address. */
413 RTR0PTR pvImageBase;
414 /** Entry point type. */
415 SUPLDRLOADEP eEPType;
416 /** The size of the image bits (starting at offset 0 and
417 * approaching offSymbols). */
418 uint32_t cbImageBits;
419 /** The offset of the symbol table. */
420 uint32_t offSymbols;
421 /** The number of entries in the symbol table. */
422 uint32_t cSymbols;
423 /** The offset of the string table. */
424 uint32_t offStrTab;
425 /** Size of the string table. */
426 uint32_t cbStrTab;
427 /** Size of image data in achImage. */
428 uint32_t cbImageWithTabs;
429 /** The image data. */
430 uint8_t abImage[1];
431 } In;
432 } u;
433} SUPLDRLOAD, *PSUPLDRLOAD;
434/** @} */
435
436
437/** @name SUP_IOCTL_LDR_FREE
438 * Free an image.
439 * @{
440 */
441#define SUP_IOCTL_LDR_FREE SUP_CTL_CODE_SIZE(5, SUP_IOCTL_LDR_FREE_SIZE)
442#define SUP_IOCTL_LDR_FREE_SIZE sizeof(SUPLDRFREE)
443#define SUP_IOCTL_LDR_FREE_SIZE_IN sizeof(SUPLDRFREE)
444#define SUP_IOCTL_LDR_FREE_SIZE_OUT sizeof(SUPREQHDR)
445typedef struct SUPLDRFREE
446{
447 /** The header. */
448 SUPREQHDR Hdr;
449 union
450 {
451 struct
452 {
453 /** Address. */
454 RTR0PTR pvImageBase;
455 } In;
456 } u;
457} SUPLDRFREE, *PSUPLDRFREE;
458/** @} */
459
460
461/** @name SUP_IOCTL_LDR_GET_SYMBOL
462 * Get address of a symbol within an image.
463 * @{
464 */
465#define SUP_IOCTL_LDR_GET_SYMBOL SUP_CTL_CODE_SIZE(6, SUP_IOCTL_LDR_GET_SYMBOL_SIZE)
466#define SUP_IOCTL_LDR_GET_SYMBOL_SIZE sizeof(SUPLDRGETSYMBOL)
467#define SUP_IOCTL_LDR_GET_SYMBOL_SIZE_IN sizeof(SUPLDRGETSYMBOL)
468#define SUP_IOCTL_LDR_GET_SYMBOL_SIZE_OUT (sizeof(SUPREQHDR) + RT_SIZEOFMEMB(SUPLDRGETSYMBOL, u.Out))
469typedef struct SUPLDRGETSYMBOL
470{
471 /** The header. */
472 SUPREQHDR Hdr;
473 union
474 {
475 struct
476 {
477 /** Address. */
478 RTR0PTR pvImageBase;
479 /** The symbol name. */
480 char szSymbol[64];
481 } In;
482 struct
483 {
484 /** The symbol address. */
485 RTR0PTR pvSymbol;
486 } Out;
487 } u;
488} SUPLDRGETSYMBOL, *PSUPLDRGETSYMBOL;
489/** @} */
490
491
492/** @name SUP_IOCTL_CALL_VMMR0
493 * Call the R0 VMM Entry point.
494 * @{
495 */
496#define SUP_IOCTL_CALL_VMMR0(cbReq) SUP_CTL_CODE_SIZE(7, SUP_IOCTL_CALL_VMMR0_SIZE(cbReq))
497#define SUP_IOCTL_CALL_VMMR0_SIZE(cbReq) RT_UOFFSETOF(SUPCALLVMMR0, abReqPkt[cbReq])
498#define SUP_IOCTL_CALL_VMMR0_SIZE_IN(cbReq) SUP_IOCTL_CALL_VMMR0_SIZE(cbReq)
499#define SUP_IOCTL_CALL_VMMR0_SIZE_OUT(cbReq) SUP_IOCTL_CALL_VMMR0_SIZE(cbReq)
500typedef struct SUPCALLVMMR0
501{
502 /** The header. */
503 SUPREQHDR Hdr;
504 union
505 {
506 struct
507 {
508 /** The VM handle. */
509 PVMR0 pVMR0;
510 /** VCPU id. */
511 uint32_t idCpu;
512 /** Which operation to execute. */
513 uint32_t uOperation;
514 /** Argument to use when no request packet is supplied. */
515 uint64_t u64Arg;
516 } In;
517 } u;
518 /** The VMMR0Entry request packet. */
519 uint8_t abReqPkt[1];
520} SUPCALLVMMR0, *PSUPCALLVMMR0;
521/** @} */
522
523
524/** @name SUP_IOCTL_CALL_VMMR0_BIG
525 * Version of SUP_IOCTL_CALL_VMMR0 for dealing with large requests.
526 * @{
527 */
528#define SUP_IOCTL_CALL_VMMR0_BIG SUP_CTL_CODE_BIG(27)
529#define SUP_IOCTL_CALL_VMMR0_BIG_SIZE(cbReq) RT_UOFFSETOF(SUPCALLVMMR0, abReqPkt[cbReq])
530#define SUP_IOCTL_CALL_VMMR0_BIG_SIZE_IN(cbReq) SUP_IOCTL_CALL_VMMR0_SIZE(cbReq)
531#define SUP_IOCTL_CALL_VMMR0_BIG_SIZE_OUT(cbReq) SUP_IOCTL_CALL_VMMR0_SIZE(cbReq)
532/** @} */
533
534
535/** @name SUP_IOCTL_LOW_ALLOC
536 * Allocate memory below 4GB (physically).
537 * @{
538 */
539#define SUP_IOCTL_LOW_ALLOC SUP_CTL_CODE_BIG(8)
540#define SUP_IOCTL_LOW_ALLOC_SIZE(cPages) ((uint32_t)RT_UOFFSETOF(SUPLOWALLOC, u.Out.aPages[cPages]))
541#define SUP_IOCTL_LOW_ALLOC_SIZE_IN (sizeof(SUPREQHDR) + RT_SIZEOFMEMB(SUPLOWALLOC, u.In))
542#define SUP_IOCTL_LOW_ALLOC_SIZE_OUT(cPages) SUP_IOCTL_LOW_ALLOC_SIZE(cPages)
543typedef struct SUPLOWALLOC
544{
545 /** The header. */
546 SUPREQHDR Hdr;
547 union
548 {
549 struct
550 {
551 /** Number of pages to allocate. */
552 uint32_t cPages;
553 } In;
554 struct
555 {
556 /** The ring-3 address of the allocated memory. */
557 RTR3PTR pvR3;
558 /** The ring-0 address of the allocated memory. */
559 RTR0PTR pvR0;
560 /** Array of pages. */
561 RTHCPHYS aPages[1];
562 } Out;
563 } u;
564} SUPLOWALLOC, *PSUPLOWALLOC;
565/** @} */
566
567
568/** @name SUP_IOCTL_LOW_FREE
569 * Free low memory.
570 * @{
571 */
572#define SUP_IOCTL_LOW_FREE SUP_CTL_CODE_SIZE(9, SUP_IOCTL_LOW_FREE_SIZE)
573#define SUP_IOCTL_LOW_FREE_SIZE sizeof(SUPLOWFREE)
574#define SUP_IOCTL_LOW_FREE_SIZE_IN sizeof(SUPLOWFREE)
575#define SUP_IOCTL_LOW_FREE_SIZE_OUT sizeof(SUPREQHDR)
576typedef struct SUPLOWFREE
577{
578 /** The header. */
579 SUPREQHDR Hdr;
580 union
581 {
582 struct
583 {
584 /** The ring-3 address of the memory to free. */
585 RTR3PTR pvR3;
586 } In;
587 } u;
588} SUPLOWFREE, *PSUPLOWFREE;
589/** @} */
590
591
592/** @name SUP_IOCTL_PAGE_ALLOC_EX
593 * Allocate memory and map it into kernel and/or user space. The memory is of
594 * course locked. The result should be freed using SUP_IOCTL_PAGE_FREE.
595 *
596 * @remarks Allocations without a kernel mapping may fail with
597 * VERR_NOT_SUPPORTED on some platforms.
598 *
599 * @{
600 */
601#define SUP_IOCTL_PAGE_ALLOC_EX SUP_CTL_CODE_BIG(10)
602#define SUP_IOCTL_PAGE_ALLOC_EX_SIZE(cPages) RT_UOFFSETOF(SUPPAGEALLOCEX, u.Out.aPages[cPages])
603#define SUP_IOCTL_PAGE_ALLOC_EX_SIZE_IN (sizeof(SUPREQHDR) + RT_SIZEOFMEMB(SUPPAGEALLOCEX, u.In))
604#define SUP_IOCTL_PAGE_ALLOC_EX_SIZE_OUT(cPages) SUP_IOCTL_PAGE_ALLOC_EX_SIZE(cPages)
605typedef struct SUPPAGEALLOCEX
606{
607 /** The header. */
608 SUPREQHDR Hdr;
609 union
610 {
611 struct
612 {
613 /** Number of pages to allocate */
614 uint32_t cPages;
615 /** Whether it should have kernel mapping. */
616 bool fKernelMapping;
617 /** Whether it should have a user mapping. */
618 bool fUserMapping;
619 /** Reserved. Must be false. */
620 bool fReserved0;
621 /** Reserved. Must be false. */
622 bool fReserved1;
623 } In;
624 struct
625 {
626 /** Returned ring-3 address. */
627 RTR3PTR pvR3;
628 /** Returned ring-0 address. */
629 RTR0PTR pvR0;
630 /** The physical addresses of the allocated pages. */
631 RTHCPHYS aPages[1];
632 } Out;
633 } u;
634} SUPPAGEALLOCEX, *PSUPPAGEALLOCEX;
635/** @} */
636
637
638/** @name SUP_IOCTL_PAGE_MAP_KERNEL
639 * Maps a portion of memory allocated by SUP_IOCTL_PAGE_ALLOC_EX /
640 * SUPR0PageAllocEx into kernel space for use by a device or similar.
641 *
642 * The mapping will be freed together with the ring-3 mapping when
643 * SUP_IOCTL_PAGE_FREE or SUPR0PageFree is called.
644 *
645 * @remarks Not necessarily supported on all platforms.
646 *
647 * @{
648 */
649#define SUP_IOCTL_PAGE_MAP_KERNEL SUP_CTL_CODE_SIZE(11, SUP_IOCTL_PAGE_MAP_KERNEL_SIZE)
650#define SUP_IOCTL_PAGE_MAP_KERNEL_SIZE sizeof(SUPPAGEMAPKERNEL)
651#define SUP_IOCTL_PAGE_MAP_KERNEL_SIZE_IN sizeof(SUPPAGEMAPKERNEL)
652#define SUP_IOCTL_PAGE_MAP_KERNEL_SIZE_OUT sizeof(SUPPAGEMAPKERNEL)
653typedef struct SUPPAGEMAPKERNEL
654{
655 /** The header. */
656 SUPREQHDR Hdr;
657 union
658 {
659 struct
660 {
661 /** The pointer of to the previously allocated memory. */
662 RTR3PTR pvR3;
663 /** The offset to start mapping from. */
664 uint32_t offSub;
665 /** Size of the section to map. */
666 uint32_t cbSub;
667 /** Flags reserved for future fun. */
668 uint32_t fFlags;
669 } In;
670 struct
671 {
672 /** The ring-0 address corresponding to pvR3 + offSub. */
673 RTR0PTR pvR0;
674 } Out;
675 } u;
676} SUPPAGEMAPKERNEL, *PSUPPAGEMAPKERNEL;
677/** @} */
678
679
680/** @name SUP_IOCTL_PAGE_PROTECT
681 * Changes the page level protection of the user and/or kernel mappings of
682 * memory previously allocated by SUPR0PageAllocEx.
683 *
684 * @remarks Not necessarily supported on all platforms.
685 *
686 * @{
687 */
688#define SUP_IOCTL_PAGE_PROTECT SUP_CTL_CODE_SIZE(12, SUP_IOCTL_PAGE_PROTECT_SIZE)
689#define SUP_IOCTL_PAGE_PROTECT_SIZE sizeof(SUPPAGEPROTECT)
690#define SUP_IOCTL_PAGE_PROTECT_SIZE_IN sizeof(SUPPAGEPROTECT)
691#define SUP_IOCTL_PAGE_PROTECT_SIZE_OUT sizeof(SUPPAGEPROTECT)
692typedef struct SUPPAGEPROTECT
693{
694 /** The header. */
695 SUPREQHDR Hdr;
696 union
697 {
698 struct
699 {
700 /** The pointer of to the previously allocated memory.
701 * Pass NIL_RTR3PTR if the ring-0 mapping should remain unaffected. */
702 RTR3PTR pvR3;
703 /** The pointer of to the previously allocated memory.
704 * Pass NIL_RTR0PTR if the ring-0 mapping should remain unaffected. */
705 RTR0PTR pvR0;
706 /** The offset to start changing protection at. */
707 uint32_t offSub;
708 /** Size of the portion that should be changed. */
709 uint32_t cbSub;
710 /** Protection flags, RTMEM_PROT_*. */
711 uint32_t fProt;
712 } In;
713 } u;
714} SUPPAGEPROTECT, *PSUPPAGEPROTECT;
715/** @} */
716
717
718/** @name SUP_IOCTL_PAGE_FREE
719 * Free memory allocated with SUP_IOCTL_PAGE_ALLOC_EX.
720 * @{
721 */
722#define SUP_IOCTL_PAGE_FREE SUP_CTL_CODE_SIZE(13, SUP_IOCTL_PAGE_FREE_SIZE_IN)
723#define SUP_IOCTL_PAGE_FREE_SIZE sizeof(SUPPAGEFREE)
724#define SUP_IOCTL_PAGE_FREE_SIZE_IN sizeof(SUPPAGEFREE)
725#define SUP_IOCTL_PAGE_FREE_SIZE_OUT sizeof(SUPREQHDR)
726typedef struct SUPPAGEFREE
727{
728 /** The header. */
729 SUPREQHDR Hdr;
730 union
731 {
732 struct
733 {
734 /** Address of memory range to free. */
735 RTR3PTR pvR3;
736 } In;
737 } u;
738} SUPPAGEFREE, *PSUPPAGEFREE;
739/** @} */
740
741
742
743
744/** @name SUP_IOCTL_PAGE_LOCK
745 * Pin down physical pages.
746 * @{
747 */
748#define SUP_IOCTL_PAGE_LOCK SUP_CTL_CODE_BIG(14)
749#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)))
750#define SUP_IOCTL_PAGE_LOCK_SIZE_IN (sizeof(SUPREQHDR) + RT_SIZEOFMEMB(SUPPAGELOCK, u.In))
751#define SUP_IOCTL_PAGE_LOCK_SIZE_OUT(cPages) RT_UOFFSETOF(SUPPAGELOCK, u.Out.aPages[cPages])
752typedef struct SUPPAGELOCK
753{
754 /** The header. */
755 SUPREQHDR Hdr;
756 union
757 {
758 struct
759 {
760 /** Start of page range. Must be PAGE aligned. */
761 RTR3PTR pvR3;
762 /** The range size given as a page count. */
763 uint32_t cPages;
764 } In;
765
766 struct
767 {
768 /** Array of pages. */
769 RTHCPHYS aPages[1];
770 } Out;
771 } u;
772} SUPPAGELOCK, *PSUPPAGELOCK;
773/** @} */
774
775
776/** @name SUP_IOCTL_PAGE_UNLOCK
777 * Unpin physical pages.
778 * @{ */
779#define SUP_IOCTL_PAGE_UNLOCK SUP_CTL_CODE_SIZE(15, SUP_IOCTL_PAGE_UNLOCK_SIZE)
780#define SUP_IOCTL_PAGE_UNLOCK_SIZE sizeof(SUPPAGEUNLOCK)
781#define SUP_IOCTL_PAGE_UNLOCK_SIZE_IN sizeof(SUPPAGEUNLOCK)
782#define SUP_IOCTL_PAGE_UNLOCK_SIZE_OUT sizeof(SUPREQHDR)
783typedef struct SUPPAGEUNLOCK
784{
785 /** The header. */
786 SUPREQHDR Hdr;
787 union
788 {
789 struct
790 {
791 /** Start of page range of a range previously pinned. */
792 RTR3PTR pvR3;
793 } In;
794 } u;
795} SUPPAGEUNLOCK, *PSUPPAGEUNLOCK;
796/** @} */
797
798
799/** @name SUP_IOCTL_CONT_ALLOC
800 * Allocate continuous memory.
801 * @{
802 */
803#define SUP_IOCTL_CONT_ALLOC SUP_CTL_CODE_SIZE(16, SUP_IOCTL_CONT_ALLOC_SIZE)
804#define SUP_IOCTL_CONT_ALLOC_SIZE sizeof(SUPCONTALLOC)
805#define SUP_IOCTL_CONT_ALLOC_SIZE_IN (sizeof(SUPREQHDR) + RT_SIZEOFMEMB(SUPCONTALLOC, u.In))
806#define SUP_IOCTL_CONT_ALLOC_SIZE_OUT sizeof(SUPCONTALLOC)
807typedef struct SUPCONTALLOC
808{
809 /** The header. */
810 SUPREQHDR Hdr;
811 union
812 {
813 struct
814 {
815 /** The allocation size given as a page count. */
816 uint32_t cPages;
817 } In;
818
819 struct
820 {
821 /** The address of the ring-0 mapping of the allocated memory. */
822 RTR0PTR pvR0;
823 /** The address of the ring-3 mapping of the allocated memory. */
824 RTR3PTR pvR3;
825 /** The physical address of the allocation. */
826 RTHCPHYS HCPhys;
827 } Out;
828 } u;
829} SUPCONTALLOC, *PSUPCONTALLOC;
830/** @} */
831
832
833/** @name SUP_IOCTL_CONT_FREE Input.
834 * @{
835 */
836/** Free continuous memory. */
837#define SUP_IOCTL_CONT_FREE SUP_CTL_CODE_SIZE(17, SUP_IOCTL_CONT_FREE_SIZE)
838#define SUP_IOCTL_CONT_FREE_SIZE sizeof(SUPCONTFREE)
839#define SUP_IOCTL_CONT_FREE_SIZE_IN sizeof(SUPCONTFREE)
840#define SUP_IOCTL_CONT_FREE_SIZE_OUT sizeof(SUPREQHDR)
841typedef struct SUPCONTFREE
842{
843 /** The header. */
844 SUPREQHDR Hdr;
845 union
846 {
847 struct
848 {
849 /** The ring-3 address of the memory to free. */
850 RTR3PTR pvR3;
851 } In;
852 } u;
853} SUPCONTFREE, *PSUPCONTFREE;
854/** @} */
855
856
857/** @name SUP_IOCTL_GET_PAGING_MODE
858 * Get the host paging mode.
859 * @{
860 */
861#define SUP_IOCTL_GET_PAGING_MODE SUP_CTL_CODE_SIZE(18, SUP_IOCTL_GET_PAGING_MODE_SIZE)
862#define SUP_IOCTL_GET_PAGING_MODE_SIZE sizeof(SUPGETPAGINGMODE)
863#define SUP_IOCTL_GET_PAGING_MODE_SIZE_IN sizeof(SUPREQHDR)
864#define SUP_IOCTL_GET_PAGING_MODE_SIZE_OUT sizeof(SUPGETPAGINGMODE)
865typedef struct SUPGETPAGINGMODE
866{
867 /** The header. */
868 SUPREQHDR Hdr;
869 union
870 {
871 struct
872 {
873 /** The paging mode. */
874 SUPPAGINGMODE enmMode;
875 } Out;
876 } u;
877} SUPGETPAGINGMODE, *PSUPGETPAGINGMODE;
878/** @} */
879
880
881/** @name SUP_IOCTL_SET_VM_FOR_FAST
882 * Set the VM handle for doing fast call ioctl calls.
883 * @{
884 */
885#define SUP_IOCTL_SET_VM_FOR_FAST SUP_CTL_CODE_SIZE(19, SUP_IOCTL_SET_VM_FOR_FAST_SIZE)
886#define SUP_IOCTL_SET_VM_FOR_FAST_SIZE sizeof(SUPSETVMFORFAST)
887#define SUP_IOCTL_SET_VM_FOR_FAST_SIZE_IN sizeof(SUPSETVMFORFAST)
888#define SUP_IOCTL_SET_VM_FOR_FAST_SIZE_OUT sizeof(SUPREQHDR)
889typedef struct SUPSETVMFORFAST
890{
891 /** The header. */
892 SUPREQHDR Hdr;
893 union
894 {
895 struct
896 {
897 /** The ring-0 VM handle (pointer). */
898 PVMR0 pVMR0;
899 } In;
900 } u;
901} SUPSETVMFORFAST, *PSUPSETVMFORFAST;
902/** @} */
903
904
905/** @name SUP_IOCTL_GIP_MAP
906 * Map the GIP into user space.
907 * @{
908 */
909#define SUP_IOCTL_GIP_MAP SUP_CTL_CODE_SIZE(20, SUP_IOCTL_GIP_MAP_SIZE)
910#define SUP_IOCTL_GIP_MAP_SIZE sizeof(SUPGIPMAP)
911#define SUP_IOCTL_GIP_MAP_SIZE_IN sizeof(SUPREQHDR)
912#define SUP_IOCTL_GIP_MAP_SIZE_OUT sizeof(SUPGIPMAP)
913typedef struct SUPGIPMAP
914{
915 /** The header. */
916 SUPREQHDR Hdr;
917 union
918 {
919 struct
920 {
921 /** The physical address of the GIP. */
922 RTHCPHYS HCPhysGip;
923 /** Pointer to the read-only usermode GIP mapping for this session. */
924 R3PTRTYPE(PSUPGLOBALINFOPAGE) pGipR3;
925 /** Pointer to the supervisor mode GIP mapping. */
926 R0PTRTYPE(PSUPGLOBALINFOPAGE) pGipR0;
927 } Out;
928 } u;
929} SUPGIPMAP, *PSUPGIPMAP;
930/** @} */
931
932
933/** @name SUP_IOCTL_GIP_UNMAP
934 * Unmap the GIP.
935 * @{
936 */
937#define SUP_IOCTL_GIP_UNMAP SUP_CTL_CODE_SIZE(21, SUP_IOCTL_GIP_UNMAP_SIZE)
938#define SUP_IOCTL_GIP_UNMAP_SIZE sizeof(SUPGIPUNMAP)
939#define SUP_IOCTL_GIP_UNMAP_SIZE_IN sizeof(SUPGIPUNMAP)
940#define SUP_IOCTL_GIP_UNMAP_SIZE_OUT sizeof(SUPGIPUNMAP)
941typedef struct SUPGIPUNMAP
942{
943 /** The header. */
944 SUPREQHDR Hdr;
945} SUPGIPUNMAP, *PSUPGIPUNMAP;
946/** @} */
947
948
949/** @name SUP_IOCTL_CALL_SERVICE
950 * Call the a ring-0 service.
951 *
952 * @todo Might have to convert this to a big request, just like
953 * SUP_IOCTL_CALL_VMMR0
954 * @{
955 */
956#define SUP_IOCTL_CALL_SERVICE(cbReq) SUP_CTL_CODE_SIZE(22, SUP_IOCTL_CALL_SERVICE_SIZE(cbReq))
957#define SUP_IOCTL_CALL_SERVICE_SIZE(cbReq) RT_UOFFSETOF(SUPCALLSERVICE, abReqPkt[cbReq])
958#define SUP_IOCTL_CALL_SERVICE_SIZE_IN(cbReq) SUP_IOCTL_CALL_SERVICE_SIZE(cbReq)
959#define SUP_IOCTL_CALL_SERVICE_SIZE_OUT(cbReq) SUP_IOCTL_CALL_SERVICE_SIZE(cbReq)
960typedef struct SUPCALLSERVICE
961{
962 /** The header. */
963 SUPREQHDR Hdr;
964 union
965 {
966 struct
967 {
968 /** The service name. */
969 char szName[28];
970 /** Which operation to execute. */
971 uint32_t uOperation;
972 /** Argument to use when no request packet is supplied. */
973 uint64_t u64Arg;
974 } In;
975 } u;
976 /** The request packet passed to SUP. */
977 uint8_t abReqPkt[1];
978} SUPCALLSERVICE, *PSUPCALLSERVICE;
979/** @} */
980
981
982/** @name SUP_IOCTL_LOGGER_SETTINGS
983 * Changes the ring-0 release or debug logger settings.
984 * @{
985 */
986#define SUP_IOCTL_LOGGER_SETTINGS(cbStrTab) SUP_CTL_CODE_SIZE(23, SUP_IOCTL_LOGGER_SETTINGS_SIZE(cbStrTab))
987#define SUP_IOCTL_LOGGER_SETTINGS_SIZE(cbStrTab) RT_UOFFSETOF(SUPLOGGERSETTINGS, u.In.szStrings[cbStrTab])
988#define SUP_IOCTL_LOGGER_SETTINGS_SIZE_IN(cbStrTab) RT_UOFFSETOF(SUPLOGGERSETTINGS, u.In.szStrings[cbStrTab])
989#define SUP_IOCTL_LOGGER_SETTINGS_SIZE_OUT sizeof(SUPREQHDR)
990typedef struct SUPLOGGERSETTINGS
991{
992 /** The header. */
993 SUPREQHDR Hdr;
994 union
995 {
996 struct
997 {
998 /** Which logger. */
999 uint32_t fWhich;
1000 /** What to do with it. */
1001 uint32_t fWhat;
1002 /** Offset of the flags setting string. */
1003 uint32_t offFlags;
1004 /** Offset of the groups setting string. */
1005 uint32_t offGroups;
1006 /** Offset of the destination setting string. */
1007 uint32_t offDestination;
1008 /** The string table. */
1009 char szStrings[1];
1010 } In;
1011 } u;
1012} SUPLOGGERSETTINGS, *PSUPLOGGERSETTINGS;
1013
1014/** Debug logger. */
1015#define SUPLOGGERSETTINGS_WHICH_DEBUG 0
1016/** Release logger. */
1017#define SUPLOGGERSETTINGS_WHICH_RELEASE 1
1018
1019/** Change the settings. */
1020#define SUPLOGGERSETTINGS_WHAT_SETTINGS 0
1021/** Create the logger instance. */
1022#define SUPLOGGERSETTINGS_WHAT_CREATE 1
1023/** Destroy the logger instance. */
1024#define SUPLOGGERSETTINGS_WHAT_DESTROY 2
1025
1026/** @} */
1027
1028
1029/** @name Semaphore Types
1030 * @{ */
1031#define SUP_SEM_TYPE_EVENT 0
1032#define SUP_SEM_TYPE_EVENT_MULTI 1
1033/** @} */
1034
1035
1036/** @name SUP_IOCTL_SEM_OP2
1037 * Semaphore operations.
1038 * @remarks This replaces the old SUP_IOCTL_SEM_OP interface.
1039 * @{
1040 */
1041#define SUP_IOCTL_SEM_OP2 SUP_CTL_CODE_SIZE(24, SUP_IOCTL_SEM_OP2_SIZE)
1042#define SUP_IOCTL_SEM_OP2_SIZE sizeof(SUPSEMOP2)
1043#define SUP_IOCTL_SEM_OP2_SIZE_IN sizeof(SUPSEMOP2)
1044#define SUP_IOCTL_SEM_OP2_SIZE_OUT sizeof(SUPREQHDR)
1045typedef struct SUPSEMOP2
1046{
1047 /** The header. */
1048 SUPREQHDR Hdr;
1049 union
1050 {
1051 struct
1052 {
1053 /** The semaphore type. */
1054 uint32_t uType;
1055 /** The semaphore handle. */
1056 uint32_t hSem;
1057 /** The operation. */
1058 uint32_t uOp;
1059 /** Reserved, must be zero. */
1060 uint32_t uReserved;
1061 /** The number of milliseconds to wait if it's a wait operation. */
1062 union
1063 {
1064 /** Absolute timeout (RTTime[System]NanoTS).
1065 * Used by SUPSEMOP2_WAIT_NS_ABS. */
1066 uint64_t uAbsNsTimeout;
1067 /** Relative nanosecond timeout.
1068 * Used by SUPSEMOP2_WAIT_NS_REL. */
1069 uint64_t cRelNsTimeout;
1070 /** Relative millisecond timeout.
1071 * Used by SUPSEMOP2_WAIT_MS_REL. */
1072 uint32_t cRelMsTimeout;
1073 /** Generic 64-bit accessor.
1074 * ASSUMES little endian! */
1075 uint64_t u64;
1076 } uArg;
1077 } In;
1078 } u;
1079} SUPSEMOP2, *PSUPSEMOP2;
1080
1081/** Wait for a number of milliseconds. */
1082#define SUPSEMOP2_WAIT_MS_REL 0
1083/** Wait until the specified deadline is reached. */
1084#define SUPSEMOP2_WAIT_NS_ABS 1
1085/** Wait for a number of nanoseconds. */
1086#define SUPSEMOP2_WAIT_NS_REL 2
1087/** Signal the semaphore. */
1088#define SUPSEMOP2_SIGNAL 3
1089/** Reset the semaphore (only applicable to SUP_SEM_TYPE_EVENT_MULTI). */
1090#define SUPSEMOP2_RESET 4
1091/** Close the semaphore handle. */
1092#define SUPSEMOP2_CLOSE 5
1093/** @} */
1094
1095
1096/** @name SUP_IOCTL_SEM_OP3
1097 * Semaphore operations.
1098 * @{
1099 */
1100#define SUP_IOCTL_SEM_OP3 SUP_CTL_CODE_SIZE(25, SUP_IOCTL_SEM_OP3_SIZE)
1101#define SUP_IOCTL_SEM_OP3_SIZE sizeof(SUPSEMOP3)
1102#define SUP_IOCTL_SEM_OP3_SIZE_IN sizeof(SUPSEMOP3)
1103#define SUP_IOCTL_SEM_OP3_SIZE_OUT sizeof(SUPSEMOP3)
1104typedef struct SUPSEMOP3
1105{
1106 /** The header. */
1107 SUPREQHDR Hdr;
1108 union
1109 {
1110 struct
1111 {
1112 /** The semaphore type. */
1113 uint32_t uType;
1114 /** The semaphore handle. */
1115 uint32_t hSem;
1116 /** The operation. */
1117 uint32_t uOp;
1118 /** Reserved, must be zero. */
1119 uint32_t u32Reserved;
1120 /** Reserved for future use. */
1121 uint64_t u64Reserved;
1122 } In;
1123 union
1124 {
1125 /** The handle of the created semaphore.
1126 * Used by SUPSEMOP3_CREATE. */
1127 uint32_t hSem;
1128 /** The semaphore resolution in nano seconds.
1129 * Used by SUPSEMOP3_GET_RESOLUTION. */
1130 uint32_t cNsResolution;
1131 /** The 32-bit view. */
1132 uint32_t u32;
1133 /** Reserved some space for later expansion. */
1134 uint64_t u64Reserved;
1135 } Out;
1136 } u;
1137} SUPSEMOP3, *PSUPSEMOP3;
1138
1139/** Get the wait resolution. */
1140#define SUPSEMOP3_CREATE 0
1141/** Get the wait resolution. */
1142#define SUPSEMOP3_GET_RESOLUTION 1
1143/** @} */
1144
1145
1146/** @name SUP_IOCTL_VT_CAPS
1147 * Get the VT-x/AMD-V capabilities.
1148 *
1149 * @todo Intended for main, which means we need to relax the privilege requires
1150 * when accessing certain vboxdrv functions.
1151 *
1152 * @{
1153 */
1154#define SUP_IOCTL_VT_CAPS SUP_CTL_CODE_SIZE(26, SUP_IOCTL_VT_CAPS_SIZE)
1155#define SUP_IOCTL_VT_CAPS_SIZE sizeof(SUPVTCAPS)
1156#define SUP_IOCTL_VT_CAPS_SIZE_IN sizeof(SUPREQHDR)
1157#define SUP_IOCTL_VT_CAPS_SIZE_OUT sizeof(SUPVTCAPS)
1158typedef struct SUPVTCAPS
1159{
1160 /** The header. */
1161 SUPREQHDR Hdr;
1162 union
1163 {
1164 struct
1165 {
1166 /** The VT capability dword. */
1167 uint32_t Caps;
1168 } Out;
1169 } u;
1170} SUPVTCAPS, *PSUPVTCAPS;
1171/** @} */
1172
1173
1174/** @name SUP_IOCTL_TRACER_OPEN
1175 * Open the tracer.
1176 *
1177 * Should be matched by an SUP_IOCTL_TRACER_CLOSE call.
1178 *
1179 * @{
1180 */
1181#define SUP_IOCTL_TRACER_OPEN SUP_CTL_CODE_SIZE(28, SUP_IOCTL_TRACER_OPEN_SIZE)
1182#define SUP_IOCTL_TRACER_OPEN_SIZE sizeof(SUPTRACEROPEN)
1183#define SUP_IOCTL_TRACER_OPEN_SIZE_IN sizeof(SUPTRACEROPEN)
1184#define SUP_IOCTL_TRACER_OPEN_SIZE_OUT sizeof(SUPREQHDR)
1185typedef struct SUPTRACEROPEN
1186{
1187 /** The header. */
1188 SUPREQHDR Hdr;
1189 union
1190 {
1191 struct
1192 {
1193 /** Tracer cookie. Used to make sure we only open a matching tracer. */
1194 uint32_t uCookie;
1195 /** Tracer specific argument. */
1196 RTHCUINTPTR uArg;
1197 } In;
1198 } u;
1199} SUPTRACEROPEN, *PSUPTRACEROPEN;
1200/** @} */
1201
1202
1203/** @name SUP_IOCTL_TRACER_CLOSE
1204 * Close the tracer.
1205 *
1206 * Must match a SUP_IOCTL_TRACER_OPEN call.
1207 *
1208 * @{
1209 */
1210#define SUP_IOCTL_TRACER_CLOSE SUP_CTL_CODE_SIZE(29, SUP_IOCTL_TRACER_CLOSE_SIZE)
1211#define SUP_IOCTL_TRACER_CLOSE_SIZE sizeof(SUPREQHDR)
1212#define SUP_IOCTL_TRACER_CLOSE_SIZE_IN sizeof(SUPREQHDR)
1213#define SUP_IOCTL_TRACER_CLOSE_SIZE_OUT sizeof(SUPREQHDR)
1214/** @} */
1215
1216
1217/** @name SUP_IOCTL_TRACER_IOCTL
1218 * Speak UNIX ioctl() with the tracer.
1219 *
1220 * The session must have opened the tracer prior to issuing this request.
1221 *
1222 * @{
1223 */
1224#define SUP_IOCTL_TRACER_IOCTL SUP_CTL_CODE_SIZE(30, SUP_IOCTL_TRACER_IOCTL_SIZE)
1225#define SUP_IOCTL_TRACER_IOCTL_SIZE sizeof(SUPTRACERIOCTL)
1226#define SUP_IOCTL_TRACER_IOCTL_SIZE_IN sizeof(SUPTRACERIOCTL)
1227#define SUP_IOCTL_TRACER_IOCTL_SIZE_OUT (RT_UOFFSETOF(SUPTRACERIOCTL, u.Out.iRetVal) + sizeof(int32_t))
1228typedef struct SUPTRACERIOCTL
1229{
1230 /** The header. */
1231 SUPREQHDR Hdr;
1232 union
1233 {
1234 struct
1235 {
1236 /** The command. */
1237 RTHCUINTPTR uCmd;
1238 /** Argument to the command. */
1239 RTHCUINTPTR uArg;
1240 } In;
1241
1242 struct
1243 {
1244 /** The return value. */
1245 int32_t iRetVal;
1246 } Out;
1247 } u;
1248} SUPTRACERIOCTL, *PSUPTRACERIOCTL;
1249/** @} */
1250
1251
1252/** @name SUP_IOCTL_TRACER_UMOD_REG
1253 * Registers tracepoints in a user mode module.
1254 *
1255 * @{
1256 */
1257#define SUP_IOCTL_TRACER_UMOD_REG SUP_CTL_CODE_SIZE(31, SUP_IOCTL_TRACER_UMOD_REG_SIZE)
1258#define SUP_IOCTL_TRACER_UMOD_REG_SIZE sizeof(SUPTRACERUMODREG)
1259#define SUP_IOCTL_TRACER_UMOD_REG_SIZE_IN sizeof(SUPTRACERUMODREG)
1260#define SUP_IOCTL_TRACER_UMOD_REG_SIZE_OUT sizeof(SUPREQHDR)
1261typedef struct SUPTRACERUMODREG
1262{
1263 /** The header. */
1264 SUPREQHDR Hdr;
1265 union
1266 {
1267 struct
1268 {
1269 /** The address at which the VTG header actually resides.
1270 * This will differ from R3PtrVtgHdr for raw-mode context
1271 * modules. */
1272 RTUINTPTR uVtgHdrAddr;
1273 /** The ring-3 pointer of the VTG header. */
1274 RTR3PTR R3PtrVtgHdr;
1275 /** The ring-3 pointer of the probe location string table. */
1276 RTR3PTR R3PtrStrTab;
1277 /** The size of the string table. */
1278 uint32_t cbStrTab;
1279 /** Future flags, MBZ. */
1280 uint32_t fFlags;
1281 /** The module name. */
1282 char szName[64];
1283 } In;
1284 } u;
1285} SUPTRACERUMODREG, *PSUPTRACERUMODREG;
1286/** @} */
1287
1288
1289/** @name SUP_IOCTL_TRACER_UMOD_DEREG
1290 * Deregisters tracepoints in a user mode module.
1291 *
1292 * @{
1293 */
1294#define SUP_IOCTL_TRACER_UMOD_DEREG SUP_CTL_CODE_SIZE(32, SUP_IOCTL_TRACER_UMOD_DEREG_SIZE)
1295#define SUP_IOCTL_TRACER_UMOD_DEREG_SIZE sizeof(SUPTRACERUMODDEREG)
1296#define SUP_IOCTL_TRACER_UMOD_DEREG_SIZE_IN sizeof(SUPTRACERUMODDEREG)
1297#define SUP_IOCTL_TRACER_UMOD_DEREG_SIZE_OUT sizeof(SUPREQHDR)
1298typedef struct SUPTRACERUMODDEREG
1299{
1300 /** The header. */
1301 SUPREQHDR Hdr;
1302 union
1303 {
1304 struct
1305 {
1306 /** Pointer to the VTG header. */
1307 RTR3PTR pVtgHdr;
1308 } In;
1309 } u;
1310} SUPTRACERUMODDEREG, *PSUPTRACERUMODDEREG;
1311/** @} */
1312
1313
1314/** @name SUP_IOCTL_TRACER_UMOD_FIRE_PROBE
1315 * Fire a probe in a user tracepoint module.
1316 *
1317 * @{
1318 */
1319#define SUP_IOCTL_TRACER_UMOD_FIRE_PROBE SUP_CTL_CODE_SIZE(33, SUP_IOCTL_TRACER_UMOD_FIRE_PROBE_SIZE)
1320#define SUP_IOCTL_TRACER_UMOD_FIRE_PROBE_SIZE sizeof(SUPTRACERUMODFIREPROBE)
1321#define SUP_IOCTL_TRACER_UMOD_FIRE_PROBE_SIZE_IN sizeof(SUPTRACERUMODFIREPROBE)
1322#define SUP_IOCTL_TRACER_UMOD_FIRE_PROBE_SIZE_OUT sizeof(SUPREQHDR)
1323typedef struct SUPTRACERUMODFIREPROBE
1324{
1325 /** The header. */
1326 SUPREQHDR Hdr;
1327 union
1328 {
1329 SUPDRVTRACERUSRCTX In;
1330 } u;
1331} SUPTRACERUMODFIREPROBE, *PSUPTRACERUMODFIREPROBE;
1332/** @} */
1333
1334
1335#pragma pack() /* paranoia */
1336
1337#endif
1338
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