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