VirtualBox

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

Last change on this file since 85416 was 85121, checked in by vboxsync, 4 years ago

iprt/cdefs.h: Refactored the typedef use of DECLCALLBACK as well as DECLCALLBACKMEMBER to wrap the whole expression, similar to the DECLR?CALLBACKMEMBER macros. This allows adding a throw() at the end when compiling with the VC++ compiler to indicate that the callbacks won't throw anything, so we can stop supressing the C5039 warning about passing functions that can potential throw C++ exceptions to extern C code that can't necessarily cope with such (unwind,++). Introduced a few _EX variations that allows specifying different/no calling convention too, as that's handy when dynamically resolving host APIs. Fixed numerous places missing DECLCALLBACK and such. Left two angry @todos regarding use of CreateThread. bugref:9794

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 56.8 KB
Line 
1/* $Id: SUPDrvIOC.h 85121 2020-07-08 19:33:26Z vboxsync $ */
2/** @file
3 * VirtualBox Support Driver - IOCtl definitions.
4 */
5
6/*
7 * Copyright (C) 2006-2020 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 VBOX_INCLUDED_SRC_Support_SUPDrvIOC_h
28#define VBOX_INCLUDED_SRC_Support_SUPDrvIOC_h
29#ifndef RT_WITHOUT_PRAGMA_ONCE
30# pragma once
31#endif
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 <iprt/win/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# define SUP_NT_STATUS_BASE UINT32_C(0xe9860000) /**< STATUS_SEVERITY_ERROR + C-bit + facility 0x986. */
61# define SUP_NT_STATUS_IS_VBOX(a_rcNt) ( ((uint32_t)(a_rcNt) & 0xffff0000) == SUP_NT_STATUS_BASE )
62# define SUP_NT_STATUS_TO_VBOX(a_rcNt) ( (int)((uint32_t)(a_rcNt) | UINT32_C(0xffff0000)) )
63
64/** NT device name for system access. */
65# define SUPDRV_NT_DEVICE_NAME_SYS L"\\Device\\VBoxDrv"
66/** NT device name for user access. */
67# define SUPDRV_NT_DEVICE_NAME_USR L"\\Device\\VBoxDrvU"
68# ifdef VBOX_WITH_HARDENING
69/** NT device name for hardened stub access. */
70# define SUPDRV_NT_DEVICE_NAME_STUB L"\\Device\\VBoxDrvStub"
71/** NT device name for getting error information for failed VBoxDrv or
72 * VBoxDrvStub open. */
73# define SUPDRV_NT_DEVICE_NAME_ERROR_INFO L"\\Device\\VBoxDrvErrorInfo"
74# endif
75
76
77#elif defined(RT_OS_SOLARIS)
78 /* No automatic buffering, size limited to 255 bytes. */
79# include <sys/ioccom.h>
80# define SUP_CTL_CODE_SIZE(Function, Size) _IOWRN('V', (Function) | SUP_IOCTL_FLAG, sizeof(SUPREQHDR))
81# define SUP_CTL_CODE_BIG(Function) _IOWRN('V', (Function) | SUP_IOCTL_FLAG, sizeof(SUPREQHDR))
82# define SUP_CTL_CODE_FAST(Function) _IO( 'V', (Function) | SUP_IOCTL_FLAG)
83# define SUP_CTL_CODE_NO_SIZE(uIOCtl) (uIOCtl)
84
85#elif defined(RT_OS_OS2)
86 /* No automatic buffering, size not encoded. */
87# define SUP_CTL_CATEGORY 0xc0
88# define SUP_CTL_CODE_SIZE(Function, Size) ((unsigned char)(Function))
89# define SUP_CTL_CODE_BIG(Function) ((unsigned char)(Function))
90# define SUP_CTL_CATEGORY_FAST 0xc1
91# define SUP_CTL_CODE_FAST(Function) ((unsigned char)(Function))
92# define SUP_CTL_CODE_NO_SIZE(uIOCtl) (uIOCtl)
93
94#elif defined(RT_OS_LINUX)
95 /* No automatic buffering, size limited to 16KB. */
96# include <linux/ioctl.h>
97# define SUP_CTL_CODE_SIZE(Function, Size) _IOC(_IOC_READ | _IOC_WRITE, 'V', (Function) | SUP_IOCTL_FLAG, (Size))
98# define SUP_CTL_CODE_BIG(Function) _IO('V', (Function) | SUP_IOCTL_FLAG)
99# define SUP_CTL_CODE_FAST(Function) _IO('V', (Function) | SUP_IOCTL_FLAG)
100# define SUP_CTL_CODE_NO_SIZE(uIOCtl) ((uIOCtl) & ~IOCSIZE_MASK)
101
102#elif defined(RT_OS_L4)
103 /* Implemented in suplib, no worries. */
104# define SUP_CTL_CODE_SIZE(Function, Size) (Function)
105# define SUP_CTL_CODE_BIG(Function) (Function)
106# define SUP_CTL_CODE_FAST(Function) (Function)
107# define SUP_CTL_CODE_NO_SIZE(uIOCtl) (uIOCtl)
108
109#else /* BSD Like */
110 /* Automatic buffering, size limited to 4KB on *BSD and 8KB on Darwin - commands the limit, 4KB. */
111# include <sys/ioccom.h>
112# define SUP_CTL_CODE_SIZE(Function, Size) _IOC(IOC_INOUT, 'V', (Function) | SUP_IOCTL_FLAG, (Size))
113# define SUP_CTL_CODE_BIG(Function) _IO('V', (Function) | SUP_IOCTL_FLAG)
114# define SUP_CTL_CODE_FAST(Function) _IO('V', (Function) | SUP_IOCTL_FLAG)
115# define SUP_CTL_CODE_NO_SIZE(uIOCtl) ( (uIOCtl) & ~_IOC(0,0,0,IOCPARM_MASK) )
116#endif
117
118/** @name Fast path I/O control codes.
119 * @note These must run parallel to SUP_VMMR0_DO_XXX
120 * @note Implementations ASSUMES up to 32 I/O controls codes in the fast range.
121 * @{ */
122/** Fast path IOCtl: VMMR0_DO_HM_RUN */
123#define SUP_IOCTL_FAST_DO_HM_RUN SUP_CTL_CODE_FAST(64)
124/** Fast path IOCtl: VMMR0_DO_NEM_RUN */
125#define SUP_IOCTL_FAST_DO_NEM_RUN SUP_CTL_CODE_FAST(65)
126/** Just a NOP call for profiling the latency of a fast ioctl call to VMMR0. */
127#define SUP_IOCTL_FAST_DO_NOP SUP_CTL_CODE_FAST(66)
128/** First fast path IOCtl number. */
129#define SUP_IOCTL_FAST_DO_FIRST SUP_IOCTL_FAST_DO_HM_RUN
130/** @} */
131
132
133#ifdef RT_OS_DARWIN
134/** Cookie used to fend off some unwanted clients to the IOService. */
135# define SUP_DARWIN_IOSERVICE_COOKIE 0x64726962 /* 'bird' */
136#endif
137
138
139/*******************************************************************************
140* Structures and Typedefs *
141*******************************************************************************/
142#ifdef RT_ARCH_AMD64
143# pragma pack(8) /* paranoia. */
144#else
145# pragma pack(4) /* paranoia. */
146#endif
147
148
149/**
150 * Common In/Out header.
151 */
152typedef struct SUPREQHDR
153{
154 /** Cookie. */
155 uint32_t u32Cookie;
156 /** Session cookie. */
157 uint32_t u32SessionCookie;
158 /** The size of the input. */
159 uint32_t cbIn;
160 /** The size of the output. */
161 uint32_t cbOut;
162 /** Flags. See SUPREQHDR_FLAGS_* for details and values. */
163 uint32_t fFlags;
164 /** The VBox status code of the operation, out direction only. */
165 int32_t rc;
166} SUPREQHDR;
167/** Pointer to a IOC header. */
168typedef SUPREQHDR *PSUPREQHDR;
169
170/** @name SUPREQHDR::fFlags values
171 * @{ */
172/** Masks out the magic value. */
173#define SUPREQHDR_FLAGS_MAGIC_MASK UINT32_C(0xff0000ff)
174/** The generic mask. */
175#define SUPREQHDR_FLAGS_GEN_MASK UINT32_C(0x0000ff00)
176/** The request specific mask. */
177#define SUPREQHDR_FLAGS_REQ_MASK UINT32_C(0x00ff0000)
178
179/** There is extra input that needs copying on some platforms. */
180#define SUPREQHDR_FLAGS_EXTRA_IN UINT32_C(0x00000100)
181/** There is extra output that needs copying on some platforms. */
182#define SUPREQHDR_FLAGS_EXTRA_OUT UINT32_C(0x00000200)
183
184/** The magic value. */
185#define SUPREQHDR_FLAGS_MAGIC UINT32_C(0x42000042)
186/** The default value. Use this when no special stuff is requested. */
187#define SUPREQHDR_FLAGS_DEFAULT SUPREQHDR_FLAGS_MAGIC
188/** @} */
189
190
191/** @name SUP_IOCTL_COOKIE
192 * @{
193 */
194/** Negotiate cookie. */
195#define SUP_IOCTL_COOKIE SUP_CTL_CODE_SIZE(1, SUP_IOCTL_COOKIE_SIZE)
196/** The request size. */
197#define SUP_IOCTL_COOKIE_SIZE sizeof(SUPCOOKIE)
198/** The SUPREQHDR::cbIn value. */
199#define SUP_IOCTL_COOKIE_SIZE_IN sizeof(SUPREQHDR) + RT_SIZEOFMEMB(SUPCOOKIE, u.In)
200/** The SUPREQHDR::cbOut value. */
201#define SUP_IOCTL_COOKIE_SIZE_OUT sizeof(SUPREQHDR) + RT_SIZEOFMEMB(SUPCOOKIE, u.Out)
202/** SUPCOOKIE_IN magic word. */
203#define SUPCOOKIE_MAGIC "The Magic Word!"
204/** The initial cookie. */
205#define SUPCOOKIE_INITIAL_COOKIE 0x69726f74 /* 'tori' */
206
207/** Current interface version.
208 * The upper 16-bit is the major version, the lower the minor version.
209 * When incompatible changes are made, the upper major number has to be changed.
210 *
211 * Update rules:
212 * -# Only update the major number when incompatible changes have been made to
213 * the IOC interface or the ABI provided via the functions returned by
214 * SUPQUERYFUNCS.
215 * -# When adding new features (new IOC number, new flags, new exports, ++)
216 * only update the minor number and change SUPLib.cpp to require the
217 * new IOC version.
218 * -# When incrementing the major number, clear the minor part and reset
219 * any IOC version requirements in SUPLib.cpp.
220 * -# When increment the major number, execute all pending work.
221 *
222 * @todo Pending work on next major version change:
223 * - Move SUP_IOCTL_FAST_DO_NOP and SUP_VMMR0_DO_NEM_RUN after NEM.
224 */
225#define SUPDRV_IOC_VERSION 0x002d0001
226
227/** SUP_IOCTL_COOKIE. */
228typedef struct SUPCOOKIE
229{
230 /** The header.
231 * u32Cookie must be set to SUPCOOKIE_INITIAL_COOKIE.
232 * u32SessionCookie should be set to some random value. */
233 SUPREQHDR Hdr;
234 union
235 {
236 struct
237 {
238 /** Magic word. */
239 char szMagic[16];
240 /** The requested interface version number. */
241 uint32_t u32ReqVersion;
242 /** The minimum interface version number. */
243 uint32_t u32MinVersion;
244 } In;
245 struct
246 {
247 /** Cookie. */
248 uint32_t u32Cookie;
249 /** Session cookie. */
250 uint32_t u32SessionCookie;
251 /** Interface version for this session. */
252 uint32_t u32SessionVersion;
253 /** The actual interface version in the driver. */
254 uint32_t u32DriverVersion;
255 /** Number of functions available for the SUP_IOCTL_QUERY_FUNCS request. */
256 uint32_t cFunctions;
257 /** Session handle. */
258 R0PTRTYPE(PSUPDRVSESSION) pSession;
259 } Out;
260 } u;
261} SUPCOOKIE, *PSUPCOOKIE;
262/** @} */
263
264
265/** @name SUP_IOCTL_QUERY_FUNCS
266 * Query SUPR0 functions.
267 * @{
268 */
269#define SUP_IOCTL_QUERY_FUNCS(cFuncs) SUP_CTL_CODE_BIG(2)
270#define SUP_IOCTL_QUERY_FUNCS_SIZE(cFuncs) RT_UOFFSETOF_DYN(SUPQUERYFUNCS, u.Out.aFunctions[(cFuncs)])
271#define SUP_IOCTL_QUERY_FUNCS_SIZE_IN sizeof(SUPREQHDR)
272#define SUP_IOCTL_QUERY_FUNCS_SIZE_OUT(cFuncs) SUP_IOCTL_QUERY_FUNCS_SIZE(cFuncs)
273
274/** A function. */
275typedef struct SUPFUNC
276{
277 /** Name - mangled. */
278 char szName[32];
279 /** Address. */
280 RTR0PTR pfn;
281} SUPFUNC, *PSUPFUNC;
282
283typedef struct SUPQUERYFUNCS
284{
285 /** The header. */
286 SUPREQHDR Hdr;
287 union
288 {
289 struct
290 {
291 /** Number of functions returned. */
292 uint32_t cFunctions;
293 /** Array of functions. */
294 SUPFUNC aFunctions[1];
295 } Out;
296 } u;
297} SUPQUERYFUNCS, *PSUPQUERYFUNCS;
298/** @} */
299
300
301/** @name SUP_IOCTL_LDR_OPEN
302 * Open an image.
303 * @{
304 */
305#define SUP_IOCTL_LDR_OPEN SUP_CTL_CODE_SIZE(3, SUP_IOCTL_LDR_OPEN_SIZE)
306#define SUP_IOCTL_LDR_OPEN_SIZE sizeof(SUPLDROPEN)
307#define SUP_IOCTL_LDR_OPEN_SIZE_IN sizeof(SUPLDROPEN)
308#define SUP_IOCTL_LDR_OPEN_SIZE_OUT (sizeof(SUPREQHDR) + RT_SIZEOFMEMB(SUPLDROPEN, u.Out))
309typedef struct SUPLDROPEN
310{
311 /** The header. */
312 SUPREQHDR Hdr;
313 union
314 {
315 struct
316 {
317 /** Size of the image we'll be loading (including tables). */
318 uint32_t cbImageWithTabs;
319 /** The size of the image bits. (Less or equal to cbImageWithTabs.) */
320 uint32_t cbImageBits;
321 /** Image name.
322 * This is the NAME of the image, not the file name. It is used
323 * to share code with other processes. (Max len is 32 chars!) */
324 char szName[32];
325 /** Image file name.
326 * This can be used to load the image using a native loader. */
327 char szFilename[260];
328 } In;
329 struct
330 {
331 /** The base address of the image. */
332 RTR0PTR pvImageBase;
333 /** Indicate whether or not the image requires loading. */
334 bool fNeedsLoading;
335 /** Indicates that we're using the native ring-0 loader. */
336 bool fNativeLoader;
337 } Out;
338 } u;
339} SUPLDROPEN, *PSUPLDROPEN;
340/** @} */
341
342
343/** @name SUP_IOCTL_LDR_LOAD
344 * Upload the image bits.
345 * @{
346 */
347#define SUP_IOCTL_LDR_LOAD SUP_CTL_CODE_BIG(4)
348#define SUP_IOCTL_LDR_LOAD_SIZE(cbImage) RT_MAX(RT_UOFFSETOF_DYN(SUPLDRLOAD, u.In.abImage[cbImage]), SUP_IOCTL_LDR_LOAD_SIZE_OUT)
349#define SUP_IOCTL_LDR_LOAD_SIZE_IN(cbImage) RT_UOFFSETOF_DYN(SUPLDRLOAD, u.In.abImage[cbImage])
350#define SUP_IOCTL_LDR_LOAD_SIZE_OUT (RT_UOFFSETOF(SUPLDRLOAD, u.Out.szError) + RT_SIZEOFMEMB(SUPLDRLOAD, u.Out.szError))
351
352/**
353 * Module initialization callback function.
354 * This is called once after the module has been loaded.
355 *
356 * @returns 0 on success.
357 * @returns Appropriate error code on failure.
358 * @param hMod Image handle for use in APIs.
359 */
360typedef DECLCALLBACKTYPE(int, FNR0MODULEINIT,(void *hMod));
361/** Pointer to a FNR0MODULEINIT(). */
362typedef R0PTRTYPE(FNR0MODULEINIT *) PFNR0MODULEINIT;
363
364/**
365 * Module termination callback function.
366 * This is called once right before the module is being unloaded.
367 *
368 * @param hMod Image handle for use in APIs.
369 */
370typedef DECLCALLBACKTYPE(void, FNR0MODULETERM,(void *hMod));
371/** Pointer to a FNR0MODULETERM(). */
372typedef R0PTRTYPE(FNR0MODULETERM *) PFNR0MODULETERM;
373
374/**
375 * Symbol table entry.
376 */
377typedef struct SUPLDRSYM
378{
379 /** Offset into of the string table. */
380 uint32_t offName;
381 /** Offset of the symbol relative to the image load address.
382 * @remarks When used inside the SUPDrv to calculate real addresses, it
383 * must be cast to int32_t for the sake of native loader support
384 * on Solaris. (The loader puts the and data in different
385 * memory areans, and the text one is generally higher.) */
386 uint32_t offSymbol;
387} SUPLDRSYM;
388/** Pointer to a symbol table entry. */
389typedef SUPLDRSYM *PSUPLDRSYM;
390/** Pointer to a const symbol table entry. */
391typedef SUPLDRSYM const *PCSUPLDRSYM;
392
393/**
394 * SUPLDRLOAD::u::In::EP type.
395 */
396typedef enum SUPLDRLOADEP
397{
398 SUPLDRLOADEP_NOTHING = 0,
399 SUPLDRLOADEP_VMMR0,
400 SUPLDRLOADEP_SERVICE,
401 SUPLDRLOADEP_32BIT_HACK = 0x7fffffff
402} SUPLDRLOADEP;
403
404typedef struct SUPLDRLOAD
405{
406 /** The header. */
407 SUPREQHDR Hdr;
408 union
409 {
410 struct
411 {
412 /** The address of module initialization function. Similar to _DLL_InitTerm(hmod, 0). */
413 RTR0PTR pfnModuleInit;
414 /** The address of module termination function. Similar to _DLL_InitTerm(hmod, 1). */
415 RTR0PTR pfnModuleTerm;
416 /** Special entry points. */
417 union
418 {
419 /** SUPLDRLOADEP_VMMR0. */
420 struct
421 {
422 /** The module handle (i.e. address). */
423 RTR0PTR pvVMMR0;
424 /** Address of VMMR0EntryFast function. */
425 RTR0PTR pvVMMR0EntryFast;
426 /** Address of VMMR0EntryEx function. */
427 RTR0PTR pvVMMR0EntryEx;
428 } VMMR0;
429 /** SUPLDRLOADEP_SERVICE. */
430 struct
431 {
432 /** The service request handler.
433 * (PFNR0SERVICEREQHANDLER isn't defined yet.) */
434 RTR0PTR pfnServiceReq;
435 /** Reserved, must be NIL. */
436 RTR0PTR apvReserved[3];
437 } Service;
438 } EP;
439 /** Address. */
440 RTR0PTR pvImageBase;
441 /** Entry point type. */
442 SUPLDRLOADEP eEPType;
443 /** The size of the image bits (starting at offset 0 and
444 * approaching offSymbols). */
445 uint32_t cbImageBits;
446 /** The offset of the symbol table. */
447 uint32_t offSymbols;
448 /** The number of entries in the symbol table. */
449 uint32_t cSymbols;
450 /** The offset of the string table. */
451 uint32_t offStrTab;
452 /** Size of the string table. */
453 uint32_t cbStrTab;
454 /** Size of image data in achImage. */
455 uint32_t cbImageWithTabs;
456 /** The image data. */
457 uint8_t abImage[1];
458 } In;
459 struct
460 {
461 /** Magic value indicating whether extended error information is
462 * present or not (SUPLDRLOAD_ERROR_MAGIC). */
463 uint64_t uErrorMagic;
464 /** Extended error information. */
465 char szError[2048];
466 } Out;
467 } u;
468} SUPLDRLOAD, *PSUPLDRLOAD;
469/** Magic value that indicates that there is a valid error information string
470 * present on SUP_IOCTL_LDR_LOAD failure.
471 * @remarks The value is choosen to be an unlikely init and term address. */
472#define SUPLDRLOAD_ERROR_MAGIC UINT64_C(0xabcdefef0feddcb9)
473/** @} */
474
475
476/** @name SUP_IOCTL_LDR_FREE
477 * Free an image.
478 * @{
479 */
480#define SUP_IOCTL_LDR_FREE SUP_CTL_CODE_SIZE(5, SUP_IOCTL_LDR_FREE_SIZE)
481#define SUP_IOCTL_LDR_FREE_SIZE sizeof(SUPLDRFREE)
482#define SUP_IOCTL_LDR_FREE_SIZE_IN sizeof(SUPLDRFREE)
483#define SUP_IOCTL_LDR_FREE_SIZE_OUT sizeof(SUPREQHDR)
484typedef struct SUPLDRFREE
485{
486 /** The header. */
487 SUPREQHDR Hdr;
488 union
489 {
490 struct
491 {
492 /** Address. */
493 RTR0PTR pvImageBase;
494 } In;
495 } u;
496} SUPLDRFREE, *PSUPLDRFREE;
497/** @} */
498
499
500/** @name SUP_IOCTL_LDR_LOCK_DOWN
501 * Lock down the image loader interface.
502 * @{
503 */
504#define SUP_IOCTL_LDR_LOCK_DOWN SUP_CTL_CODE_SIZE(38, SUP_IOCTL_LDR_LOCK_DOWN_SIZE)
505#define SUP_IOCTL_LDR_LOCK_DOWN_SIZE sizeof(SUPREQHDR)
506#define SUP_IOCTL_LDR_LOCK_DOWN_SIZE_IN sizeof(SUPREQHDR)
507#define SUP_IOCTL_LDR_LOCK_DOWN_SIZE_OUT sizeof(SUPREQHDR)
508/** @} */
509
510
511/** @name SUP_IOCTL_LDR_GET_SYMBOL
512 * Get address of a symbol within an image.
513 * @{
514 */
515#define SUP_IOCTL_LDR_GET_SYMBOL SUP_CTL_CODE_SIZE(6, SUP_IOCTL_LDR_GET_SYMBOL_SIZE)
516#define SUP_IOCTL_LDR_GET_SYMBOL_SIZE sizeof(SUPLDRGETSYMBOL)
517#define SUP_IOCTL_LDR_GET_SYMBOL_SIZE_IN sizeof(SUPLDRGETSYMBOL)
518#define SUP_IOCTL_LDR_GET_SYMBOL_SIZE_OUT (sizeof(SUPREQHDR) + RT_SIZEOFMEMB(SUPLDRGETSYMBOL, u.Out))
519typedef struct SUPLDRGETSYMBOL
520{
521 /** The header. */
522 SUPREQHDR Hdr;
523 union
524 {
525 struct
526 {
527 /** Address. */
528 RTR0PTR pvImageBase;
529 /** The symbol name. */
530 char szSymbol[64];
531 } In;
532 struct
533 {
534 /** The symbol address. */
535 RTR0PTR pvSymbol;
536 } Out;
537 } u;
538} SUPLDRGETSYMBOL, *PSUPLDRGETSYMBOL;
539/** @} */
540
541
542/** @name SUP_IOCTL_CALL_VMMR0
543 * Call the R0 VMM Entry point.
544 * @{
545 */
546#define SUP_IOCTL_CALL_VMMR0(cbReq) SUP_CTL_CODE_SIZE(7, SUP_IOCTL_CALL_VMMR0_SIZE(cbReq))
547#define SUP_IOCTL_CALL_VMMR0_NO_SIZE() SUP_CTL_CODE_SIZE(7, 0)
548#define SUP_IOCTL_CALL_VMMR0_SIZE(cbReq) RT_UOFFSETOF_DYN(SUPCALLVMMR0, abReqPkt[cbReq])
549#define SUP_IOCTL_CALL_VMMR0_SIZE_IN(cbReq) SUP_IOCTL_CALL_VMMR0_SIZE(cbReq)
550#define SUP_IOCTL_CALL_VMMR0_SIZE_OUT(cbReq) SUP_IOCTL_CALL_VMMR0_SIZE(cbReq)
551typedef struct SUPCALLVMMR0
552{
553 /** The header. */
554 SUPREQHDR Hdr;
555 union
556 {
557 struct
558 {
559 /** The VM handle. */
560 PVMR0 pVMR0;
561 /** VCPU id. */
562 uint32_t idCpu;
563 /** Which operation to execute. */
564 uint32_t uOperation;
565 /** Argument to use when no request packet is supplied. */
566 uint64_t u64Arg;
567 } In;
568 } u;
569 /** The VMMR0Entry request packet. */
570 uint8_t abReqPkt[1];
571} SUPCALLVMMR0, *PSUPCALLVMMR0;
572/** @} */
573
574
575/** @name SUP_IOCTL_CALL_VMMR0_BIG
576 * Version of SUP_IOCTL_CALL_VMMR0 for dealing with large requests.
577 * @{
578 */
579#define SUP_IOCTL_CALL_VMMR0_BIG SUP_CTL_CODE_BIG(27)
580#define SUP_IOCTL_CALL_VMMR0_BIG_SIZE(cbReq) RT_UOFFSETOF_DYN(SUPCALLVMMR0, abReqPkt[cbReq])
581#define SUP_IOCTL_CALL_VMMR0_BIG_SIZE_IN(cbReq) SUP_IOCTL_CALL_VMMR0_SIZE(cbReq)
582#define SUP_IOCTL_CALL_VMMR0_BIG_SIZE_OUT(cbReq) SUP_IOCTL_CALL_VMMR0_SIZE(cbReq)
583/** @} */
584
585
586/** @name SUP_IOCTL_LOW_ALLOC
587 * Allocate memory below 4GB (physically).
588 * @{
589 */
590#define SUP_IOCTL_LOW_ALLOC SUP_CTL_CODE_BIG(8)
591#define SUP_IOCTL_LOW_ALLOC_SIZE(cPages) ((uint32_t)RT_UOFFSETOF_DYN(SUPLOWALLOC, u.Out.aPages[cPages]))
592#define SUP_IOCTL_LOW_ALLOC_SIZE_IN (sizeof(SUPREQHDR) + RT_SIZEOFMEMB(SUPLOWALLOC, u.In))
593#define SUP_IOCTL_LOW_ALLOC_SIZE_OUT(cPages) SUP_IOCTL_LOW_ALLOC_SIZE(cPages)
594typedef struct SUPLOWALLOC
595{
596 /** The header. */
597 SUPREQHDR Hdr;
598 union
599 {
600 struct
601 {
602 /** Number of pages to allocate. */
603 uint32_t cPages;
604 } In;
605 struct
606 {
607 /** The ring-3 address of the allocated memory. */
608 RTR3PTR pvR3;
609 /** The ring-0 address of the allocated memory. */
610 RTR0PTR pvR0;
611 /** Array of pages. */
612 RTHCPHYS aPages[1];
613 } Out;
614 } u;
615} SUPLOWALLOC, *PSUPLOWALLOC;
616/** @} */
617
618
619/** @name SUP_IOCTL_LOW_FREE
620 * Free low memory.
621 * @{
622 */
623#define SUP_IOCTL_LOW_FREE SUP_CTL_CODE_SIZE(9, SUP_IOCTL_LOW_FREE_SIZE)
624#define SUP_IOCTL_LOW_FREE_SIZE sizeof(SUPLOWFREE)
625#define SUP_IOCTL_LOW_FREE_SIZE_IN sizeof(SUPLOWFREE)
626#define SUP_IOCTL_LOW_FREE_SIZE_OUT sizeof(SUPREQHDR)
627typedef struct SUPLOWFREE
628{
629 /** The header. */
630 SUPREQHDR Hdr;
631 union
632 {
633 struct
634 {
635 /** The ring-3 address of the memory to free. */
636 RTR3PTR pvR3;
637 } In;
638 } u;
639} SUPLOWFREE, *PSUPLOWFREE;
640/** @} */
641
642
643/** @name SUP_IOCTL_PAGE_ALLOC_EX
644 * Allocate memory and map it into kernel and/or user space. The memory is of
645 * course locked. The result should be freed using SUP_IOCTL_PAGE_FREE.
646 *
647 * @remarks Allocations without a kernel mapping may fail with
648 * VERR_NOT_SUPPORTED on some platforms.
649 *
650 * @{
651 */
652#define SUP_IOCTL_PAGE_ALLOC_EX SUP_CTL_CODE_BIG(10)
653#define SUP_IOCTL_PAGE_ALLOC_EX_SIZE(cPages) RT_UOFFSETOF_DYN(SUPPAGEALLOCEX, u.Out.aPages[cPages])
654#define SUP_IOCTL_PAGE_ALLOC_EX_SIZE_IN (sizeof(SUPREQHDR) + RT_SIZEOFMEMB(SUPPAGEALLOCEX, u.In))
655#define SUP_IOCTL_PAGE_ALLOC_EX_SIZE_OUT(cPages) SUP_IOCTL_PAGE_ALLOC_EX_SIZE(cPages)
656typedef struct SUPPAGEALLOCEX
657{
658 /** The header. */
659 SUPREQHDR Hdr;
660 union
661 {
662 struct
663 {
664 /** Number of pages to allocate */
665 uint32_t cPages;
666 /** Whether it should have kernel mapping. */
667 bool fKernelMapping;
668 /** Whether it should have a user mapping. */
669 bool fUserMapping;
670 /** Reserved. Must be false. */
671 bool fReserved0;
672 /** Reserved. Must be false. */
673 bool fReserved1;
674 } In;
675 struct
676 {
677 /** Returned ring-3 address. */
678 RTR3PTR pvR3;
679 /** Returned ring-0 address. */
680 RTR0PTR pvR0;
681 /** The physical addresses of the allocated pages. */
682 RTHCPHYS aPages[1];
683 } Out;
684 } u;
685} SUPPAGEALLOCEX, *PSUPPAGEALLOCEX;
686/** @} */
687
688
689/** @name SUP_IOCTL_PAGE_MAP_KERNEL
690 * Maps a portion of memory allocated by SUP_IOCTL_PAGE_ALLOC_EX /
691 * SUPR0PageAllocEx into kernel space for use by a device or similar.
692 *
693 * The mapping will be freed together with the ring-3 mapping when
694 * SUP_IOCTL_PAGE_FREE or SUPR0PageFree is called.
695 *
696 * @remarks Not necessarily supported on all platforms.
697 *
698 * @{
699 */
700#define SUP_IOCTL_PAGE_MAP_KERNEL SUP_CTL_CODE_SIZE(11, SUP_IOCTL_PAGE_MAP_KERNEL_SIZE)
701#define SUP_IOCTL_PAGE_MAP_KERNEL_SIZE sizeof(SUPPAGEMAPKERNEL)
702#define SUP_IOCTL_PAGE_MAP_KERNEL_SIZE_IN sizeof(SUPPAGEMAPKERNEL)
703#define SUP_IOCTL_PAGE_MAP_KERNEL_SIZE_OUT sizeof(SUPPAGEMAPKERNEL)
704typedef struct SUPPAGEMAPKERNEL
705{
706 /** The header. */
707 SUPREQHDR Hdr;
708 union
709 {
710 struct
711 {
712 /** The pointer of to the previously allocated memory. */
713 RTR3PTR pvR3;
714 /** The offset to start mapping from. */
715 uint32_t offSub;
716 /** Size of the section to map. */
717 uint32_t cbSub;
718 /** Flags reserved for future fun. */
719 uint32_t fFlags;
720 } In;
721 struct
722 {
723 /** The ring-0 address corresponding to pvR3 + offSub. */
724 RTR0PTR pvR0;
725 } Out;
726 } u;
727} SUPPAGEMAPKERNEL, *PSUPPAGEMAPKERNEL;
728/** @} */
729
730
731/** @name SUP_IOCTL_PAGE_PROTECT
732 * Changes the page level protection of the user and/or kernel mappings of
733 * memory previously allocated by SUPR0PageAllocEx.
734 *
735 * @remarks Not necessarily supported on all platforms.
736 *
737 * @{
738 */
739#define SUP_IOCTL_PAGE_PROTECT SUP_CTL_CODE_SIZE(12, SUP_IOCTL_PAGE_PROTECT_SIZE)
740#define SUP_IOCTL_PAGE_PROTECT_SIZE sizeof(SUPPAGEPROTECT)
741#define SUP_IOCTL_PAGE_PROTECT_SIZE_IN sizeof(SUPPAGEPROTECT)
742#define SUP_IOCTL_PAGE_PROTECT_SIZE_OUT sizeof(SUPPAGEPROTECT)
743typedef struct SUPPAGEPROTECT
744{
745 /** The header. */
746 SUPREQHDR Hdr;
747 union
748 {
749 struct
750 {
751 /** The pointer of to the previously allocated memory.
752 * Pass NIL_RTR3PTR if the ring-0 mapping should remain unaffected. */
753 RTR3PTR pvR3;
754 /** The pointer of to the previously allocated memory.
755 * Pass NIL_RTR0PTR if the ring-0 mapping should remain unaffected. */
756 RTR0PTR pvR0;
757 /** The offset to start changing protection at. */
758 uint32_t offSub;
759 /** Size of the portion that should be changed. */
760 uint32_t cbSub;
761 /** Protection flags, RTMEM_PROT_*. */
762 uint32_t fProt;
763 } In;
764 } u;
765} SUPPAGEPROTECT, *PSUPPAGEPROTECT;
766/** @} */
767
768
769/** @name SUP_IOCTL_PAGE_FREE
770 * Free memory allocated with SUP_IOCTL_PAGE_ALLOC_EX.
771 * @{
772 */
773#define SUP_IOCTL_PAGE_FREE SUP_CTL_CODE_SIZE(13, SUP_IOCTL_PAGE_FREE_SIZE_IN)
774#define SUP_IOCTL_PAGE_FREE_SIZE sizeof(SUPPAGEFREE)
775#define SUP_IOCTL_PAGE_FREE_SIZE_IN sizeof(SUPPAGEFREE)
776#define SUP_IOCTL_PAGE_FREE_SIZE_OUT sizeof(SUPREQHDR)
777typedef struct SUPPAGEFREE
778{
779 /** The header. */
780 SUPREQHDR Hdr;
781 union
782 {
783 struct
784 {
785 /** Address of memory range to free. */
786 RTR3PTR pvR3;
787 } In;
788 } u;
789} SUPPAGEFREE, *PSUPPAGEFREE;
790/** @} */
791
792
793
794
795/** @name SUP_IOCTL_PAGE_LOCK
796 * Pin down physical pages.
797 * @{
798 */
799#define SUP_IOCTL_PAGE_LOCK SUP_CTL_CODE_BIG(14)
800#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)))
801#define SUP_IOCTL_PAGE_LOCK_SIZE_IN (sizeof(SUPREQHDR) + RT_SIZEOFMEMB(SUPPAGELOCK, u.In))
802#define SUP_IOCTL_PAGE_LOCK_SIZE_OUT(cPages) RT_UOFFSETOF_DYN(SUPPAGELOCK, u.Out.aPages[cPages])
803typedef struct SUPPAGELOCK
804{
805 /** The header. */
806 SUPREQHDR Hdr;
807 union
808 {
809 struct
810 {
811 /** Start of page range. Must be PAGE aligned. */
812 RTR3PTR pvR3;
813 /** The range size given as a page count. */
814 uint32_t cPages;
815 } In;
816
817 struct
818 {
819 /** Array of pages. */
820 RTHCPHYS aPages[1];
821 } Out;
822 } u;
823} SUPPAGELOCK, *PSUPPAGELOCK;
824/** @} */
825
826
827/** @name SUP_IOCTL_PAGE_UNLOCK
828 * Unpin physical pages.
829 * @{ */
830#define SUP_IOCTL_PAGE_UNLOCK SUP_CTL_CODE_SIZE(15, SUP_IOCTL_PAGE_UNLOCK_SIZE)
831#define SUP_IOCTL_PAGE_UNLOCK_SIZE sizeof(SUPPAGEUNLOCK)
832#define SUP_IOCTL_PAGE_UNLOCK_SIZE_IN sizeof(SUPPAGEUNLOCK)
833#define SUP_IOCTL_PAGE_UNLOCK_SIZE_OUT sizeof(SUPREQHDR)
834typedef struct SUPPAGEUNLOCK
835{
836 /** The header. */
837 SUPREQHDR Hdr;
838 union
839 {
840 struct
841 {
842 /** Start of page range of a range previously pinned. */
843 RTR3PTR pvR3;
844 } In;
845 } u;
846} SUPPAGEUNLOCK, *PSUPPAGEUNLOCK;
847/** @} */
848
849
850/** @name SUP_IOCTL_CONT_ALLOC
851 * Allocate continuous memory.
852 * @{
853 */
854#define SUP_IOCTL_CONT_ALLOC SUP_CTL_CODE_SIZE(16, SUP_IOCTL_CONT_ALLOC_SIZE)
855#define SUP_IOCTL_CONT_ALLOC_SIZE sizeof(SUPCONTALLOC)
856#define SUP_IOCTL_CONT_ALLOC_SIZE_IN (sizeof(SUPREQHDR) + RT_SIZEOFMEMB(SUPCONTALLOC, u.In))
857#define SUP_IOCTL_CONT_ALLOC_SIZE_OUT sizeof(SUPCONTALLOC)
858typedef struct SUPCONTALLOC
859{
860 /** The header. */
861 SUPREQHDR Hdr;
862 union
863 {
864 struct
865 {
866 /** The allocation size given as a page count. */
867 uint32_t cPages;
868 } In;
869
870 struct
871 {
872 /** The address of the ring-0 mapping of the allocated memory. */
873 RTR0PTR pvR0;
874 /** The address of the ring-3 mapping of the allocated memory. */
875 RTR3PTR pvR3;
876 /** The physical address of the allocation. */
877 RTHCPHYS HCPhys;
878 } Out;
879 } u;
880} SUPCONTALLOC, *PSUPCONTALLOC;
881/** @} */
882
883
884/** @name SUP_IOCTL_CONT_FREE Input.
885 * @{
886 */
887/** Free continuous memory. */
888#define SUP_IOCTL_CONT_FREE SUP_CTL_CODE_SIZE(17, SUP_IOCTL_CONT_FREE_SIZE)
889#define SUP_IOCTL_CONT_FREE_SIZE sizeof(SUPCONTFREE)
890#define SUP_IOCTL_CONT_FREE_SIZE_IN sizeof(SUPCONTFREE)
891#define SUP_IOCTL_CONT_FREE_SIZE_OUT sizeof(SUPREQHDR)
892typedef struct SUPCONTFREE
893{
894 /** The header. */
895 SUPREQHDR Hdr;
896 union
897 {
898 struct
899 {
900 /** The ring-3 address of the memory to free. */
901 RTR3PTR pvR3;
902 } In;
903 } u;
904} SUPCONTFREE, *PSUPCONTFREE;
905/** @} */
906
907
908/** @name SUP_IOCTL_GET_PAGING_MODE
909 * Get the host paging mode.
910 * @{
911 */
912#define SUP_IOCTL_GET_PAGING_MODE SUP_CTL_CODE_SIZE(18, SUP_IOCTL_GET_PAGING_MODE_SIZE)
913#define SUP_IOCTL_GET_PAGING_MODE_SIZE sizeof(SUPGETPAGINGMODE)
914#define SUP_IOCTL_GET_PAGING_MODE_SIZE_IN sizeof(SUPREQHDR)
915#define SUP_IOCTL_GET_PAGING_MODE_SIZE_OUT sizeof(SUPGETPAGINGMODE)
916typedef struct SUPGETPAGINGMODE
917{
918 /** The header. */
919 SUPREQHDR Hdr;
920 union
921 {
922 struct
923 {
924 /** The paging mode. */
925 SUPPAGINGMODE enmMode;
926 } Out;
927 } u;
928} SUPGETPAGINGMODE, *PSUPGETPAGINGMODE;
929/** @} */
930
931
932/** @name SUP_IOCTL_SET_VM_FOR_FAST
933 * Set the VM handle for doing fast call ioctl calls.
934 * @{
935 */
936#define SUP_IOCTL_SET_VM_FOR_FAST SUP_CTL_CODE_SIZE(19, SUP_IOCTL_SET_VM_FOR_FAST_SIZE)
937#define SUP_IOCTL_SET_VM_FOR_FAST_SIZE sizeof(SUPSETVMFORFAST)
938#define SUP_IOCTL_SET_VM_FOR_FAST_SIZE_IN sizeof(SUPSETVMFORFAST)
939#define SUP_IOCTL_SET_VM_FOR_FAST_SIZE_OUT sizeof(SUPREQHDR)
940typedef struct SUPSETVMFORFAST
941{
942 /** The header. */
943 SUPREQHDR Hdr;
944 union
945 {
946 struct
947 {
948 /** The ring-0 VM handle (pointer). */
949 PVMR0 pVMR0;
950 } In;
951 } u;
952} SUPSETVMFORFAST, *PSUPSETVMFORFAST;
953/** @} */
954
955
956/** @name SUP_IOCTL_GIP_MAP
957 * Map the GIP into user space.
958 * @{
959 */
960#define SUP_IOCTL_GIP_MAP SUP_CTL_CODE_SIZE(20, SUP_IOCTL_GIP_MAP_SIZE)
961#define SUP_IOCTL_GIP_MAP_SIZE sizeof(SUPGIPMAP)
962#define SUP_IOCTL_GIP_MAP_SIZE_IN sizeof(SUPREQHDR)
963#define SUP_IOCTL_GIP_MAP_SIZE_OUT sizeof(SUPGIPMAP)
964typedef struct SUPGIPMAP
965{
966 /** The header. */
967 SUPREQHDR Hdr;
968 union
969 {
970 struct
971 {
972 /** The physical address of the GIP. */
973 RTHCPHYS HCPhysGip;
974 /** Pointer to the read-only usermode GIP mapping for this session. */
975 R3PTRTYPE(PSUPGLOBALINFOPAGE) pGipR3;
976 /** Pointer to the supervisor mode GIP mapping. */
977 R0PTRTYPE(PSUPGLOBALINFOPAGE) pGipR0;
978 } Out;
979 } u;
980} SUPGIPMAP, *PSUPGIPMAP;
981/** @} */
982
983
984/** @name SUP_IOCTL_GIP_UNMAP
985 * Unmap the GIP.
986 * @{
987 */
988#define SUP_IOCTL_GIP_UNMAP SUP_CTL_CODE_SIZE(21, SUP_IOCTL_GIP_UNMAP_SIZE)
989#define SUP_IOCTL_GIP_UNMAP_SIZE sizeof(SUPGIPUNMAP)
990#define SUP_IOCTL_GIP_UNMAP_SIZE_IN sizeof(SUPGIPUNMAP)
991#define SUP_IOCTL_GIP_UNMAP_SIZE_OUT sizeof(SUPGIPUNMAP)
992typedef struct SUPGIPUNMAP
993{
994 /** The header. */
995 SUPREQHDR Hdr;
996} SUPGIPUNMAP, *PSUPGIPUNMAP;
997/** @} */
998
999
1000/** @name SUP_IOCTL_CALL_SERVICE
1001 * Call the a ring-0 service.
1002 *
1003 * @todo Might have to convert this to a big request, just like
1004 * SUP_IOCTL_CALL_VMMR0
1005 * @{
1006 */
1007#define SUP_IOCTL_CALL_SERVICE(cbReq) SUP_CTL_CODE_SIZE(22, SUP_IOCTL_CALL_SERVICE_SIZE(cbReq))
1008#define SUP_IOCTL_CALL_SERVICE_NO_SIZE() SUP_CTL_CODE_SIZE(22, 0)
1009#define SUP_IOCTL_CALL_SERVICE_SIZE(cbReq) RT_UOFFSETOF_DYN(SUPCALLSERVICE, abReqPkt[cbReq])
1010#define SUP_IOCTL_CALL_SERVICE_SIZE_IN(cbReq) SUP_IOCTL_CALL_SERVICE_SIZE(cbReq)
1011#define SUP_IOCTL_CALL_SERVICE_SIZE_OUT(cbReq) SUP_IOCTL_CALL_SERVICE_SIZE(cbReq)
1012typedef struct SUPCALLSERVICE
1013{
1014 /** The header. */
1015 SUPREQHDR Hdr;
1016 union
1017 {
1018 struct
1019 {
1020 /** The service name. */
1021 char szName[28];
1022 /** Which operation to execute. */
1023 uint32_t uOperation;
1024 /** Argument to use when no request packet is supplied. */
1025 uint64_t u64Arg;
1026 } In;
1027 } u;
1028 /** The request packet passed to SUP. */
1029 uint8_t abReqPkt[1];
1030} SUPCALLSERVICE, *PSUPCALLSERVICE;
1031/** @} */
1032
1033
1034/** @name SUP_IOCTL_LOGGER_SETTINGS
1035 * Changes the ring-0 release or debug logger settings.
1036 * @{
1037 */
1038#define SUP_IOCTL_LOGGER_SETTINGS(cbStrTab) SUP_CTL_CODE_SIZE(23, SUP_IOCTL_LOGGER_SETTINGS_SIZE(cbStrTab))
1039#define SUP_IOCTL_LOGGER_SETTINGS_NO_SIZE() SUP_CTL_CODE_SIZE(23, 0)
1040#define SUP_IOCTL_LOGGER_SETTINGS_SIZE(cbStrTab) RT_UOFFSETOF_DYN(SUPLOGGERSETTINGS, u.In.szStrings[cbStrTab])
1041#define SUP_IOCTL_LOGGER_SETTINGS_SIZE_IN(cbStrTab) RT_UOFFSETOF_DYN(SUPLOGGERSETTINGS, u.In.szStrings[cbStrTab])
1042#define SUP_IOCTL_LOGGER_SETTINGS_SIZE_OUT sizeof(SUPREQHDR)
1043typedef struct SUPLOGGERSETTINGS
1044{
1045 /** The header. */
1046 SUPREQHDR Hdr;
1047 union
1048 {
1049 struct
1050 {
1051 /** Which logger. */
1052 uint32_t fWhich;
1053 /** What to do with it. */
1054 uint32_t fWhat;
1055 /** Offset of the flags setting string. */
1056 uint32_t offFlags;
1057 /** Offset of the groups setting string. */
1058 uint32_t offGroups;
1059 /** Offset of the destination setting string. */
1060 uint32_t offDestination;
1061 /** The string table. */
1062 char szStrings[1];
1063 } In;
1064 } u;
1065} SUPLOGGERSETTINGS, *PSUPLOGGERSETTINGS;
1066
1067/** Debug logger. */
1068#define SUPLOGGERSETTINGS_WHICH_DEBUG 0
1069/** Release logger. */
1070#define SUPLOGGERSETTINGS_WHICH_RELEASE 1
1071
1072/** Change the settings. */
1073#define SUPLOGGERSETTINGS_WHAT_SETTINGS 0
1074/** Create the logger instance. */
1075#define SUPLOGGERSETTINGS_WHAT_CREATE 1
1076/** Destroy the logger instance. */
1077#define SUPLOGGERSETTINGS_WHAT_DESTROY 2
1078
1079/** @} */
1080
1081
1082/** @name Semaphore Types
1083 * @{ */
1084#define SUP_SEM_TYPE_EVENT 0
1085#define SUP_SEM_TYPE_EVENT_MULTI 1
1086/** @} */
1087
1088
1089/** @name SUP_IOCTL_SEM_OP2
1090 * Semaphore operations.
1091 * @remarks This replaces the old SUP_IOCTL_SEM_OP interface.
1092 * @{
1093 */
1094#define SUP_IOCTL_SEM_OP2 SUP_CTL_CODE_SIZE(24, SUP_IOCTL_SEM_OP2_SIZE)
1095#define SUP_IOCTL_SEM_OP2_SIZE sizeof(SUPSEMOP2)
1096#define SUP_IOCTL_SEM_OP2_SIZE_IN sizeof(SUPSEMOP2)
1097#define SUP_IOCTL_SEM_OP2_SIZE_OUT sizeof(SUPREQHDR)
1098typedef struct SUPSEMOP2
1099{
1100 /** The header. */
1101 SUPREQHDR Hdr;
1102 union
1103 {
1104 struct
1105 {
1106 /** The semaphore type. */
1107 uint32_t uType;
1108 /** The semaphore handle. */
1109 uint32_t hSem;
1110 /** The operation. */
1111 uint32_t uOp;
1112 /** Reserved, must be zero. */
1113 uint32_t uReserved;
1114 /** The number of milliseconds to wait if it's a wait operation. */
1115 union
1116 {
1117 /** Absolute timeout (RTTime[System]NanoTS).
1118 * Used by SUPSEMOP2_WAIT_NS_ABS. */
1119 uint64_t uAbsNsTimeout;
1120 /** Relative nanosecond timeout.
1121 * Used by SUPSEMOP2_WAIT_NS_REL. */
1122 uint64_t cRelNsTimeout;
1123 /** Relative millisecond timeout.
1124 * Used by SUPSEMOP2_WAIT_MS_REL. */
1125 uint32_t cRelMsTimeout;
1126 /** Generic 64-bit accessor.
1127 * ASSUMES little endian! */
1128 uint64_t u64;
1129 } uArg;
1130 } In;
1131 } u;
1132} SUPSEMOP2, *PSUPSEMOP2;
1133
1134/** Wait for a number of milliseconds. */
1135#define SUPSEMOP2_WAIT_MS_REL 0
1136/** Wait until the specified deadline is reached. */
1137#define SUPSEMOP2_WAIT_NS_ABS 1
1138/** Wait for a number of nanoseconds. */
1139#define SUPSEMOP2_WAIT_NS_REL 2
1140/** Signal the semaphore. */
1141#define SUPSEMOP2_SIGNAL 3
1142/** Reset the semaphore (only applicable to SUP_SEM_TYPE_EVENT_MULTI). */
1143#define SUPSEMOP2_RESET 4
1144/** Close the semaphore handle. */
1145#define SUPSEMOP2_CLOSE 5
1146/** @} */
1147
1148
1149/** @name SUP_IOCTL_SEM_OP3
1150 * Semaphore operations.
1151 * @{
1152 */
1153#define SUP_IOCTL_SEM_OP3 SUP_CTL_CODE_SIZE(25, 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
1199/** @name SUP_IOCTL_VT_CAPS
1200 * Get the VT-x/AMD-V capabilities.
1201 *
1202 * @todo Intended for main, which means we need to relax the privilege requires
1203 * when accessing certain vboxdrv functions.
1204 *
1205 * @{
1206 */
1207#define SUP_IOCTL_VT_CAPS SUP_CTL_CODE_SIZE(26, SUP_IOCTL_VT_CAPS_SIZE)
1208#define SUP_IOCTL_VT_CAPS_SIZE sizeof(SUPVTCAPS)
1209#define SUP_IOCTL_VT_CAPS_SIZE_IN sizeof(SUPREQHDR)
1210#define SUP_IOCTL_VT_CAPS_SIZE_OUT sizeof(SUPVTCAPS)
1211typedef struct SUPVTCAPS
1212{
1213 /** The header. */
1214 SUPREQHDR Hdr;
1215 union
1216 {
1217 struct
1218 {
1219 /** The VT capability dword. */
1220 uint32_t fCaps;
1221 } Out;
1222 } u;
1223} SUPVTCAPS, *PSUPVTCAPS;
1224/** @} */
1225
1226
1227/** @name SUP_IOCTL_TRACER_OPEN
1228 * Open the tracer.
1229 *
1230 * Should be matched by an SUP_IOCTL_TRACER_CLOSE call.
1231 *
1232 * @{
1233 */
1234#define SUP_IOCTL_TRACER_OPEN SUP_CTL_CODE_SIZE(28, SUP_IOCTL_TRACER_OPEN_SIZE)
1235#define SUP_IOCTL_TRACER_OPEN_SIZE sizeof(SUPTRACEROPEN)
1236#define SUP_IOCTL_TRACER_OPEN_SIZE_IN sizeof(SUPTRACEROPEN)
1237#define SUP_IOCTL_TRACER_OPEN_SIZE_OUT sizeof(SUPREQHDR)
1238typedef struct SUPTRACEROPEN
1239{
1240 /** The header. */
1241 SUPREQHDR Hdr;
1242 union
1243 {
1244 struct
1245 {
1246 /** Tracer cookie. Used to make sure we only open a matching tracer. */
1247 uint32_t uCookie;
1248 /** Tracer specific argument. */
1249 RTHCUINTPTR uArg;
1250 } In;
1251 } u;
1252} SUPTRACEROPEN, *PSUPTRACEROPEN;
1253/** @} */
1254
1255
1256/** @name SUP_IOCTL_TRACER_CLOSE
1257 * Close the tracer.
1258 *
1259 * Must match a SUP_IOCTL_TRACER_OPEN call.
1260 *
1261 * @{
1262 */
1263#define SUP_IOCTL_TRACER_CLOSE SUP_CTL_CODE_SIZE(29, SUP_IOCTL_TRACER_CLOSE_SIZE)
1264#define SUP_IOCTL_TRACER_CLOSE_SIZE sizeof(SUPREQHDR)
1265#define SUP_IOCTL_TRACER_CLOSE_SIZE_IN sizeof(SUPREQHDR)
1266#define SUP_IOCTL_TRACER_CLOSE_SIZE_OUT sizeof(SUPREQHDR)
1267/** @} */
1268
1269
1270/** @name SUP_IOCTL_TRACER_IOCTL
1271 * Speak UNIX ioctl() with the tracer.
1272 *
1273 * The session must have opened the tracer prior to issuing this request.
1274 *
1275 * @{
1276 */
1277#define SUP_IOCTL_TRACER_IOCTL SUP_CTL_CODE_SIZE(30, SUP_IOCTL_TRACER_IOCTL_SIZE)
1278#define SUP_IOCTL_TRACER_IOCTL_SIZE sizeof(SUPTRACERIOCTL)
1279#define SUP_IOCTL_TRACER_IOCTL_SIZE_IN sizeof(SUPTRACERIOCTL)
1280#define SUP_IOCTL_TRACER_IOCTL_SIZE_OUT (RT_UOFFSETOF(SUPTRACERIOCTL, u.Out.iRetVal) + sizeof(int32_t))
1281typedef struct SUPTRACERIOCTL
1282{
1283 /** The header. */
1284 SUPREQHDR Hdr;
1285 union
1286 {
1287 struct
1288 {
1289 /** The command. */
1290 RTHCUINTPTR uCmd;
1291 /** Argument to the command. */
1292 RTHCUINTPTR uArg;
1293 } In;
1294
1295 struct
1296 {
1297 /** The return value. */
1298 int32_t iRetVal;
1299 } Out;
1300 } u;
1301} SUPTRACERIOCTL, *PSUPTRACERIOCTL;
1302/** @} */
1303
1304
1305/** @name SUP_IOCTL_TRACER_UMOD_REG
1306 * Registers tracepoints in a user mode module.
1307 *
1308 * @{
1309 */
1310#define SUP_IOCTL_TRACER_UMOD_REG SUP_CTL_CODE_SIZE(31, SUP_IOCTL_TRACER_UMOD_REG_SIZE)
1311#define SUP_IOCTL_TRACER_UMOD_REG_SIZE sizeof(SUPTRACERUMODREG)
1312#define SUP_IOCTL_TRACER_UMOD_REG_SIZE_IN sizeof(SUPTRACERUMODREG)
1313#define SUP_IOCTL_TRACER_UMOD_REG_SIZE_OUT sizeof(SUPREQHDR)
1314typedef struct SUPTRACERUMODREG
1315{
1316 /** The header. */
1317 SUPREQHDR Hdr;
1318 union
1319 {
1320 struct
1321 {
1322 /** The address at which the VTG header actually resides.
1323 * This will differ from R3PtrVtgHdr for raw-mode context
1324 * modules. */
1325 RTUINTPTR uVtgHdrAddr;
1326 /** The ring-3 pointer of the VTG header. */
1327 RTR3PTR R3PtrVtgHdr;
1328 /** The ring-3 pointer of the probe location string table. */
1329 RTR3PTR R3PtrStrTab;
1330 /** The size of the string table. */
1331 uint32_t cbStrTab;
1332 /** Future flags, MBZ. */
1333 uint32_t fFlags;
1334 /** The module name. */
1335 char szName[64];
1336 } In;
1337 } u;
1338} SUPTRACERUMODREG, *PSUPTRACERUMODREG;
1339/** @} */
1340
1341
1342/** @name SUP_IOCTL_TRACER_UMOD_DEREG
1343 * Deregisters tracepoints in a user mode module.
1344 *
1345 * @{
1346 */
1347#define SUP_IOCTL_TRACER_UMOD_DEREG SUP_CTL_CODE_SIZE(32, SUP_IOCTL_TRACER_UMOD_DEREG_SIZE)
1348#define SUP_IOCTL_TRACER_UMOD_DEREG_SIZE sizeof(SUPTRACERUMODDEREG)
1349#define SUP_IOCTL_TRACER_UMOD_DEREG_SIZE_IN sizeof(SUPTRACERUMODDEREG)
1350#define SUP_IOCTL_TRACER_UMOD_DEREG_SIZE_OUT sizeof(SUPREQHDR)
1351typedef struct SUPTRACERUMODDEREG
1352{
1353 /** The header. */
1354 SUPREQHDR Hdr;
1355 union
1356 {
1357 struct
1358 {
1359 /** Pointer to the VTG header. */
1360 RTR3PTR pVtgHdr;
1361 } In;
1362 } u;
1363} SUPTRACERUMODDEREG, *PSUPTRACERUMODDEREG;
1364/** @} */
1365
1366
1367/** @name SUP_IOCTL_TRACER_UMOD_FIRE_PROBE
1368 * Fire a probe in a user tracepoint module.
1369 *
1370 * @{
1371 */
1372#define SUP_IOCTL_TRACER_UMOD_FIRE_PROBE SUP_CTL_CODE_SIZE(33, SUP_IOCTL_TRACER_UMOD_FIRE_PROBE_SIZE)
1373#define SUP_IOCTL_TRACER_UMOD_FIRE_PROBE_SIZE sizeof(SUPTRACERUMODFIREPROBE)
1374#define SUP_IOCTL_TRACER_UMOD_FIRE_PROBE_SIZE_IN sizeof(SUPTRACERUMODFIREPROBE)
1375#define SUP_IOCTL_TRACER_UMOD_FIRE_PROBE_SIZE_OUT sizeof(SUPREQHDR)
1376typedef struct SUPTRACERUMODFIREPROBE
1377{
1378 /** The header. */
1379 SUPREQHDR Hdr;
1380 union
1381 {
1382 SUPDRVTRACERUSRCTX In;
1383 } u;
1384} SUPTRACERUMODFIREPROBE, *PSUPTRACERUMODFIREPROBE;
1385/** @} */
1386
1387
1388/** @name SUP_IOCTL_MSR_PROBER
1389 * MSR probing interface, not available in normal builds.
1390 *
1391 * @{
1392 */
1393#define SUP_IOCTL_MSR_PROBER SUP_CTL_CODE_SIZE(34, SUP_IOCTL_MSR_PROBER_SIZE)
1394#define SUP_IOCTL_MSR_PROBER_SIZE sizeof(SUPMSRPROBER)
1395#define SUP_IOCTL_MSR_PROBER_SIZE_IN sizeof(SUPMSRPROBER)
1396#define SUP_IOCTL_MSR_PROBER_SIZE_OUT sizeof(SUPMSRPROBER)
1397
1398typedef enum SUPMSRPROBEROP
1399{
1400 SUPMSRPROBEROP_INVALID = 0, /**< The customary invalid zero value. */
1401 SUPMSRPROBEROP_READ, /**< Read an MSR. */
1402 SUPMSRPROBEROP_WRITE, /**< Write a value to an MSR (use with care!). */
1403 SUPMSRPROBEROP_MODIFY, /**< Read-modify-restore-flushall. */
1404 SUPMSRPROBEROP_MODIFY_FASTER, /**< Read-modify-restore, skip the flushing. */
1405 SUPMSRPROBEROP_END, /**< End of valid values. */
1406 SUPMSRPROBEROP_32BIT_HACK = 0x7fffffff /**< The customary 32-bit type hack. */
1407} SUPMSRPROBEROP;
1408
1409typedef struct SUPMSRPROBER
1410{
1411 /** The header. */
1412 SUPREQHDR Hdr;
1413
1414 /** Input/output union. */
1415 union
1416 {
1417 /** Inputs. */
1418 struct
1419 {
1420 /** The operation. */
1421 SUPMSRPROBEROP enmOp;
1422 /** The MSR to test. */
1423 uint32_t uMsr;
1424 /** The CPU to perform the operation on.
1425 * Use UINT32_MAX to indicate that any CPU will do. */
1426 uint32_t idCpu;
1427 /** Alignment padding. */
1428 uint32_t u32Padding;
1429 /** Operation specific arguments. */
1430 union
1431 {
1432 /* SUPMSRPROBEROP_READ takes no extra arguments. */
1433
1434 /** For SUPMSRPROBEROP_WRITE. */
1435 struct
1436 {
1437 /** The value to write. */
1438 uint64_t uToWrite;
1439 } Write;
1440
1441 /** For SUPMSRPROBEROP_MODIFY and SUPMSRPROBEROP_MODIFY_FASTER. */
1442 struct
1443 {
1444 /** The value to AND the current MSR value with to construct the value to
1445 * write. This applied first. */
1446 uint64_t fAndMask;
1447 /** The value to OR the result of the above mentioned AND operation with
1448 * attempting to modify the MSR. */
1449 uint64_t fOrMask;
1450 } Modify;
1451
1452 /** Reserve space for the future. */
1453 uint64_t auPadding[3];
1454 } uArgs;
1455 } In;
1456
1457 /** Outputs. */
1458 struct
1459 {
1460 /** Operation specific results. */
1461 union
1462 {
1463 /** For SUPMSRPROBEROP_READ. */
1464 struct
1465 {
1466 /** The value we've read. */
1467 uint64_t uValue;
1468 /** Set if we GPed while reading it. */
1469 bool fGp;
1470 } Read;
1471
1472 /** For SUPMSRPROBEROP_WRITE. */
1473 struct
1474 {
1475 /** Set if we GPed while writing it. */
1476 bool fGp;
1477 } Write;
1478
1479 /** For SUPMSRPROBEROP_MODIFY and SUPMSRPROBEROP_MODIFY_FASTER. */
1480 SUPMSRPROBERMODIFYRESULT Modify;
1481
1482 /** Size padding/aligning. */
1483 uint64_t auPadding[5];
1484 } uResults;
1485 } Out;
1486 } u;
1487} SUPMSRPROBER, *PSUPMSRPROBER;
1488AssertCompileMemberAlignment(SUPMSRPROBER, u, 8);
1489AssertCompileMemberAlignment(SUPMSRPROBER, u.In.uArgs, 8);
1490AssertCompileMembersSameSizeAndOffset(SUPMSRPROBER, u.In, SUPMSRPROBER, u.Out);
1491/** @} */
1492
1493/** @name SUP_IOCTL_RESUME_SUSPENDED_KBDS
1494 * Resume suspended keyboard devices if any found in the system.
1495 *
1496 * @{
1497 */
1498#define SUP_IOCTL_RESUME_SUSPENDED_KBDS SUP_CTL_CODE_SIZE(35, SUP_IOCTL_RESUME_SUSPENDED_KBDS_SIZE)
1499#define SUP_IOCTL_RESUME_SUSPENDED_KBDS_SIZE sizeof(SUPREQHDR)
1500#define SUP_IOCTL_RESUME_SUSPENDED_KBDS_SIZE_IN sizeof(SUPREQHDR)
1501#define SUP_IOCTL_RESUME_SUSPENDED_KBDS_SIZE_OUT sizeof(SUPREQHDR)
1502/** @} */
1503
1504
1505/** @name SUP_IOCTL_TSC_DELTA_MEASURE
1506 * Measure the TSC-delta between the specified CPU and the master TSC.
1507 *
1508 * To call this I/O control, the client must first have mapped the GIP.
1509 *
1510 * @{
1511 */
1512#define SUP_IOCTL_TSC_DELTA_MEASURE SUP_CTL_CODE_SIZE(36, SUP_IOCTL_TSC_DELTA_MEASURE_SIZE)
1513#define SUP_IOCTL_TSC_DELTA_MEASURE_SIZE sizeof(SUPTSCDELTAMEASURE)
1514#define SUP_IOCTL_TSC_DELTA_MEASURE_SIZE_IN sizeof(SUPTSCDELTAMEASURE)
1515#define SUP_IOCTL_TSC_DELTA_MEASURE_SIZE_OUT sizeof(SUPREQHDR)
1516typedef struct SUPTSCDELTAMEASURE
1517{
1518 /** The header. */
1519 SUPREQHDR Hdr;
1520
1521 /** Input/output union. */
1522 union
1523 {
1524 struct
1525 {
1526 /** Which CPU to take the TSC-delta measurement for. */
1527 RTCPUID idCpu;
1528 /** Number of times to retry on failure (specify 0 for default). */
1529 uint8_t cRetries;
1530 /** Number of milliseconds to wait before each retry. */
1531 uint8_t cMsWaitRetry;
1532 /** Whether to force taking a measurement if one exists already. */
1533 bool fForce;
1534 /** Whether to do the measurement asynchronously (if possible). */
1535 bool fAsync;
1536 } In;
1537 } u;
1538} SUPTSCDELTAMEASURE, *PSUPTSCDELTAMEASURE;
1539AssertCompileMemberAlignment(SUPTSCDELTAMEASURE, u, 8);
1540AssertCompileSize(SUPTSCDELTAMEASURE, 6*4 + 4+1+1+1+1);
1541/** @} */
1542
1543
1544/** @name SUP_IOCTL_TSC_READ
1545 * Reads the TSC and apply TSC-delta if applicable, determining the delta if
1546 * necessary (i64TSCDelta = INT64_MAX).
1547 *
1548 * This latter function is the primary use case of this I/O control. To call
1549 * this I/O control, the client must first have mapped the GIP.
1550 *
1551 * @{
1552 */
1553#define SUP_IOCTL_TSC_READ SUP_CTL_CODE_SIZE(37, SUP_IOCTL_TSC_READ_SIZE)
1554#define SUP_IOCTL_TSC_READ_SIZE sizeof(SUPTSCREAD)
1555#define SUP_IOCTL_TSC_READ_SIZE_IN sizeof(SUPREQHDR)
1556#define SUP_IOCTL_TSC_READ_SIZE_OUT sizeof(SUPTSCREAD)
1557typedef struct SUPTSCREAD
1558{
1559 /** The header. */
1560 SUPREQHDR Hdr;
1561
1562 /** Input/output union. */
1563 union
1564 {
1565 struct
1566 {
1567 /** The TSC after applying the relevant delta. */
1568 uint64_t u64AdjustedTsc;
1569 /** The APIC Id of the CPU where the TSC was read. */
1570 uint16_t idApic;
1571 /** Explicit alignment padding. */
1572 uint16_t auPadding[3];
1573 } Out;
1574 } u;
1575} SUPTSCREAD, *PSUPTSCREAD;
1576AssertCompileMemberAlignment(SUPTSCREAD, u, 8);
1577AssertCompileSize(SUPTSCREAD, 6*4 + 2*8);
1578/** @} */
1579
1580
1581/** @name SUP_IOCTL_GIP_SET_FLAGS
1582 * Set GIP flags.
1583 *
1584 * @{
1585 */
1586#define SUP_IOCTL_GIP_SET_FLAGS SUP_CTL_CODE_SIZE(39, SUP_IOCTL_GIP_SET_FLAGS_SIZE)
1587#define SUP_IOCTL_GIP_SET_FLAGS_SIZE sizeof(SUPGIPSETFLAGS)
1588#define SUP_IOCTL_GIP_SET_FLAGS_SIZE_IN sizeof(SUPGIPSETFLAGS)
1589#define SUP_IOCTL_GIP_SET_FLAGS_SIZE_OUT sizeof(SUPREQHDR)
1590typedef struct SUPGIPSETFLAGS
1591{
1592 /** The header. */
1593 SUPREQHDR Hdr;
1594 union
1595 {
1596 struct
1597 {
1598 /** The AND flags mask, see SUPGIP_FLAGS_XXX. */
1599 uint32_t fAndMask;
1600 /** The OR flags mask, see SUPGIP_FLAGS_XXX. */
1601 uint32_t fOrMask;
1602 } In;
1603 } u;
1604} SUPGIPSETFLAGS, *PSUPGIPSETFLAGS;
1605/** @} */
1606
1607
1608/** @name SUP_IOCTL_UCODE_REV
1609 * Get the CPU microcode revision.
1610 *
1611 * @{
1612 */
1613#define SUP_IOCTL_UCODE_REV SUP_CTL_CODE_SIZE(40, SUP_IOCTL_UCODE_REV_SIZE)
1614#define SUP_IOCTL_UCODE_REV_SIZE sizeof(SUPUCODEREV)
1615#define SUP_IOCTL_UCODE_REV_SIZE_IN sizeof(SUPREQHDR)
1616#define SUP_IOCTL_UCODE_REV_SIZE_OUT sizeof(SUPUCODEREV)
1617typedef struct SUPUCODEREV
1618{
1619 /** The header. */
1620 SUPREQHDR Hdr;
1621 union
1622 {
1623 struct
1624 {
1625 /** The microcode revision dword. */
1626 uint32_t MicrocodeRev;
1627 } Out;
1628 } u;
1629} SUPUCODEREV, *PSUPUCODEREV;
1630/** @} */
1631
1632
1633/** @name SUP_IOCTL_HWVIRT_MSRS
1634 * Get hardware-virtualization MSRs.
1635 *
1636 * This queries a lot more information than merely VT-x/AMD-V basic capabilities
1637 * provided by SUP_IOCTL_VT_CAPS.
1638 *
1639 * @{
1640 */
1641#define SUP_IOCTL_GET_HWVIRT_MSRS SUP_CTL_CODE_SIZE(41, SUP_IOCTL_GET_HWVIRT_MSRS_SIZE)
1642#define SUP_IOCTL_GET_HWVIRT_MSRS_SIZE sizeof(SUPGETHWVIRTMSRS)
1643#define SUP_IOCTL_GET_HWVIRT_MSRS_SIZE_IN (sizeof(SUPREQHDR) + RT_SIZEOFMEMB(SUPGETHWVIRTMSRS, u.In))
1644#define SUP_IOCTL_GET_HWVIRT_MSRS_SIZE_OUT sizeof(SUPGETHWVIRTMSRS)
1645
1646typedef struct SUPGETHWVIRTMSRS
1647{
1648 /** The header. */
1649 SUPREQHDR Hdr;
1650 union
1651 {
1652 struct
1653 {
1654 /** Whether to force re-querying of MSRs. */
1655 bool fForce;
1656 /** Reserved. Must be false. */
1657 bool fReserved0;
1658 /** Reserved. Must be false. */
1659 bool fReserved1;
1660 /** Reserved. Must be false. */
1661 bool fReserved2;
1662 } In;
1663
1664 struct
1665 {
1666 /** Hardware-virtualization MSRs. */
1667 SUPHWVIRTMSRS HwvirtMsrs;
1668 } Out;
1669 } u;
1670} SUPGETHWVIRTMSRS, *PSUPGETHWVIRTMSRS;
1671/** @} */
1672
1673
1674#pragma pack() /* paranoia */
1675
1676#endif /* !VBOX_INCLUDED_SRC_Support_SUPDrvIOC_h */
1677
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