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