VirtualBox

source: vbox/trunk/include/VBox/VBoxGuest.h@ 76410

Last change on this file since 76410 was 75706, checked in by vboxsync, 6 years ago

VBoxGuest.h: Darwin now has a vboxguestu device too. bugref:4686

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 39.1 KB
Line 
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 63.
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# if defined(RT_OS_DARWIN)
158# define VBOXGUEST_DEVICE_NAME "/dev/vboxguest"
159# define VBOXGUEST_USER_DEVICE_NAME "/dev/vboxguestu"
160# endif
161
162#endif
163
164/** @todo It would be nice if we could have two defines without paths. */
165
166/** @def VBOXGUEST_DEVICE_NAME
167 * The support device name. */
168#ifndef VBOXGUEST_DEVICE_NAME /* PORTME */
169# define VBOXGUEST_DEVICE_NAME "/dev/vboxguest"
170#endif
171
172/** @def VBOXGUEST_USER_DEVICE_NAME
173 * The support device name of the user accessible device node. */
174#ifndef VBOXGUEST_USER_DEVICE_NAME
175# define VBOXGUEST_USER_DEVICE_NAME VBOXGUEST_DEVICE_NAME
176#endif
177
178
179/**
180 * The VBoxGuest I/O control version.
181 *
182 * As usual, the high word contains the major version and changes to it
183 * signifies incompatible changes.
184 *
185 * The lower word is the minor version number, it is increased when new
186 * functions are added or existing changed in a backwards compatible manner.
187 */
188#define VBGL_IOC_VERSION UINT32_C(0x00010000)
189
190
191
192/** @name VBGL_IOCTL_DRIVER_INFO
193 * Adjust and get driver information.
194 *
195 * @note May switch the session to a backwards compatible interface version if
196 * uClientVersion indicates older client code.
197 *
198 * @{
199 */
200#define VBGL_IOCTL_DRIVER_VERSION_INFO VBGL_IOCTL_CODE_SIZE(0, VBGL_IOCTL_DRIVER_VERSION_INFO_SIZE)
201#define VBGL_IOCTL_DRIVER_VERSION_INFO_SIZE sizeof(VBGLIOCDRIVERVERSIONINFO)
202#define VBGL_IOCTL_DRIVER_VERSION_INFO_SIZE_IN RT_UOFFSET_AFTER(VBGLIOCDRIVERVERSIONINFO, u.In)
203#define VBGL_IOCTL_DRIVER_VERSION_INFO_SIZE_OUT sizeof(VBGLIOCDRIVERVERSIONINFO)
204typedef struct VBGLIOCDRIVERVERSIONINFO
205{
206 /** The header. */
207 VBGLREQHDR Hdr;
208 union
209 {
210 struct
211 {
212 /** The requested interface version number (VBGL_IOC_VERSION). */
213 uint32_t uReqVersion;
214 /** The minimum interface version number
215 * (typically the major version part of VBGL_IOC_VERSION). */
216 uint32_t uMinVersion;
217 /** Reserved, MBZ. */
218 uint32_t uReserved1;
219 /** Reserved, MBZ. */
220 uint32_t uReserved2;
221 } In;
222 struct
223 {
224 /** Interface version for this session (typically VBGL_IOC_VERSION). */
225 uint32_t uSessionVersion;
226 /** The version of the IDC interface (VBGL_IOC_VERSION). */
227 uint32_t uDriverVersion;
228 /** The SVN revision of the driver.
229 * This will be set to 0 if not compiled into the driver. */
230 uint32_t uDriverRevision;
231 /** Reserved \#1 (will be returned as zero until defined). */
232 uint32_t uReserved1;
233 /** Reserved \#2 (will be returned as zero until defined). */
234 uint32_t uReserved2;
235 } Out;
236 } u;
237} VBGLIOCDRIVERVERSIONINFO, RT_FAR *PVBGLIOCDRIVERVERSIONINFO;
238AssertCompileSize(VBGLIOCDRIVERVERSIONINFO, 24 + 20);
239#if !defined(__GNUC__) /* Some GCC versions can't handle the complicated RT_UOFFSET_AFTER macro, it seems. */ \
240 && (!defined(RT_OS_OS2) || (!defined(__IBMC__) && !defined(__IBMCPP__) && (!defined(__WATCOMC__) || !defined(__cplusplus))))
241AssertCompile(VBGL_IOCTL_DRIVER_VERSION_INFO_SIZE_IN == 24 + 16);
242#endif
243/** @} */
244
245
246/** @name VBGL_IOCTL_GET_PORT_INFO
247 * Query VMMDev I/O port region and MMIO mapping address.
248 * @remarks Ring-0 only.
249 * @{
250 */
251#define VBGL_IOCTL_GET_VMMDEV_IO_INFO VBGL_IOCTL_CODE_SIZE(1, VBGL_IOCTL_GET_VMMDEV_IO_INFO_SIZE)
252#define VBGL_IOCTL_GET_VMMDEV_IO_INFO_SIZE sizeof(VBGLIOCGETVMMDEVIOINFO)
253#define VBGL_IOCTL_GET_VMMDEV_IO_INFO_SIZE_IN sizeof(VBGLREQHDR)
254#define VBGL_IOCTL_GET_VMMDEV_IO_INFO_SIZE_OUT sizeof(VBGLIOCGETVMMDEVIOINFO)
255typedef struct VBGLIOCGETVMMDEVIOINFO
256{
257 /** The header. */
258 VBGLREQHDR Hdr;
259 union
260 {
261 struct
262 {
263 /** The MMIO mapping. NULL if no MMIO region. */
264 struct VMMDevMemory volatile RT_FAR *pvVmmDevMapping;
265 /** The I/O port address. */
266 RTIOPORT IoPort;
267 /** Padding, ignore. */
268 RTIOPORT auPadding[HC_ARCH_BITS == 64 ? 3 : 1];
269 } Out;
270 } u;
271} VBGLIOCGETVMMDEVIOINFO, RT_FAR *PVBGLIOCGETVMMDEVIOINFO;
272AssertCompileSize(VBGLIOCGETVMMDEVIOINFO, 24 + (HC_ARCH_BITS == 64 ? 16 : 8));
273/** @} */
274
275
276/** @name VBGL_IOCTL_VMMDEV_REQUEST
277 * IOCTL to VBoxGuest to perform a VMM Device request less than 1KB in size.
278 * @{
279 */
280#define VBGL_IOCTL_VMMDEV_REQUEST(a_cb) VBGL_IOCTL_CODE_SIZE(2, (a_cb))
281/** @} */
282
283
284/** @name VBGL_IOCTL_VMMDEV_REQUEST_BIG
285 * IOCTL to VBoxGuest to perform a VMM Device request that can 1KB or larger.
286 * @{
287 */
288#define VBGL_IOCTL_VMMDEV_REQUEST_BIG VBGL_IOCTL_CODE_BIG(3)
289/** @} */
290
291#ifdef VBOX_WITH_HGCM
292
293/** @name VBGL_IOCTL_HGCM_CONNECT
294 * Connect to a HGCM service.
295 * @{ */
296# define VBGL_IOCTL_HGCM_CONNECT VBGL_IOCTL_CODE_SIZE(4, VBGL_IOCTL_HGCM_CONNECT_SIZE)
297# define VBGL_IOCTL_HGCM_CONNECT_SIZE sizeof(VBGLIOCHGCMCONNECT)
298# define VBGL_IOCTL_HGCM_CONNECT_SIZE_IN sizeof(VBGLIOCHGCMCONNECT)
299# define VBGL_IOCTL_HGCM_CONNECT_SIZE_OUT RT_UOFFSET_AFTER(VBGLIOCHGCMCONNECT, u.Out)
300typedef struct VBGLIOCHGCMCONNECT
301{
302 /** The header. */
303 VBGLREQHDR Hdr;
304 union
305 {
306 struct
307 {
308 HGCMServiceLocation Loc;
309 } In;
310 struct
311 {
312 uint32_t idClient;
313 } Out;
314 } u;
315} VBGLIOCHGCMCONNECT, RT_FAR *PVBGLIOCHGCMCONNECT;
316AssertCompileSize(VBGLIOCHGCMCONNECT, 24 + 132);
317#if !defined(__GNUC__) /* Some GCC versions can't handle the complicated RT_UOFFSET_AFTER macro, it seems. */ \
318 && (!defined(RT_OS_OS2) || (!defined(__IBMC__) && !defined(__IBMCPP__) && (!defined(__WATCOMC__) || !defined(__cplusplus))))
319AssertCompile(VBGL_IOCTL_HGCM_CONNECT_SIZE_OUT == 24 + 4);
320#endif
321/** @} */
322
323
324/** @name VBGL_IOCTL_HGCM_DISCONNECT
325 * Disconnect from a HGCM service.
326 * @{ */
327# define VBGL_IOCTL_HGCM_DISCONNECT VBGL_IOCTL_CODE_SIZE(5, VBGL_IOCTL_HGCM_DISCONNECT_SIZE)
328# define VBGL_IOCTL_HGCM_DISCONNECT_SIZE sizeof(VBGLIOCHGCMDISCONNECT)
329# define VBGL_IOCTL_HGCM_DISCONNECT_SIZE_IN sizeof(VBGLIOCHGCMDISCONNECT)
330# define VBGL_IOCTL_HGCM_DISCONNECT_SIZE_OUT sizeof(VBGLREQHDR)
331/** @note This is also used by a VbglR0 API. */
332typedef struct VBGLIOCHGCMDISCONNECT
333{
334 /** The header. */
335 VBGLREQHDR Hdr;
336 union
337 {
338 struct
339 {
340 uint32_t idClient;
341 } In;
342 } u;
343} VBGLIOCHGCMDISCONNECT, RT_FAR *PVBGLIOCHGCMDISCONNECT;
344AssertCompileSize(VBGLIOCHGCMDISCONNECT, 24 + 4);
345/** @} */
346
347
348/** @name VBGL_IOCTL_HGCM_CALL, VBGL_IOCTL_HGCM_CALL_WITH_USER_DATA
349 *
350 * Make a call to a HGCM service. There are several variations here.
351 *
352 * The VBGL_IOCTL_HGCM_CALL_WITH_USER_DATA variation is for other drivers (like
353 * the graphics ones) passing on requests from user land that contains user
354 * data. These calls are always interruptible.
355 *
356 * @{ */
357# define VBGL_IOCTL_HGCM_CALL_32(a_cb) VBGL_IOCTL_CODE_SIZE(6, (a_cb))
358# define VBGL_IOCTL_HGCM_CALL_64(a_cb) VBGL_IOCTL_CODE_SIZE(7, (a_cb))
359# if ARCH_BITS == 64
360# define VBGL_IOCTL_HGCM_CALL(a_cb) VBGL_IOCTL_HGCM_CALL_64(a_cb)
361# else
362# define VBGL_IOCTL_HGCM_CALL(a_cb) VBGL_IOCTL_HGCM_CALL_32(a_cb)
363# endif
364# define VBGL_IOCTL_HGCM_CALL_WITH_USER_DATA(a_cb) VBGL_IOCTL_CODE_SIZE(8, (a_cb))
365/** @} */
366
367
368/** @name VBGL_IOCTL_IDC_HGCM_FAST_CALL
369 *
370 * Variant of VBGL_IOCTL_HGCM_CALL for drivers that submits the request as-is to
371 * the host and handles the waiting, the caller does all the rest.
372 *
373 * @note ring-0 only.
374 * @note Size is not encoded in the I/O control code.
375 * @{
376 */
377#define VBGL_IOCTL_IDC_HGCM_FAST_CALL VBGL_IOCTL_CODE_SIZE(62, sizeof(VBGLIOCIDCHGCMFASTCALL))
378#define VBGL_IOCTL_IDC_HGCM_FAST_CALL_SIZE(a_cb) (a_cb)
379#define VBGL_IOCTL_IDC_HGCM_FAST_CALL_SIZE_IN(a_cb) (a_cb)
380#define VBGL_IOCTL_IDC_HGCM_FAST_CALL_SIZE_OUT(a_cb) (a_cb)
381#pragma pack(4) /* Want it to fit nicely with the 44 byte VMMDevHGCMCall and optimally align 64-bit parameters structures. */
382typedef struct VBGLIOCIDCHGCMFASTCALL
383{
384 /** The header. */
385 VBGLREQHDR Hdr;
386 /** The physical address of the following VMMDevHGCMCall structure. */
387 RTGCPHYS32 GCPhysReq;
388 /** Set if interruptible. */
389 bool fInterruptible;
390 /** Reserved. */
391 uint8_t abReserved0[3];
392 uint64_t uTimestamp[2];
393 uint8_t abReserved1[4];
394 /* After this structure follows a VMMDevHGCMCall strcuture (44 bytes), then
395 zero or more HGCMFunctionParameter structures (12 or 16 bytes), and finally
396 page lists and embedded buffers. */
397} VBGLIOCIDCHGCMFASTCALL, RT_FAR *PVBGLIOCIDCHGCMFASTCALL;
398#pragma pack()
399AssertCompileSize(VBGLIOCIDCHGCMFASTCALL, /* 24 + 4 + 1 + 3 + 2*8 + 4 = 0x34 (52) = */ 0x34);
400
401/**
402 * Macro for initializing VBGLIOCIDCHGCMFASTCALL and the following
403 * VMMDevHGCMCall structures.
404 *
405 * @param a_pHdr The request header to initialize.
406 * @param a_HdrPhys The 32-bit physical address corresponding to @a a_pHdr.
407 * @param a_pCall Pointer to the VMMDevHGCMCall structure.
408 * @param a_idClient The HGCM client ID.
409 * @param a_uFunction The HGCM function number.
410 * @param a_cParms The number of parameters following @a a_pCall.
411 * @param a_cbReq The size of the whole request.
412 */
413#define VBGLIOCIDCHGCMFASTCALL_INIT(a_pHdr, a_HdrPhys, a_pCall, a_idClient, a_uFunction, a_cParms, a_cbReq) \
414 do { \
415 Assert((uintptr_t)(a_pHdr) + sizeof(VBGLIOCIDCHGCMFASTCALL) == (uintptr_t)(a_pCall)); \
416 VBGLREQHDR_INIT_EX(&(a_pHdr)->Hdr, a_cbReq, a_cbReq); \
417 pReq->Hdr.GCPhysReq = (a_HdrPhys) + sizeof(VBGLIOCIDCHGCMFASTCALL); \
418 pReq->Hdr.fInterruptible = false; \
419 \
420 (a_pCall)->header.header.size = (a_cbReq) - sizeof(VBGLIOCIDCHGCMFASTCALL); \
421 (a_pCall)->header.header.version = VBGLREQHDR_VERSION; \
422 (a_pCall)->header.header.requestType= (ARCH_BITS == 32 ? VMMDevReq_HGCMCall32 : VMMDevReq_HGCMCall64); \
423 (a_pCall)->header.header.rc = VERR_INTERNAL_ERROR; \
424 (a_pCall)->header.header.reserved1 = 0; \
425 (a_pCall)->header.header.fRequestor = VMMDEV_REQUESTOR_KERNEL | VMMDEV_REQUESTOR_USR_DRV_OTHER \
426 | VMMDEV_REQUESTOR_CON_DONT_KNOW | VMMDEV_REQUESTOR_TRUST_NOT_GIVEN; \
427 (a_pCall)->header.fu32Flags = 0; \
428 (a_pCall)->header.result = VERR_INTERNAL_ERROR; \
429 (a_pCall)->u32ClientID = (a_idClient); \
430 (a_pCall)->u32Function = (a_uFunction); \
431 (a_pCall)->cParms = (a_cParms); \
432 } while (0)
433
434
435/** @} */
436
437#endif /* VBOX_WITH_HGCM */
438
439
440/** @name VBGL_IOCTL_LOG
441 * IOCTL to VBoxGuest to perform backdoor logging.
442 * @{ */
443#define VBOXGUEST_IOCTL_LOG(Size)
444#define VBGL_IOCTL_LOG(a_cchMsg) VBGL_IOCTL_CODE_BIG(9)
445#define VBGL_IOCTL_LOG_SIZE(a_cchMsg) (sizeof(VBGLREQHDR) + (a_cchMsg) + 1)
446#define VBGL_IOCTL_LOG_SIZE_IN(a_cchMsg) (sizeof(VBGLREQHDR) + (a_cchMsg) + 1)
447#define VBGL_IOCTL_LOG_SIZE_OUT sizeof(VBGLREQHDR)
448typedef struct VBGLIOCLOG
449{
450 /** The header. */
451 VBGLREQHDR Hdr;
452 union
453 {
454 struct
455 {
456 /** The log message.
457 * The length is determined from the input size and zero termination. */
458 char szMsg[RT_FLEXIBLE_ARRAY_IN_NESTED_UNION];
459 } In;
460 } u;
461} VBGLIOCLOG, RT_FAR *PVBGLIOCLOG;
462/** @} */
463
464
465/** @name VBGL_IOCTL_WAIT_FOR_EVENTS
466 * Wait for a VMMDev host event notification.
467 * @{
468 */
469#define VBGL_IOCTL_WAIT_FOR_EVENTS VBGL_IOCTL_CODE_SIZE(10, VBGL_IOCTL_WAIT_FOR_EVENTS_SIZE)
470#define VBGL_IOCTL_WAIT_FOR_EVENTS_SIZE sizeof(VBGLIOCWAITFOREVENTS)
471#define VBGL_IOCTL_WAIT_FOR_EVENTS_SIZE_IN sizeof(VBGLIOCWAITFOREVENTS)
472#define VBGL_IOCTL_WAIT_FOR_EVENTS_SIZE_OUT RT_UOFFSET_AFTER(VBGLIOCWAITFOREVENTS, u.Out)
473typedef struct VBGLIOCWAITFOREVENTS
474{
475 /** The header. */
476 VBGLREQHDR Hdr;
477 union
478 {
479 struct
480 {
481 /** Timeout in milliseconds. */
482 uint32_t cMsTimeOut;
483 /** Events to wait for. */
484 uint32_t fEvents;
485 } In;
486 struct
487 {
488 /** Events that occurred. */
489 uint32_t fEvents;
490 } Out;
491 } u;
492} VBGLIOCWAITFOREVENTS, RT_FAR *PVBGLIOCWAITFOREVENTS;
493AssertCompileSize(VBGLIOCWAITFOREVENTS, 24 + 8);
494/** @} */
495
496
497/** @name VBGL_IOCTL_INTERRUPT_ALL_WAIT_FOR_EVENTS
498 * IOCTL to VBoxGuest to interrupt (cancel) any pending
499 * VBGL_IOCTL_WAIT_FOR_EVENTS and return.
500 *
501 * Handled inside the guest additions and not seen by the host at all.
502 * After calling this, VBGL_IOCTL_WAIT_FOR_EVENTS should no longer be called in
503 * the same session. At the time of writing this is not enforced; at the time
504 * of reading it may be.
505 * @see VBGL_IOCTL_WAIT_FOR_EVENTS
506 *
507 * @{
508 */
509#define VBGL_IOCTL_INTERRUPT_ALL_WAIT_FOR_EVENTS VBGL_IOCTL_CODE_SIZE(11, VBGL_IOCTL_INTERRUPT_ALL_WAIT_FOR_EVENTS_SIZE)
510#define VBGL_IOCTL_INTERRUPT_ALL_WAIT_FOR_EVENTS_SIZE sizeof(VBGLREQHDR)
511#define VBGL_IOCTL_INTERRUPT_ALL_WAIT_FOR_EVENTS_SIZE_IN sizeof(VBGLREQHDR)
512#define VBGL_IOCTL_INTERRUPT_ALL_WAIT_FOR_EVENTS_SIZE_OUT sizeof(VBGLREQHDR)
513/** @} */
514
515
516/** @name VBGL_IOCTL_CHANGE_FILTER_MASK
517 * IOCTL to VBoxGuest to control the event filter mask.
518 * @{ */
519#define VBGL_IOCTL_CHANGE_FILTER_MASK VBGL_IOCTL_CODE_SIZE(12, VBGL_IOCTL_CHANGE_FILTER_MASK_SIZE)
520#define VBGL_IOCTL_CHANGE_FILTER_MASK_SIZE sizeof(VBGLIOCCHANGEFILTERMASK)
521#define VBGL_IOCTL_CHANGE_FILTER_MASK_SIZE_IN sizeof(VBGLIOCCHANGEFILTERMASK)
522#define VBGL_IOCTL_CHANGE_FILTER_MASK_SIZE_OUT sizeof(VBGLREQHDR)
523typedef struct VBGLIOCCHANGEFILTERMASK
524{
525 /** The header. */
526 VBGLREQHDR Hdr;
527 union
528 {
529 struct
530 {
531 /** Flags to set. */
532 uint32_t fOrMask;
533 /** Flags to remove. */
534 uint32_t fNotMask;
535 } In;
536 } u;
537} VBGLIOCCHANGEFILTERMASK, RT_FAR *PVBGLIOCCHANGEFILTERMASK;
538AssertCompileSize(VBGLIOCCHANGEFILTERMASK, 24 + 8);
539/** @} */
540
541
542/** @name VBGL_IOCTL_GUEST_CAPS_ACQUIRE
543 * IOCTL to for acquiring and releasing guest capabilities.
544 *
545 * This is used for multiple purposes:
546 * 1. By doing @a acquire r3 client application (e.g. VBoxTray) claims it will
547 * use the given session for performing operations like @a seamless or
548 * @a auto-resize, thus, if the application terminates, the driver will
549 * automatically cleanup the caps reported to host, so that host knows guest
550 * does not support them anymore
551 * 2. In a multy-user environment this will not allow r3 applications (like
552 * VBoxTray) running in different user sessions simultaneously to interfere
553 * with each other. An r3 client application (like VBoxTray) is responsible
554 * for Acquiring/Releasing caps properly as needed.
555 *
556 *
557 * VERR_RESOURCE_BUSY is returned if any capabilities in the fOrMask are
558 * currently acquired by some other VBoxGuest session.
559 *
560 * @{
561 */
562#define VBGL_IOCTL_ACQUIRE_GUEST_CAPABILITIES VBGL_IOCTL_CODE_SIZE(13, VBGL_IOCTL_ACQUIRE_GUEST_CAPABILITIES_SIZE)
563#define VBGL_IOCTL_ACQUIRE_GUEST_CAPABILITIES_SIZE sizeof(VBGLIOCACQUIREGUESTCAPS)
564#define VBGL_IOCTL_ACQUIRE_GUEST_CAPABILITIES_SIZE_IN sizeof(VBGLIOCACQUIREGUESTCAPS)
565#define VBGL_IOCTL_ACQUIRE_GUEST_CAPABILITIES_SIZE_OUT sizeof(VBGLREQHDR)
566
567/** Default operation (full acquire/release). */
568#define VBGL_IOC_AGC_FLAGS_DEFAULT UINT32_C(0x00000000)
569/** Configures VBoxGuest to use the specified caps in Acquire mode, w/o making
570 * any caps acquisition/release. This is only possible to set acquire mode for
571 * caps, but not clear it, so fNotMask is ignored when this flag is set. */
572#define VBGL_IOC_AGC_FLAGS_CONFIG_ACQUIRE_MODE UINT32_C(0x00000001)
573/** Valid flag mask. */
574#define VBGL_IOC_AGC_FLAGS_VALID_MASK UINT32_C(0x00000001)
575
576typedef struct VBGLIOCACQUIREGUESTCAPS
577{
578 /** The header. */
579 VBGLREQHDR Hdr;
580 union
581 {
582 struct
583 {
584 /** Acquire flags (VBGL_IOC_AGC_FLAGS_XXX). */
585 uint32_t fFlags;
586 /** Guest capabilities to acquire (VMMDEV_GUEST_SUPPORTS_XXX). */
587 uint32_t fOrMask;
588 /** Guest capabilities to release (VMMDEV_GUEST_SUPPORTS_XXX). */
589 uint32_t fNotMask;
590 } In;
591 } u;
592} VBGLIOCACQUIREGUESTCAPS, RT_FAR *PVBGLIOCACQUIREGUESTCAPS;
593AssertCompileSize(VBGLIOCACQUIREGUESTCAPS, 24 + 12);
594/** @} */
595
596
597/** @name VBGL_IOCTL_CHANGE_GUEST_CAPABILITIES
598 * IOCTL to VBoxGuest to set guest capabilities.
599 * @{ */
600#define VBGL_IOCTL_CHANGE_GUEST_CAPABILITIES VBGL_IOCTL_CODE_SIZE(14, VBGL_IOCTL_CHANGE_GUEST_CAPABILITIES_SIZE)
601#define VBGL_IOCTL_CHANGE_GUEST_CAPABILITIES_SIZE sizeof(VBGLIOCSETGUESTCAPS)
602#define VBGL_IOCTL_CHANGE_GUEST_CAPABILITIES_SIZE_IN sizeof(VBGLIOCSETGUESTCAPS)
603#define VBGL_IOCTL_CHANGE_GUEST_CAPABILITIES_SIZE_OUT sizeof(VBGLIOCSETGUESTCAPS)
604typedef struct VBGLIOCSETGUESTCAPS
605{
606 /** The header. */
607 VBGLREQHDR Hdr;
608 union
609 {
610 struct
611 {
612 /** The capabilities to set (VMMDEV_GUEST_SUPPORTS_XXX). */
613 uint32_t fOrMask;
614 /** The capabilities to drop (VMMDEV_GUEST_SUPPORTS_XXX). */
615 uint32_t fNotMask;
616 } In;
617 struct
618 {
619 /** The capabilities held by the session after the call (VMMDEV_GUEST_SUPPORTS_XXX). */
620 uint32_t fSessionCaps;
621 /** The capabilities for all the sessions after the call (VMMDEV_GUEST_SUPPORTS_XXX). */
622 uint32_t fGlobalCaps;
623 } Out;
624 } u;
625} VBGLIOCSETGUESTCAPS, RT_FAR *PVBGLIOCSETGUESTCAPS;
626AssertCompileSize(VBGLIOCSETGUESTCAPS, 24 + 8);
627typedef VBGLIOCSETGUESTCAPS VBoxGuestSetCapabilitiesInfo;
628/** @} */
629
630
631/** @name VBGL_IOCTL_SET_MOUSE_STATUS
632 * IOCTL to VBoxGuest to update the mouse status features.
633 * @{ */
634#define VBGL_IOCTL_SET_MOUSE_STATUS VBGL_IOCTL_CODE_SIZE(15, VBGL_IOCTL_SET_MOUSE_STATUS_SIZE)
635#define VBGL_IOCTL_SET_MOUSE_STATUS_SIZE sizeof(VBGLIOCSETMOUSESTATUS)
636#define VBGL_IOCTL_SET_MOUSE_STATUS_SIZE_IN sizeof(VBGLIOCSETMOUSESTATUS)
637#define VBGL_IOCTL_SET_MOUSE_STATUS_SIZE_OUT sizeof(VBGLREQHDR)
638typedef struct VBGLIOCSETMOUSESTATUS
639{
640 /** The header. */
641 VBGLREQHDR Hdr;
642 union
643 {
644 struct
645 {
646 /** Mouse status flags (VMMDEV_MOUSE_XXX). */
647 uint32_t fStatus;
648 } In;
649 } u;
650} VBGLIOCSETMOUSESTATUS, RT_FAR *PVBGLIOCSETMOUSESTATUS;
651/** @} */
652
653
654/** @name VBGL_IOCTL_SET_MOUSE_NOTIFY_CALLBACK
655 *
656 * IOCTL to for setting the mouse driver callback.
657 * @note The callback will be called in interrupt context with the VBoxGuest
658 * device event spinlock held.
659 * @note ring-0 only.
660 *
661 * @{ */
662#define VBGL_IOCTL_SET_MOUSE_NOTIFY_CALLBACK VBGL_IOCTL_CODE_SIZE(16, VBGL_IOCTL_SET_MOUSE_NOTIFY_CALLBACK_SIZE)
663#define VBGL_IOCTL_SET_MOUSE_NOTIFY_CALLBACK_SIZE sizeof(VBGLIOCSETMOUSENOTIFYCALLBACK)
664#define VBGL_IOCTL_SET_MOUSE_NOTIFY_CALLBACK_SIZE_IN sizeof(VBGLIOCSETMOUSENOTIFYCALLBACK)
665#define VBGL_IOCTL_SET_MOUSE_NOTIFY_CALLBACK_SIZE_OUT sizeof(VBGLREQHDR)
666typedef struct VBGLIOCSETMOUSENOTIFYCALLBACK
667{
668 /** The header. */
669 VBGLREQHDR Hdr;
670 union
671 {
672 struct
673 {
674 /** Mouse notification callback function. */
675 PFNVBOXGUESTMOUSENOTIFY pfnNotify;
676 /** The callback argument. */
677 void RT_FAR *pvUser;
678 } In;
679 } u;
680} VBGLIOCSETMOUSENOTIFYCALLBACK, RT_FAR *PVBGLIOCSETMOUSENOTIFYCALLBACK;
681/** @} */
682
683
684/** @name VBGL_IOCTL_CHECK_BALLOON
685 * IOCTL to VBoxGuest to check memory ballooning.
686 *
687 * The guest kernel module / device driver will ask the host for the current size of
688 * the balloon and adjust the size. Or it will set fHandledInR0 = false and R3 is
689 * responsible for allocating memory and calling R0 (VBGL_IOCTL_CHANGE_BALLOON).
690 * @{ */
691#define VBGL_IOCTL_CHECK_BALLOON VBGL_IOCTL_CODE_SIZE(17, VBGL_IOCTL_CHECK_BALLOON_SIZE)
692#define VBGL_IOCTL_CHECK_BALLOON_SIZE sizeof(VBGLIOCCHECKBALLOON)
693#define VBGL_IOCTL_CHECK_BALLOON_SIZE_IN sizeof(VBGLREQHDR)
694#define VBGL_IOCTL_CHECK_BALLOON_SIZE_OUT sizeof(VBGLIOCCHECKBALLOON)
695typedef struct VBGLIOCCHECKBALLOON
696{
697 /** The header. */
698 VBGLREQHDR Hdr;
699 union
700 {
701 struct
702 {
703 /** The size of the balloon in chunks of 1MB. */
704 uint32_t cBalloonChunks;
705 /** false = handled in R0, no further action required.
706 * true = allocate balloon memory in R3. */
707 bool fHandleInR3;
708 /** Explicit padding, please ignore. */
709 bool afPadding[3];
710 } Out;
711 } u;
712} VBGLIOCCHECKBALLOON, RT_FAR *PVBGLIOCCHECKBALLOON;
713AssertCompileSize(VBGLIOCCHECKBALLOON, 24 + 8);
714typedef VBGLIOCCHECKBALLOON VBoxGuestCheckBalloonInfo;
715/** @} */
716
717
718/** @name VBGL_IOCTL_CHANGE_BALLOON
719 * IOCTL to VBoxGuest to supply or revoke one chunk for ballooning.
720 *
721 * The guest kernel module / device driver will lock down supplied memory or
722 * unlock reclaimed memory and then forward the physical addresses of the
723 * changed balloon chunk to the host.
724 *
725 * @{ */
726#define VBGL_IOCTL_CHANGE_BALLOON VBGL_IOCTL_CODE_SIZE(18, VBGL_IOCTL_CHANGE_BALLOON_SIZE)
727#define VBGL_IOCTL_CHANGE_BALLOON_SIZE sizeof(VBGLIOCCHANGEBALLOON)
728#define VBGL_IOCTL_CHANGE_BALLOON_SIZE_IN sizeof(VBGLIOCCHANGEBALLOON)
729#define VBGL_IOCTL_CHANGE_BALLOON_SIZE_OUT sizeof(VBGLREQHDR)
730typedef struct VBGLIOCCHANGEBALLOON
731{
732 /** The header. */
733 VBGLREQHDR Hdr;
734 union
735 {
736 struct
737 {
738 /** Address of the chunk (user space address). */
739 RTR3PTR pvChunk;
740 /** Explicit alignment padding, MBZ. */
741 uint8_t abPadding[ARCH_BITS == 64 ? 0 + 7 : 4 + 7];
742 /** true = inflate, false = deflate. */
743 bool fInflate;
744 } In;
745 } u;
746} VBGLIOCCHANGEBALLOON, RT_FAR *PVBGLIOCCHANGEBALLOON;
747AssertCompileSize(VBGLIOCCHANGEBALLOON, 24+16);
748/** @} */
749
750
751/** @name VBGL_IOCTL_WRITE_CORE_DUMP
752 * IOCTL to VBoxGuest to write guest core.
753 * @{ */
754#define VBGL_IOCTL_WRITE_CORE_DUMP VBGL_IOCTL_CODE_SIZE(19, VBGL_IOCTL_WRITE_CORE_DUMP_SIZE)
755#define VBGL_IOCTL_WRITE_CORE_DUMP_SIZE sizeof(VBGLIOCWRITECOREDUMP)
756#define VBGL_IOCTL_WRITE_CORE_DUMP_SIZE_IN sizeof(VBGLIOCWRITECOREDUMP)
757#define VBGL_IOCTL_WRITE_CORE_DUMP_SIZE_OUT sizeof(VBGLREQHDR)
758typedef struct VBGLIOCWRITECOREDUMP
759{
760 /** The header. */
761 VBGLREQHDR Hdr;
762 union
763 {
764 struct
765 {
766 /** Flags (reserved, MBZ). */
767 uint32_t fFlags;
768 } In;
769 } u;
770} VBGLIOCWRITECOREDUMP, RT_FAR *PVBGLIOCWRITECOREDUMP;
771AssertCompileSize(VBGLIOCWRITECOREDUMP, 24 + 4);
772typedef VBGLIOCWRITECOREDUMP VBoxGuestWriteCoreDump;
773/** @} */
774
775
776#ifdef VBOX_WITH_DPC_LATENCY_CHECKER
777/** @name VBGL_IOCTL_DPC_LATENCY_CHECKER
778 * IOCTL to VBoxGuest to perform DPC latency tests, printing the result in
779 * the release log on the host. Takes no data, returns no data.
780 * @{ */
781# define VBGL_IOCTL_DPC_LATENCY_CHECKER VBGL_IOCTL_CODE_SIZE(20, VBGL_IOCTL_DPC_LATENCY_CHECKER_SIZE)
782# define VBGL_IOCTL_DPC_LATENCY_CHECKER_SIZE sizeof(VBGLREQHDR)
783# define VBGL_IOCTL_DPC_LATENCY_CHECKER_SIZE_IN sizeof(VBGLREQHDR)
784# define VBGL_IOCTL_DPC_LATENCY_CHECKER_SIZE_OUT sizeof(VBGLREQHDR)
785/** @} */
786#endif
787
788
789#ifdef RT_OS_OS2
790/**
791 * The data buffer layout for the IDC entry point (AttachDD).
792 *
793 * @remark This is defined in multiple 16-bit headers / sources.
794 * Some places it's called VBGOS2IDC to short things a bit.
795 */
796typedef struct VBGLOS2ATTACHDD
797{
798 /** VBGL_IOC_VERSION. */
799 uint32_t u32Version;
800 /** Opaque session handle. */
801 uint32_t u32Session;
802
803 /**
804 * The 32-bit service entry point.
805 *
806 * @returns VBox status code.
807 * @param u32Session The session handle (PVBOXGUESTSESSION).
808 * @param iFunction The requested function.
809 * @param pReqHdr The input/output data buffer. The caller
810 * ensures that this cannot be swapped out, or that
811 * it's acceptable to take a page in fault in the
812 * current context. If the request doesn't take
813 * input or produces output, apssing NULL is okay.
814 * @param cbReq The size of the data buffer.
815 */
816# if ARCH_BITS == 32 || defined(DOXYGEN_RUNNING)
817 DECLCALLBACKMEMBER(int, pfnServiceEP)(uint32_t u32Session, unsigned iFunction, PVBGLREQHDR pReqHdr, size_t cbReq);
818# else
819 uint32_t pfnServiceEP;
820#endif
821
822 /** The 16-bit service entry point for C code (cdecl).
823 *
824 * It's the same as the 32-bit entry point, but the types has
825 * changed to 16-bit equivalents.
826 *
827 * @code
828 * int far cdecl
829 * VBoxGuestOs2IDCService16(uint32_t u32Session, uint16_t iFunction,
830 * PVBGLREQHDR fpvData, uint16_t cbData);
831 * @endcode
832 */
833# if ARCH_BITS == 16 || defined(DOXYGEN_RUNNING)
834 DECLCALLBACKMEMBER(int, fpfnServiceEP)(uint32_t u32Session, uint16_t iFunction, PVBGLREQHDR fpvData, uint16_t cbData);
835# else
836 RTFAR16 fpfnServiceEP;
837# endif
838
839 /** The 16-bit service entry point for Assembly code (register).
840 *
841 * This is just a wrapper around fpfnServiceEP to simplify calls
842 * from 16-bit assembly code.
843 *
844 * @returns (e)ax: VBox status code; cx: The amount of data returned.
845 *
846 * @param u32Session eax - The above session handle.
847 * @param iFunction dl - The requested function.
848 * @param pvData es:bx - The input/output data buffer.
849 * @param cbData cx - The size of the data buffer.
850 */
851 RTFAR16 fpfnServiceAsmEP;
852} VBGLOS2ATTACHDD;
853/** Pointer to VBOXGUESTOS2IDCCONNECT buffer. */
854typedef VBGLOS2ATTACHDD RT_FAR *PVBGLOS2ATTACHDD;
855
856/**
857 * Prototype for the 16-bit callback returned by AttachDD on OS/2.
858 * @param pAttachInfo Pointer to structure to fill in.
859 */
860# if defined(__IBMC__) || defined(__IBMCPP__)
861typedef void (* __cdecl RT_FAR_CODE PFNVBGLOS2ATTACHDD)(PVBGLOS2ATTACHDD pAttachInfo);
862# else
863typedef void (__cdecl RT_FAR_CODE *PFNVBGLOS2ATTACHDD)(PVBGLOS2ATTACHDD pAttachInfo);
864# endif
865#endif /* RT_OS_OS2 */
866
867
868/** @name VBGL_IOCL_IDC_CONNECT
869 * IDC client connect request.
870 *
871 * On platforms other than Windows and OS/2, this will also create a kernel
872 * session for the caller.
873 *
874 * @note ring-0 only.
875 * @{
876 */
877#define VBGL_IOCTL_IDC_CONNECT VBGL_IOCTL_CODE_SIZE(63, VBGL_IOCTL_IDC_CONNECT_SIZE)
878#define VBGL_IOCTL_IDC_CONNECT_SIZE sizeof(VBGLIOCIDCCONNECT)
879#define VBGL_IOCTL_IDC_CONNECT_SIZE_IN RT_UOFFSET_AFTER(VBGLIOCIDCCONNECT, u.In)
880#define VBGL_IOCTL_IDC_CONNECT_SIZE_OUT sizeof(VBGLIOCIDCCONNECT)
881typedef struct VBGLIOCIDCCONNECT
882{
883 /** The header. */
884 VBGLREQHDR Hdr;
885 /** The payload union. */
886 union
887 {
888 struct
889 {
890 /** VBGL_IOCTL_IDC_CONNECT_MAGIC_COOKIE. */
891 uint32_t u32MagicCookie;
892 /** The desired version of the I/O control interface (VBGL_IOC_VERSION). */
893 uint32_t uReqVersion;
894 /** The minimum version of the I/O control interface (VBGL_IOC_VERSION). */
895 uint32_t uMinVersion;
896 /** Reserved, MBZ. */
897 uint32_t uReserved;
898 } In;
899 struct
900 {
901 /** The session handle (opaque). */
902#if ARCH_BITS >= 32
903 void RT_FAR *pvSession;
904#else
905 uint32_t pvSession;
906#endif
907 /** The version of the I/O control interface for this session
908 * (typically VBGL_IOC_VERSION). */
909 uint32_t uSessionVersion;
910 /** The I/O control interface version for of the driver (VBGL_IOC_VERSION). */
911 uint32_t uDriverVersion;
912 /** The SVN revision of the driver.
913 * This will be set to 0 if not compiled into the driver. */
914 uint32_t uDriverRevision;
915 /** Reserved \#1 (will be returned as zero until defined). */
916 uint32_t uReserved1;
917 /** Reserved \#2 (will be returned as NULL until defined). */
918 void RT_FAR *pvReserved2;
919 } Out;
920 } u;
921} VBGLIOCIDCCONNECT, RT_FAR *PVBGLIOCIDCCONNECT;
922AssertCompileSize(VBGLIOCIDCCONNECT, 24 + 16 + (ARCH_BITS == 64 ? 8 : 4) * 2);
923#if !defined(__GNUC__) /* Some GCC versions can't handle the complicated RT_UOFFSET_AFTER macro, it seems. */ \
924 && (!defined(RT_OS_OS2) || (!defined(__IBMC__) && !defined(__IBMCPP__) && (!defined(__WATCOMC__) || !defined(__cplusplus))))
925AssertCompile(VBGL_IOCTL_IDC_CONNECT_SIZE_IN == 24 + 16);
926#endif
927#define VBGL_IOCTL_IDC_CONNECT_MAGIC_COOKIE UINT32_C(0x55aa4d5a) /**< Magic value for doing an IDC connect. */
928/** @} */
929
930
931/** @name VBGL_IOCL_IDC_DISCONNECT
932 * IDC client disconnect request.
933 *
934 * This will destroy the kernel session associated with the IDC connection.
935 *
936 * @note ring-0 only.
937 * @{
938 */
939#define VBGL_IOCTL_IDC_DISCONNECT VBGL_IOCTL_CODE_SIZE(62, VBGL_IOCTL_IDC_DISCONNECT_SIZE)
940#define VBGL_IOCTL_IDC_DISCONNECT_SIZE sizeof(VBGLIOCIDCDISCONNECT)
941#define VBGL_IOCTL_IDC_DISCONNECT_SIZE_IN sizeof(VBGLIOCIDCDISCONNECT)
942#define VBGL_IOCTL_IDC_DISCONNECT_SIZE_OUT sizeof(VBGLREQHDR)
943typedef struct VBGLIOCIDCDISCONNECT
944{
945 /** The header. */
946 VBGLREQHDR Hdr;
947 union
948 {
949 struct
950 {
951 /** The session handle for platforms where this is needed. */
952#if ARCH_BITS >= 32
953 void RT_FAR *pvSession;
954#else
955 uint32_t pvSession;
956#endif
957 } In;
958 } u;
959} VBGLIOCIDCDISCONNECT, RT_FAR *PVBGLIOCIDCDISCONNECT;
960AssertCompileSize(VBGLIOCIDCDISCONNECT, 24 + (ARCH_BITS == 64 ? 8 : 4));
961/** @} */
962
963
964#if !defined(RT_OS_WINDOWS) && !defined(RT_OS_OS2)
965RT_C_DECLS_BEGIN
966/**
967 * The VBoxGuest IDC entry point.
968 *
969 * @returns VBox status code.
970 * @param pvSession The session.
971 * @param uReq The request code.
972 * @param pReqHdr The request.
973 * @param cbReq The request size.
974 */
975int VBOXCALL VBoxGuestIDC(void RT_FAR *pvSession, uintptr_t uReq, PVBGLREQHDR pReqHdr, size_t cbReq);
976RT_C_DECLS_END
977#endif
978
979
980#if defined(RT_OS_LINUX) || defined(RT_OS_SOLARIS) || defined(RT_OS_FREEBSD)
981
982/* Private IOCtls between user space and the kernel video driver. DRM private
983 * IOCtls always have the type 'd' and a number between 0x40 and 0x99 (0x9F?) */
984
985# define VBOX_DRM_IOCTL(a) (0x40 + DRM_VBOX_ ## a)
986
987/** Stop using HGSMI in the kernel driver until it is re-enabled, so that a
988 * user-space driver can use it. It must be re-enabled before the kernel
989 * driver can be used again in a sensible way. */
990/** @note These IOCtls was removed from the code, but are left here as
991 * templates as we may need similar ones in future. */
992# define DRM_VBOX_DISABLE_HGSMI 0
993# define DRM_IOCTL_VBOX_DISABLE_HGSMI VBOX_DRM_IOCTL(DISABLE_HGSMI)
994# define VBOXVIDEO_IOCTL_DISABLE_HGSMI _IO('d', DRM_IOCTL_VBOX_DISABLE_HGSMI)
995/** Enable HGSMI in the kernel driver after it was previously disabled. */
996# define DRM_VBOX_ENABLE_HGSMI 1
997# define DRM_IOCTL_VBOX_ENABLE_HGSMI VBOX_DRM_IOCTL(ENABLE_HGSMI)
998# define VBOXVIDEO_IOCTL_ENABLE_HGSMI _IO('d', DRM_IOCTL_VBOX_ENABLE_HGSMI)
999
1000#endif /* RT_OS_LINUX || RT_OS_SOLARIS || RT_OS_FREEBSD */
1001
1002#endif /* !defined(IN_RC) && !defined(IN_RING0_AGNOSTIC) && !defined(IPRT_NO_CRT) */
1003
1004/** @} */
1005
1006/** @} */
1007#endif
1008
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette