VirtualBox

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

最後變更 在這個檔案從107675是 107091,由 vboxsync 提交於 4 月 前

iprt/cdefs.h,SUPDrvIOC.h,VBoxGuestR0Lib: Added a RT_UOFFSETOF_FLEX_ARRAY macro for calculating the size of structures ending with an variables length arrays. Only tested on windows... bugref:10585

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 58.6 KB
 
1/* $Id: SUPDrvIOC.h 107091 2024-11-21 16:12:02Z 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.alldomusa.eu.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) ((uint32_t)RT_UOFFSETOF_FLEX_ARRAY(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_IN(cbImage) ((uint32_t)RT_UOFFSETOF_FLEX_ARRAY(SUPLDRLOAD, u.In.abImage, (cbImage)))
364#define SUP_IOCTL_LDR_LOAD_SIZE_OUT (RT_UOFFSETOF(SUPLDRLOAD, u.Out.szError) + RT_SIZEOFMEMB(SUPLDRLOAD, u.Out.szError))
365#define SUP_IOCTL_LDR_LOAD_SIZE(cbImage) RT_MAX(SUP_IOCTL_LDR_LOAD_SIZE_IN(cbImage), SUP_IOCTL_LDR_LOAD_SIZE_OUT)
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 RT_FLEXIBLE_ARRAY_EXTENSION
617 uint8_t abReqPkt[RT_FLEXIBLE_ARRAY];
618} SUPCALLVMMR0, *PSUPCALLVMMR0;
619/** @} */
620
621
622/** @name SUP_IOCTL_CALL_VMMR0_BIG
623 * Version of SUP_IOCTL_CALL_VMMR0 for dealing with large requests.
624 * @{
625 */
626#define SUP_IOCTL_CALL_VMMR0_BIG SUP_CTL_CODE_BIG(27)
627#define SUP_IOCTL_CALL_VMMR0_BIG_SIZE(cbReq) RT_UOFFSETOF_DYN(SUPCALLVMMR0, abReqPkt[cbReq])
628#define SUP_IOCTL_CALL_VMMR0_BIG_SIZE_IN(cbReq) SUP_IOCTL_CALL_VMMR0_SIZE(cbReq)
629#define SUP_IOCTL_CALL_VMMR0_BIG_SIZE_OUT(cbReq) SUP_IOCTL_CALL_VMMR0_SIZE(cbReq)
630/** @} */
631
632
633/** @name SUP_IOCTL_LOW_ALLOC
634 * Allocate memory below 4GB (physically).
635 * @{
636 */
637#define SUP_IOCTL_LOW_ALLOC SUP_CTL_CODE_BIG(8)
638#define SUP_IOCTL_LOW_ALLOC_SIZE(cPages) ((uint32_t)RT_UOFFSETOF_FLEX_ARRAY(SUPLOWALLOC, u.Out.aPages, (cPages)))
639#define SUP_IOCTL_LOW_ALLOC_SIZE_IN (sizeof(SUPREQHDR) + RT_SIZEOFMEMB(SUPLOWALLOC, u.In))
640#define SUP_IOCTL_LOW_ALLOC_SIZE_OUT(cPages) SUP_IOCTL_LOW_ALLOC_SIZE(cPages)
641typedef struct SUPLOWALLOC
642{
643 /** The header. */
644 SUPREQHDR Hdr;
645 union
646 {
647 struct
648 {
649 /** Number of pages to allocate. */
650 uint32_t cPages;
651 } In;
652 struct
653 {
654 /** The ring-3 address of the allocated memory. */
655 RTR3PTR pvR3;
656 /** The ring-0 address of the allocated memory. */
657 RTR0PTR pvR0;
658 /** Array of pages. */
659 RTHCPHYS aPages[1];
660 } Out;
661 } u;
662} SUPLOWALLOC, *PSUPLOWALLOC;
663/** @} */
664
665
666/** @name SUP_IOCTL_LOW_FREE
667 * Free low memory.
668 * @{
669 */
670#define SUP_IOCTL_LOW_FREE SUP_CTL_CODE_SIZE(9, SUP_IOCTL_LOW_FREE_SIZE)
671#define SUP_IOCTL_LOW_FREE_SIZE sizeof(SUPLOWFREE)
672#define SUP_IOCTL_LOW_FREE_SIZE_IN sizeof(SUPLOWFREE)
673#define SUP_IOCTL_LOW_FREE_SIZE_OUT sizeof(SUPREQHDR)
674typedef struct SUPLOWFREE
675{
676 /** The header. */
677 SUPREQHDR Hdr;
678 union
679 {
680 struct
681 {
682 /** The ring-3 address of the memory to free. */
683 RTR3PTR pvR3;
684 } In;
685 } u;
686} SUPLOWFREE, *PSUPLOWFREE;
687/** @} */
688
689
690/** @name SUP_IOCTL_PAGE_ALLOC_EX
691 * Allocate memory and map it into kernel and/or user space. The memory is of
692 * course locked. The result should be freed using SUP_IOCTL_PAGE_FREE.
693 *
694 * @remarks Allocations without a kernel mapping may fail with
695 * VERR_NOT_SUPPORTED on some platforms.
696 *
697 * @{
698 */
699#define SUP_IOCTL_PAGE_ALLOC_EX SUP_CTL_CODE_BIG(10)
700#define SUP_IOCTL_PAGE_ALLOC_EX_SIZE(cPages) ((uint32_t)RT_UOFFSETOF_FLEX_ARRAY(SUPPAGEALLOCEX, u.Out.aPages, (cPages)))
701#define SUP_IOCTL_PAGE_ALLOC_EX_SIZE_IN (sizeof(SUPREQHDR) + RT_SIZEOFMEMB(SUPPAGEALLOCEX, u.In))
702#define SUP_IOCTL_PAGE_ALLOC_EX_SIZE_OUT(cPages) SUP_IOCTL_PAGE_ALLOC_EX_SIZE(cPages)
703typedef struct SUPPAGEALLOCEX
704{
705 /** The header. */
706 SUPREQHDR Hdr;
707 union
708 {
709 struct
710 {
711 /** Number of pages to allocate */
712 uint32_t cPages;
713 /** Whether it should have kernel mapping. */
714 bool fKernelMapping;
715 /** Whether it should have a user mapping. */
716 bool fUserMapping;
717 /** Reserved. Must be false. */
718 bool fReserved0;
719 /** Reserved. Must be false. */
720 bool fReserved1;
721 } In;
722 struct
723 {
724 /** Returned ring-3 address. */
725 RTR3PTR pvR3;
726 /** Returned ring-0 address. */
727 RTR0PTR pvR0;
728 /** The physical addresses of the allocated pages. */
729 RTHCPHYS aPages[1];
730 } Out;
731 } u;
732} SUPPAGEALLOCEX, *PSUPPAGEALLOCEX;
733/** @} */
734
735
736/** @name SUP_IOCTL_PAGE_MAP_KERNEL
737 * Maps a portion of memory allocated by SUP_IOCTL_PAGE_ALLOC_EX /
738 * SUPR0PageAllocEx into kernel space for use by a device or similar.
739 *
740 * The mapping will be freed together with the ring-3 mapping when
741 * SUP_IOCTL_PAGE_FREE or SUPR0PageFree is called.
742 *
743 * @remarks Not necessarily supported on all platforms.
744 *
745 * @{
746 */
747#define SUP_IOCTL_PAGE_MAP_KERNEL SUP_CTL_CODE_SIZE(11, SUP_IOCTL_PAGE_MAP_KERNEL_SIZE)
748#define SUP_IOCTL_PAGE_MAP_KERNEL_SIZE sizeof(SUPPAGEMAPKERNEL)
749#define SUP_IOCTL_PAGE_MAP_KERNEL_SIZE_IN sizeof(SUPPAGEMAPKERNEL)
750#define SUP_IOCTL_PAGE_MAP_KERNEL_SIZE_OUT sizeof(SUPPAGEMAPKERNEL)
751typedef struct SUPPAGEMAPKERNEL
752{
753 /** The header. */
754 SUPREQHDR Hdr;
755 union
756 {
757 struct
758 {
759 /** The pointer of to the previously allocated memory. */
760 RTR3PTR pvR3;
761 /** The offset to start mapping from. */
762 uint32_t offSub;
763 /** Size of the section to map. */
764 uint32_t cbSub;
765 /** Flags reserved for future fun. */
766 uint32_t fFlags;
767 } In;
768 struct
769 {
770 /** The ring-0 address corresponding to pvR3 + offSub. */
771 RTR0PTR pvR0;
772 } Out;
773 } u;
774} SUPPAGEMAPKERNEL, *PSUPPAGEMAPKERNEL;
775/** @} */
776
777
778/** @name SUP_IOCTL_PAGE_PROTECT
779 * Changes the page level protection of the user and/or kernel mappings of
780 * memory previously allocated by SUPR0PageAllocEx.
781 *
782 * @remarks Not necessarily supported on all platforms.
783 *
784 * @{
785 */
786#define SUP_IOCTL_PAGE_PROTECT SUP_CTL_CODE_SIZE(12, SUP_IOCTL_PAGE_PROTECT_SIZE)
787#define SUP_IOCTL_PAGE_PROTECT_SIZE sizeof(SUPPAGEPROTECT)
788#define SUP_IOCTL_PAGE_PROTECT_SIZE_IN sizeof(SUPPAGEPROTECT)
789#define SUP_IOCTL_PAGE_PROTECT_SIZE_OUT sizeof(SUPPAGEPROTECT)
790typedef struct SUPPAGEPROTECT
791{
792 /** The header. */
793 SUPREQHDR Hdr;
794 union
795 {
796 struct
797 {
798 /** The pointer of to the previously allocated memory.
799 * Pass NIL_RTR3PTR if the ring-0 mapping should remain unaffected. */
800 RTR3PTR pvR3;
801 /** The pointer of to the previously allocated memory.
802 * Pass NIL_RTR0PTR if the ring-0 mapping should remain unaffected. */
803 RTR0PTR pvR0;
804 /** The offset to start changing protection at. */
805 uint32_t offSub;
806 /** Size of the portion that should be changed. */
807 uint32_t cbSub;
808 /** Protection flags, RTMEM_PROT_*. */
809 uint32_t fProt;
810 } In;
811 } u;
812} SUPPAGEPROTECT, *PSUPPAGEPROTECT;
813/** @} */
814
815
816/** @name SUP_IOCTL_PAGE_FREE
817 * Free memory allocated with SUP_IOCTL_PAGE_ALLOC_EX.
818 * @{
819 */
820#define SUP_IOCTL_PAGE_FREE SUP_CTL_CODE_SIZE(13, SUP_IOCTL_PAGE_FREE_SIZE_IN)
821#define SUP_IOCTL_PAGE_FREE_SIZE sizeof(SUPPAGEFREE)
822#define SUP_IOCTL_PAGE_FREE_SIZE_IN sizeof(SUPPAGEFREE)
823#define SUP_IOCTL_PAGE_FREE_SIZE_OUT sizeof(SUPREQHDR)
824typedef struct SUPPAGEFREE
825{
826 /** The header. */
827 SUPREQHDR Hdr;
828 union
829 {
830 struct
831 {
832 /** Address of memory range to free. */
833 RTR3PTR pvR3;
834 } In;
835 } u;
836} SUPPAGEFREE, *PSUPPAGEFREE;
837/** @} */
838
839
840
841
842/** @name SUP_IOCTL_PAGE_LOCK
843 * Pin down physical pages.
844 * @{
845 */
846#define SUP_IOCTL_PAGE_LOCK SUP_CTL_CODE_BIG(14)
847#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)))
848#define SUP_IOCTL_PAGE_LOCK_SIZE_IN (sizeof(SUPREQHDR) + RT_SIZEOFMEMB(SUPPAGELOCK, u.In))
849#define SUP_IOCTL_PAGE_LOCK_SIZE_OUT(cPages) RT_UOFFSETOF_DYN(SUPPAGELOCK, u.Out.aPages[cPages])
850typedef struct SUPPAGELOCK
851{
852 /** The header. */
853 SUPREQHDR Hdr;
854 union
855 {
856 struct
857 {
858 /** Start of page range. Must be PAGE aligned. */
859 RTR3PTR pvR3;
860 /** The range size given as a page count. */
861 uint32_t cPages;
862 } In;
863
864 struct
865 {
866 /** Array of pages. */
867 RTHCPHYS aPages[1];
868 } Out;
869 } u;
870} SUPPAGELOCK, *PSUPPAGELOCK;
871/** @} */
872
873
874/** @name SUP_IOCTL_PAGE_UNLOCK
875 * Unpin physical pages.
876 * @{ */
877#define SUP_IOCTL_PAGE_UNLOCK SUP_CTL_CODE_SIZE(15, SUP_IOCTL_PAGE_UNLOCK_SIZE)
878#define SUP_IOCTL_PAGE_UNLOCK_SIZE sizeof(SUPPAGEUNLOCK)
879#define SUP_IOCTL_PAGE_UNLOCK_SIZE_IN sizeof(SUPPAGEUNLOCK)
880#define SUP_IOCTL_PAGE_UNLOCK_SIZE_OUT sizeof(SUPREQHDR)
881typedef struct SUPPAGEUNLOCK
882{
883 /** The header. */
884 SUPREQHDR Hdr;
885 union
886 {
887 struct
888 {
889 /** Start of page range of a range previously pinned. */
890 RTR3PTR pvR3;
891 } In;
892 } u;
893} SUPPAGEUNLOCK, *PSUPPAGEUNLOCK;
894/** @} */
895
896
897/** @name SUP_IOCTL_CONT_ALLOC
898 * Allocate continuous memory.
899 * @{
900 */
901#define SUP_IOCTL_CONT_ALLOC SUP_CTL_CODE_SIZE(16, SUP_IOCTL_CONT_ALLOC_SIZE)
902#define SUP_IOCTL_CONT_ALLOC_SIZE sizeof(SUPCONTALLOC)
903#define SUP_IOCTL_CONT_ALLOC_SIZE_IN (sizeof(SUPREQHDR) + RT_SIZEOFMEMB(SUPCONTALLOC, u.In))
904#define SUP_IOCTL_CONT_ALLOC_SIZE_OUT sizeof(SUPCONTALLOC)
905typedef struct SUPCONTALLOC
906{
907 /** The header. */
908 SUPREQHDR Hdr;
909 union
910 {
911 struct
912 {
913 /** The allocation size given as a page count. */
914 uint32_t cPages;
915 } In;
916
917 struct
918 {
919 /** The address of the ring-0 mapping of the allocated memory. */
920 RTR0PTR pvR0;
921 /** The address of the ring-3 mapping of the allocated memory. */
922 RTR3PTR pvR3;
923 /** The physical address of the allocation. */
924 RTHCPHYS HCPhys;
925 } Out;
926 } u;
927} SUPCONTALLOC, *PSUPCONTALLOC;
928/** @} */
929
930
931/** @name SUP_IOCTL_CONT_FREE Input.
932 * @{
933 */
934/** Free continuous memory. */
935#define SUP_IOCTL_CONT_FREE SUP_CTL_CODE_SIZE(17, SUP_IOCTL_CONT_FREE_SIZE)
936#define SUP_IOCTL_CONT_FREE_SIZE sizeof(SUPCONTFREE)
937#define SUP_IOCTL_CONT_FREE_SIZE_IN sizeof(SUPCONTFREE)
938#define SUP_IOCTL_CONT_FREE_SIZE_OUT sizeof(SUPREQHDR)
939typedef struct SUPCONTFREE
940{
941 /** The header. */
942 SUPREQHDR Hdr;
943 union
944 {
945 struct
946 {
947 /** The ring-3 address of the memory to free. */
948 RTR3PTR pvR3;
949 } In;
950 } u;
951} SUPCONTFREE, *PSUPCONTFREE;
952/** @} */
953
954
955/** @name SUP_IOCTL_GET_PAGING_MODE
956 * Get the host paging mode.
957 * @{
958 */
959#define SUP_IOCTL_GET_PAGING_MODE SUP_CTL_CODE_SIZE(18, SUP_IOCTL_GET_PAGING_MODE_SIZE)
960#define SUP_IOCTL_GET_PAGING_MODE_SIZE sizeof(SUPGETPAGINGMODE)
961#define SUP_IOCTL_GET_PAGING_MODE_SIZE_IN sizeof(SUPREQHDR)
962#define SUP_IOCTL_GET_PAGING_MODE_SIZE_OUT sizeof(SUPGETPAGINGMODE)
963typedef struct SUPGETPAGINGMODE
964{
965 /** The header. */
966 SUPREQHDR Hdr;
967 union
968 {
969 struct
970 {
971 /** The paging mode. */
972 SUPPAGINGMODE enmMode;
973 } Out;
974 } u;
975} SUPGETPAGINGMODE, *PSUPGETPAGINGMODE;
976/** @} */
977
978
979/** @name SUP_IOCTL_SET_VM_FOR_FAST
980 * Set the VM handle for doing fast call ioctl calls.
981 * @{
982 */
983#define SUP_IOCTL_SET_VM_FOR_FAST SUP_CTL_CODE_SIZE(19, SUP_IOCTL_SET_VM_FOR_FAST_SIZE)
984#define SUP_IOCTL_SET_VM_FOR_FAST_SIZE sizeof(SUPSETVMFORFAST)
985#define SUP_IOCTL_SET_VM_FOR_FAST_SIZE_IN sizeof(SUPSETVMFORFAST)
986#define SUP_IOCTL_SET_VM_FOR_FAST_SIZE_OUT sizeof(SUPREQHDR)
987typedef struct SUPSETVMFORFAST
988{
989 /** The header. */
990 SUPREQHDR Hdr;
991 union
992 {
993 struct
994 {
995 /** The ring-0 VM handle (pointer). */
996 PVMR0 pVMR0;
997 } In;
998 } u;
999} SUPSETVMFORFAST, *PSUPSETVMFORFAST;
1000/** @} */
1001
1002
1003/** @name SUP_IOCTL_GIP_MAP
1004 * Map the GIP into user space.
1005 * @{
1006 */
1007#define SUP_IOCTL_GIP_MAP SUP_CTL_CODE_SIZE(20, SUP_IOCTL_GIP_MAP_SIZE)
1008#define SUP_IOCTL_GIP_MAP_SIZE sizeof(SUPGIPMAP)
1009#define SUP_IOCTL_GIP_MAP_SIZE_IN sizeof(SUPREQHDR)
1010#define SUP_IOCTL_GIP_MAP_SIZE_OUT sizeof(SUPGIPMAP)
1011typedef struct SUPGIPMAP
1012{
1013 /** The header. */
1014 SUPREQHDR Hdr;
1015 union
1016 {
1017 struct
1018 {
1019 /** The physical address of the GIP. */
1020 RTHCPHYS HCPhysGip;
1021 /** Pointer to the read-only usermode GIP mapping for this session. */
1022 R3PTRTYPE(PSUPGLOBALINFOPAGE) pGipR3;
1023 /** Pointer to the supervisor mode GIP mapping. */
1024 R0PTRTYPE(PSUPGLOBALINFOPAGE) pGipR0;
1025 } Out;
1026 } u;
1027} SUPGIPMAP, *PSUPGIPMAP;
1028/** @} */
1029
1030
1031/** @name SUP_IOCTL_GIP_UNMAP
1032 * Unmap the GIP.
1033 * @{
1034 */
1035#define SUP_IOCTL_GIP_UNMAP SUP_CTL_CODE_SIZE(21, SUP_IOCTL_GIP_UNMAP_SIZE)
1036#define SUP_IOCTL_GIP_UNMAP_SIZE sizeof(SUPGIPUNMAP)
1037#define SUP_IOCTL_GIP_UNMAP_SIZE_IN sizeof(SUPGIPUNMAP)
1038#define SUP_IOCTL_GIP_UNMAP_SIZE_OUT sizeof(SUPGIPUNMAP)
1039typedef struct SUPGIPUNMAP
1040{
1041 /** The header. */
1042 SUPREQHDR Hdr;
1043} SUPGIPUNMAP, *PSUPGIPUNMAP;
1044/** @} */
1045
1046
1047/** @name SUP_IOCTL_CALL_SERVICE
1048 * Call the a ring-0 service.
1049 *
1050 * @todo Might have to convert this to a big request, just like
1051 * SUP_IOCTL_CALL_VMMR0
1052 * @{
1053 */
1054#define SUP_IOCTL_CALL_SERVICE(cbReq) SUP_CTL_CODE_SIZE(22, SUP_IOCTL_CALL_SERVICE_SIZE(cbReq))
1055#define SUP_IOCTL_CALL_SERVICE_NO_SIZE() SUP_CTL_CODE_SIZE(22, 0)
1056#define SUP_IOCTL_CALL_SERVICE_SIZE(cbReq) RT_UOFFSETOF_DYN(SUPCALLSERVICE, abReqPkt[cbReq])
1057#define SUP_IOCTL_CALL_SERVICE_SIZE_IN(cbReq) SUP_IOCTL_CALL_SERVICE_SIZE(cbReq)
1058#define SUP_IOCTL_CALL_SERVICE_SIZE_OUT(cbReq) SUP_IOCTL_CALL_SERVICE_SIZE(cbReq)
1059typedef struct SUPCALLSERVICE
1060{
1061 /** The header. */
1062 SUPREQHDR Hdr;
1063 union
1064 {
1065 struct
1066 {
1067 /** The service name. */
1068 char szName[28];
1069 /** Which operation to execute. */
1070 uint32_t uOperation;
1071 /** Argument to use when no request packet is supplied. */
1072 uint64_t u64Arg;
1073 } In;
1074 } u;
1075 /** The request packet passed to SUP. */
1076 uint8_t abReqPkt[1];
1077} SUPCALLSERVICE, *PSUPCALLSERVICE;
1078/** @} */
1079
1080
1081/** @name SUP_IOCTL_LOGGER_SETTINGS
1082 * Changes the ring-0 release or debug logger settings.
1083 * @{
1084 */
1085#define SUP_IOCTL_LOGGER_SETTINGS(cbStrTab) SUP_CTL_CODE_SIZE(23, SUP_IOCTL_LOGGER_SETTINGS_SIZE(cbStrTab))
1086#define SUP_IOCTL_LOGGER_SETTINGS_NO_SIZE() SUP_CTL_CODE_SIZE(23, 0)
1087#define SUP_IOCTL_LOGGER_SETTINGS_SIZE(cbStrTab) RT_UOFFSETOF_DYN(SUPLOGGERSETTINGS, u.In.szStrings[cbStrTab])
1088#define SUP_IOCTL_LOGGER_SETTINGS_SIZE_IN(cbStrTab) RT_UOFFSETOF_DYN(SUPLOGGERSETTINGS, u.In.szStrings[cbStrTab])
1089#define SUP_IOCTL_LOGGER_SETTINGS_SIZE_OUT sizeof(SUPREQHDR)
1090typedef struct SUPLOGGERSETTINGS
1091{
1092 /** The header. */
1093 SUPREQHDR Hdr;
1094 union
1095 {
1096 struct
1097 {
1098 /** Which logger. */
1099 uint32_t fWhich;
1100 /** What to do with it. */
1101 uint32_t fWhat;
1102 /** Offset of the flags setting string. */
1103 uint32_t offFlags;
1104 /** Offset of the groups setting string. */
1105 uint32_t offGroups;
1106 /** Offset of the destination setting string. */
1107 uint32_t offDestination;
1108 /** The string table. */
1109 char szStrings[1];
1110 } In;
1111 } u;
1112} SUPLOGGERSETTINGS, *PSUPLOGGERSETTINGS;
1113
1114/** Debug logger. */
1115#define SUPLOGGERSETTINGS_WHICH_DEBUG 0
1116/** Release logger. */
1117#define SUPLOGGERSETTINGS_WHICH_RELEASE 1
1118
1119/** Change the settings. */
1120#define SUPLOGGERSETTINGS_WHAT_SETTINGS 0
1121/** Create the logger instance. */
1122#define SUPLOGGERSETTINGS_WHAT_CREATE 1
1123/** Destroy the logger instance. */
1124#define SUPLOGGERSETTINGS_WHAT_DESTROY 2
1125
1126/** @} */
1127
1128
1129/** @name Semaphore Types
1130 * @{ */
1131#define SUP_SEM_TYPE_EVENT 0
1132#define SUP_SEM_TYPE_EVENT_MULTI 1
1133/** @} */
1134
1135
1136/** @name SUP_IOCTL_SEM_OP2
1137 * Semaphore operations.
1138 * @remarks This replaces the old SUP_IOCTL_SEM_OP interface.
1139 * @{
1140 */
1141#define SUP_IOCTL_SEM_OP2 SUP_CTL_CODE_SIZE(24, SUP_IOCTL_SEM_OP2_SIZE)
1142#define SUP_IOCTL_SEM_OP2_SIZE sizeof(SUPSEMOP2)
1143#define SUP_IOCTL_SEM_OP2_SIZE_IN sizeof(SUPSEMOP2)
1144#define SUP_IOCTL_SEM_OP2_SIZE_OUT sizeof(SUPREQHDR)
1145typedef struct SUPSEMOP2
1146{
1147 /** The header. */
1148 SUPREQHDR Hdr;
1149 union
1150 {
1151 struct
1152 {
1153 /** The semaphore type. */
1154 uint32_t uType;
1155 /** The semaphore handle. */
1156 uint32_t hSem;
1157 /** The operation. */
1158 uint32_t uOp;
1159 /** Reserved, must be zero. */
1160 uint32_t uReserved;
1161 /** The number of milliseconds to wait if it's a wait operation. */
1162 union
1163 {
1164 /** Absolute timeout (RTTime[System]NanoTS).
1165 * Used by SUPSEMOP2_WAIT_NS_ABS. */
1166 uint64_t uAbsNsTimeout;
1167 /** Relative nanosecond timeout.
1168 * Used by SUPSEMOP2_WAIT_NS_REL. */
1169 uint64_t cRelNsTimeout;
1170 /** Relative millisecond timeout.
1171 * Used by SUPSEMOP2_WAIT_MS_REL. */
1172 uint32_t cRelMsTimeout;
1173 /** Generic 64-bit accessor.
1174 * ASSUMES little endian! */
1175 uint64_t u64;
1176 } uArg;
1177 } In;
1178 } u;
1179} SUPSEMOP2, *PSUPSEMOP2;
1180
1181/** Wait for a number of milliseconds. */
1182#define SUPSEMOP2_WAIT_MS_REL 0
1183/** Wait until the specified deadline is reached. */
1184#define SUPSEMOP2_WAIT_NS_ABS 1
1185/** Wait for a number of nanoseconds. */
1186#define SUPSEMOP2_WAIT_NS_REL 2
1187/** Signal the semaphore. */
1188#define SUPSEMOP2_SIGNAL 3
1189/** Reset the semaphore (only applicable to SUP_SEM_TYPE_EVENT_MULTI). */
1190#define SUPSEMOP2_RESET 4
1191/** Close the semaphore handle. */
1192#define SUPSEMOP2_CLOSE 5
1193/** @} */
1194
1195
1196/** @name SUP_IOCTL_SEM_OP3
1197 * Semaphore operations.
1198 * @{
1199 */
1200#define SUP_IOCTL_SEM_OP3 SUP_CTL_CODE_SIZE(25, SUP_IOCTL_SEM_OP3_SIZE)
1201#define SUP_IOCTL_SEM_OP3_SIZE sizeof(SUPSEMOP3)
1202#define SUP_IOCTL_SEM_OP3_SIZE_IN sizeof(SUPSEMOP3)
1203#define SUP_IOCTL_SEM_OP3_SIZE_OUT sizeof(SUPSEMOP3)
1204typedef struct SUPSEMOP3
1205{
1206 /** The header. */
1207 SUPREQHDR Hdr;
1208 union
1209 {
1210 struct
1211 {
1212 /** The semaphore type. */
1213 uint32_t uType;
1214 /** The semaphore handle. */
1215 uint32_t hSem;
1216 /** The operation. */
1217 uint32_t uOp;
1218 /** Reserved, must be zero. */
1219 uint32_t u32Reserved;
1220 /** Reserved for future use. */
1221 uint64_t u64Reserved;
1222 } In;
1223 union
1224 {
1225 /** The handle of the created semaphore.
1226 * Used by SUPSEMOP3_CREATE. */
1227 uint32_t hSem;
1228 /** The semaphore resolution in nano seconds.
1229 * Used by SUPSEMOP3_GET_RESOLUTION. */
1230 uint32_t cNsResolution;
1231 /** The 32-bit view. */
1232 uint32_t u32;
1233 /** Reserved some space for later expansion. */
1234 uint64_t u64Reserved;
1235 } Out;
1236 } u;
1237} SUPSEMOP3, *PSUPSEMOP3;
1238
1239/** Get the wait resolution. */
1240#define SUPSEMOP3_CREATE 0
1241/** Get the wait resolution. */
1242#define SUPSEMOP3_GET_RESOLUTION 1
1243/** @} */
1244
1245
1246/** @name SUP_IOCTL_VT_CAPS
1247 * Get the VT-x/AMD-V capabilities.
1248 *
1249 * @todo Intended for main, which means we need to relax the privilege requires
1250 * when accessing certain vboxdrv functions.
1251 *
1252 * @{
1253 */
1254#define SUP_IOCTL_VT_CAPS SUP_CTL_CODE_SIZE(26, SUP_IOCTL_VT_CAPS_SIZE)
1255#define SUP_IOCTL_VT_CAPS_SIZE sizeof(SUPVTCAPS)
1256#define SUP_IOCTL_VT_CAPS_SIZE_IN sizeof(SUPREQHDR)
1257#define SUP_IOCTL_VT_CAPS_SIZE_OUT sizeof(SUPVTCAPS)
1258typedef struct SUPVTCAPS
1259{
1260 /** The header. */
1261 SUPREQHDR Hdr;
1262 union
1263 {
1264 struct
1265 {
1266 /** The VT capability dword. */
1267 uint32_t fCaps;
1268 } Out;
1269 } u;
1270} SUPVTCAPS, *PSUPVTCAPS;
1271/** @} */
1272
1273
1274/** @name SUP_IOCTL_TRACER_OPEN
1275 * Open the tracer.
1276 *
1277 * Should be matched by an SUP_IOCTL_TRACER_CLOSE call.
1278 *
1279 * @{
1280 */
1281#define SUP_IOCTL_TRACER_OPEN SUP_CTL_CODE_SIZE(28, SUP_IOCTL_TRACER_OPEN_SIZE)
1282#define SUP_IOCTL_TRACER_OPEN_SIZE sizeof(SUPTRACEROPEN)
1283#define SUP_IOCTL_TRACER_OPEN_SIZE_IN sizeof(SUPTRACEROPEN)
1284#define SUP_IOCTL_TRACER_OPEN_SIZE_OUT sizeof(SUPREQHDR)
1285typedef struct SUPTRACEROPEN
1286{
1287 /** The header. */
1288 SUPREQHDR Hdr;
1289 union
1290 {
1291 struct
1292 {
1293 /** Tracer cookie. Used to make sure we only open a matching tracer. */
1294 uint32_t uCookie;
1295 /** Tracer specific argument. */
1296 RTHCUINTPTR uArg;
1297 } In;
1298 } u;
1299} SUPTRACEROPEN, *PSUPTRACEROPEN;
1300/** @} */
1301
1302
1303/** @name SUP_IOCTL_TRACER_CLOSE
1304 * Close the tracer.
1305 *
1306 * Must match a SUP_IOCTL_TRACER_OPEN call.
1307 *
1308 * @{
1309 */
1310#define SUP_IOCTL_TRACER_CLOSE SUP_CTL_CODE_SIZE(29, SUP_IOCTL_TRACER_CLOSE_SIZE)
1311#define SUP_IOCTL_TRACER_CLOSE_SIZE sizeof(SUPREQHDR)
1312#define SUP_IOCTL_TRACER_CLOSE_SIZE_IN sizeof(SUPREQHDR)
1313#define SUP_IOCTL_TRACER_CLOSE_SIZE_OUT sizeof(SUPREQHDR)
1314/** @} */
1315
1316
1317/** @name SUP_IOCTL_TRACER_IOCTL
1318 * Speak UNIX ioctl() with the tracer.
1319 *
1320 * The session must have opened the tracer prior to issuing this request.
1321 *
1322 * @{
1323 */
1324#define SUP_IOCTL_TRACER_IOCTL SUP_CTL_CODE_SIZE(30, SUP_IOCTL_TRACER_IOCTL_SIZE)
1325#define SUP_IOCTL_TRACER_IOCTL_SIZE sizeof(SUPTRACERIOCTL)
1326#define SUP_IOCTL_TRACER_IOCTL_SIZE_IN sizeof(SUPTRACERIOCTL)
1327#define SUP_IOCTL_TRACER_IOCTL_SIZE_OUT (RT_UOFFSETOF(SUPTRACERIOCTL, u.Out.iRetVal) + sizeof(int32_t))
1328typedef struct SUPTRACERIOCTL
1329{
1330 /** The header. */
1331 SUPREQHDR Hdr;
1332 union
1333 {
1334 struct
1335 {
1336 /** The command. */
1337 RTHCUINTPTR uCmd;
1338 /** Argument to the command. */
1339 RTHCUINTPTR uArg;
1340 } In;
1341
1342 struct
1343 {
1344 /** The return value. */
1345 int32_t iRetVal;
1346 } Out;
1347 } u;
1348} SUPTRACERIOCTL, *PSUPTRACERIOCTL;
1349/** @} */
1350
1351
1352/** @name SUP_IOCTL_TRACER_UMOD_REG
1353 * Registers tracepoints in a user mode module.
1354 *
1355 * @{
1356 */
1357#define SUP_IOCTL_TRACER_UMOD_REG SUP_CTL_CODE_SIZE(31, SUP_IOCTL_TRACER_UMOD_REG_SIZE)
1358#define SUP_IOCTL_TRACER_UMOD_REG_SIZE sizeof(SUPTRACERUMODREG)
1359#define SUP_IOCTL_TRACER_UMOD_REG_SIZE_IN sizeof(SUPTRACERUMODREG)
1360#define SUP_IOCTL_TRACER_UMOD_REG_SIZE_OUT sizeof(SUPREQHDR)
1361typedef struct SUPTRACERUMODREG
1362{
1363 /** The header. */
1364 SUPREQHDR Hdr;
1365 union
1366 {
1367 struct
1368 {
1369 /** The address at which the VTG header actually resides.
1370 * This will differ from R3PtrVtgHdr for raw-mode context
1371 * modules. */
1372 RTUINTPTR uVtgHdrAddr;
1373 /** The ring-3 pointer of the VTG header. */
1374 RTR3PTR R3PtrVtgHdr;
1375 /** The ring-3 pointer of the probe location string table. */
1376 RTR3PTR R3PtrStrTab;
1377 /** The size of the string table. */
1378 uint32_t cbStrTab;
1379 /** Future flags, MBZ. */
1380 uint32_t fFlags;
1381 /** The module name. */
1382 char szName[64];
1383 } In;
1384 } u;
1385} SUPTRACERUMODREG, *PSUPTRACERUMODREG;
1386/** @} */
1387
1388
1389/** @name SUP_IOCTL_TRACER_UMOD_DEREG
1390 * Deregisters tracepoints in a user mode module.
1391 *
1392 * @{
1393 */
1394#define SUP_IOCTL_TRACER_UMOD_DEREG SUP_CTL_CODE_SIZE(32, SUP_IOCTL_TRACER_UMOD_DEREG_SIZE)
1395#define SUP_IOCTL_TRACER_UMOD_DEREG_SIZE sizeof(SUPTRACERUMODDEREG)
1396#define SUP_IOCTL_TRACER_UMOD_DEREG_SIZE_IN sizeof(SUPTRACERUMODDEREG)
1397#define SUP_IOCTL_TRACER_UMOD_DEREG_SIZE_OUT sizeof(SUPREQHDR)
1398typedef struct SUPTRACERUMODDEREG
1399{
1400 /** The header. */
1401 SUPREQHDR Hdr;
1402 union
1403 {
1404 struct
1405 {
1406 /** Pointer to the VTG header. */
1407 RTR3PTR pVtgHdr;
1408 } In;
1409 } u;
1410} SUPTRACERUMODDEREG, *PSUPTRACERUMODDEREG;
1411/** @} */
1412
1413
1414/** @name SUP_IOCTL_TRACER_UMOD_FIRE_PROBE
1415 * Fire a probe in a user tracepoint module.
1416 *
1417 * @{
1418 */
1419#define SUP_IOCTL_TRACER_UMOD_FIRE_PROBE SUP_CTL_CODE_SIZE(33, SUP_IOCTL_TRACER_UMOD_FIRE_PROBE_SIZE)
1420#define SUP_IOCTL_TRACER_UMOD_FIRE_PROBE_SIZE sizeof(SUPTRACERUMODFIREPROBE)
1421#define SUP_IOCTL_TRACER_UMOD_FIRE_PROBE_SIZE_IN sizeof(SUPTRACERUMODFIREPROBE)
1422#define SUP_IOCTL_TRACER_UMOD_FIRE_PROBE_SIZE_OUT sizeof(SUPREQHDR)
1423typedef struct SUPTRACERUMODFIREPROBE
1424{
1425 /** The header. */
1426 SUPREQHDR Hdr;
1427 union
1428 {
1429 SUPDRVTRACERUSRCTX In;
1430 } u;
1431} SUPTRACERUMODFIREPROBE, *PSUPTRACERUMODFIREPROBE;
1432/** @} */
1433
1434
1435/** @name SUP_IOCTL_MSR_PROBER
1436 * MSR probing interface, not available in normal builds.
1437 *
1438 * @{
1439 */
1440#define SUP_IOCTL_MSR_PROBER SUP_CTL_CODE_SIZE(34, SUP_IOCTL_MSR_PROBER_SIZE)
1441#define SUP_IOCTL_MSR_PROBER_SIZE sizeof(SUPMSRPROBER)
1442#define SUP_IOCTL_MSR_PROBER_SIZE_IN sizeof(SUPMSRPROBER)
1443#define SUP_IOCTL_MSR_PROBER_SIZE_OUT sizeof(SUPMSRPROBER)
1444
1445typedef enum SUPMSRPROBEROP
1446{
1447 SUPMSRPROBEROP_INVALID = 0, /**< The customary invalid zero value. */
1448 SUPMSRPROBEROP_READ, /**< Read an MSR. */
1449 SUPMSRPROBEROP_WRITE, /**< Write a value to an MSR (use with care!). */
1450 SUPMSRPROBEROP_MODIFY, /**< Read-modify-restore-flushall. */
1451 SUPMSRPROBEROP_MODIFY_FASTER, /**< Read-modify-restore, skip the flushing. */
1452 SUPMSRPROBEROP_END, /**< End of valid values. */
1453 SUPMSRPROBEROP_32BIT_HACK = 0x7fffffff /**< The customary 32-bit type hack. */
1454} SUPMSRPROBEROP;
1455
1456typedef struct SUPMSRPROBER
1457{
1458 /** The header. */
1459 SUPREQHDR Hdr;
1460
1461 /** Input/output union. */
1462 union
1463 {
1464 /** Inputs. */
1465 struct
1466 {
1467 /** The operation. */
1468 SUPMSRPROBEROP enmOp;
1469 /** The MSR to test. */
1470 uint32_t uMsr;
1471 /** The CPU to perform the operation on.
1472 * Use UINT32_MAX to indicate that any CPU will do. */
1473 uint32_t idCpu;
1474 /** Alignment padding. */
1475 uint32_t u32Padding;
1476 /** Operation specific arguments. */
1477 union
1478 {
1479 /* SUPMSRPROBEROP_READ takes no extra arguments. */
1480
1481 /** For SUPMSRPROBEROP_WRITE. */
1482 struct
1483 {
1484 /** The value to write. */
1485 uint64_t uToWrite;
1486 } Write;
1487
1488 /** For SUPMSRPROBEROP_MODIFY and SUPMSRPROBEROP_MODIFY_FASTER. */
1489 struct
1490 {
1491 /** The value to AND the current MSR value with to construct the value to
1492 * write. This applied first. */
1493 uint64_t fAndMask;
1494 /** The value to OR the result of the above mentioned AND operation with
1495 * attempting to modify the MSR. */
1496 uint64_t fOrMask;
1497 } Modify;
1498
1499 /** Reserve space for the future. */
1500 uint64_t auPadding[3];
1501 } uArgs;
1502 } In;
1503
1504 /** Outputs. */
1505 struct
1506 {
1507 /** Operation specific results. */
1508 union
1509 {
1510 /** For SUPMSRPROBEROP_READ. */
1511 struct
1512 {
1513 /** The value we've read. */
1514 uint64_t uValue;
1515 /** Set if we GPed while reading it. */
1516 bool fGp;
1517 } Read;
1518
1519 /** For SUPMSRPROBEROP_WRITE. */
1520 struct
1521 {
1522 /** Set if we GPed while writing it. */
1523 bool fGp;
1524 } Write;
1525
1526 /** For SUPMSRPROBEROP_MODIFY and SUPMSRPROBEROP_MODIFY_FASTER. */
1527 SUPMSRPROBERMODIFYRESULT Modify;
1528
1529 /** Size padding/aligning. */
1530 uint64_t auPadding[5];
1531 } uResults;
1532 } Out;
1533 } u;
1534} SUPMSRPROBER, *PSUPMSRPROBER;
1535AssertCompileMemberAlignment(SUPMSRPROBER, u, 8);
1536AssertCompileMemberAlignment(SUPMSRPROBER, u.In.uArgs, 8);
1537AssertCompileMembersSameSizeAndOffset(SUPMSRPROBER, u.In, SUPMSRPROBER, u.Out);
1538/** @} */
1539
1540/** @name SUP_IOCTL_RESUME_SUSPENDED_KBDS
1541 * Resume suspended keyboard devices if any found in the system.
1542 *
1543 * @{
1544 */
1545#define SUP_IOCTL_RESUME_SUSPENDED_KBDS SUP_CTL_CODE_SIZE(35, SUP_IOCTL_RESUME_SUSPENDED_KBDS_SIZE)
1546#define SUP_IOCTL_RESUME_SUSPENDED_KBDS_SIZE sizeof(SUPREQHDR)
1547#define SUP_IOCTL_RESUME_SUSPENDED_KBDS_SIZE_IN sizeof(SUPREQHDR)
1548#define SUP_IOCTL_RESUME_SUSPENDED_KBDS_SIZE_OUT sizeof(SUPREQHDR)
1549/** @} */
1550
1551
1552/** @name SUP_IOCTL_TSC_DELTA_MEASURE
1553 * Measure the TSC-delta between the specified CPU and the master TSC.
1554 *
1555 * To call this I/O control, the client must first have mapped the GIP.
1556 *
1557 * @{
1558 */
1559#define SUP_IOCTL_TSC_DELTA_MEASURE SUP_CTL_CODE_SIZE(36, SUP_IOCTL_TSC_DELTA_MEASURE_SIZE)
1560#define SUP_IOCTL_TSC_DELTA_MEASURE_SIZE sizeof(SUPTSCDELTAMEASURE)
1561#define SUP_IOCTL_TSC_DELTA_MEASURE_SIZE_IN sizeof(SUPTSCDELTAMEASURE)
1562#define SUP_IOCTL_TSC_DELTA_MEASURE_SIZE_OUT sizeof(SUPREQHDR)
1563typedef struct SUPTSCDELTAMEASURE
1564{
1565 /** The header. */
1566 SUPREQHDR Hdr;
1567
1568 /** Input/output union. */
1569 union
1570 {
1571 struct
1572 {
1573 /** Which CPU to take the TSC-delta measurement for. */
1574 RTCPUID idCpu;
1575 /** Number of times to retry on failure (specify 0 for default). */
1576 uint8_t cRetries;
1577 /** Number of milliseconds to wait before each retry. */
1578 uint8_t cMsWaitRetry;
1579 /** Whether to force taking a measurement if one exists already. */
1580 bool fForce;
1581 /** Whether to do the measurement asynchronously (if possible). */
1582 bool fAsync;
1583 } In;
1584 } u;
1585} SUPTSCDELTAMEASURE, *PSUPTSCDELTAMEASURE;
1586AssertCompileMemberAlignment(SUPTSCDELTAMEASURE, u, 8);
1587AssertCompileSize(SUPTSCDELTAMEASURE, 6*4 + 4+1+1+1+1);
1588/** @} */
1589
1590
1591/** @name SUP_IOCTL_TSC_READ
1592 * Reads the TSC and apply TSC-delta if applicable, determining the delta if
1593 * necessary (i64TSCDelta = INT64_MAX).
1594 *
1595 * This latter function is the primary use case of this I/O control. To call
1596 * this I/O control, the client must first have mapped the GIP.
1597 *
1598 * @{
1599 */
1600#define SUP_IOCTL_TSC_READ SUP_CTL_CODE_SIZE(37, SUP_IOCTL_TSC_READ_SIZE)
1601#define SUP_IOCTL_TSC_READ_SIZE sizeof(SUPTSCREAD)
1602#define SUP_IOCTL_TSC_READ_SIZE_IN sizeof(SUPREQHDR)
1603#define SUP_IOCTL_TSC_READ_SIZE_OUT sizeof(SUPTSCREAD)
1604typedef struct SUPTSCREAD
1605{
1606 /** The header. */
1607 SUPREQHDR Hdr;
1608
1609 /** Input/output union. */
1610 union
1611 {
1612 struct
1613 {
1614 /** The TSC after applying the relevant delta. */
1615 uint64_t u64AdjustedTsc;
1616 /** The APIC Id of the CPU where the TSC was read. */
1617 uint16_t idApic;
1618 /** Explicit alignment padding. */
1619 uint16_t auPadding[3];
1620 } Out;
1621 } u;
1622} SUPTSCREAD, *PSUPTSCREAD;
1623AssertCompileMemberAlignment(SUPTSCREAD, u, 8);
1624AssertCompileSize(SUPTSCREAD, 6*4 + 2*8);
1625/** @} */
1626
1627
1628/** @name SUP_IOCTL_GIP_SET_FLAGS
1629 * Set GIP flags.
1630 *
1631 * @{
1632 */
1633#define SUP_IOCTL_GIP_SET_FLAGS SUP_CTL_CODE_SIZE(39, SUP_IOCTL_GIP_SET_FLAGS_SIZE)
1634#define SUP_IOCTL_GIP_SET_FLAGS_SIZE sizeof(SUPGIPSETFLAGS)
1635#define SUP_IOCTL_GIP_SET_FLAGS_SIZE_IN sizeof(SUPGIPSETFLAGS)
1636#define SUP_IOCTL_GIP_SET_FLAGS_SIZE_OUT sizeof(SUPREQHDR)
1637typedef struct SUPGIPSETFLAGS
1638{
1639 /** The header. */
1640 SUPREQHDR Hdr;
1641 union
1642 {
1643 struct
1644 {
1645 /** The AND flags mask, see SUPGIP_FLAGS_XXX. */
1646 uint32_t fAndMask;
1647 /** The OR flags mask, see SUPGIP_FLAGS_XXX. */
1648 uint32_t fOrMask;
1649 } In;
1650 } u;
1651} SUPGIPSETFLAGS, *PSUPGIPSETFLAGS;
1652/** @} */
1653
1654
1655/** @name SUP_IOCTL_UCODE_REV
1656 * Get the CPU microcode revision.
1657 *
1658 * @{
1659 */
1660#define SUP_IOCTL_UCODE_REV SUP_CTL_CODE_SIZE(40, SUP_IOCTL_UCODE_REV_SIZE)
1661#define SUP_IOCTL_UCODE_REV_SIZE sizeof(SUPUCODEREV)
1662#define SUP_IOCTL_UCODE_REV_SIZE_IN sizeof(SUPREQHDR)
1663#define SUP_IOCTL_UCODE_REV_SIZE_OUT sizeof(SUPUCODEREV)
1664typedef struct SUPUCODEREV
1665{
1666 /** The header. */
1667 SUPREQHDR Hdr;
1668 union
1669 {
1670 struct
1671 {
1672 /** The microcode revision dword. */
1673 uint32_t MicrocodeRev;
1674 } Out;
1675 } u;
1676} SUPUCODEREV, *PSUPUCODEREV;
1677/** @} */
1678
1679
1680/** @name SUP_IOCTL_HWVIRT_MSRS
1681 * Get hardware-virtualization MSRs.
1682 *
1683 * This queries a lot more information than merely VT-x/AMD-V basic capabilities
1684 * provided by SUP_IOCTL_VT_CAPS.
1685 *
1686 * @{
1687 */
1688#define SUP_IOCTL_GET_HWVIRT_MSRS SUP_CTL_CODE_SIZE(41, SUP_IOCTL_GET_HWVIRT_MSRS_SIZE)
1689#define SUP_IOCTL_GET_HWVIRT_MSRS_SIZE sizeof(SUPGETHWVIRTMSRS)
1690#define SUP_IOCTL_GET_HWVIRT_MSRS_SIZE_IN (sizeof(SUPREQHDR) + RT_SIZEOFMEMB(SUPGETHWVIRTMSRS, u.In))
1691#define SUP_IOCTL_GET_HWVIRT_MSRS_SIZE_OUT sizeof(SUPGETHWVIRTMSRS)
1692
1693typedef struct SUPGETHWVIRTMSRS
1694{
1695 /** The header. */
1696 SUPREQHDR Hdr;
1697 union
1698 {
1699 struct
1700 {
1701 /** Whether to force re-querying of MSRs. */
1702 bool fForce;
1703 /** Reserved. Must be false. */
1704 bool fReserved0;
1705 /** Reserved. Must be false. */
1706 bool fReserved1;
1707 /** Reserved. Must be false. */
1708 bool fReserved2;
1709 } In;
1710
1711 struct
1712 {
1713 /** Hardware-virtualization MSRs. */
1714 SUPHWVIRTMSRS HwvirtMsrs;
1715 } Out;
1716 } u;
1717} SUPGETHWVIRTMSRS, *PSUPGETHWVIRTMSRS;
1718/** @} */
1719
1720
1721#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
1722# pragma pack() /* paranoia */
1723#endif
1724
1725#endif /* !VBOX_INCLUDED_SRC_Support_SUPDrvIOC_h */
1726
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette