VirtualBox

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

Last change on this file since 68550 was 68550, checked in by vboxsync, 7 years ago

merging vbglioc r117689: Initial VBoxGuest I/O control changes.

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