VirtualBox

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

Last change on this file was 106061, checked in by vboxsync, 2 months ago

Copyright year updates by scm.

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