1 | /** @file
|
---|
2 | * VBoxGuest - VirtualBox Guest Additions Driver Interface. (ADD,DEV)
|
---|
3 | *
|
---|
4 | * @note This file is used by 16-bit compilers too (OpenWatcom).
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2006-2018 Oracle Corporation
|
---|
9 | *
|
---|
10 | * Permission is hereby granted, free of charge, to any person
|
---|
11 | * obtaining a copy of this software and associated documentation
|
---|
12 | * files (the "Software"), to deal in the Software without
|
---|
13 | * restriction, including without limitation the rights to use,
|
---|
14 | * copy, modify, merge, publish, distribute, sublicense, and/or sell
|
---|
15 | * copies of the Software, and to permit persons to whom the
|
---|
16 | * Software is furnished to do so, subject to the following
|
---|
17 | * conditions:
|
---|
18 | *
|
---|
19 | * The above copyright notice and this permission notice shall be
|
---|
20 | * included in all copies or substantial portions of the Software.
|
---|
21 | *
|
---|
22 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
---|
23 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
---|
24 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
---|
25 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
---|
26 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
---|
27 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
---|
28 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
---|
29 | * OTHER DEALINGS IN THE SOFTWARE.
|
---|
30 | */
|
---|
31 |
|
---|
32 | #ifndef ___VBox_VBoxGuest_h
|
---|
33 | #define ___VBox_VBoxGuest_h
|
---|
34 |
|
---|
35 | #include <VBox/types.h>
|
---|
36 | #include <iprt/assertcompile.h>
|
---|
37 | #include <VBox/VMMDevCoreTypes.h>
|
---|
38 | #include <VBox/VBoxGuestCoreTypes.h>
|
---|
39 |
|
---|
40 |
|
---|
41 |
|
---|
42 | /** @defgroup grp_vboxguest VirtualBox Guest Additions Device Driver
|
---|
43 | *
|
---|
44 | * Also know as VBoxGuest.
|
---|
45 | *
|
---|
46 | * @{
|
---|
47 | */
|
---|
48 |
|
---|
49 | /** @defgroup grp_vboxguest_ioc VirtualBox Guest Additions Driver Interface
|
---|
50 | *
|
---|
51 | * @note This is considered internal in ring-3, please use the VbglR3 functions.
|
---|
52 | *
|
---|
53 | * - I/O controls for user and/or kernel mode starts at 0.
|
---|
54 | * - IDC specific requests descends from 127.
|
---|
55 | * - Bits 7 and 6 are currently reserved for future hacks.
|
---|
56 | *
|
---|
57 | * @remarks When creating new IOCtl interfaces keep in mind that not all OSes supports
|
---|
58 | * reporting back the output size. (This got messed up a little bit in VBoxDrv.)
|
---|
59 | *
|
---|
60 | * The request size is also a little bit tricky as it's passed as part of the
|
---|
61 | * request code on unix. The size field is 14 bits on Linux, 12 bits on *BSD,
|
---|
62 | * 13 bits Darwin, and 8-bits on Solaris. All the BSDs and Darwin kernels
|
---|
63 | * will make use of the size field, while Linux and Solaris will not. We're of
|
---|
64 | * course using the size to validate and/or map/lock the request, so it has
|
---|
65 | * to be valid.
|
---|
66 | *
|
---|
67 | * For Solaris we will have to do something special though, 255 isn't
|
---|
68 | * sufficient for all we need. A 4KB restriction (BSD) is probably not
|
---|
69 | * too problematic (yet) as a general one.
|
---|
70 | *
|
---|
71 | * More info can be found in SUPDRVIOC.h and related sources.
|
---|
72 | *
|
---|
73 | * @remarks If adding interfaces that only has input or only has output, some new macros
|
---|
74 | * needs to be created so the most efficient IOCtl data buffering method can be
|
---|
75 | * used.
|
---|
76 | *
|
---|
77 | * @{
|
---|
78 | */
|
---|
79 | #if !defined(IN_RC) && !defined(IN_RING0_AGNOSTIC) && !defined(IPRT_NO_CRT)
|
---|
80 |
|
---|
81 | /** Fictive start address of the hypervisor physical memory for MmMapIoSpace. */
|
---|
82 | #define VBOXGUEST_HYPERVISOR_PHYSICAL_START UINT32_C(0xf8000000)
|
---|
83 |
|
---|
84 | #ifdef RT_OS_DARWIN
|
---|
85 | /** Cookie used to fend off some unwanted clients to the IOService. */
|
---|
86 | # define VBOXGUEST_DARWIN_IOSERVICE_COOKIE UINT32_C(0x56426f78) /* 'VBox' */
|
---|
87 | #endif
|
---|
88 |
|
---|
89 |
|
---|
90 | #if defined(RT_OS_WINDOWS)
|
---|
91 | # ifndef CTL_CODE
|
---|
92 | # include <iprt/win/windows.h>
|
---|
93 | # endif
|
---|
94 | /* Automatic buffering, size not encoded. */
|
---|
95 | # define VBGL_IOCTL_CODE_SIZE(Function, Size) CTL_CODE(FILE_DEVICE_UNKNOWN, 2048 + (Function), METHOD_BUFFERED, FILE_WRITE_ACCESS)
|
---|
96 | # define VBGL_IOCTL_CODE_BIG(Function) CTL_CODE(FILE_DEVICE_UNKNOWN, 2048 + (Function), METHOD_BUFFERED, FILE_WRITE_ACCESS)
|
---|
97 | # define VBGL_IOCTL_CODE_FAST(Function) CTL_CODE(FILE_DEVICE_UNKNOWN, 2048 + (Function), METHOD_NEITHER, FILE_WRITE_ACCESS)
|
---|
98 | # define VBGL_IOCTL_CODE_STRIPPED(a_uIOCtl) (a_uIOCtl)
|
---|
99 | # define VBOXGUEST_DEVICE_NAME "\\\\.\\VBoxGuest"
|
---|
100 | /** The support service name. */
|
---|
101 | # define VBOXGUEST_SERVICE_NAME "VBoxGuest"
|
---|
102 | /** Global name for Win2k+ */
|
---|
103 | # define VBOXGUEST_DEVICE_NAME_GLOBAL "\\\\.\\Global\\VBoxGuest"
|
---|
104 | /** Win32 driver name */
|
---|
105 | # define VBOXGUEST_DEVICE_NAME_NT L"\\Device\\VBoxGuest"
|
---|
106 | /** Device name. */
|
---|
107 | # define VBOXGUEST_DEVICE_NAME_DOS L"\\DosDevices\\VBoxGuest"
|
---|
108 |
|
---|
109 | #elif defined(RT_OS_OS2)
|
---|
110 | /* No automatic buffering, size not encoded. */
|
---|
111 | # define VBGL_IOCTL_CATEGORY 0xc2
|
---|
112 | # define VBGL_IOCTL_CODE_SIZE(Function, Size) ((unsigned char)(Function))
|
---|
113 | # define VBGL_IOCTL_CODE_BIG(Function) ((unsigned char)(Function))
|
---|
114 | # define VBGL_IOCTL_CATEGORY_FAST 0xc3 /**< Also defined in VBoxGuestA-os2.asm. */
|
---|
115 | # define VBGL_IOCTL_CODE_FAST(Function) ((unsigned char)(Function))
|
---|
116 | # define VBGL_IOCTL_CODE_STRIPPED(a_uIOCtl) (a_uIOCtl)
|
---|
117 | # define VBOXGUEST_DEVICE_NAME "\\Dev\\VBoxGst$"
|
---|
118 | /** Short device name for AttachDD.
|
---|
119 | * @note Case sensitive. Must match what VBoxGuestA-os2.asm says! */
|
---|
120 | # define VBOXGUEST_DEVICE_NAME_SHORT "vboxgst$"
|
---|
121 |
|
---|
122 | #elif defined(RT_OS_SOLARIS)
|
---|
123 | /* No automatic buffering, size limited to 255 bytes => use VBGLBIGREQ for everything. */
|
---|
124 | # include <sys/ioccom.h>
|
---|
125 | # define VBGL_IOCTL_CODE_SIZE(Function, Size) _IOWRN('V', (Function), sizeof(VBGLREQHDR))
|
---|
126 | # define VBGL_IOCTL_CODE_BIG(Function) _IOWRN('V', (Function), sizeof(VBGLREQHDR))
|
---|
127 | # define VBGL_IOCTL_CODE_FAST(Function) _IO( 'F', (Function))
|
---|
128 | # define VBGL_IOCTL_CODE_STRIPPED(a_uIOCtl) (a_uIOCtl)
|
---|
129 | # define VBGL_IOCTL_IS_FAST(a_uIOCtl) ( ((a_uIOCtl) & 0x0000ff00) == ('F' << 8) )
|
---|
130 |
|
---|
131 | #elif defined(RT_OS_LINUX)
|
---|
132 | /* No automatic buffering, size limited to 16KB. */
|
---|
133 | # include <linux/ioctl.h>
|
---|
134 | # define VBGL_IOCTL_CODE_SIZE(Function, Size) _IOC(_IOC_READ | _IOC_WRITE, 'V', (Function), (Size))
|
---|
135 | # define VBGL_IOCTL_CODE_BIG(Function) _IO('V', (Function))
|
---|
136 | # define VBGL_IOCTL_CODE_FAST(Function) _IO('F', (Function))
|
---|
137 | # define VBGL_IOCTL_CODE_STRIPPED(a_uIOCtl) _IOC_NR((a_uIOCtl))
|
---|
138 | # define VBOXGUEST_USER_DEVICE_NAME "/dev/vboxuser"
|
---|
139 |
|
---|
140 | #elif defined(RT_OS_HAIKU)
|
---|
141 | /* No automatic buffering, size not encoded. */
|
---|
142 | /** @todo do something better */
|
---|
143 | # define VBGL_IOCTL_CODE_SIZE(Function, Size) (0x56420000 | (Function))
|
---|
144 | # define VBGL_IOCTL_CODE_BIG(Function) (0x56420000 | (Function))
|
---|
145 | # define VBGL_IOCTL_CODE_FAST(Function) (0x56420000 | (Function))
|
---|
146 | # define VBGL_IOCTL_CODE_STRIPPED(a_uIOCtl) (a_uIOCtl)
|
---|
147 | # define VBOXGUEST_DEVICE_NAME "/dev/misc/vboxguest"
|
---|
148 |
|
---|
149 | #else /* BSD Like */
|
---|
150 | /* Automatic buffering, size limited to 4KB on *BSD and 8KB on Darwin - commands the limit, 4KB. */
|
---|
151 | # include <sys/ioccom.h>
|
---|
152 | # define VBGL_IOCTL_CODE_SIZE(Function, Size) _IOC(IOC_INOUT, 'V', (Function), (Size))
|
---|
153 | # define VBGL_IOCTL_CODE_BIG(Function) _IO('V', (Function))
|
---|
154 | # define VBGL_IOCTL_CODE_FAST(Function) _IO('F', (Function))
|
---|
155 | # define VBGL_IOCTL_CODE_STRIPPED(a_uIOCtl) ((a_uIOCtl) & ~(_IOC(0,0,0,IOCPARM_MASK)))
|
---|
156 | # define VBGL_IOCTL_IS_FAST(a_uIOCtl) ( IOCGROUP(a_uIOCtl) == 'F' )
|
---|
157 | #endif
|
---|
158 |
|
---|
159 |
|
---|
160 | /** @todo It would be nice if we could have two defines without paths. */
|
---|
161 |
|
---|
162 | /** @def VBOXGUEST_DEVICE_NAME
|
---|
163 | * The support device name. */
|
---|
164 | #ifndef VBOXGUEST_DEVICE_NAME /* PORTME */
|
---|
165 | # define VBOXGUEST_DEVICE_NAME "/dev/vboxguest"
|
---|
166 | #endif
|
---|
167 |
|
---|
168 | /** @def VBOXGUEST_USER_DEVICE_NAME
|
---|
169 | * The support device name of the user accessible device node. */
|
---|
170 | #ifndef VBOXGUEST_USER_DEVICE_NAME
|
---|
171 | # define VBOXGUEST_USER_DEVICE_NAME VBOXGUEST_DEVICE_NAME
|
---|
172 | #endif
|
---|
173 |
|
---|
174 |
|
---|
175 | /**
|
---|
176 | * The VBoxGuest I/O control version.
|
---|
177 | *
|
---|
178 | * As usual, the high word contains the major version and changes to it
|
---|
179 | * signifies incompatible changes.
|
---|
180 | *
|
---|
181 | * The lower word is the minor version number, it is increased when new
|
---|
182 | * functions are added or existing changed in a backwards compatible manner.
|
---|
183 | */
|
---|
184 | #define VBGL_IOC_VERSION UINT32_C(0x00010000)
|
---|
185 |
|
---|
186 |
|
---|
187 |
|
---|
188 | /** @name VBGL_IOCTL_DRIVER_INFO
|
---|
189 | * Adjust and get driver information.
|
---|
190 | *
|
---|
191 | * @note May switch the session to a backwards compatible interface version if
|
---|
192 | * uClientVersion indicates older client code.
|
---|
193 | *
|
---|
194 | * @{
|
---|
195 | */
|
---|
196 | #define VBGL_IOCTL_DRIVER_VERSION_INFO VBGL_IOCTL_CODE_SIZE(0, VBGL_IOCTL_DRIVER_VERSION_INFO_SIZE)
|
---|
197 | #define VBGL_IOCTL_DRIVER_VERSION_INFO_SIZE sizeof(VBGLIOCDRIVERVERSIONINFO)
|
---|
198 | #define VBGL_IOCTL_DRIVER_VERSION_INFO_SIZE_IN RT_UOFFSET_AFTER(VBGLIOCDRIVERVERSIONINFO, u.In)
|
---|
199 | #define VBGL_IOCTL_DRIVER_VERSION_INFO_SIZE_OUT sizeof(VBGLIOCDRIVERVERSIONINFO)
|
---|
200 | typedef struct VBGLIOCDRIVERVERSIONINFO
|
---|
201 | {
|
---|
202 | /** The header. */
|
---|
203 | VBGLREQHDR Hdr;
|
---|
204 | union
|
---|
205 | {
|
---|
206 | struct
|
---|
207 | {
|
---|
208 | /** The requested interface version number (VBGL_IOC_VERSION). */
|
---|
209 | uint32_t uReqVersion;
|
---|
210 | /** The minimum interface version number
|
---|
211 | * (typically the major version part of VBGL_IOC_VERSION). */
|
---|
212 | uint32_t uMinVersion;
|
---|
213 | /** Reserved, MBZ. */
|
---|
214 | uint32_t uReserved1;
|
---|
215 | /** Reserved, MBZ. */
|
---|
216 | uint32_t uReserved2;
|
---|
217 | } In;
|
---|
218 | struct
|
---|
219 | {
|
---|
220 | /** Interface version for this session (typically VBGL_IOC_VERSION). */
|
---|
221 | uint32_t uSessionVersion;
|
---|
222 | /** The version of the IDC interface (VBGL_IOC_VERSION). */
|
---|
223 | uint32_t uDriverVersion;
|
---|
224 | /** The SVN revision of the driver.
|
---|
225 | * This will be set to 0 if not compiled into the driver. */
|
---|
226 | uint32_t uDriverRevision;
|
---|
227 | /** Reserved \#1 (will be returned as zero until defined). */
|
---|
228 | uint32_t uReserved1;
|
---|
229 | /** Reserved \#2 (will be returned as zero until defined). */
|
---|
230 | uint32_t uReserved2;
|
---|
231 | } Out;
|
---|
232 | } u;
|
---|
233 | } VBGLIOCDRIVERVERSIONINFO, RT_FAR *PVBGLIOCDRIVERVERSIONINFO;
|
---|
234 | AssertCompileSize(VBGLIOCDRIVERVERSIONINFO, 24 + 20);
|
---|
235 | #if !defined(__GNUC__) /* Some GCC versions can't handle the complicated RT_UOFFSET_AFTER macro, it seems. */ \
|
---|
236 | && (!defined(RT_OS_OS2) || (!defined(__IBMC__) && !defined(__IBMCPP__) && (!defined(__WATCOMC__) || !defined(__cplusplus))))
|
---|
237 | AssertCompile(VBGL_IOCTL_DRIVER_VERSION_INFO_SIZE_IN == 24 + 16);
|
---|
238 | #endif
|
---|
239 | /** @} */
|
---|
240 |
|
---|
241 |
|
---|
242 | /** @name VBGL_IOCTL_GET_PORT_INFO
|
---|
243 | * Query VMMDev I/O port region and MMIO mapping address.
|
---|
244 | * @remarks Ring-0 only.
|
---|
245 | * @{
|
---|
246 | */
|
---|
247 | #define VBGL_IOCTL_GET_VMMDEV_IO_INFO VBGL_IOCTL_CODE_SIZE(1, VBGL_IOCTL_GET_VMMDEV_IO_INFO_SIZE)
|
---|
248 | #define VBGL_IOCTL_GET_VMMDEV_IO_INFO_SIZE sizeof(VBGLIOCGETVMMDEVIOINFO)
|
---|
249 | #define VBGL_IOCTL_GET_VMMDEV_IO_INFO_SIZE_IN sizeof(VBGLREQHDR)
|
---|
250 | #define VBGL_IOCTL_GET_VMMDEV_IO_INFO_SIZE_OUT sizeof(VBGLIOCGETVMMDEVIOINFO)
|
---|
251 | typedef struct VBGLIOCGETVMMDEVIOINFO
|
---|
252 | {
|
---|
253 | /** The header. */
|
---|
254 | VBGLREQHDR Hdr;
|
---|
255 | union
|
---|
256 | {
|
---|
257 | struct
|
---|
258 | {
|
---|
259 | /** The MMIO mapping. NULL if no MMIO region. */
|
---|
260 | struct VMMDevMemory volatile RT_FAR *pvVmmDevMapping;
|
---|
261 | /** The I/O port address. */
|
---|
262 | RTIOPORT IoPort;
|
---|
263 | /** Padding, ignore. */
|
---|
264 | RTIOPORT auPadding[HC_ARCH_BITS == 64 ? 3 : 1];
|
---|
265 | } Out;
|
---|
266 | } u;
|
---|
267 | } VBGLIOCGETVMMDEVIOINFO, RT_FAR *PVBGLIOCGETVMMDEVIOINFO;
|
---|
268 | AssertCompileSize(VBGLIOCGETVMMDEVIOINFO, 24 + (HC_ARCH_BITS == 64 ? 16 : 8));
|
---|
269 | /** @} */
|
---|
270 |
|
---|
271 |
|
---|
272 | /** @name VBGL_IOCTL_VMMDEV_REQUEST
|
---|
273 | * IOCTL to VBoxGuest to perform a VMM Device request less than 1KB in size.
|
---|
274 | * @{
|
---|
275 | */
|
---|
276 | #define VBGL_IOCTL_VMMDEV_REQUEST(a_cb) VBGL_IOCTL_CODE_SIZE(2, (a_cb))
|
---|
277 | /** @} */
|
---|
278 |
|
---|
279 |
|
---|
280 | /** @name VBGL_IOCTL_VMMDEV_REQUEST_BIG
|
---|
281 | * IOCTL to VBoxGuest to perform a VMM Device request that can 1KB or larger.
|
---|
282 | * @{
|
---|
283 | */
|
---|
284 | #define VBGL_IOCTL_VMMDEV_REQUEST_BIG VBGL_IOCTL_CODE_BIG(3)
|
---|
285 | /** @} */
|
---|
286 |
|
---|
287 |
|
---|
288 | #ifdef VBOX_WITH_HGCM
|
---|
289 | /** @name VBGL_IOCTL_HGCM_CONNECT
|
---|
290 | * Connect to a HGCM service.
|
---|
291 | * @{ */
|
---|
292 | # define VBGL_IOCTL_HGCM_CONNECT VBGL_IOCTL_CODE_SIZE(4, VBGL_IOCTL_HGCM_CONNECT_SIZE)
|
---|
293 | # define VBGL_IOCTL_HGCM_CONNECT_SIZE sizeof(VBGLIOCHGCMCONNECT)
|
---|
294 | # define VBGL_IOCTL_HGCM_CONNECT_SIZE_IN sizeof(VBGLIOCHGCMCONNECT)
|
---|
295 | # define VBGL_IOCTL_HGCM_CONNECT_SIZE_OUT RT_UOFFSET_AFTER(VBGLIOCHGCMCONNECT, u.Out)
|
---|
296 | typedef struct VBGLIOCHGCMCONNECT
|
---|
297 | {
|
---|
298 | /** The header. */
|
---|
299 | VBGLREQHDR Hdr;
|
---|
300 | union
|
---|
301 | {
|
---|
302 | struct
|
---|
303 | {
|
---|
304 | HGCMServiceLocation Loc;
|
---|
305 | } In;
|
---|
306 | struct
|
---|
307 | {
|
---|
308 | uint32_t idClient;
|
---|
309 | } Out;
|
---|
310 | } u;
|
---|
311 | } VBGLIOCHGCMCONNECT, RT_FAR *PVBGLIOCHGCMCONNECT;
|
---|
312 | AssertCompileSize(VBGLIOCHGCMCONNECT, 24 + 132);
|
---|
313 | #if !defined(__GNUC__) /* Some GCC versions can't handle the complicated RT_UOFFSET_AFTER macro, it seems. */ \
|
---|
314 | && (!defined(RT_OS_OS2) || (!defined(__IBMC__) && !defined(__IBMCPP__) && (!defined(__WATCOMC__) || !defined(__cplusplus))))
|
---|
315 | AssertCompile(VBGL_IOCTL_HGCM_CONNECT_SIZE_OUT == 24 + 4);
|
---|
316 | #endif
|
---|
317 | /** @} */
|
---|
318 |
|
---|
319 |
|
---|
320 | /** @name VBGL_IOCTL_HGCM_DISCONNECT
|
---|
321 | * Disconnect from a HGCM service.
|
---|
322 | * @{ */
|
---|
323 | # define VBGL_IOCTL_HGCM_DISCONNECT VBGL_IOCTL_CODE_SIZE(5, VBGL_IOCTL_HGCM_DISCONNECT_SIZE)
|
---|
324 | # define VBGL_IOCTL_HGCM_DISCONNECT_SIZE sizeof(VBGLIOCHGCMDISCONNECT)
|
---|
325 | # define VBGL_IOCTL_HGCM_DISCONNECT_SIZE_IN sizeof(VBGLIOCHGCMDISCONNECT)
|
---|
326 | # define VBGL_IOCTL_HGCM_DISCONNECT_SIZE_OUT sizeof(VBGLREQHDR)
|
---|
327 | /** @note This is also used by a VbglR0 API. */
|
---|
328 | typedef struct VBGLIOCHGCMDISCONNECT
|
---|
329 | {
|
---|
330 | /** The header. */
|
---|
331 | VBGLREQHDR Hdr;
|
---|
332 | union
|
---|
333 | {
|
---|
334 | struct
|
---|
335 | {
|
---|
336 | uint32_t idClient;
|
---|
337 | } In;
|
---|
338 | } u;
|
---|
339 | } VBGLIOCHGCMDISCONNECT, RT_FAR *PVBGLIOCHGCMDISCONNECT;
|
---|
340 | AssertCompileSize(VBGLIOCHGCMDISCONNECT, 24 + 4);
|
---|
341 | /** @} */
|
---|
342 |
|
---|
343 |
|
---|
344 | /** @name VBGL_IOCTL_HGCM_CALL, VBGL_IOCTL_HGCM_CALL_WITH_USER_DATA
|
---|
345 | *
|
---|
346 | * Make a call to a HGCM servicesure. There are several variations here.
|
---|
347 | *
|
---|
348 | * The VBGL_IOCTL_HGCM_CALL_WITH_USER_DATA variation is for other drivers (like
|
---|
349 | * the graphics ones) passing on requests from user land that contains user
|
---|
350 | * data. These calls are always interruptible.
|
---|
351 | *
|
---|
352 | * @{ */
|
---|
353 | # define VBGL_IOCTL_HGCM_CALL_32(a_cb) VBGL_IOCTL_CODE_SIZE(6, (a_cb))
|
---|
354 | # define VBGL_IOCTL_HGCM_CALL_64(a_cb) VBGL_IOCTL_CODE_SIZE(7, (a_cb))
|
---|
355 | # if ARCH_BITS == 64
|
---|
356 | # define VBGL_IOCTL_HGCM_CALL(a_cb) VBGL_IOCTL_HGCM_CALL_64(a_cb)
|
---|
357 | # else
|
---|
358 | # define VBGL_IOCTL_HGCM_CALL(a_cb) VBGL_IOCTL_HGCM_CALL_32(a_cb)
|
---|
359 | # endif
|
---|
360 | # define VBGL_IOCTL_HGCM_CALL_WITH_USER_DATA(a_cb) VBGL_IOCTL_CODE_SIZE(8, (a_cb))
|
---|
361 | /** @} */
|
---|
362 | #endif /* VBOX_WITH_HGCM */
|
---|
363 |
|
---|
364 |
|
---|
365 | /** @name VBGL_IOCTL_LOG
|
---|
366 | * IOCTL to VBoxGuest to perform backdoor logging.
|
---|
367 | * @{ */
|
---|
368 | #define VBOXGUEST_IOCTL_LOG(Size)
|
---|
369 | #define VBGL_IOCTL_LOG(a_cchMsg) VBGL_IOCTL_CODE_BIG(9)
|
---|
370 | #define VBGL_IOCTL_LOG_SIZE(a_cchMsg) (sizeof(VBGLREQHDR) + (a_cchMsg) + 1)
|
---|
371 | #define VBGL_IOCTL_LOG_SIZE_IN(a_cchMsg) (sizeof(VBGLREQHDR) + (a_cchMsg) + 1)
|
---|
372 | #define VBGL_IOCTL_LOG_SIZE_OUT sizeof(VBGLREQHDR)
|
---|
373 | typedef struct VBGLIOCLOG
|
---|
374 | {
|
---|
375 | /** The header. */
|
---|
376 | VBGLREQHDR Hdr;
|
---|
377 | union
|
---|
378 | {
|
---|
379 | struct
|
---|
380 | {
|
---|
381 | /** The log message.
|
---|
382 | * The length is determined from the input size and zero termination. */
|
---|
383 | char szMsg[RT_FLEXIBLE_ARRAY_IN_NESTED_UNION];
|
---|
384 | } In;
|
---|
385 | } u;
|
---|
386 | } VBGLIOCLOG, RT_FAR *PVBGLIOCLOG;
|
---|
387 | /** @} */
|
---|
388 |
|
---|
389 |
|
---|
390 | /** @name VBGL_IOCTL_WAIT_FOR_EVENTS
|
---|
391 | * Wait for a VMMDev host event notification.
|
---|
392 | * @{
|
---|
393 | */
|
---|
394 | #define VBGL_IOCTL_WAIT_FOR_EVENTS VBGL_IOCTL_CODE_SIZE(10, VBGL_IOCTL_WAIT_FOR_EVENTS_SIZE)
|
---|
395 | #define VBGL_IOCTL_WAIT_FOR_EVENTS_SIZE sizeof(VBGLIOCWAITFOREVENTS)
|
---|
396 | #define VBGL_IOCTL_WAIT_FOR_EVENTS_SIZE_IN sizeof(VBGLIOCWAITFOREVENTS)
|
---|
397 | #define VBGL_IOCTL_WAIT_FOR_EVENTS_SIZE_OUT RT_UOFFSET_AFTER(VBGLIOCWAITFOREVENTS, u.Out)
|
---|
398 | typedef struct VBGLIOCWAITFOREVENTS
|
---|
399 | {
|
---|
400 | /** The header. */
|
---|
401 | VBGLREQHDR Hdr;
|
---|
402 | union
|
---|
403 | {
|
---|
404 | struct
|
---|
405 | {
|
---|
406 | /** Timeout in milliseconds. */
|
---|
407 | uint32_t cMsTimeOut;
|
---|
408 | /** Events to wait for. */
|
---|
409 | uint32_t fEvents;
|
---|
410 | } In;
|
---|
411 | struct
|
---|
412 | {
|
---|
413 | /** Events that occurred. */
|
---|
414 | uint32_t fEvents;
|
---|
415 | } Out;
|
---|
416 | } u;
|
---|
417 | } VBGLIOCWAITFOREVENTS, RT_FAR *PVBGLIOCWAITFOREVENTS;
|
---|
418 | AssertCompileSize(VBGLIOCWAITFOREVENTS, 24 + 8);
|
---|
419 | /** @} */
|
---|
420 |
|
---|
421 |
|
---|
422 | /** @name VBGL_IOCTL_INTERRUPT_ALL_WAIT_FOR_EVENTS
|
---|
423 | * IOCTL to VBoxGuest to interrupt (cancel) any pending
|
---|
424 | * VBGL_IOCTL_WAIT_FOR_EVENTS and return.
|
---|
425 | *
|
---|
426 | * Handled inside the guest additions and not seen by the host at all.
|
---|
427 | * After calling this, VBGL_IOCTL_WAIT_FOR_EVENTS should no longer be called in
|
---|
428 | * the same session. At the time of writing this is not enforced; at the time
|
---|
429 | * of reading it may be.
|
---|
430 | * @see VBGL_IOCTL_WAIT_FOR_EVENTS
|
---|
431 | *
|
---|
432 | * @{
|
---|
433 | */
|
---|
434 | #define VBGL_IOCTL_INTERRUPT_ALL_WAIT_FOR_EVENTS VBGL_IOCTL_CODE_SIZE(11, VBGL_IOCTL_INTERRUPT_ALL_WAIT_FOR_EVENTS_SIZE)
|
---|
435 | #define VBGL_IOCTL_INTERRUPT_ALL_WAIT_FOR_EVENTS_SIZE sizeof(VBGLREQHDR)
|
---|
436 | #define VBGL_IOCTL_INTERRUPT_ALL_WAIT_FOR_EVENTS_SIZE_IN sizeof(VBGLREQHDR)
|
---|
437 | #define VBGL_IOCTL_INTERRUPT_ALL_WAIT_FOR_EVENTS_SIZE_OUT sizeof(VBGLREQHDR)
|
---|
438 | /** @} */
|
---|
439 |
|
---|
440 |
|
---|
441 | /** @name VBGL_IOCTL_CHANGE_FILTER_MASK
|
---|
442 | * IOCTL to VBoxGuest to control the event filter mask.
|
---|
443 | * @{ */
|
---|
444 | #define VBGL_IOCTL_CHANGE_FILTER_MASK VBGL_IOCTL_CODE_SIZE(12, VBGL_IOCTL_CHANGE_FILTER_MASK_SIZE)
|
---|
445 | #define VBGL_IOCTL_CHANGE_FILTER_MASK_SIZE sizeof(VBGLIOCCHANGEFILTERMASK)
|
---|
446 | #define VBGL_IOCTL_CHANGE_FILTER_MASK_SIZE_IN sizeof(VBGLIOCCHANGEFILTERMASK)
|
---|
447 | #define VBGL_IOCTL_CHANGE_FILTER_MASK_SIZE_OUT sizeof(VBGLREQHDR)
|
---|
448 | typedef struct VBGLIOCCHANGEFILTERMASK
|
---|
449 | {
|
---|
450 | /** The header. */
|
---|
451 | VBGLREQHDR Hdr;
|
---|
452 | union
|
---|
453 | {
|
---|
454 | struct
|
---|
455 | {
|
---|
456 | /** Flags to set. */
|
---|
457 | uint32_t fOrMask;
|
---|
458 | /** Flags to remove. */
|
---|
459 | uint32_t fNotMask;
|
---|
460 | } In;
|
---|
461 | } u;
|
---|
462 | } VBGLIOCCHANGEFILTERMASK, RT_FAR *PVBGLIOCCHANGEFILTERMASK;
|
---|
463 | AssertCompileSize(VBGLIOCCHANGEFILTERMASK, 24 + 8);
|
---|
464 | /** @} */
|
---|
465 |
|
---|
466 |
|
---|
467 | /** @name VBGL_IOCTL_GUEST_CAPS_ACQUIRE
|
---|
468 | * IOCTL to for acquiring and releasing guest capabilities.
|
---|
469 | *
|
---|
470 | * This is used for multiple purposes:
|
---|
471 | * 1. By doing @a acquire r3 client application (e.g. VBoxTray) claims it will
|
---|
472 | * use the given session for performing operations like @a seamless or
|
---|
473 | * @a auto-resize, thus, if the application terminates, the driver will
|
---|
474 | * automatically cleanup the caps reported to host, so that host knows guest
|
---|
475 | * does not support them anymore
|
---|
476 | * 2. In a multy-user environment this will not allow r3 applications (like
|
---|
477 | * VBoxTray) running in different user sessions simultaneously to interfere
|
---|
478 | * with each other. An r3 client application (like VBoxTray) is responsible
|
---|
479 | * for Acquiring/Releasing caps properly as needed.
|
---|
480 | *
|
---|
481 | *
|
---|
482 | * VERR_RESOURCE_BUSY is returned if any capabilities in the fOrMask are
|
---|
483 | * currently acquired by some other VBoxGuest session.
|
---|
484 | *
|
---|
485 | * @{
|
---|
486 | */
|
---|
487 | #define VBGL_IOCTL_ACQUIRE_GUEST_CAPABILITIES VBGL_IOCTL_CODE_SIZE(13, VBGL_IOCTL_ACQUIRE_GUEST_CAPABILITIES_SIZE)
|
---|
488 | #define VBGL_IOCTL_ACQUIRE_GUEST_CAPABILITIES_SIZE sizeof(VBGLIOCACQUIREGUESTCAPS)
|
---|
489 | #define VBGL_IOCTL_ACQUIRE_GUEST_CAPABILITIES_SIZE_IN sizeof(VBGLIOCACQUIREGUESTCAPS)
|
---|
490 | #define VBGL_IOCTL_ACQUIRE_GUEST_CAPABILITIES_SIZE_OUT sizeof(VBGLREQHDR)
|
---|
491 |
|
---|
492 | /** Default operation (full acquire/release). */
|
---|
493 | #define VBGL_IOC_AGC_FLAGS_DEFAULT UINT32_C(0x00000000)
|
---|
494 | /** Configures VBoxGuest to use the specified caps in Acquire mode, w/o making
|
---|
495 | * any caps acquisition/release. This is only possible to set acquire mode for
|
---|
496 | * caps, but not clear it, so fNotMask is ignored when this flag is set. */
|
---|
497 | #define VBGL_IOC_AGC_FLAGS_CONFIG_ACQUIRE_MODE UINT32_C(0x00000001)
|
---|
498 | /** Valid flag mask. */
|
---|
499 | #define VBGL_IOC_AGC_FLAGS_VALID_MASK UINT32_C(0x00000001)
|
---|
500 |
|
---|
501 | typedef struct VBGLIOCACQUIREGUESTCAPS
|
---|
502 | {
|
---|
503 | /** The header. */
|
---|
504 | VBGLREQHDR Hdr;
|
---|
505 | union
|
---|
506 | {
|
---|
507 | struct
|
---|
508 | {
|
---|
509 | /** Acquire flags (VBGL_IOC_AGC_FLAGS_XXX). */
|
---|
510 | uint32_t fFlags;
|
---|
511 | /** Guest capabilities to acquire (VMMDEV_GUEST_SUPPORTS_XXX). */
|
---|
512 | uint32_t fOrMask;
|
---|
513 | /** Guest capabilities to release (VMMDEV_GUEST_SUPPORTS_XXX). */
|
---|
514 | uint32_t fNotMask;
|
---|
515 | } In;
|
---|
516 | } u;
|
---|
517 | } VBGLIOCACQUIREGUESTCAPS, RT_FAR *PVBGLIOCACQUIREGUESTCAPS;
|
---|
518 | AssertCompileSize(VBGLIOCACQUIREGUESTCAPS, 24 + 12);
|
---|
519 | /** @} */
|
---|
520 |
|
---|
521 |
|
---|
522 | /** @name VBGL_IOCTL_CHANGE_GUEST_CAPABILITIES
|
---|
523 | * IOCTL to VBoxGuest to set guest capabilities.
|
---|
524 | * @{ */
|
---|
525 | #define VBGL_IOCTL_CHANGE_GUEST_CAPABILITIES VBGL_IOCTL_CODE_SIZE(14, VBGL_IOCTL_CHANGE_GUEST_CAPABILITIES_SIZE)
|
---|
526 | #define VBGL_IOCTL_CHANGE_GUEST_CAPABILITIES_SIZE sizeof(VBGLIOCSETGUESTCAPS)
|
---|
527 | #define VBGL_IOCTL_CHANGE_GUEST_CAPABILITIES_SIZE_IN sizeof(VBGLIOCSETGUESTCAPS)
|
---|
528 | #define VBGL_IOCTL_CHANGE_GUEST_CAPABILITIES_SIZE_OUT sizeof(VBGLIOCSETGUESTCAPS)
|
---|
529 | typedef struct VBGLIOCSETGUESTCAPS
|
---|
530 | {
|
---|
531 | /** The header. */
|
---|
532 | VBGLREQHDR Hdr;
|
---|
533 | union
|
---|
534 | {
|
---|
535 | struct
|
---|
536 | {
|
---|
537 | /** The capabilities to set (VMMDEV_GUEST_SUPPORTS_XXX). */
|
---|
538 | uint32_t fOrMask;
|
---|
539 | /** The capabilities to drop (VMMDEV_GUEST_SUPPORTS_XXX). */
|
---|
540 | uint32_t fNotMask;
|
---|
541 | } In;
|
---|
542 | struct
|
---|
543 | {
|
---|
544 | /** The capabilities held by the session after the call (VMMDEV_GUEST_SUPPORTS_XXX). */
|
---|
545 | uint32_t fSessionCaps;
|
---|
546 | /** The capabilities for all the sessions after the call (VMMDEV_GUEST_SUPPORTS_XXX). */
|
---|
547 | uint32_t fGlobalCaps;
|
---|
548 | } Out;
|
---|
549 | } u;
|
---|
550 | } VBGLIOCSETGUESTCAPS, RT_FAR *PVBGLIOCSETGUESTCAPS;
|
---|
551 | AssertCompileSize(VBGLIOCSETGUESTCAPS, 24 + 8);
|
---|
552 | typedef VBGLIOCSETGUESTCAPS VBoxGuestSetCapabilitiesInfo;
|
---|
553 | /** @} */
|
---|
554 |
|
---|
555 |
|
---|
556 | /** @name VBGL_IOCTL_SET_MOUSE_STATUS
|
---|
557 | * IOCTL to VBoxGuest to update the mouse status features.
|
---|
558 | * @{ */
|
---|
559 | #define VBGL_IOCTL_SET_MOUSE_STATUS VBGL_IOCTL_CODE_SIZE(15, VBGL_IOCTL_SET_MOUSE_STATUS_SIZE)
|
---|
560 | #define VBGL_IOCTL_SET_MOUSE_STATUS_SIZE sizeof(VBGLIOCSETMOUSESTATUS)
|
---|
561 | #define VBGL_IOCTL_SET_MOUSE_STATUS_SIZE_IN sizeof(VBGLIOCSETMOUSESTATUS)
|
---|
562 | #define VBGL_IOCTL_SET_MOUSE_STATUS_SIZE_OUT sizeof(VBGLREQHDR)
|
---|
563 | typedef struct VBGLIOCSETMOUSESTATUS
|
---|
564 | {
|
---|
565 | /** The header. */
|
---|
566 | VBGLREQHDR Hdr;
|
---|
567 | union
|
---|
568 | {
|
---|
569 | struct
|
---|
570 | {
|
---|
571 | /** Mouse status flags (VMMDEV_MOUSE_XXX). */
|
---|
572 | uint32_t fStatus;
|
---|
573 | } In;
|
---|
574 | } u;
|
---|
575 | } VBGLIOCSETMOUSESTATUS, RT_FAR *PVBGLIOCSETMOUSESTATUS;
|
---|
576 | /** @} */
|
---|
577 |
|
---|
578 |
|
---|
579 | /** @name VBGL_IOCTL_SET_MOUSE_NOTIFY_CALLBACK
|
---|
580 | *
|
---|
581 | * IOCTL to for setting the mouse driver callback.
|
---|
582 | * @note The callback will be called in interrupt context with the VBoxGuest
|
---|
583 | * device event spinlock held.
|
---|
584 | * @note ring-0 only.
|
---|
585 | *
|
---|
586 | * @{ */
|
---|
587 | #define VBGL_IOCTL_SET_MOUSE_NOTIFY_CALLBACK VBGL_IOCTL_CODE_SIZE(16, VBGL_IOCTL_SET_MOUSE_NOTIFY_CALLBACK_SIZE)
|
---|
588 | #define VBGL_IOCTL_SET_MOUSE_NOTIFY_CALLBACK_SIZE sizeof(VBGLIOCSETMOUSENOTIFYCALLBACK)
|
---|
589 | #define VBGL_IOCTL_SET_MOUSE_NOTIFY_CALLBACK_SIZE_IN sizeof(VBGLIOCSETMOUSENOTIFYCALLBACK)
|
---|
590 | #define VBGL_IOCTL_SET_MOUSE_NOTIFY_CALLBACK_SIZE_OUT sizeof(VBGLREQHDR)
|
---|
591 | typedef struct VBGLIOCSETMOUSENOTIFYCALLBACK
|
---|
592 | {
|
---|
593 | /** The header. */
|
---|
594 | VBGLREQHDR Hdr;
|
---|
595 | union
|
---|
596 | {
|
---|
597 | struct
|
---|
598 | {
|
---|
599 | /** Mouse notification callback function. */
|
---|
600 | PFNVBOXGUESTMOUSENOTIFY pfnNotify;
|
---|
601 | /** The callback argument. */
|
---|
602 | void RT_FAR *pvUser;
|
---|
603 | } In;
|
---|
604 | } u;
|
---|
605 | } VBGLIOCSETMOUSENOTIFYCALLBACK, RT_FAR *PVBGLIOCSETMOUSENOTIFYCALLBACK;
|
---|
606 | /** @} */
|
---|
607 |
|
---|
608 |
|
---|
609 | /** @name VBGL_IOCTL_CHECK_BALLOON
|
---|
610 | * IOCTL to VBoxGuest to check memory ballooning.
|
---|
611 | *
|
---|
612 | * The guest kernel module / device driver will ask the host for the current size of
|
---|
613 | * the balloon and adjust the size. Or it will set fHandledInR0 = false and R3 is
|
---|
614 | * responsible for allocating memory and calling R0 (VBGL_IOCTL_CHANGE_BALLOON).
|
---|
615 | * @{ */
|
---|
616 | #define VBGL_IOCTL_CHECK_BALLOON VBGL_IOCTL_CODE_SIZE(17, VBGL_IOCTL_CHECK_BALLOON_SIZE)
|
---|
617 | #define VBGL_IOCTL_CHECK_BALLOON_SIZE sizeof(VBGLIOCCHECKBALLOON)
|
---|
618 | #define VBGL_IOCTL_CHECK_BALLOON_SIZE_IN sizeof(VBGLREQHDR)
|
---|
619 | #define VBGL_IOCTL_CHECK_BALLOON_SIZE_OUT sizeof(VBGLIOCCHECKBALLOON)
|
---|
620 | typedef struct VBGLIOCCHECKBALLOON
|
---|
621 | {
|
---|
622 | /** The header. */
|
---|
623 | VBGLREQHDR Hdr;
|
---|
624 | union
|
---|
625 | {
|
---|
626 | struct
|
---|
627 | {
|
---|
628 | /** The size of the balloon in chunks of 1MB. */
|
---|
629 | uint32_t cBalloonChunks;
|
---|
630 | /** false = handled in R0, no further action required.
|
---|
631 | * true = allocate balloon memory in R3. */
|
---|
632 | bool fHandleInR3;
|
---|
633 | /** Explicit padding, please ignore. */
|
---|
634 | bool afPadding[3];
|
---|
635 | } Out;
|
---|
636 | } u;
|
---|
637 | } VBGLIOCCHECKBALLOON, RT_FAR *PVBGLIOCCHECKBALLOON;
|
---|
638 | AssertCompileSize(VBGLIOCCHECKBALLOON, 24 + 8);
|
---|
639 | typedef VBGLIOCCHECKBALLOON VBoxGuestCheckBalloonInfo;
|
---|
640 | /** @} */
|
---|
641 |
|
---|
642 |
|
---|
643 | /** @name VBGL_IOCTL_CHANGE_BALLOON
|
---|
644 | * IOCTL to VBoxGuest to supply or revoke one chunk for ballooning.
|
---|
645 | *
|
---|
646 | * The guest kernel module / device driver will lock down supplied memory or
|
---|
647 | * unlock reclaimed memory and then forward the physical addresses of the
|
---|
648 | * changed balloon chunk to the host.
|
---|
649 | *
|
---|
650 | * @{ */
|
---|
651 | #define VBGL_IOCTL_CHANGE_BALLOON VBGL_IOCTL_CODE_SIZE(18, VBGL_IOCTL_CHANGE_BALLOON_SIZE)
|
---|
652 | #define VBGL_IOCTL_CHANGE_BALLOON_SIZE sizeof(VBGLIOCCHANGEBALLOON)
|
---|
653 | #define VBGL_IOCTL_CHANGE_BALLOON_SIZE_IN sizeof(VBGLIOCCHANGEBALLOON)
|
---|
654 | #define VBGL_IOCTL_CHANGE_BALLOON_SIZE_OUT sizeof(VBGLREQHDR)
|
---|
655 | typedef struct VBGLIOCCHANGEBALLOON
|
---|
656 | {
|
---|
657 | /** The header. */
|
---|
658 | VBGLREQHDR Hdr;
|
---|
659 | union
|
---|
660 | {
|
---|
661 | struct
|
---|
662 | {
|
---|
663 | /** Address of the chunk (user space address). */
|
---|
664 | RTR3PTR pvChunk;
|
---|
665 | /** Explicit alignment padding, MBZ. */
|
---|
666 | uint8_t abPadding[ARCH_BITS == 64 ? 0 + 7 : 4 + 7];
|
---|
667 | /** true = inflate, false = deflate. */
|
---|
668 | bool fInflate;
|
---|
669 | } In;
|
---|
670 | } u;
|
---|
671 | } VBGLIOCCHANGEBALLOON, RT_FAR *PVBGLIOCCHANGEBALLOON;
|
---|
672 | AssertCompileSize(VBGLIOCCHANGEBALLOON, 24+16);
|
---|
673 | /** @} */
|
---|
674 |
|
---|
675 |
|
---|
676 | /** @name VBGL_IOCTL_WRITE_CORE_DUMP
|
---|
677 | * IOCTL to VBoxGuest to write guest core.
|
---|
678 | * @{ */
|
---|
679 | #define VBGL_IOCTL_WRITE_CORE_DUMP VBGL_IOCTL_CODE_SIZE(19, VBGL_IOCTL_WRITE_CORE_DUMP_SIZE)
|
---|
680 | #define VBGL_IOCTL_WRITE_CORE_DUMP_SIZE sizeof(VBGLIOCWRITECOREDUMP)
|
---|
681 | #define VBGL_IOCTL_WRITE_CORE_DUMP_SIZE_IN sizeof(VBGLIOCWRITECOREDUMP)
|
---|
682 | #define VBGL_IOCTL_WRITE_CORE_DUMP_SIZE_OUT sizeof(VBGLREQHDR)
|
---|
683 | typedef struct VBGLIOCWRITECOREDUMP
|
---|
684 | {
|
---|
685 | /** The header. */
|
---|
686 | VBGLREQHDR Hdr;
|
---|
687 | union
|
---|
688 | {
|
---|
689 | struct
|
---|
690 | {
|
---|
691 | /** Flags (reserved, MBZ). */
|
---|
692 | uint32_t fFlags;
|
---|
693 | } In;
|
---|
694 | } u;
|
---|
695 | } VBGLIOCWRITECOREDUMP, RT_FAR *PVBGLIOCWRITECOREDUMP;
|
---|
696 | AssertCompileSize(VBGLIOCWRITECOREDUMP, 24 + 4);
|
---|
697 | typedef VBGLIOCWRITECOREDUMP VBoxGuestWriteCoreDump;
|
---|
698 | /** @} */
|
---|
699 |
|
---|
700 |
|
---|
701 | #ifdef VBOX_WITH_DPC_LATENCY_CHECKER
|
---|
702 | /** @name VBGL_IOCTL_DPC_LATENCY_CHECKER
|
---|
703 | * IOCTL to VBoxGuest to perform DPC latency tests, printing the result in
|
---|
704 | * the release log on the host. Takes no data, returns no data.
|
---|
705 | * @{ */
|
---|
706 | # define VBGL_IOCTL_DPC_LATENCY_CHECKER VBGL_IOCTL_CODE_SIZE(20, VBGL_IOCTL_DPC_LATENCY_CHECKER_SIZE)
|
---|
707 | # define VBGL_IOCTL_DPC_LATENCY_CHECKER_SIZE sizeof(VBGLREQHDR)
|
---|
708 | # define VBGL_IOCTL_DPC_LATENCY_CHECKER_SIZE_IN sizeof(VBGLREQHDR)
|
---|
709 | # define VBGL_IOCTL_DPC_LATENCY_CHECKER_SIZE_OUT sizeof(VBGLREQHDR)
|
---|
710 | /** @} */
|
---|
711 | #endif
|
---|
712 |
|
---|
713 |
|
---|
714 | #ifdef RT_OS_OS2
|
---|
715 | /**
|
---|
716 | * The data buffer layout for the IDC entry point (AttachDD).
|
---|
717 | *
|
---|
718 | * @remark This is defined in multiple 16-bit headers / sources.
|
---|
719 | * Some places it's called VBGOS2IDC to short things a bit.
|
---|
720 | */
|
---|
721 | typedef struct VBGLOS2ATTACHDD
|
---|
722 | {
|
---|
723 | /** VBGL_IOC_VERSION. */
|
---|
724 | uint32_t u32Version;
|
---|
725 | /** Opaque session handle. */
|
---|
726 | uint32_t u32Session;
|
---|
727 |
|
---|
728 | /**
|
---|
729 | * The 32-bit service entry point.
|
---|
730 | *
|
---|
731 | * @returns VBox status code.
|
---|
732 | * @param u32Session The session handle (PVBOXGUESTSESSION).
|
---|
733 | * @param iFunction The requested function.
|
---|
734 | * @param pReqHdr The input/output data buffer. The caller
|
---|
735 | * ensures that this cannot be swapped out, or that
|
---|
736 | * it's acceptable to take a page in fault in the
|
---|
737 | * current context. If the request doesn't take
|
---|
738 | * input or produces output, apssing NULL is okay.
|
---|
739 | * @param cbReq The size of the data buffer.
|
---|
740 | */
|
---|
741 | # if ARCH_BITS == 32 || defined(DOXYGEN_RUNNING)
|
---|
742 | DECLCALLBACKMEMBER(int, pfnServiceEP)(uint32_t u32Session, unsigned iFunction, PVBGLREQHDR pReqHdr, size_t cbReq);
|
---|
743 | # else
|
---|
744 | uint32_t pfnServiceEP;
|
---|
745 | #endif
|
---|
746 |
|
---|
747 | /** The 16-bit service entry point for C code (cdecl).
|
---|
748 | *
|
---|
749 | * It's the same as the 32-bit entry point, but the types has
|
---|
750 | * changed to 16-bit equivalents.
|
---|
751 | *
|
---|
752 | * @code
|
---|
753 | * int far cdecl
|
---|
754 | * VBoxGuestOs2IDCService16(uint32_t u32Session, uint16_t iFunction,
|
---|
755 | * PVBGLREQHDR fpvData, uint16_t cbData);
|
---|
756 | * @endcode
|
---|
757 | */
|
---|
758 | # if ARCH_BITS == 16 || defined(DOXYGEN_RUNNING)
|
---|
759 | DECLCALLBACKMEMBER(int, fpfnServiceEP)(uint32_t u32Session, uint16_t iFunction, PVBGLREQHDR fpvData, uint16_t cbData);
|
---|
760 | # else
|
---|
761 | RTFAR16 fpfnServiceEP;
|
---|
762 | # endif
|
---|
763 |
|
---|
764 | /** The 16-bit service entry point for Assembly code (register).
|
---|
765 | *
|
---|
766 | * This is just a wrapper around fpfnServiceEP to simplify calls
|
---|
767 | * from 16-bit assembly code.
|
---|
768 | *
|
---|
769 | * @returns (e)ax: VBox status code; cx: The amount of data returned.
|
---|
770 | *
|
---|
771 | * @param u32Session eax - The above session handle.
|
---|
772 | * @param iFunction dl - The requested function.
|
---|
773 | * @param pvData es:bx - The input/output data buffer.
|
---|
774 | * @param cbData cx - The size of the data buffer.
|
---|
775 | */
|
---|
776 | RTFAR16 fpfnServiceAsmEP;
|
---|
777 | } VBGLOS2ATTACHDD;
|
---|
778 | /** Pointer to VBOXGUESTOS2IDCCONNECT buffer. */
|
---|
779 | typedef VBGLOS2ATTACHDD RT_FAR *PVBGLOS2ATTACHDD;
|
---|
780 |
|
---|
781 | /**
|
---|
782 | * Prototype for the 16-bit callback returned by AttachDD on OS/2.
|
---|
783 | * @param pAttachInfo Pointer to structure to fill in.
|
---|
784 | */
|
---|
785 | # if defined(__IBMC__) || defined(__IBMCPP__)
|
---|
786 | typedef void (* __cdecl RT_FAR_CODE PFNVBGLOS2ATTACHDD)(PVBGLOS2ATTACHDD pAttachInfo);
|
---|
787 | # else
|
---|
788 | typedef void (__cdecl RT_FAR_CODE *PFNVBGLOS2ATTACHDD)(PVBGLOS2ATTACHDD pAttachInfo);
|
---|
789 | # endif
|
---|
790 | #endif /* RT_OS_OS2 */
|
---|
791 |
|
---|
792 |
|
---|
793 | /** @name VBGL_IOCL_IDC_CONNECT
|
---|
794 | * IDC client connect request.
|
---|
795 | *
|
---|
796 | * On platforms other than Windows and OS/2, this will also create a kernel
|
---|
797 | * session for the caller.
|
---|
798 | *
|
---|
799 | * @note ring-0 only.
|
---|
800 | */
|
---|
801 | #define VBGL_IOCTL_IDC_CONNECT VBGL_IOCTL_CODE_SIZE(63, VBGL_IOCTL_IDC_CONNECT_SIZE)
|
---|
802 | #define VBGL_IOCTL_IDC_CONNECT_SIZE sizeof(VBGLIOCIDCCONNECT)
|
---|
803 | #define VBGL_IOCTL_IDC_CONNECT_SIZE_IN RT_UOFFSET_AFTER(VBGLIOCIDCCONNECT, u.In)
|
---|
804 | #define VBGL_IOCTL_IDC_CONNECT_SIZE_OUT sizeof(VBGLIOCIDCCONNECT)
|
---|
805 | typedef struct VBGLIOCIDCCONNECT
|
---|
806 | {
|
---|
807 | /** The header. */
|
---|
808 | VBGLREQHDR Hdr;
|
---|
809 | /** The payload union. */
|
---|
810 | union
|
---|
811 | {
|
---|
812 | struct
|
---|
813 | {
|
---|
814 | /** VBGL_IOCTL_IDC_CONNECT_MAGIC_COOKIE. */
|
---|
815 | uint32_t u32MagicCookie;
|
---|
816 | /** The desired version of the I/O control interface (VBGL_IOC_VERSION). */
|
---|
817 | uint32_t uReqVersion;
|
---|
818 | /** The minimum version of the I/O control interface (VBGL_IOC_VERSION). */
|
---|
819 | uint32_t uMinVersion;
|
---|
820 | /** Reserved, MBZ. */
|
---|
821 | uint32_t uReserved;
|
---|
822 | } In;
|
---|
823 | struct
|
---|
824 | {
|
---|
825 | /** The session handle (opaque). */
|
---|
826 | #if ARCH_BITS >= 32
|
---|
827 | void RT_FAR *pvSession;
|
---|
828 | #else
|
---|
829 | uint32_t pvSession;
|
---|
830 | #endif
|
---|
831 | /** The version of the I/O control interface for this session
|
---|
832 | * (typically VBGL_IOC_VERSION). */
|
---|
833 | uint32_t uSessionVersion;
|
---|
834 | /** The I/O control interface version for of the driver (VBGL_IOC_VERSION). */
|
---|
835 | uint32_t uDriverVersion;
|
---|
836 | /** The SVN revision of the driver.
|
---|
837 | * This will be set to 0 if not compiled into the driver. */
|
---|
838 | uint32_t uDriverRevision;
|
---|
839 | /** Reserved \#1 (will be returned as zero until defined). */
|
---|
840 | uint32_t uReserved1;
|
---|
841 | /** Reserved \#2 (will be returned as NULL until defined). */
|
---|
842 | void RT_FAR *pvReserved2;
|
---|
843 | } Out;
|
---|
844 | } u;
|
---|
845 | } VBGLIOCIDCCONNECT, RT_FAR *PVBGLIOCIDCCONNECT;
|
---|
846 | AssertCompileSize(VBGLIOCIDCCONNECT, 24 + 16 + (ARCH_BITS == 64 ? 8 : 4) * 2);
|
---|
847 | #if !defined(__GNUC__) /* Some GCC versions can't handle the complicated RT_UOFFSET_AFTER macro, it seems. */ \
|
---|
848 | && (!defined(RT_OS_OS2) || (!defined(__IBMC__) && !defined(__IBMCPP__) && (!defined(__WATCOMC__) || !defined(__cplusplus))))
|
---|
849 | AssertCompile(VBGL_IOCTL_IDC_CONNECT_SIZE_IN == 24 + 16);
|
---|
850 | #endif
|
---|
851 | #define VBGL_IOCTL_IDC_CONNECT_MAGIC_COOKIE UINT32_C(0x55aa4d5a) /**< Magic value for doing an IDC connect. */
|
---|
852 | /** @} */
|
---|
853 |
|
---|
854 |
|
---|
855 | /** @name VBGL_IOCL_IDC_DISCONNECT
|
---|
856 | * IDC client disconnect request.
|
---|
857 | *
|
---|
858 | * This will destroy the kernel session associated with the IDC connection.
|
---|
859 | *
|
---|
860 | * @note ring-0 only.
|
---|
861 | */
|
---|
862 | #define VBGL_IOCTL_IDC_DISCONNECT VBGL_IOCTL_CODE_SIZE(62, VBGL_IOCTL_IDC_DISCONNECT_SIZE)
|
---|
863 | #define VBGL_IOCTL_IDC_DISCONNECT_SIZE sizeof(VBGLIOCIDCDISCONNECT)
|
---|
864 | #define VBGL_IOCTL_IDC_DISCONNECT_SIZE_IN sizeof(VBGLIOCIDCDISCONNECT)
|
---|
865 | #define VBGL_IOCTL_IDC_DISCONNECT_SIZE_OUT sizeof(VBGLREQHDR)
|
---|
866 | typedef struct VBGLIOCIDCDISCONNECT
|
---|
867 | {
|
---|
868 | /** The header. */
|
---|
869 | VBGLREQHDR Hdr;
|
---|
870 | union
|
---|
871 | {
|
---|
872 | struct
|
---|
873 | {
|
---|
874 | /** The session handle for platforms where this is needed. */
|
---|
875 | #if ARCH_BITS >= 32
|
---|
876 | void RT_FAR *pvSession;
|
---|
877 | #else
|
---|
878 | uint32_t pvSession;
|
---|
879 | #endif
|
---|
880 | } In;
|
---|
881 | } u;
|
---|
882 | } VBGLIOCIDCDISCONNECT, RT_FAR *PVBGLIOCIDCDISCONNECT;
|
---|
883 | AssertCompileSize(VBGLIOCIDCDISCONNECT, 24 + (ARCH_BITS == 64 ? 8 : 4));
|
---|
884 | /** @} */
|
---|
885 |
|
---|
886 |
|
---|
887 | #if !defined(RT_OS_WINDOWS) && !defined(RT_OS_OS2)
|
---|
888 | RT_C_DECLS_BEGIN
|
---|
889 | /**
|
---|
890 | * The VBoxGuest IDC entry point.
|
---|
891 | *
|
---|
892 | * @returns VBox status code.
|
---|
893 | * @param pvSession The session.
|
---|
894 | * @param uReq The request code.
|
---|
895 | * @param pReqHdr The request.
|
---|
896 | * @param cbReq The request size.
|
---|
897 | */
|
---|
898 | int VBOXCALL VBoxGuestIDC(void RT_FAR *pvSession, uintptr_t uReq, PVBGLREQHDR pReqHdr, size_t cbReq);
|
---|
899 | RT_C_DECLS_END
|
---|
900 | #endif
|
---|
901 |
|
---|
902 |
|
---|
903 | #if defined(RT_OS_LINUX) || defined(RT_OS_SOLARIS) || defined(RT_OS_FREEBSD)
|
---|
904 |
|
---|
905 | /* Private IOCtls between user space and the kernel video driver. DRM private
|
---|
906 | * IOCtls always have the type 'd' and a number between 0x40 and 0x99 (0x9F?) */
|
---|
907 |
|
---|
908 | # define VBOX_DRM_IOCTL(a) (0x40 + DRM_VBOX_ ## a)
|
---|
909 |
|
---|
910 | /** Stop using HGSMI in the kernel driver until it is re-enabled, so that a
|
---|
911 | * user-space driver can use it. It must be re-enabled before the kernel
|
---|
912 | * driver can be used again in a sensible way. */
|
---|
913 | /** @note These IOCtls was removed from the code, but are left here as
|
---|
914 | * templates as we may need similar ones in future. */
|
---|
915 | # define DRM_VBOX_DISABLE_HGSMI 0
|
---|
916 | # define DRM_IOCTL_VBOX_DISABLE_HGSMI VBOX_DRM_IOCTL(DISABLE_HGSMI)
|
---|
917 | # define VBOXVIDEO_IOCTL_DISABLE_HGSMI _IO('d', DRM_IOCTL_VBOX_DISABLE_HGSMI)
|
---|
918 | /** Enable HGSMI in the kernel driver after it was previously disabled. */
|
---|
919 | # define DRM_VBOX_ENABLE_HGSMI 1
|
---|
920 | # define DRM_IOCTL_VBOX_ENABLE_HGSMI VBOX_DRM_IOCTL(ENABLE_HGSMI)
|
---|
921 | # define VBOXVIDEO_IOCTL_ENABLE_HGSMI _IO('d', DRM_IOCTL_VBOX_ENABLE_HGSMI)
|
---|
922 |
|
---|
923 | #endif /* RT_OS_LINUX || RT_OS_SOLARIS || RT_OS_FREEBSD */
|
---|
924 |
|
---|
925 | #endif /* !defined(IN_RC) && !defined(IN_RING0_AGNOSTIC) && !defined(IPRT_NO_CRT) */
|
---|
926 |
|
---|
927 | /** @} */
|
---|
928 |
|
---|
929 | /** @} */
|
---|
930 | #endif
|
---|
931 |
|
---|