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