VirtualBox

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

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

VBoxGuest: Added an IDC interface for faster HGCM calls (VBGL_IOCTL_IDC_HGCM_FAST_CALL, VbglR0HGCMFastCall). This expects the caller to construct a valid call and only concerns itself with issuing it to the host and waiting for the result to arrive. bugref:9172

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

© 2023 Oracle
ContactPrivacy policyTerms of Use