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