VirtualBox

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

Last change on this file since 77848 was 77060, checked in by vboxsync, 6 years ago

VBoxGuest.h: Reverted previous VBGLIOCIDCHGCMFASTCALL_INIT change as it breaks header compilation test (compiled as if host, not guest). bugref:9172

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