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