VirtualBox

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

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

Host Drivers: Linux: vboxdrv: Fix UBSAN warnings, bugref:10585.

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