1 | /* $Revision: 40636 $ */
|
---|
2 | /** @file
|
---|
3 | * VirtualBox Support Driver - IOCtl definitions.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2010 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 ___SUPDrvIOC_h___
|
---|
28 | #define ___SUPDrvIOC_h___
|
---|
29 |
|
---|
30 | /*
|
---|
31 | * Basic types.
|
---|
32 | */
|
---|
33 | #include <iprt/types.h>
|
---|
34 |
|
---|
35 | /*
|
---|
36 | * IOCtl numbers.
|
---|
37 | * We're using the Win32 type of numbers here, thus the macros below.
|
---|
38 | * The SUP_IOCTL_FLAG macro is used to separate requests from 32-bit
|
---|
39 | * and 64-bit processes.
|
---|
40 | */
|
---|
41 | #if defined(RT_ARCH_AMD64) || defined(RT_ARCH_SPARC64)
|
---|
42 | # define SUP_IOCTL_FLAG 128
|
---|
43 | #elif defined(RT_ARCH_X86) || defined(RT_ARCH_SPARC)
|
---|
44 | # define SUP_IOCTL_FLAG 0
|
---|
45 | #else
|
---|
46 | # error "dunno which arch this is!"
|
---|
47 | #endif
|
---|
48 |
|
---|
49 | #ifdef RT_OS_WINDOWS
|
---|
50 | # ifndef CTL_CODE
|
---|
51 | # include <Windows.h>
|
---|
52 | # endif
|
---|
53 | /* Automatic buffering, size not encoded. */
|
---|
54 | # define SUP_CTL_CODE_SIZE(Function, Size) CTL_CODE(FILE_DEVICE_UNKNOWN, (Function) | SUP_IOCTL_FLAG, METHOD_BUFFERED, FILE_WRITE_ACCESS)
|
---|
55 | # define SUP_CTL_CODE_BIG(Function) CTL_CODE(FILE_DEVICE_UNKNOWN, (Function) | SUP_IOCTL_FLAG, METHOD_BUFFERED, FILE_WRITE_ACCESS)
|
---|
56 | # define SUP_CTL_CODE_FAST(Function) CTL_CODE(FILE_DEVICE_UNKNOWN, (Function) | SUP_IOCTL_FLAG, METHOD_NEITHER, FILE_WRITE_ACCESS)
|
---|
57 | # define SUP_CTL_CODE_NO_SIZE(uIOCtl) (uIOCtl)
|
---|
58 |
|
---|
59 | #elif defined(RT_OS_SOLARIS)
|
---|
60 | /* No automatic buffering, size limited to 255 bytes. */
|
---|
61 | # include <sys/ioccom.h>
|
---|
62 | # define SUP_CTL_CODE_SIZE(Function, Size) _IOWRN('V', (Function) | SUP_IOCTL_FLAG, sizeof(SUPREQHDR))
|
---|
63 | # define SUP_CTL_CODE_BIG(Function) _IOWRN('V', (Function) | SUP_IOCTL_FLAG, sizeof(SUPREQHDR))
|
---|
64 | # define SUP_CTL_CODE_FAST(Function) _IO( 'V', (Function) | SUP_IOCTL_FLAG)
|
---|
65 | # define SUP_CTL_CODE_NO_SIZE(uIOCtl) (uIOCtl)
|
---|
66 |
|
---|
67 | #elif defined(RT_OS_OS2)
|
---|
68 | /* No automatic buffering, size not encoded. */
|
---|
69 | # define SUP_CTL_CATEGORY 0xc0
|
---|
70 | # define SUP_CTL_CODE_SIZE(Function, Size) ((unsigned char)(Function))
|
---|
71 | # define SUP_CTL_CODE_BIG(Function) ((unsigned char)(Function))
|
---|
72 | # define SUP_CTL_CATEGORY_FAST 0xc1
|
---|
73 | # define SUP_CTL_CODE_FAST(Function) ((unsigned char)(Function))
|
---|
74 | # define SUP_CTL_CODE_NO_SIZE(uIOCtl) (uIOCtl)
|
---|
75 |
|
---|
76 | #elif defined(RT_OS_LINUX)
|
---|
77 | /* No automatic buffering, size limited to 16KB. */
|
---|
78 | # include <linux/ioctl.h>
|
---|
79 | # define SUP_CTL_CODE_SIZE(Function, Size) _IOC(_IOC_READ | _IOC_WRITE, 'V', (Function) | SUP_IOCTL_FLAG, (Size))
|
---|
80 | # define SUP_CTL_CODE_BIG(Function) _IO('V', (Function) | SUP_IOCTL_FLAG)
|
---|
81 | # define SUP_CTL_CODE_FAST(Function) _IO('V', (Function) | SUP_IOCTL_FLAG)
|
---|
82 | # define SUP_CTL_CODE_NO_SIZE(uIOCtl) ((uIOCtl) & ~IOCSIZE_MASK)
|
---|
83 |
|
---|
84 | #elif defined(RT_OS_L4)
|
---|
85 | /* Implemented in suplib, no worries. */
|
---|
86 | # define SUP_CTL_CODE_SIZE(Function, Size) (Function)
|
---|
87 | # define SUP_CTL_CODE_BIG(Function) (Function)
|
---|
88 | # define SUP_CTL_CODE_FAST(Function) (Function)
|
---|
89 | # define SUP_CTL_CODE_NO_SIZE(uIOCtl) (uIOCtl)
|
---|
90 |
|
---|
91 | #else /* BSD Like */
|
---|
92 | /* Automatic buffering, size limited to 4KB on *BSD and 8KB on Darwin - commands the limit, 4KB. */
|
---|
93 | # include <sys/ioccom.h>
|
---|
94 | # define SUP_CTL_CODE_SIZE(Function, Size) _IOC(IOC_INOUT, 'V', (Function) | SUP_IOCTL_FLAG, (Size))
|
---|
95 | # define SUP_CTL_CODE_BIG(Function) _IO('V', (Function) | SUP_IOCTL_FLAG)
|
---|
96 | # define SUP_CTL_CODE_FAST(Function) _IO('V', (Function) | SUP_IOCTL_FLAG)
|
---|
97 | # define SUP_CTL_CODE_NO_SIZE(uIOCtl) ( (uIOCtl) & ~_IOC(0,0,0,IOCPARM_MASK) )
|
---|
98 | #endif
|
---|
99 |
|
---|
100 | /** Fast path IOCtl: VMMR0_DO_RAW_RUN */
|
---|
101 | #define SUP_IOCTL_FAST_DO_RAW_RUN SUP_CTL_CODE_FAST(64)
|
---|
102 | /** Fast path IOCtl: VMMR0_DO_HWACC_RUN */
|
---|
103 | #define SUP_IOCTL_FAST_DO_HWACC_RUN SUP_CTL_CODE_FAST(65)
|
---|
104 | /** Just a NOP call for profiling the latency of a fast ioctl call to VMMR0. */
|
---|
105 | #define SUP_IOCTL_FAST_DO_NOP SUP_CTL_CODE_FAST(66)
|
---|
106 |
|
---|
107 |
|
---|
108 |
|
---|
109 | /*******************************************************************************
|
---|
110 | * Structures and Typedefs *
|
---|
111 | *******************************************************************************/
|
---|
112 | #ifdef RT_ARCH_AMD64
|
---|
113 | # pragma pack(8) /* paranoia. */
|
---|
114 | #else
|
---|
115 | # pragma pack(4) /* paranoia. */
|
---|
116 | #endif
|
---|
117 |
|
---|
118 |
|
---|
119 | /**
|
---|
120 | * Common In/Out header.
|
---|
121 | */
|
---|
122 | typedef struct SUPREQHDR
|
---|
123 | {
|
---|
124 | /** Cookie. */
|
---|
125 | uint32_t u32Cookie;
|
---|
126 | /** Session cookie. */
|
---|
127 | uint32_t u32SessionCookie;
|
---|
128 | /** The size of the input. */
|
---|
129 | uint32_t cbIn;
|
---|
130 | /** The size of the output. */
|
---|
131 | uint32_t cbOut;
|
---|
132 | /** Flags. See SUPREQHDR_FLAGS_* for details and values. */
|
---|
133 | uint32_t fFlags;
|
---|
134 | /** The VBox status code of the operation, out direction only. */
|
---|
135 | int32_t rc;
|
---|
136 | } SUPREQHDR;
|
---|
137 | /** Pointer to a IOC header. */
|
---|
138 | typedef SUPREQHDR *PSUPREQHDR;
|
---|
139 |
|
---|
140 | /** @name SUPREQHDR::fFlags values
|
---|
141 | * @{ */
|
---|
142 | /** Masks out the magic value. */
|
---|
143 | #define SUPREQHDR_FLAGS_MAGIC_MASK UINT32_C(0xff0000ff)
|
---|
144 | /** The generic mask. */
|
---|
145 | #define SUPREQHDR_FLAGS_GEN_MASK UINT32_C(0x0000ff00)
|
---|
146 | /** The request specific mask. */
|
---|
147 | #define SUPREQHDR_FLAGS_REQ_MASK UINT32_C(0x00ff0000)
|
---|
148 |
|
---|
149 | /** There is extra input that needs copying on some platforms. */
|
---|
150 | #define SUPREQHDR_FLAGS_EXTRA_IN UINT32_C(0x00000100)
|
---|
151 | /** There is extra output that needs copying on some platforms. */
|
---|
152 | #define SUPREQHDR_FLAGS_EXTRA_OUT UINT32_C(0x00000200)
|
---|
153 |
|
---|
154 | /** The magic value. */
|
---|
155 | #define SUPREQHDR_FLAGS_MAGIC UINT32_C(0x42000042)
|
---|
156 | /** The default value. Use this when no special stuff is requested. */
|
---|
157 | #define SUPREQHDR_FLAGS_DEFAULT SUPREQHDR_FLAGS_MAGIC
|
---|
158 | /** @} */
|
---|
159 |
|
---|
160 |
|
---|
161 | /** @name SUP_IOCTL_COOKIE
|
---|
162 | * @{
|
---|
163 | */
|
---|
164 | /** Negotiate cookie. */
|
---|
165 | #define SUP_IOCTL_COOKIE SUP_CTL_CODE_SIZE(1, SUP_IOCTL_COOKIE_SIZE)
|
---|
166 | /** The request size. */
|
---|
167 | #define SUP_IOCTL_COOKIE_SIZE sizeof(SUPCOOKIE)
|
---|
168 | /** The SUPREQHDR::cbIn value. */
|
---|
169 | #define SUP_IOCTL_COOKIE_SIZE_IN sizeof(SUPREQHDR) + RT_SIZEOFMEMB(SUPCOOKIE, u.In)
|
---|
170 | /** The SUPREQHDR::cbOut value. */
|
---|
171 | #define SUP_IOCTL_COOKIE_SIZE_OUT sizeof(SUPREQHDR) + RT_SIZEOFMEMB(SUPCOOKIE, u.Out)
|
---|
172 | /** SUPCOOKIE_IN magic word. */
|
---|
173 | #define SUPCOOKIE_MAGIC "The Magic Word!"
|
---|
174 | /** The initial cookie. */
|
---|
175 | #define SUPCOOKIE_INITIAL_COOKIE 0x69726f74 /* 'tori' */
|
---|
176 |
|
---|
177 | /** Current interface version.
|
---|
178 | * The upper 16-bit is the major version, the the lower the minor version.
|
---|
179 | * When incompatible changes are made, the upper major number has to be changed.
|
---|
180 | *
|
---|
181 | * Update rules:
|
---|
182 | * -# Only update the major number when incompatible changes have been made to
|
---|
183 | * the IOC interface or the ABI provided via the functions returned by
|
---|
184 | * SUPQUERYFUNCS.
|
---|
185 | * -# When adding new features (new IOC number, new flags, new exports, ++)
|
---|
186 | * only update the minor number and change SUPLib.cpp to require the
|
---|
187 | * new IOC version.
|
---|
188 | * -# When incrementing the major number, clear the minor part and reset
|
---|
189 | * any IOC version requirements in SUPLib.cpp.
|
---|
190 | * -# When increment the major number, execute all pending work.
|
---|
191 | *
|
---|
192 | * @todo Pending work on next major version change:
|
---|
193 | * - None.
|
---|
194 | */
|
---|
195 | #define SUPDRV_IOC_VERSION 0x00190001
|
---|
196 |
|
---|
197 | /** SUP_IOCTL_COOKIE. */
|
---|
198 | typedef struct SUPCOOKIE
|
---|
199 | {
|
---|
200 | /** The header.
|
---|
201 | * u32Cookie must be set to SUPCOOKIE_INITIAL_COOKIE.
|
---|
202 | * u32SessionCookie should be set to some random value. */
|
---|
203 | SUPREQHDR Hdr;
|
---|
204 | union
|
---|
205 | {
|
---|
206 | struct
|
---|
207 | {
|
---|
208 | /** Magic word. */
|
---|
209 | char szMagic[16];
|
---|
210 | /** The requested interface version number. */
|
---|
211 | uint32_t u32ReqVersion;
|
---|
212 | /** The minimum interface version number. */
|
---|
213 | uint32_t u32MinVersion;
|
---|
214 | } In;
|
---|
215 | struct
|
---|
216 | {
|
---|
217 | /** Cookie. */
|
---|
218 | uint32_t u32Cookie;
|
---|
219 | /** Session cookie. */
|
---|
220 | uint32_t u32SessionCookie;
|
---|
221 | /** Interface version for this session. */
|
---|
222 | uint32_t u32SessionVersion;
|
---|
223 | /** The actual interface version in the driver. */
|
---|
224 | uint32_t u32DriverVersion;
|
---|
225 | /** Number of functions available for the SUP_IOCTL_QUERY_FUNCS request. */
|
---|
226 | uint32_t cFunctions;
|
---|
227 | /** Session handle. */
|
---|
228 | R0PTRTYPE(PSUPDRVSESSION) pSession;
|
---|
229 | } Out;
|
---|
230 | } u;
|
---|
231 | } SUPCOOKIE, *PSUPCOOKIE;
|
---|
232 | /** @} */
|
---|
233 |
|
---|
234 |
|
---|
235 | /** @name SUP_IOCTL_QUERY_FUNCS
|
---|
236 | * Query SUPR0 functions.
|
---|
237 | * @{
|
---|
238 | */
|
---|
239 | #define SUP_IOCTL_QUERY_FUNCS(cFuncs) SUP_CTL_CODE_BIG(2)
|
---|
240 | #define SUP_IOCTL_QUERY_FUNCS_SIZE(cFuncs) RT_UOFFSETOF(SUPQUERYFUNCS, u.Out.aFunctions[(cFuncs)])
|
---|
241 | #define SUP_IOCTL_QUERY_FUNCS_SIZE_IN sizeof(SUPREQHDR)
|
---|
242 | #define SUP_IOCTL_QUERY_FUNCS_SIZE_OUT(cFuncs) SUP_IOCTL_QUERY_FUNCS_SIZE(cFuncs)
|
---|
243 |
|
---|
244 | /** A function. */
|
---|
245 | typedef struct SUPFUNC
|
---|
246 | {
|
---|
247 | /** Name - mangled. */
|
---|
248 | char szName[32];
|
---|
249 | /** Address. */
|
---|
250 | RTR0PTR pfn;
|
---|
251 | } SUPFUNC, *PSUPFUNC;
|
---|
252 |
|
---|
253 | typedef struct SUPQUERYFUNCS
|
---|
254 | {
|
---|
255 | /** The header. */
|
---|
256 | SUPREQHDR Hdr;
|
---|
257 | union
|
---|
258 | {
|
---|
259 | struct
|
---|
260 | {
|
---|
261 | /** Number of functions returned. */
|
---|
262 | uint32_t cFunctions;
|
---|
263 | /** Array of functions. */
|
---|
264 | SUPFUNC aFunctions[1];
|
---|
265 | } Out;
|
---|
266 | } u;
|
---|
267 | } SUPQUERYFUNCS, *PSUPQUERYFUNCS;
|
---|
268 | /** @} */
|
---|
269 |
|
---|
270 |
|
---|
271 | /** @name SUP_IOCTL_LDR_OPEN
|
---|
272 | * Open an image.
|
---|
273 | * @{
|
---|
274 | */
|
---|
275 | #define SUP_IOCTL_LDR_OPEN SUP_CTL_CODE_SIZE(3, SUP_IOCTL_LDR_OPEN_SIZE)
|
---|
276 | #define SUP_IOCTL_LDR_OPEN_SIZE sizeof(SUPLDROPEN)
|
---|
277 | #define SUP_IOCTL_LDR_OPEN_SIZE_IN sizeof(SUPLDROPEN)
|
---|
278 | #define SUP_IOCTL_LDR_OPEN_SIZE_OUT (sizeof(SUPREQHDR) + RT_SIZEOFMEMB(SUPLDROPEN, u.Out))
|
---|
279 | typedef struct SUPLDROPEN
|
---|
280 | {
|
---|
281 | /** The header. */
|
---|
282 | SUPREQHDR Hdr;
|
---|
283 | union
|
---|
284 | {
|
---|
285 | struct
|
---|
286 | {
|
---|
287 | /** Size of the image we'll be loading (including tables). */
|
---|
288 | uint32_t cbImageWithTabs;
|
---|
289 | /** The size of the image bits. (Less or equal to cbImageWithTabs.) */
|
---|
290 | uint32_t cbImageBits;
|
---|
291 | /** Image name.
|
---|
292 | * This is the NAME of the image, not the file name. It is used
|
---|
293 | * to share code with other processes. (Max len is 32 chars!) */
|
---|
294 | char szName[32];
|
---|
295 | /** Image file name.
|
---|
296 | * This can be used to load the image using a native loader. */
|
---|
297 | char szFilename[260];
|
---|
298 | } In;
|
---|
299 | struct
|
---|
300 | {
|
---|
301 | /** The base address of the image. */
|
---|
302 | RTR0PTR pvImageBase;
|
---|
303 | /** Indicate whether or not the image requires loading. */
|
---|
304 | bool fNeedsLoading;
|
---|
305 | /** Indicates that we're using the native ring-0 loader. */
|
---|
306 | bool fNativeLoader;
|
---|
307 | } Out;
|
---|
308 | } u;
|
---|
309 | } SUPLDROPEN, *PSUPLDROPEN;
|
---|
310 | /** @} */
|
---|
311 |
|
---|
312 |
|
---|
313 | /** @name SUP_IOCTL_LDR_LOAD
|
---|
314 | * Upload the image bits.
|
---|
315 | * @{
|
---|
316 | */
|
---|
317 | #define SUP_IOCTL_LDR_LOAD SUP_CTL_CODE_BIG(4)
|
---|
318 | #define SUP_IOCTL_LDR_LOAD_SIZE(cbImage) RT_UOFFSETOF(SUPLDRLOAD, u.In.abImage[cbImage])
|
---|
319 | #define SUP_IOCTL_LDR_LOAD_SIZE_IN(cbImage) RT_UOFFSETOF(SUPLDRLOAD, u.In.abImage[cbImage])
|
---|
320 | #define SUP_IOCTL_LDR_LOAD_SIZE_OUT sizeof(SUPREQHDR)
|
---|
321 |
|
---|
322 | /**
|
---|
323 | * Module initialization callback function.
|
---|
324 | * This is called once after the module has been loaded.
|
---|
325 | *
|
---|
326 | * @returns 0 on success.
|
---|
327 | * @returns Appropriate error code on failure.
|
---|
328 | * @param hMod Image handle for use in APIs.
|
---|
329 | */
|
---|
330 | typedef DECLCALLBACK(int) FNR0MODULEINIT(void *hMod);
|
---|
331 | /** Pointer to a FNR0MODULEINIT(). */
|
---|
332 | typedef R0PTRTYPE(FNR0MODULEINIT *) PFNR0MODULEINIT;
|
---|
333 |
|
---|
334 | /**
|
---|
335 | * Module termination callback function.
|
---|
336 | * This is called once right before the module is being unloaded.
|
---|
337 | *
|
---|
338 | * @param hMod Image handle for use in APIs.
|
---|
339 | */
|
---|
340 | typedef DECLCALLBACK(void) FNR0MODULETERM(void *hMod);
|
---|
341 | /** Pointer to a FNR0MODULETERM(). */
|
---|
342 | typedef R0PTRTYPE(FNR0MODULETERM *) PFNR0MODULETERM;
|
---|
343 |
|
---|
344 | /**
|
---|
345 | * Symbol table entry.
|
---|
346 | */
|
---|
347 | typedef struct SUPLDRSYM
|
---|
348 | {
|
---|
349 | /** Offset into of the string table. */
|
---|
350 | uint32_t offName;
|
---|
351 | /** Offset of the symbol relative to the image load address.
|
---|
352 | * @remarks When used inside the SUPDrv to calculate real addresses, it
|
---|
353 | * must be cast to int32_t for the sake of native loader support
|
---|
354 | * on Solaris. (The loader puts the and data in different
|
---|
355 | * memory areans, and the text one is generally higher.) */
|
---|
356 | uint32_t offSymbol;
|
---|
357 | } SUPLDRSYM;
|
---|
358 | /** Pointer to a symbol table entry. */
|
---|
359 | typedef SUPLDRSYM *PSUPLDRSYM;
|
---|
360 | /** Pointer to a const symbol table entry. */
|
---|
361 | typedef SUPLDRSYM const *PCSUPLDRSYM;
|
---|
362 |
|
---|
363 | /**
|
---|
364 | * SUPLDRLOAD::u::In::EP type.
|
---|
365 | */
|
---|
366 | typedef enum SUPLDRLOADEP
|
---|
367 | {
|
---|
368 | SUPLDRLOADEP_NOTHING = 0,
|
---|
369 | SUPLDRLOADEP_VMMR0,
|
---|
370 | SUPLDRLOADEP_SERVICE,
|
---|
371 | SUPLDRLOADEP_32BIT_HACK = 0x7fffffff
|
---|
372 | } SUPLDRLOADEP;
|
---|
373 |
|
---|
374 | typedef struct SUPLDRLOAD
|
---|
375 | {
|
---|
376 | /** The header. */
|
---|
377 | SUPREQHDR Hdr;
|
---|
378 | union
|
---|
379 | {
|
---|
380 | struct
|
---|
381 | {
|
---|
382 | /** The address of module initialization function. Similar to _DLL_InitTerm(hmod, 0). */
|
---|
383 | PFNR0MODULEINIT pfnModuleInit;
|
---|
384 | /** The address of module termination function. Similar to _DLL_InitTerm(hmod, 1). */
|
---|
385 | PFNR0MODULETERM pfnModuleTerm;
|
---|
386 | /** Special entry points. */
|
---|
387 | union
|
---|
388 | {
|
---|
389 | /** SUPLDRLOADEP_VMMR0. */
|
---|
390 | struct
|
---|
391 | {
|
---|
392 | /** The module handle (i.e. address). */
|
---|
393 | RTR0PTR pvVMMR0;
|
---|
394 | /** Address of VMMR0EntryInt function. */
|
---|
395 | RTR0PTR pvVMMR0EntryInt;
|
---|
396 | /** Address of VMMR0EntryFast function. */
|
---|
397 | RTR0PTR pvVMMR0EntryFast;
|
---|
398 | /** Address of VMMR0EntryEx function. */
|
---|
399 | RTR0PTR pvVMMR0EntryEx;
|
---|
400 | } VMMR0;
|
---|
401 | /** SUPLDRLOADEP_SERVICE. */
|
---|
402 | struct
|
---|
403 | {
|
---|
404 | /** The service request handler.
|
---|
405 | * (PFNR0SERVICEREQHANDLER isn't defined yet.) */
|
---|
406 | RTR0PTR pfnServiceReq;
|
---|
407 | /** Reserved, must be NIL. */
|
---|
408 | RTR0PTR apvReserved[3];
|
---|
409 | } Service;
|
---|
410 | } EP;
|
---|
411 | /** Address. */
|
---|
412 | RTR0PTR pvImageBase;
|
---|
413 | /** Entry point type. */
|
---|
414 | SUPLDRLOADEP eEPType;
|
---|
415 | /** The size of the image bits (starting at offset 0 and
|
---|
416 | * approaching offSymbols). */
|
---|
417 | uint32_t cbImageBits;
|
---|
418 | /** The offset of the symbol table. */
|
---|
419 | uint32_t offSymbols;
|
---|
420 | /** The number of entries in the symbol table. */
|
---|
421 | uint32_t cSymbols;
|
---|
422 | /** The offset of the string table. */
|
---|
423 | uint32_t offStrTab;
|
---|
424 | /** Size of the string table. */
|
---|
425 | uint32_t cbStrTab;
|
---|
426 | /** Size of image data in achImage. */
|
---|
427 | uint32_t cbImageWithTabs;
|
---|
428 | /** The image data. */
|
---|
429 | uint8_t abImage[1];
|
---|
430 | } In;
|
---|
431 | } u;
|
---|
432 | } SUPLDRLOAD, *PSUPLDRLOAD;
|
---|
433 | /** @} */
|
---|
434 |
|
---|
435 |
|
---|
436 | /** @name SUP_IOCTL_LDR_FREE
|
---|
437 | * Free an image.
|
---|
438 | * @{
|
---|
439 | */
|
---|
440 | #define SUP_IOCTL_LDR_FREE SUP_CTL_CODE_SIZE(5, SUP_IOCTL_LDR_FREE_SIZE)
|
---|
441 | #define SUP_IOCTL_LDR_FREE_SIZE sizeof(SUPLDRFREE)
|
---|
442 | #define SUP_IOCTL_LDR_FREE_SIZE_IN sizeof(SUPLDRFREE)
|
---|
443 | #define SUP_IOCTL_LDR_FREE_SIZE_OUT sizeof(SUPREQHDR)
|
---|
444 | typedef struct SUPLDRFREE
|
---|
445 | {
|
---|
446 | /** The header. */
|
---|
447 | SUPREQHDR Hdr;
|
---|
448 | union
|
---|
449 | {
|
---|
450 | struct
|
---|
451 | {
|
---|
452 | /** Address. */
|
---|
453 | RTR0PTR pvImageBase;
|
---|
454 | } In;
|
---|
455 | } u;
|
---|
456 | } SUPLDRFREE, *PSUPLDRFREE;
|
---|
457 | /** @} */
|
---|
458 |
|
---|
459 |
|
---|
460 | /** @name SUP_IOCTL_LDR_GET_SYMBOL
|
---|
461 | * Get address of a symbol within an image.
|
---|
462 | * @{
|
---|
463 | */
|
---|
464 | #define SUP_IOCTL_LDR_GET_SYMBOL SUP_CTL_CODE_SIZE(6, SUP_IOCTL_LDR_GET_SYMBOL_SIZE)
|
---|
465 | #define SUP_IOCTL_LDR_GET_SYMBOL_SIZE sizeof(SUPLDRGETSYMBOL)
|
---|
466 | #define SUP_IOCTL_LDR_GET_SYMBOL_SIZE_IN sizeof(SUPLDRGETSYMBOL)
|
---|
467 | #define SUP_IOCTL_LDR_GET_SYMBOL_SIZE_OUT (sizeof(SUPREQHDR) + RT_SIZEOFMEMB(SUPLDRGETSYMBOL, u.Out))
|
---|
468 | typedef struct SUPLDRGETSYMBOL
|
---|
469 | {
|
---|
470 | /** The header. */
|
---|
471 | SUPREQHDR Hdr;
|
---|
472 | union
|
---|
473 | {
|
---|
474 | struct
|
---|
475 | {
|
---|
476 | /** Address. */
|
---|
477 | RTR0PTR pvImageBase;
|
---|
478 | /** The symbol name. */
|
---|
479 | char szSymbol[64];
|
---|
480 | } In;
|
---|
481 | struct
|
---|
482 | {
|
---|
483 | /** The symbol address. */
|
---|
484 | RTR0PTR pvSymbol;
|
---|
485 | } Out;
|
---|
486 | } u;
|
---|
487 | } SUPLDRGETSYMBOL, *PSUPLDRGETSYMBOL;
|
---|
488 | /** @} */
|
---|
489 |
|
---|
490 |
|
---|
491 | /** @name SUP_IOCTL_CALL_VMMR0
|
---|
492 | * Call the R0 VMM Entry point.
|
---|
493 | * @{
|
---|
494 | */
|
---|
495 | #define SUP_IOCTL_CALL_VMMR0(cbReq) SUP_CTL_CODE_SIZE(7, SUP_IOCTL_CALL_VMMR0_SIZE(cbReq))
|
---|
496 | #define SUP_IOCTL_CALL_VMMR0_SIZE(cbReq) RT_UOFFSETOF(SUPCALLVMMR0, abReqPkt[cbReq])
|
---|
497 | #define SUP_IOCTL_CALL_VMMR0_SIZE_IN(cbReq) SUP_IOCTL_CALL_VMMR0_SIZE(cbReq)
|
---|
498 | #define SUP_IOCTL_CALL_VMMR0_SIZE_OUT(cbReq) SUP_IOCTL_CALL_VMMR0_SIZE(cbReq)
|
---|
499 | typedef struct SUPCALLVMMR0
|
---|
500 | {
|
---|
501 | /** The header. */
|
---|
502 | SUPREQHDR Hdr;
|
---|
503 | union
|
---|
504 | {
|
---|
505 | struct
|
---|
506 | {
|
---|
507 | /** The VM handle. */
|
---|
508 | PVMR0 pVMR0;
|
---|
509 | /** VCPU id. */
|
---|
510 | uint32_t idCpu;
|
---|
511 | /** Which operation to execute. */
|
---|
512 | uint32_t uOperation;
|
---|
513 | /** Argument to use when no request packet is supplied. */
|
---|
514 | uint64_t u64Arg;
|
---|
515 | } In;
|
---|
516 | } u;
|
---|
517 | /** The VMMR0Entry request packet. */
|
---|
518 | uint8_t abReqPkt[1];
|
---|
519 | } SUPCALLVMMR0, *PSUPCALLVMMR0;
|
---|
520 | /** @} */
|
---|
521 |
|
---|
522 |
|
---|
523 | /** @name SUP_IOCTL_CALL_VMMR0_BIG
|
---|
524 | * Version of SUP_IOCTL_CALL_VMMR0 for dealing with large requests.
|
---|
525 | * @{
|
---|
526 | */
|
---|
527 | #define SUP_IOCTL_CALL_VMMR0_BIG SUP_CTL_CODE_BIG(27)
|
---|
528 | #define SUP_IOCTL_CALL_VMMR0_BIG_SIZE(cbReq) RT_UOFFSETOF(SUPCALLVMMR0, abReqPkt[cbReq])
|
---|
529 | #define SUP_IOCTL_CALL_VMMR0_BIG_SIZE_IN(cbReq) SUP_IOCTL_CALL_VMMR0_SIZE(cbReq)
|
---|
530 | #define SUP_IOCTL_CALL_VMMR0_BIG_SIZE_OUT(cbReq) SUP_IOCTL_CALL_VMMR0_SIZE(cbReq)
|
---|
531 | /** @} */
|
---|
532 |
|
---|
533 |
|
---|
534 | /** @name SUP_IOCTL_LOW_ALLOC
|
---|
535 | * Allocate memory below 4GB (physically).
|
---|
536 | * @{
|
---|
537 | */
|
---|
538 | #define SUP_IOCTL_LOW_ALLOC SUP_CTL_CODE_BIG(8)
|
---|
539 | #define SUP_IOCTL_LOW_ALLOC_SIZE(cPages) ((uint32_t)RT_UOFFSETOF(SUPLOWALLOC, u.Out.aPages[cPages]))
|
---|
540 | #define SUP_IOCTL_LOW_ALLOC_SIZE_IN (sizeof(SUPREQHDR) + RT_SIZEOFMEMB(SUPLOWALLOC, u.In))
|
---|
541 | #define SUP_IOCTL_LOW_ALLOC_SIZE_OUT(cPages) SUP_IOCTL_LOW_ALLOC_SIZE(cPages)
|
---|
542 | typedef struct SUPLOWALLOC
|
---|
543 | {
|
---|
544 | /** The header. */
|
---|
545 | SUPREQHDR Hdr;
|
---|
546 | union
|
---|
547 | {
|
---|
548 | struct
|
---|
549 | {
|
---|
550 | /** Number of pages to allocate. */
|
---|
551 | uint32_t cPages;
|
---|
552 | } In;
|
---|
553 | struct
|
---|
554 | {
|
---|
555 | /** The ring-3 address of the allocated memory. */
|
---|
556 | RTR3PTR pvR3;
|
---|
557 | /** The ring-0 address of the allocated memory. */
|
---|
558 | RTR0PTR pvR0;
|
---|
559 | /** Array of pages. */
|
---|
560 | RTHCPHYS aPages[1];
|
---|
561 | } Out;
|
---|
562 | } u;
|
---|
563 | } SUPLOWALLOC, *PSUPLOWALLOC;
|
---|
564 | /** @} */
|
---|
565 |
|
---|
566 |
|
---|
567 | /** @name SUP_IOCTL_LOW_FREE
|
---|
568 | * Free low memory.
|
---|
569 | * @{
|
---|
570 | */
|
---|
571 | #define SUP_IOCTL_LOW_FREE SUP_CTL_CODE_SIZE(9, SUP_IOCTL_LOW_FREE_SIZE)
|
---|
572 | #define SUP_IOCTL_LOW_FREE_SIZE sizeof(SUPLOWFREE)
|
---|
573 | #define SUP_IOCTL_LOW_FREE_SIZE_IN sizeof(SUPLOWFREE)
|
---|
574 | #define SUP_IOCTL_LOW_FREE_SIZE_OUT sizeof(SUPREQHDR)
|
---|
575 | typedef struct SUPLOWFREE
|
---|
576 | {
|
---|
577 | /** The header. */
|
---|
578 | SUPREQHDR Hdr;
|
---|
579 | union
|
---|
580 | {
|
---|
581 | struct
|
---|
582 | {
|
---|
583 | /** The ring-3 address of the memory to free. */
|
---|
584 | RTR3PTR pvR3;
|
---|
585 | } In;
|
---|
586 | } u;
|
---|
587 | } SUPLOWFREE, *PSUPLOWFREE;
|
---|
588 | /** @} */
|
---|
589 |
|
---|
590 |
|
---|
591 | /** @name SUP_IOCTL_PAGE_ALLOC_EX
|
---|
592 | * Allocate memory and map it into kernel and/or user space. The memory is of
|
---|
593 | * course locked. The result should be freed using SUP_IOCTL_PAGE_FREE.
|
---|
594 | *
|
---|
595 | * @remarks Allocations without a kernel mapping may fail with
|
---|
596 | * VERR_NOT_SUPPORTED on some platforms.
|
---|
597 | *
|
---|
598 | * @{
|
---|
599 | */
|
---|
600 | #define SUP_IOCTL_PAGE_ALLOC_EX SUP_CTL_CODE_BIG(10)
|
---|
601 | #define SUP_IOCTL_PAGE_ALLOC_EX_SIZE(cPages) RT_UOFFSETOF(SUPPAGEALLOCEX, u.Out.aPages[cPages])
|
---|
602 | #define SUP_IOCTL_PAGE_ALLOC_EX_SIZE_IN (sizeof(SUPREQHDR) + RT_SIZEOFMEMB(SUPPAGEALLOCEX, u.In))
|
---|
603 | #define SUP_IOCTL_PAGE_ALLOC_EX_SIZE_OUT(cPages) SUP_IOCTL_PAGE_ALLOC_EX_SIZE(cPages)
|
---|
604 | typedef struct SUPPAGEALLOCEX
|
---|
605 | {
|
---|
606 | /** The header. */
|
---|
607 | SUPREQHDR Hdr;
|
---|
608 | union
|
---|
609 | {
|
---|
610 | struct
|
---|
611 | {
|
---|
612 | /** Number of pages to allocate */
|
---|
613 | uint32_t cPages;
|
---|
614 | /** Whether it should have kernel mapping. */
|
---|
615 | bool fKernelMapping;
|
---|
616 | /** Whether it should have a user mapping. */
|
---|
617 | bool fUserMapping;
|
---|
618 | /** Reserved. Must be false. */
|
---|
619 | bool fReserved0;
|
---|
620 | /** Reserved. Must be false. */
|
---|
621 | bool fReserved1;
|
---|
622 | } In;
|
---|
623 | struct
|
---|
624 | {
|
---|
625 | /** Returned ring-3 address. */
|
---|
626 | RTR3PTR pvR3;
|
---|
627 | /** Returned ring-0 address. */
|
---|
628 | RTR0PTR pvR0;
|
---|
629 | /** The physical addresses of the allocated pages. */
|
---|
630 | RTHCPHYS aPages[1];
|
---|
631 | } Out;
|
---|
632 | } u;
|
---|
633 | } SUPPAGEALLOCEX, *PSUPPAGEALLOCEX;
|
---|
634 | /** @} */
|
---|
635 |
|
---|
636 |
|
---|
637 | /** @name SUP_IOCTL_PAGE_MAP_KERNEL
|
---|
638 | * Maps a portion of memory allocated by SUP_IOCTL_PAGE_ALLOC_EX /
|
---|
639 | * SUPR0PageAllocEx into kernel space for use by a device or similar.
|
---|
640 | *
|
---|
641 | * The mapping will be freed together with the ring-3 mapping when
|
---|
642 | * SUP_IOCTL_PAGE_FREE or SUPR0PageFree is called.
|
---|
643 | *
|
---|
644 | * @remarks Not necessarily supported on all platforms.
|
---|
645 | *
|
---|
646 | * @{
|
---|
647 | */
|
---|
648 | #define SUP_IOCTL_PAGE_MAP_KERNEL SUP_CTL_CODE_SIZE(11, SUP_IOCTL_PAGE_MAP_KERNEL_SIZE)
|
---|
649 | #define SUP_IOCTL_PAGE_MAP_KERNEL_SIZE sizeof(SUPPAGEMAPKERNEL)
|
---|
650 | #define SUP_IOCTL_PAGE_MAP_KERNEL_SIZE_IN sizeof(SUPPAGEMAPKERNEL)
|
---|
651 | #define SUP_IOCTL_PAGE_MAP_KERNEL_SIZE_OUT sizeof(SUPPAGEMAPKERNEL)
|
---|
652 | typedef struct SUPPAGEMAPKERNEL
|
---|
653 | {
|
---|
654 | /** The header. */
|
---|
655 | SUPREQHDR Hdr;
|
---|
656 | union
|
---|
657 | {
|
---|
658 | struct
|
---|
659 | {
|
---|
660 | /** The pointer of to the previously allocated memory. */
|
---|
661 | RTR3PTR pvR3;
|
---|
662 | /** The offset to start mapping from. */
|
---|
663 | uint32_t offSub;
|
---|
664 | /** Size of the section to map. */
|
---|
665 | uint32_t cbSub;
|
---|
666 | /** Flags reserved for future fun. */
|
---|
667 | uint32_t fFlags;
|
---|
668 | } In;
|
---|
669 | struct
|
---|
670 | {
|
---|
671 | /** The ring-0 address corresponding to pvR3 + offSub. */
|
---|
672 | RTR0PTR pvR0;
|
---|
673 | } Out;
|
---|
674 | } u;
|
---|
675 | } SUPPAGEMAPKERNEL, *PSUPPAGEMAPKERNEL;
|
---|
676 | /** @} */
|
---|
677 |
|
---|
678 |
|
---|
679 | /** @name SUP_IOCTL_PAGE_PROTECT
|
---|
680 | * Changes the page level protection of the user and/or kernel mappings of
|
---|
681 | * memory previously allocated by SUPR0PageAllocEx.
|
---|
682 | *
|
---|
683 | * @remarks Not necessarily supported on all platforms.
|
---|
684 | *
|
---|
685 | * @{
|
---|
686 | */
|
---|
687 | #define SUP_IOCTL_PAGE_PROTECT SUP_CTL_CODE_SIZE(12, SUP_IOCTL_PAGE_PROTECT_SIZE)
|
---|
688 | #define SUP_IOCTL_PAGE_PROTECT_SIZE sizeof(SUPPAGEPROTECT)
|
---|
689 | #define SUP_IOCTL_PAGE_PROTECT_SIZE_IN sizeof(SUPPAGEPROTECT)
|
---|
690 | #define SUP_IOCTL_PAGE_PROTECT_SIZE_OUT sizeof(SUPPAGEPROTECT)
|
---|
691 | typedef struct SUPPAGEPROTECT
|
---|
692 | {
|
---|
693 | /** The header. */
|
---|
694 | SUPREQHDR Hdr;
|
---|
695 | union
|
---|
696 | {
|
---|
697 | struct
|
---|
698 | {
|
---|
699 | /** The pointer of to the previously allocated memory.
|
---|
700 | * Pass NIL_RTR3PTR if the ring-0 mapping should remain unaffected. */
|
---|
701 | RTR3PTR pvR3;
|
---|
702 | /** The pointer of to the previously allocated memory.
|
---|
703 | * Pass NIL_RTR0PTR if the ring-0 mapping should remain unaffected. */
|
---|
704 | RTR0PTR pvR0;
|
---|
705 | /** The offset to start changing protection at. */
|
---|
706 | uint32_t offSub;
|
---|
707 | /** Size of the portion that should be changed. */
|
---|
708 | uint32_t cbSub;
|
---|
709 | /** Protection flags, RTMEM_PROT_*. */
|
---|
710 | uint32_t fProt;
|
---|
711 | } In;
|
---|
712 | } u;
|
---|
713 | } SUPPAGEPROTECT, *PSUPPAGEPROTECT;
|
---|
714 | /** @} */
|
---|
715 |
|
---|
716 |
|
---|
717 | /** @name SUP_IOCTL_PAGE_FREE
|
---|
718 | * Free memory allocated with SUP_IOCTL_PAGE_ALLOC_EX.
|
---|
719 | * @{
|
---|
720 | */
|
---|
721 | #define SUP_IOCTL_PAGE_FREE SUP_CTL_CODE_SIZE(13, SUP_IOCTL_PAGE_FREE_SIZE_IN)
|
---|
722 | #define SUP_IOCTL_PAGE_FREE_SIZE sizeof(SUPPAGEFREE)
|
---|
723 | #define SUP_IOCTL_PAGE_FREE_SIZE_IN sizeof(SUPPAGEFREE)
|
---|
724 | #define SUP_IOCTL_PAGE_FREE_SIZE_OUT sizeof(SUPREQHDR)
|
---|
725 | typedef struct SUPPAGEFREE
|
---|
726 | {
|
---|
727 | /** The header. */
|
---|
728 | SUPREQHDR Hdr;
|
---|
729 | union
|
---|
730 | {
|
---|
731 | struct
|
---|
732 | {
|
---|
733 | /** Address of memory range to free. */
|
---|
734 | RTR3PTR pvR3;
|
---|
735 | } In;
|
---|
736 | } u;
|
---|
737 | } SUPPAGEFREE, *PSUPPAGEFREE;
|
---|
738 | /** @} */
|
---|
739 |
|
---|
740 |
|
---|
741 |
|
---|
742 |
|
---|
743 | /** @name SUP_IOCTL_PAGE_LOCK
|
---|
744 | * Pin down physical pages.
|
---|
745 | * @{
|
---|
746 | */
|
---|
747 | #define SUP_IOCTL_PAGE_LOCK SUP_CTL_CODE_BIG(14)
|
---|
748 | #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)))
|
---|
749 | #define SUP_IOCTL_PAGE_LOCK_SIZE_IN (sizeof(SUPREQHDR) + RT_SIZEOFMEMB(SUPPAGELOCK, u.In))
|
---|
750 | #define SUP_IOCTL_PAGE_LOCK_SIZE_OUT(cPages) RT_UOFFSETOF(SUPPAGELOCK, u.Out.aPages[cPages])
|
---|
751 | typedef struct SUPPAGELOCK
|
---|
752 | {
|
---|
753 | /** The header. */
|
---|
754 | SUPREQHDR Hdr;
|
---|
755 | union
|
---|
756 | {
|
---|
757 | struct
|
---|
758 | {
|
---|
759 | /** Start of page range. Must be PAGE aligned. */
|
---|
760 | RTR3PTR pvR3;
|
---|
761 | /** The range size given as a page count. */
|
---|
762 | uint32_t cPages;
|
---|
763 | } In;
|
---|
764 |
|
---|
765 | struct
|
---|
766 | {
|
---|
767 | /** Array of pages. */
|
---|
768 | RTHCPHYS aPages[1];
|
---|
769 | } Out;
|
---|
770 | } u;
|
---|
771 | } SUPPAGELOCK, *PSUPPAGELOCK;
|
---|
772 | /** @} */
|
---|
773 |
|
---|
774 |
|
---|
775 | /** @name SUP_IOCTL_PAGE_UNLOCK
|
---|
776 | * Unpin physical pages.
|
---|
777 | * @{ */
|
---|
778 | #define SUP_IOCTL_PAGE_UNLOCK SUP_CTL_CODE_SIZE(15, SUP_IOCTL_PAGE_UNLOCK_SIZE)
|
---|
779 | #define SUP_IOCTL_PAGE_UNLOCK_SIZE sizeof(SUPPAGEUNLOCK)
|
---|
780 | #define SUP_IOCTL_PAGE_UNLOCK_SIZE_IN sizeof(SUPPAGEUNLOCK)
|
---|
781 | #define SUP_IOCTL_PAGE_UNLOCK_SIZE_OUT sizeof(SUPREQHDR)
|
---|
782 | typedef struct SUPPAGEUNLOCK
|
---|
783 | {
|
---|
784 | /** The header. */
|
---|
785 | SUPREQHDR Hdr;
|
---|
786 | union
|
---|
787 | {
|
---|
788 | struct
|
---|
789 | {
|
---|
790 | /** Start of page range of a range previously pinned. */
|
---|
791 | RTR3PTR pvR3;
|
---|
792 | } In;
|
---|
793 | } u;
|
---|
794 | } SUPPAGEUNLOCK, *PSUPPAGEUNLOCK;
|
---|
795 | /** @} */
|
---|
796 |
|
---|
797 |
|
---|
798 | /** @name SUP_IOCTL_CONT_ALLOC
|
---|
799 | * Allocate continuous memory.
|
---|
800 | * @{
|
---|
801 | */
|
---|
802 | #define SUP_IOCTL_CONT_ALLOC SUP_CTL_CODE_SIZE(16, SUP_IOCTL_CONT_ALLOC_SIZE)
|
---|
803 | #define SUP_IOCTL_CONT_ALLOC_SIZE sizeof(SUPCONTALLOC)
|
---|
804 | #define SUP_IOCTL_CONT_ALLOC_SIZE_IN (sizeof(SUPREQHDR) + RT_SIZEOFMEMB(SUPCONTALLOC, u.In))
|
---|
805 | #define SUP_IOCTL_CONT_ALLOC_SIZE_OUT sizeof(SUPCONTALLOC)
|
---|
806 | typedef struct SUPCONTALLOC
|
---|
807 | {
|
---|
808 | /** The header. */
|
---|
809 | SUPREQHDR Hdr;
|
---|
810 | union
|
---|
811 | {
|
---|
812 | struct
|
---|
813 | {
|
---|
814 | /** The allocation size given as a page count. */
|
---|
815 | uint32_t cPages;
|
---|
816 | } In;
|
---|
817 |
|
---|
818 | struct
|
---|
819 | {
|
---|
820 | /** The address of the ring-0 mapping of the allocated memory. */
|
---|
821 | RTR0PTR pvR0;
|
---|
822 | /** The address of the ring-3 mapping of the allocated memory. */
|
---|
823 | RTR3PTR pvR3;
|
---|
824 | /** The physical address of the allocation. */
|
---|
825 | RTHCPHYS HCPhys;
|
---|
826 | } Out;
|
---|
827 | } u;
|
---|
828 | } SUPCONTALLOC, *PSUPCONTALLOC;
|
---|
829 | /** @} */
|
---|
830 |
|
---|
831 |
|
---|
832 | /** @name SUP_IOCTL_CONT_FREE Input.
|
---|
833 | * @{
|
---|
834 | */
|
---|
835 | /** Free continuous memory. */
|
---|
836 | #define SUP_IOCTL_CONT_FREE SUP_CTL_CODE_SIZE(17, SUP_IOCTL_CONT_FREE_SIZE)
|
---|
837 | #define SUP_IOCTL_CONT_FREE_SIZE sizeof(SUPCONTFREE)
|
---|
838 | #define SUP_IOCTL_CONT_FREE_SIZE_IN sizeof(SUPCONTFREE)
|
---|
839 | #define SUP_IOCTL_CONT_FREE_SIZE_OUT sizeof(SUPREQHDR)
|
---|
840 | typedef struct SUPCONTFREE
|
---|
841 | {
|
---|
842 | /** The header. */
|
---|
843 | SUPREQHDR Hdr;
|
---|
844 | union
|
---|
845 | {
|
---|
846 | struct
|
---|
847 | {
|
---|
848 | /** The ring-3 address of the memory to free. */
|
---|
849 | RTR3PTR pvR3;
|
---|
850 | } In;
|
---|
851 | } u;
|
---|
852 | } SUPCONTFREE, *PSUPCONTFREE;
|
---|
853 | /** @} */
|
---|
854 |
|
---|
855 |
|
---|
856 | /** @name SUP_IOCTL_GET_PAGING_MODE
|
---|
857 | * Get the host paging mode.
|
---|
858 | * @{
|
---|
859 | */
|
---|
860 | #define SUP_IOCTL_GET_PAGING_MODE SUP_CTL_CODE_SIZE(18, SUP_IOCTL_GET_PAGING_MODE_SIZE)
|
---|
861 | #define SUP_IOCTL_GET_PAGING_MODE_SIZE sizeof(SUPGETPAGINGMODE)
|
---|
862 | #define SUP_IOCTL_GET_PAGING_MODE_SIZE_IN sizeof(SUPREQHDR)
|
---|
863 | #define SUP_IOCTL_GET_PAGING_MODE_SIZE_OUT sizeof(SUPGETPAGINGMODE)
|
---|
864 | typedef struct SUPGETPAGINGMODE
|
---|
865 | {
|
---|
866 | /** The header. */
|
---|
867 | SUPREQHDR Hdr;
|
---|
868 | union
|
---|
869 | {
|
---|
870 | struct
|
---|
871 | {
|
---|
872 | /** The paging mode. */
|
---|
873 | SUPPAGINGMODE enmMode;
|
---|
874 | } Out;
|
---|
875 | } u;
|
---|
876 | } SUPGETPAGINGMODE, *PSUPGETPAGINGMODE;
|
---|
877 | /** @} */
|
---|
878 |
|
---|
879 |
|
---|
880 | /** @name SUP_IOCTL_SET_VM_FOR_FAST
|
---|
881 | * Set the VM handle for doing fast call ioctl calls.
|
---|
882 | * @{
|
---|
883 | */
|
---|
884 | #define SUP_IOCTL_SET_VM_FOR_FAST SUP_CTL_CODE_SIZE(19, SUP_IOCTL_SET_VM_FOR_FAST_SIZE)
|
---|
885 | #define SUP_IOCTL_SET_VM_FOR_FAST_SIZE sizeof(SUPSETVMFORFAST)
|
---|
886 | #define SUP_IOCTL_SET_VM_FOR_FAST_SIZE_IN sizeof(SUPSETVMFORFAST)
|
---|
887 | #define SUP_IOCTL_SET_VM_FOR_FAST_SIZE_OUT sizeof(SUPREQHDR)
|
---|
888 | typedef struct SUPSETVMFORFAST
|
---|
889 | {
|
---|
890 | /** The header. */
|
---|
891 | SUPREQHDR Hdr;
|
---|
892 | union
|
---|
893 | {
|
---|
894 | struct
|
---|
895 | {
|
---|
896 | /** The ring-0 VM handle (pointer). */
|
---|
897 | PVMR0 pVMR0;
|
---|
898 | } In;
|
---|
899 | } u;
|
---|
900 | } SUPSETVMFORFAST, *PSUPSETVMFORFAST;
|
---|
901 | /** @} */
|
---|
902 |
|
---|
903 |
|
---|
904 | /** @name SUP_IOCTL_GIP_MAP
|
---|
905 | * Map the GIP into user space.
|
---|
906 | * @{
|
---|
907 | */
|
---|
908 | #define SUP_IOCTL_GIP_MAP SUP_CTL_CODE_SIZE(20, SUP_IOCTL_GIP_MAP_SIZE)
|
---|
909 | #define SUP_IOCTL_GIP_MAP_SIZE sizeof(SUPGIPMAP)
|
---|
910 | #define SUP_IOCTL_GIP_MAP_SIZE_IN sizeof(SUPREQHDR)
|
---|
911 | #define SUP_IOCTL_GIP_MAP_SIZE_OUT sizeof(SUPGIPMAP)
|
---|
912 | typedef struct SUPGIPMAP
|
---|
913 | {
|
---|
914 | /** The header. */
|
---|
915 | SUPREQHDR Hdr;
|
---|
916 | union
|
---|
917 | {
|
---|
918 | struct
|
---|
919 | {
|
---|
920 | /** The physical address of the GIP. */
|
---|
921 | RTHCPHYS HCPhysGip;
|
---|
922 | /** Pointer to the read-only usermode GIP mapping for this session. */
|
---|
923 | R3PTRTYPE(PSUPGLOBALINFOPAGE) pGipR3;
|
---|
924 | /** Pointer to the supervisor mode GIP mapping. */
|
---|
925 | R0PTRTYPE(PSUPGLOBALINFOPAGE) pGipR0;
|
---|
926 | } Out;
|
---|
927 | } u;
|
---|
928 | } SUPGIPMAP, *PSUPGIPMAP;
|
---|
929 | /** @} */
|
---|
930 |
|
---|
931 |
|
---|
932 | /** @name SUP_IOCTL_GIP_UNMAP
|
---|
933 | * Unmap the GIP.
|
---|
934 | * @{
|
---|
935 | */
|
---|
936 | #define SUP_IOCTL_GIP_UNMAP SUP_CTL_CODE_SIZE(21, SUP_IOCTL_GIP_UNMAP_SIZE)
|
---|
937 | #define SUP_IOCTL_GIP_UNMAP_SIZE sizeof(SUPGIPUNMAP)
|
---|
938 | #define SUP_IOCTL_GIP_UNMAP_SIZE_IN sizeof(SUPGIPUNMAP)
|
---|
939 | #define SUP_IOCTL_GIP_UNMAP_SIZE_OUT sizeof(SUPGIPUNMAP)
|
---|
940 | typedef struct SUPGIPUNMAP
|
---|
941 | {
|
---|
942 | /** The header. */
|
---|
943 | SUPREQHDR Hdr;
|
---|
944 | } SUPGIPUNMAP, *PSUPGIPUNMAP;
|
---|
945 | /** @} */
|
---|
946 |
|
---|
947 |
|
---|
948 | /** @name SUP_IOCTL_CALL_SERVICE
|
---|
949 | * Call the a ring-0 service.
|
---|
950 | *
|
---|
951 | * @todo Might have to convert this to a big request, just like
|
---|
952 | * SUP_IOCTL_CALL_VMMR0
|
---|
953 | * @{
|
---|
954 | */
|
---|
955 | #define SUP_IOCTL_CALL_SERVICE(cbReq) SUP_CTL_CODE_SIZE(22, SUP_IOCTL_CALL_SERVICE_SIZE(cbReq))
|
---|
956 | #define SUP_IOCTL_CALL_SERVICE_SIZE(cbReq) RT_UOFFSETOF(SUPCALLSERVICE, abReqPkt[cbReq])
|
---|
957 | #define SUP_IOCTL_CALL_SERVICE_SIZE_IN(cbReq) SUP_IOCTL_CALL_SERVICE_SIZE(cbReq)
|
---|
958 | #define SUP_IOCTL_CALL_SERVICE_SIZE_OUT(cbReq) SUP_IOCTL_CALL_SERVICE_SIZE(cbReq)
|
---|
959 | typedef struct SUPCALLSERVICE
|
---|
960 | {
|
---|
961 | /** The header. */
|
---|
962 | SUPREQHDR Hdr;
|
---|
963 | union
|
---|
964 | {
|
---|
965 | struct
|
---|
966 | {
|
---|
967 | /** The service name. */
|
---|
968 | char szName[28];
|
---|
969 | /** Which operation to execute. */
|
---|
970 | uint32_t uOperation;
|
---|
971 | /** Argument to use when no request packet is supplied. */
|
---|
972 | uint64_t u64Arg;
|
---|
973 | } In;
|
---|
974 | } u;
|
---|
975 | /** The request packet passed to SUP. */
|
---|
976 | uint8_t abReqPkt[1];
|
---|
977 | } SUPCALLSERVICE, *PSUPCALLSERVICE;
|
---|
978 | /** @} */
|
---|
979 |
|
---|
980 |
|
---|
981 | /** @name SUP_IOCTL_LOGGER_SETTINGS
|
---|
982 | * Changes the ring-0 release or debug logger settings.
|
---|
983 | * @{
|
---|
984 | */
|
---|
985 | #define SUP_IOCTL_LOGGER_SETTINGS(cbStrTab) SUP_CTL_CODE_SIZE(23, SUP_IOCTL_LOGGER_SETTINGS_SIZE(cbStrTab))
|
---|
986 | #define SUP_IOCTL_LOGGER_SETTINGS_SIZE(cbStrTab) RT_UOFFSETOF(SUPLOGGERSETTINGS, u.In.szStrings[cbStrTab])
|
---|
987 | #define SUP_IOCTL_LOGGER_SETTINGS_SIZE_IN(cbStrTab) RT_UOFFSETOF(SUPLOGGERSETTINGS, u.In.szStrings[cbStrTab])
|
---|
988 | #define SUP_IOCTL_LOGGER_SETTINGS_SIZE_OUT sizeof(SUPREQHDR)
|
---|
989 | typedef struct SUPLOGGERSETTINGS
|
---|
990 | {
|
---|
991 | /** The header. */
|
---|
992 | SUPREQHDR Hdr;
|
---|
993 | union
|
---|
994 | {
|
---|
995 | struct
|
---|
996 | {
|
---|
997 | /** Which logger. */
|
---|
998 | uint32_t fWhich;
|
---|
999 | /** What to do with it. */
|
---|
1000 | uint32_t fWhat;
|
---|
1001 | /** Offset of the flags setting string. */
|
---|
1002 | uint32_t offFlags;
|
---|
1003 | /** Offset of the groups setting string. */
|
---|
1004 | uint32_t offGroups;
|
---|
1005 | /** Offset of the destination setting string. */
|
---|
1006 | uint32_t offDestination;
|
---|
1007 | /** The string table. */
|
---|
1008 | char szStrings[1];
|
---|
1009 | } In;
|
---|
1010 | } u;
|
---|
1011 | } SUPLOGGERSETTINGS, *PSUPLOGGERSETTINGS;
|
---|
1012 |
|
---|
1013 | /** Debug logger. */
|
---|
1014 | #define SUPLOGGERSETTINGS_WHICH_DEBUG 0
|
---|
1015 | /** Release logger. */
|
---|
1016 | #define SUPLOGGERSETTINGS_WHICH_RELEASE 1
|
---|
1017 |
|
---|
1018 | /** Change the settings. */
|
---|
1019 | #define SUPLOGGERSETTINGS_WHAT_SETTINGS 0
|
---|
1020 | /** Create the logger instance. */
|
---|
1021 | #define SUPLOGGERSETTINGS_WHAT_CREATE 1
|
---|
1022 | /** Destroy the logger instance. */
|
---|
1023 | #define SUPLOGGERSETTINGS_WHAT_DESTROY 2
|
---|
1024 |
|
---|
1025 | /** @} */
|
---|
1026 |
|
---|
1027 |
|
---|
1028 | /** @name Semaphore Types
|
---|
1029 | * @{ */
|
---|
1030 | #define SUP_SEM_TYPE_EVENT 0
|
---|
1031 | #define SUP_SEM_TYPE_EVENT_MULTI 1
|
---|
1032 | /** @} */
|
---|
1033 |
|
---|
1034 |
|
---|
1035 | /** @name SUP_IOCTL_SEM_OP2
|
---|
1036 | * Semaphore operations.
|
---|
1037 | * @remarks This replaces the old SUP_IOCTL_SEM_OP interface.
|
---|
1038 | * @{
|
---|
1039 | */
|
---|
1040 | #define SUP_IOCTL_SEM_OP2 SUP_CTL_CODE_SIZE(24, SUP_IOCTL_SEM_OP2_SIZE)
|
---|
1041 | #define SUP_IOCTL_SEM_OP2_SIZE sizeof(SUPSEMOP2)
|
---|
1042 | #define SUP_IOCTL_SEM_OP2_SIZE_IN sizeof(SUPSEMOP2)
|
---|
1043 | #define SUP_IOCTL_SEM_OP2_SIZE_OUT sizeof(SUPREQHDR)
|
---|
1044 | typedef struct SUPSEMOP2
|
---|
1045 | {
|
---|
1046 | /** The header. */
|
---|
1047 | SUPREQHDR Hdr;
|
---|
1048 | union
|
---|
1049 | {
|
---|
1050 | struct
|
---|
1051 | {
|
---|
1052 | /** The semaphore type. */
|
---|
1053 | uint32_t uType;
|
---|
1054 | /** The semaphore handle. */
|
---|
1055 | uint32_t hSem;
|
---|
1056 | /** The operation. */
|
---|
1057 | uint32_t uOp;
|
---|
1058 | /** Reserved, must be zero. */
|
---|
1059 | uint32_t uReserved;
|
---|
1060 | /** The number of milliseconds to wait if it's a wait operation. */
|
---|
1061 | union
|
---|
1062 | {
|
---|
1063 | /** Absolute timeout (RTTime[System]NanoTS).
|
---|
1064 | * Used by SUPSEMOP2_WAIT_NS_ABS. */
|
---|
1065 | uint64_t uAbsNsTimeout;
|
---|
1066 | /** Relative nanosecond timeout.
|
---|
1067 | * Used by SUPSEMOP2_WAIT_NS_REL. */
|
---|
1068 | uint64_t cRelNsTimeout;
|
---|
1069 | /** Relative millisecond timeout.
|
---|
1070 | * Used by SUPSEMOP2_WAIT_MS_REL. */
|
---|
1071 | uint32_t cRelMsTimeout;
|
---|
1072 | /** Generic 64-bit accessor.
|
---|
1073 | * ASSUMES little endian! */
|
---|
1074 | uint64_t u64;
|
---|
1075 | } uArg;
|
---|
1076 | } In;
|
---|
1077 | } u;
|
---|
1078 | } SUPSEMOP2, *PSUPSEMOP2;
|
---|
1079 |
|
---|
1080 | /** Wait for a number of milliseconds. */
|
---|
1081 | #define SUPSEMOP2_WAIT_MS_REL 0
|
---|
1082 | /** Wait until the specified deadline is reached. */
|
---|
1083 | #define SUPSEMOP2_WAIT_NS_ABS 1
|
---|
1084 | /** Wait for a number of nanoseconds. */
|
---|
1085 | #define SUPSEMOP2_WAIT_NS_REL 2
|
---|
1086 | /** Signal the semaphore. */
|
---|
1087 | #define SUPSEMOP2_SIGNAL 3
|
---|
1088 | /** Reset the semaphore (only applicable to SUP_SEM_TYPE_EVENT_MULTI). */
|
---|
1089 | #define SUPSEMOP2_RESET 4
|
---|
1090 | /** Close the semaphore handle. */
|
---|
1091 | #define SUPSEMOP2_CLOSE 5
|
---|
1092 | /** @} */
|
---|
1093 |
|
---|
1094 | /** @name SUP_IOCTL_SEM_OP3
|
---|
1095 | * Semaphore operations.
|
---|
1096 | * @{
|
---|
1097 | */
|
---|
1098 | #define SUP_IOCTL_SEM_OP3 SUP_CTL_CODE_SIZE(25, SUP_IOCTL_SEM_OP3_SIZE)
|
---|
1099 | #define SUP_IOCTL_SEM_OP3_SIZE sizeof(SUPSEMOP3)
|
---|
1100 | #define SUP_IOCTL_SEM_OP3_SIZE_IN sizeof(SUPSEMOP3)
|
---|
1101 | #define SUP_IOCTL_SEM_OP3_SIZE_OUT sizeof(SUPSEMOP3)
|
---|
1102 | typedef struct SUPSEMOP3
|
---|
1103 | {
|
---|
1104 | /** The header. */
|
---|
1105 | SUPREQHDR Hdr;
|
---|
1106 | union
|
---|
1107 | {
|
---|
1108 | struct
|
---|
1109 | {
|
---|
1110 | /** The semaphore type. */
|
---|
1111 | uint32_t uType;
|
---|
1112 | /** The semaphore handle. */
|
---|
1113 | uint32_t hSem;
|
---|
1114 | /** The operation. */
|
---|
1115 | uint32_t uOp;
|
---|
1116 | /** Reserved, must be zero. */
|
---|
1117 | uint32_t u32Reserved;
|
---|
1118 | /** Reserved for future use. */
|
---|
1119 | uint64_t u64Reserved;
|
---|
1120 | } In;
|
---|
1121 | union
|
---|
1122 | {
|
---|
1123 | /** The handle of the created semaphore.
|
---|
1124 | * Used by SUPSEMOP3_CREATE. */
|
---|
1125 | uint32_t hSem;
|
---|
1126 | /** The semaphore resolution in nano seconds.
|
---|
1127 | * Used by SUPSEMOP3_GET_RESOLUTION. */
|
---|
1128 | uint32_t cNsResolution;
|
---|
1129 | /** The 32-bit view. */
|
---|
1130 | uint32_t u32;
|
---|
1131 | /** Reserved some space for later expansion. */
|
---|
1132 | uint64_t u64Reserved;
|
---|
1133 | } Out;
|
---|
1134 | } u;
|
---|
1135 | } SUPSEMOP3, *PSUPSEMOP3;
|
---|
1136 |
|
---|
1137 | /** Get the wait resolution. */
|
---|
1138 | #define SUPSEMOP3_CREATE 0
|
---|
1139 | /** Get the wait resolution. */
|
---|
1140 | #define SUPSEMOP3_GET_RESOLUTION 1
|
---|
1141 | /** @} */
|
---|
1142 |
|
---|
1143 | /** @name SUP_IOCTL_VT_CAPS
|
---|
1144 | * Get the VT-x/AMD-V capabilities.
|
---|
1145 | *
|
---|
1146 | * @todo Intended for main, which means we need to relax the privilege requires
|
---|
1147 | * when accessing certain vboxdrv functions.
|
---|
1148 | *
|
---|
1149 | * @{
|
---|
1150 | */
|
---|
1151 | #define SUP_IOCTL_VT_CAPS SUP_CTL_CODE_SIZE(26, SUP_IOCTL_VT_CAPS_SIZE)
|
---|
1152 | #define SUP_IOCTL_VT_CAPS_SIZE sizeof(SUPVTCAPS)
|
---|
1153 | #define SUP_IOCTL_VT_CAPS_SIZE_IN sizeof(SUPREQHDR)
|
---|
1154 | #define SUP_IOCTL_VT_CAPS_SIZE_OUT sizeof(SUPVTCAPS)
|
---|
1155 | typedef struct SUPVTCAPS
|
---|
1156 | {
|
---|
1157 | /** The header. */
|
---|
1158 | SUPREQHDR Hdr;
|
---|
1159 | union
|
---|
1160 | {
|
---|
1161 | struct
|
---|
1162 | {
|
---|
1163 | /** The VT capability dword. */
|
---|
1164 | uint32_t Caps;
|
---|
1165 | } Out;
|
---|
1166 | } u;
|
---|
1167 | } SUPVTCAPS, *PSUPVTCAPS;
|
---|
1168 | /** @} */
|
---|
1169 |
|
---|
1170 | #pragma pack() /* paranoia */
|
---|
1171 |
|
---|
1172 | #endif
|
---|
1173 |
|
---|