VirtualBox

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

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

merging vbglioc r117701: VBoxGueSTR0LibSharedFolders,VBoxGuest.h: Added new HGCM macros for dealing with passing page lists (the lists are placed after the parameters).

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 42.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) for a non-timed call, custom size.
493 *
494 * This is usually only needed when appending page lists to the call.
495 *
496 * @param a_pHdr The header to initalize.
497 * @param a_idClient The client connection ID to call thru.
498 * @param a_idFunction The function we're calling
499 * @param a_cParameters Number of parameters.
500 * @param a_cbReq The request size.
501 */
502# define VBGL_HGCM_HDR_INIT_EX(a_pHdr, a_idClient, a_idFunction, a_cParameters, a_cbReq) \
503 do { \
504 Assert((a_cbReq) >= sizeof(VBGLIOCHGCMCALL) + (a_cParameters) * sizeof(HGCMFunctionParameter)); \
505 VBGLREQHDR_INIT_EX(&(a_pHdr)->Hdr, (a_cbReq), (a_cbReq)); \
506 (a_pHdr)->u32ClientID = (a_idClient); \
507 (a_pHdr)->u32Function = (a_idFunction); \
508 (a_pHdr)->cMsTimeout = RT_INDEFINITE_WAIT; \
509 (a_pHdr)->fInterruptible = true; \
510 (a_pHdr)->bReserved = 0; \
511 (a_pHdr)->cParms = (a_cParameters); \
512 } while (0)
513
514/**
515 * Initialize a HGCM header (VBGLIOCHGCMCALL), with timeout (interruptible).
516 *
517 * @param a_pHdr The header to initalize.
518 * @param a_idClient The client connection ID to call thru.
519 * @param a_idFunction The function we're calling
520 * @param a_cParameters Number of parameters.
521 * @param a_cMsTimeout The timeout in milliseconds.
522 */
523# define VBGL_HGCM_HDR_INIT_TIMED(a_pHdr, a_idClient, a_idFunction, a_cParameters, a_cMsTimeout) \
524 do { \
525 (a_pHdr)->u32ClientID = (a_idClient); \
526 (a_pHdr)->u32Function = (a_idFunction); \
527 (a_pHdr)->cMsTimeout = (a_cMsTimeout); \
528 (a_pHdr)->fInterruptible = true; \
529 (a_pHdr)->bReserved = 0; \
530 (a_pHdr)->cParms = (a_cParameters); \
531 } while (0)
532
533/** Get the pointer to the first HGCM parameter. */
534# define VBGL_HGCM_GET_CALL_PARMS(a_pInfo) ( (HGCMFunctionParameter *)((uint8_t *)(a_pInfo) + sizeof(VBGLIOCHGCMCALL)) )
535/** Get the pointer to the first HGCM parameter in a 32-bit request. */
536# define VBGL_HGCM_GET_CALL_PARMS32(a_pInfo) ( (HGCMFunctionParameter32 *)((uint8_t *)(a_pInfo) + sizeof(VBGLIOCHGCMCALL)) )
537
538/** @} */
539#endif /* VBOX_WITH_HGCM */
540
541
542/** @name VBGL_IOCTL_LOG
543 * IOCTL to VBoxGuest to perform backdoor logging.
544 * @{ */
545#define VBOXGUEST_IOCTL_LOG(Size)
546#define VBGL_IOCTL_LOG(a_cchMsg) VBGL_IOCTL_CODE_BIG(8)
547#define VBGL_IOCTL_LOG_SIZE(a_cchMsg) (sizeof(VBGLREQHDR) + (a_cchMsg) + 1)
548#define VBGL_IOCTL_LOG_SIZE_IN(a_cchMsg) (sizeof(VBGLREQHDR) + (a_cchMsg) + 1)
549#define VBGL_IOCTL_LOG_SIZE_OUT sizeof(VBGLREQHDR)
550typedef struct VBGLIOCLOG
551{
552 /** The header. */
553 VBGLREQHDR Hdr;
554 union
555 {
556 struct
557 {
558 /** The log message.
559 * The length is determined from the input size and zero termination. */
560 char szMsg[RT_FLEXIBLE_ARRAY_IN_NESTED_UNION];
561 } In;
562 } u;
563} VBGLIOCLOG, *PVBGLIOCLOG;
564/** @} */
565
566
567/** @name VBGL_IOCTL_WAIT_FOR_EVENTS
568 * Wait for a VMMDev host event notification.
569 * @{
570 */
571#define VBGL_IOCTL_WAIT_FOR_EVENTS VBGL_IOCTL_CODE_SIZE(9, VBGL_IOCTL_GET_VMMDEV_IO_INFO_SIZE)
572#define VBGL_IOCTL_WAIT_FOR_EVENTS_SIZE sizeof(VBGLIOCWAITFOREVENTS)
573#define VBGL_IOCTL_WAIT_FOR_EVENTS_SIZE_IN sizeof(VBGLIOCWAITFOREVENTS)
574#define VBGL_IOCTL_WAIT_FOR_EVENTS_SIZE_OUT RT_UOFFSET_AFTER(VBGLIOCWAITFOREVENTS, u.Out)
575typedef struct VBGLIOCWAITFOREVENTS
576{
577 /** The header. */
578 VBGLREQHDR Hdr;
579 union
580 {
581 struct
582 {
583 /** Timeout in milliseconds. */
584 uint32_t cMsTimeOut;
585 /** Events to wait for. */
586 uint32_t fEvents;
587 } In;
588 struct
589 {
590 /** Events that occurred. */
591 uint32_t fEvents;
592 } Out;
593 } u;
594} VBGLIOCWAITFOREVENTS, *PVBGLIOCWAITFOREVENTS;
595AssertCompileSize(VBGLIOCWAITFOREVENTS, 24 + 8);
596/** @} */
597
598
599/** @name VBGL_IOCTL_INTERRUPT_ALL_WAIT_FOR_EVENTS
600 * IOCTL to VBoxGuest to interrupt (cancel) any pending
601 * VBGL_IOCTL_WAIT_FOR_EVENTS and return.
602 *
603 * Handled inside the guest additions and not seen by the host at all.
604 * After calling this, VBGL_IOCTL_WAIT_FOR_EVENTS should no longer be called in
605 * the same session. At the time of writing this is not enforced; at the time
606 * of reading it may be.
607 * @see VBGL_IOCTL_WAIT_FOR_EVENTS
608 *
609 * @{
610 */
611#define VBGL_IOCTL_INTERRUPT_ALL_WAIT_FOR_EVENTS VBGL_IOCTL_CODE_SIZE(10, VBGL_IOCTL_INTERRUPT_ALL_WAIT_FOR_EVENTS_SIZE)
612#define VBGL_IOCTL_INTERRUPT_ALL_WAIT_FOR_EVENTS_SIZE sizeof(VBGLREQHDR)
613#define VBGL_IOCTL_INTERRUPT_ALL_WAIT_FOR_EVENTS_SIZE_IN sizeof(VBGLREQHDR)
614#define VBGL_IOCTL_INTERRUPT_ALL_WAIT_FOR_EVENTS_SIZE_OUT sizeof(VBGLREQHDR)
615/** @} */
616
617
618/** @name VBGL_IOCTL_CHANGE_FILTER_MASK
619 * IOCTL to VBoxGuest to control the event filter mask.
620 * @{ */
621#define VBGL_IOCTL_CHANGE_FILTER_MASK VBGL_IOCTL_CODE_SIZE(11, VBGL_IOCTL_CHANGE_FILTER_MASK_SIZE)
622#define VBGL_IOCTL_CHANGE_FILTER_MASK_SIZE sizeof(VBGLIOCCHANGEFILTERMASK)
623#define VBGL_IOCTL_CHANGE_FILTER_MASK_SIZE_IN sizeof(VBGLIOCCHANGEFILTERMASK)
624#define VBGL_IOCTL_CHANGE_FILTER_MASK_SIZE_OUT sizeof(VBGLREQHDR)
625typedef struct VBGLIOCCHANGEFILTERMASK
626{
627 /** The header. */
628 VBGLREQHDR Hdr;
629 union
630 {
631 struct
632 {
633 /** Flags to set. */
634 uint32_t fOrMask;
635 /** Flags to remove. */
636 uint32_t fNotMask;
637 } In;
638 } u;
639} VBGLIOCCHANGEFILTERMASK, *PVBGLIOCCHANGEFILTERMASK;
640AssertCompileSize(VBGLIOCCHANGEFILTERMASK, 24 + 8);
641/** @} */
642
643
644/** @name VBGL_IOCTL_GUEST_CAPS_ACQUIRE
645 * IOCTL to for acquiring and releasing guest capabilities.
646 *
647 * This is used for multiple purposes:
648 * 1. By doing @a acquire r3 client application (e.g. VBoxTray) claims it will
649 * use the given session for performing operations like @a seamless or
650 * @a auto-resize, thus, if the application terminates, the driver will
651 * automatically cleanup the caps reported to host, so that host knows guest
652 * does not support them anymore
653 * 2. In a multy-user environment this will not allow r3 applications (like
654 * VBoxTray) running in different user sessions simultaneously to interfere
655 * with each other. An r3 client application (like VBoxTray) is responsible
656 * for Acquiring/Releasing caps properly as needed.
657 *
658 *
659 * VERR_RESOURCE_BUSY is returned if any capabilities in the fOrMask are
660 * currently acquired by some other VBoxGuest session.
661 *
662 * @{
663 */
664#define VBGL_IOCTL_ACQUIRE_GUEST_CAPABILITIES VBGL_IOCTL_CODE_SIZE(12, VBGL_IOCTL_ACQUIRE_GUEST_CAPABILITIES_SIZE)
665#define VBGL_IOCTL_ACQUIRE_GUEST_CAPABILITIES_SIZE sizeof(VBGLIOCACQUIREGUESTCAPS)
666#define VBGL_IOCTL_ACQUIRE_GUEST_CAPABILITIES_SIZE_IN sizeof(VBGLIOCACQUIREGUESTCAPS)
667#define VBGL_IOCTL_ACQUIRE_GUEST_CAPABILITIES_SIZE_OUT sizeof(VBGLREQHDR)
668
669/** Default operation (full acquire/release). */
670#define VBGL_IOC_AGC_FLAGS_DEFAULT UINT32_C(0x00000000)
671/** Configures VBoxGuest to use the specified caps in Acquire mode, w/o making
672 * any caps acquisition/release. This is only possible to set acquire mode for
673 * caps, but not clear it, so fNotMask is ignored when this flag is set. */
674#define VBGL_IOC_AGC_FLAGS_CONFIG_ACQUIRE_MODE UINT32_C(0x00000001)
675/** Valid flag mask. */
676#define VBGL_IOC_AGC_FLAGS_VALID_MASK UINT32_C(0x00000001)
677
678typedef struct VBGLIOCACQUIREGUESTCAPS
679{
680 /** The header. */
681 VBGLREQHDR Hdr;
682 union
683 {
684 struct
685 {
686 /** Acquire flags (VBGL_IOC_AGC_FLAGS_XXX). */
687 uint32_t fFlags;
688 /** Guest capabilities to acquire (VMMDEV_GUEST_SUPPORTS_XXX). */
689 uint32_t fOrMask;
690 /** Guest capabilities to release (VMMDEV_GUEST_SUPPORTS_XXX). */
691 uint32_t fNotMask;
692 } In;
693 } u;
694} VBGLIOCACQUIREGUESTCAPS, *PVBGLIOCACQUIREGUESTCAPS;
695AssertCompileSize(VBGLIOCACQUIREGUESTCAPS, 24 + 12);
696/** @} */
697
698
699/** @name VBGL_IOCTL_CHANGE_GUEST_CAPABILITIES
700 * IOCTL to VBoxGuest to set guest capabilities.
701 * @{ */
702#define VBGL_IOCTL_CHANGE_GUEST_CAPABILITIES VBGL_IOCTL_CODE_SIZE(13, VBGL_IOCTL_CHANGE_GUEST_CAPABILITIES_SIZE)
703#define VBGL_IOCTL_CHANGE_GUEST_CAPABILITIES_SIZE sizeof(VBGLIOCSETGUESTCAPS)
704#define VBGL_IOCTL_CHANGE_GUEST_CAPABILITIES_SIZE_IN sizeof(VBGLIOCSETGUESTCAPS)
705#define VBGL_IOCTL_CHANGE_GUEST_CAPABILITIES_SIZE_OUT sizeof(VBGLIOCSETGUESTCAPS)
706typedef struct VBGLIOCSETGUESTCAPS
707{
708 /** The header. */
709 VBGLREQHDR Hdr;
710 union
711 {
712 struct
713 {
714 /** The capabilities to set (VMMDEV_GUEST_SUPPORTS_XXX). */
715 uint32_t fOrMask;
716 /** The capabilities to drop (VMMDEV_GUEST_SUPPORTS_XXX). */
717 uint32_t fNotMask;
718 } In;
719 struct
720 {
721 /** The capabilities held by the session after the call (VMMDEV_GUEST_SUPPORTS_XXX). */
722 uint32_t fSessionCaps;
723 /** The capabilities for all the sessions after the call (VMMDEV_GUEST_SUPPORTS_XXX). */
724 uint32_t fGlobalCaps;
725 } Out;
726 } u;
727} VBGLIOCSETGUESTCAPS, *PVBGLIOCSETGUESTCAPS;
728AssertCompileSize(VBGLIOCSETGUESTCAPS, 24 + 8);
729typedef VBGLIOCSETGUESTCAPS VBoxGuestSetCapabilitiesInfo;
730/** @} */
731
732
733/** @name VBGL_IOCTL_SET_MOUSE_STATUS
734 * IOCTL to VBoxGuest to update the mouse status features.
735 * @{ */
736#define VBGL_IOCTL_SET_MOUSE_STATUS VBGL_IOCTL_CODE_SIZE(14, VBGL_IOCTL_SET_MOUSE_STATUS_SIZE)
737#define VBGL_IOCTL_SET_MOUSE_STATUS_SIZE sizeof(VBGLIOCSETMOUSESTATUS)
738#define VBGL_IOCTL_SET_MOUSE_STATUS_SIZE_IN sizeof(VBGLIOCSETMOUSESTATUS)
739#define VBGL_IOCTL_SET_MOUSE_STATUS_SIZE_OUT sizeof(VBGLREQHDR)
740typedef struct VBGLIOCSETMOUSESTATUS
741{
742 /** The header. */
743 VBGLREQHDR Hdr;
744 union
745 {
746 struct
747 {
748 /** Mouse status flags (VMMDEV_MOUSE_XXX). */
749 uint32_t fStatus;
750 } In;
751 } u;
752} VBGLIOCSETMOUSESTATUS, *PVBGLIOCSETMOUSESTATUS;
753/** @} */
754
755
756/** @name VBGL_IOCTL_SET_MOUSE_NOTIFY_CALLBACK
757 *
758 * IOCTL to for setting the mouse driver callback.
759 * @note The callback will be called in interrupt context with the VBoxGuest
760 * device event spinlock held.
761 * @note ring-0 only.
762 *
763 * @{ */
764#define VBGL_IOCTL_SET_MOUSE_NOTIFY_CALLBACK VBGL_IOCTL_CODE_SIZE(15, VBGL_IOCTL_SET_MOUSE_NOTIFY_CALLBACK_SIZE)
765#define VBGL_IOCTL_SET_MOUSE_NOTIFY_CALLBACK_SIZE sizeof(VBGLIOCSETMOUSENOTIFYCALLBACK)
766#define VBGL_IOCTL_SET_MOUSE_NOTIFY_CALLBACK_SIZE_IN sizeof(VBGLIOCSETMOUSENOTIFYCALLBACK)
767#define VBGL_IOCTL_SET_MOUSE_NOTIFY_CALLBACK_SIZE_OUT sizeof(VBGLREQHDR)
768/**
769 * Mouse event noticification callback function.
770 * @param pvUser Argument given when setting the callback.
771 */
772typedef DECLCALLBACK(void) FNVBOXGUESTMOUSENOTIFY(void *pvUser);
773/** Pointer to a mouse event notification callback function. */
774typedef FNVBOXGUESTMOUSENOTIFY *PFNVBOXGUESTMOUSENOTIFY; /**< @todo fix type prefix */
775typedef struct VBGLIOCSETMOUSENOTIFYCALLBACK
776{
777 /** The header. */
778 VBGLREQHDR Hdr;
779 union
780 {
781 struct
782 {
783 /** Mouse notification callback function. */
784 PFNVBOXGUESTMOUSENOTIFY pfnNotify;
785 /** The callback argument. */
786 void *pvUser;
787 } In;
788 } u;
789} VBGLIOCSETMOUSENOTIFYCALLBACK, *PVBGLIOCSETMOUSENOTIFYCALLBACK;
790/** @} */
791
792
793/** @name VBGL_IOCTL_CHECK_BALLOON
794 * IOCTL to VBoxGuest to check memory ballooning.
795 *
796 * The guest kernel module / device driver will ask the host for the current size of
797 * the balloon and adjust the size. Or it will set fHandledInR0 = false and R3 is
798 * responsible for allocating memory and calling R0 (VBGL_IOCTL_CHANGE_BALLOON).
799 * @{ */
800#define VBGL_IOCTL_CHECK_BALLOON VBGL_IOCTL_CODE_SIZE(16, VBGL_IOCTL_CHECK_BALLOON_SIZE)
801#define VBGL_IOCTL_CHECK_BALLOON_SIZE sizeof(VBGLIOCCHECKBALLOON)
802#define VBGL_IOCTL_CHECK_BALLOON_SIZE_IN sizeof(VBGLREQHDR)
803#define VBGL_IOCTL_CHECK_BALLOON_SIZE_OUT sizeof(VBGLIOCCHECKBALLOON)
804typedef struct VBGLIOCCHECKBALLOON
805{
806 /** The header. */
807 VBGLREQHDR Hdr;
808 union
809 {
810 struct
811 {
812 /** The size of the balloon in chunks of 1MB. */
813 uint32_t cBalloonChunks;
814 /** false = handled in R0, no further action required.
815 * true = allocate balloon memory in R3. */
816 bool fHandleInR3;
817 /** Explicit padding, please ignore. */
818 bool afPadding[3];
819 } Out;
820 } u;
821} VBGLIOCCHECKBALLOON, *PVBGLIOCCHECKBALLOON;
822AssertCompileSize(VBGLIOCCHECKBALLOON, 24 + 8);
823typedef VBGLIOCCHECKBALLOON VBoxGuestCheckBalloonInfo;
824/** @} */
825
826
827/** @name VBGL_IOCTL_CHANGE_BALLOON
828 * IOCTL to VBoxGuest to supply or revoke one chunk for ballooning.
829 *
830 * The guest kernel module / device driver will lock down supplied memory or
831 * unlock reclaimed memory and then forward the physical addresses of the
832 * changed balloon chunk to the host.
833 *
834 * @{ */
835#define VBGL_IOCTL_CHANGE_BALLOON VBGL_IOCTL_CODE_SIZE(17, VBGL_IOCTL_CHANGE_BALLOON_SIZE)
836#define VBGL_IOCTL_CHANGE_BALLOON_SIZE sizeof(VBGLIOCCHANGEBALLOON)
837#define VBGL_IOCTL_CHANGE_BALLOON_SIZE_IN sizeof(VBGLIOCCHANGEBALLOON)
838#define VBGL_IOCTL_CHANGE_BALLOON_SIZE_OUT sizeof(VBGLREQHDR)
839typedef struct VBGLIOCCHANGEBALLOON
840{
841 /** The header. */
842 VBGLREQHDR Hdr;
843 union
844 {
845 struct
846 {
847 /** Address of the chunk (user space address). */
848 RTR3PTR pvChunk;
849 /** Explicit alignment padding, MBZ. */
850 uint8_t abPadding[ARCH_BITS == 32 ? 4 + 7 : 0 + 7];
851 /** true = inflate, false = deflate. */
852 bool fInflate;
853 } In;
854 } u;
855} VBGLIOCCHANGEBALLOON, *PVBGLIOCCHANGEBALLOON;
856AssertCompileSize(VBGLIOCCHANGEBALLOON, 24+16);
857/** @} */
858
859
860/** @name VBGL_IOCTL_WRITE_CORE_DUMP
861 * IOCTL to VBoxGuest to write guest core.
862 * @{ */
863#define VBGL_IOCTL_WRITE_CORE_DUMP VBGL_IOCTL_CODE_SIZE(18, VBGL_IOCTL_WRITE_CORE_DUMP_SIZE)
864#define VBGL_IOCTL_WRITE_CORE_DUMP_SIZE sizeof(VBGLIOCWRITECOREDUMP)
865#define VBGL_IOCTL_WRITE_CORE_DUMP_SIZE_IN sizeof(VBGLIOCWRITECOREDUMP)
866#define VBGL_IOCTL_WRITE_CORE_DUMP_SIZE_OUT sizeof(VBGLREQHDR)
867typedef struct VBGLIOCWRITECOREDUMP
868{
869 /** The header. */
870 VBGLREQHDR Hdr;
871 union
872 {
873 struct
874 {
875 /** Flags (reserved, MBZ). */
876 uint32_t fFlags;
877 } In;
878 } u;
879} VBGLIOCWRITECOREDUMP, *PVBGLIOCWRITECOREDUMP;
880AssertCompileSize(VBGLIOCWRITECOREDUMP, 24 + 4);
881typedef VBGLIOCWRITECOREDUMP VBoxGuestWriteCoreDump;
882/** @} */
883
884
885#ifdef VBOX_WITH_DPC_LATENCY_CHECKER
886/** @name VBGL_IOCTL_DPC_LATENCY_CHECKER
887 * IOCTL to VBoxGuest to perform DPC latency tests, printing the result in
888 * the release log on the host. Takes no data, returns no data.
889 * @{ */
890# define VBGL_IOCTL_DPC_LATENCY_CHECKER VBGL_IOCTL_CODE_SIZE(19, VBGL_IOCTL_DPC_LATENCY_CHECKER_SIZE)
891# define VBGL_IOCTL_DPC_LATENCY_CHECKER_SIZE sizeof(VBGLREQHDR)
892# define VBGL_IOCTL_DPC_LATENCY_CHECKER_SIZE_IN sizeof(VBGLREQHDR)
893# define VBGL_IOCTL_DPC_LATENCY_CHECKER_SIZE_OUT sizeof(VBGLREQHDR)
894/** @} */
895#endif
896
897
898#ifdef RT_OS_OS2
899/**
900 * The data buffer layout for the IDC entry point (AttachDD).
901 *
902 * @remark This is defined in multiple 16-bit headers / sources.
903 * Some places it's called VBGOS2IDC to short things a bit.
904 */
905typedef struct VBOXGUESTOS2IDCCONNECT
906{
907 /** VMMDEV_VERSION. */
908 uint32_t u32Version;
909 /** Opaque session handle. */
910 uint32_t u32Session;
911
912 /**
913 * The 32-bit service entry point.
914 *
915 * @returns VBox status code.
916 * @param u32Session The above session handle.
917 * @param iFunction The requested function.
918 * @param pvData The input/output data buffer. The caller ensures that this
919 * cannot be swapped out, or that it's acceptable to take a
920 * page in fault in the current context. If the request doesn't
921 * take input or produces output, apssing NULL is okay.
922 * @param cbData The size of the data buffer.
923 * @param pcbDataReturned Where to store the amount of data that's returned.
924 * This can be NULL if pvData is NULL.
925 * @todo fix parameters
926 */
927 DECLCALLBACKMEMBER(int, pfnServiceEP)(uint32_t u32Session, unsigned iFunction, void *pvData, size_t cbData, size_t *pcbDataReturned);
928
929 /** The 16-bit service entry point for C code (cdecl).
930 *
931 * It's the same as the 32-bit entry point, but the types has
932 * changed to 16-bit equivalents.
933 *
934 * @code
935 * int far cdecl
936 * VBoxGuestOs2IDCService16(uint32_t u32Session, uint16_t iFunction,
937 * void far *fpvData, uint16_t cbData, uint16_t far *pcbDataReturned);
938 * @endcode
939 */
940 RTFAR16 fpfnServiceEP;
941
942 /** The 16-bit service entry point for Assembly code (register).
943 *
944 * This is just a wrapper around fpfnServiceEP to simplify calls
945 * from 16-bit assembly code.
946 *
947 * @returns (e)ax: VBox status code; cx: The amount of data returned.
948 *
949 * @param u32Session eax - The above session handle.
950 * @param iFunction dl - The requested function.
951 * @param pvData es:bx - The input/output data buffer.
952 * @param cbData cx - The size of the data buffer.
953 */
954 RTFAR16 fpfnServiceAsmEP;
955} VBOXGUESTOS2IDCCONNECT;
956/** Pointer to VBOXGUESTOS2IDCCONNECT buffer. */
957typedef VBOXGUESTOS2IDCCONNECT *PVBOXGUESTOS2IDCCONNECT;
958#endif /* RT_OS_OS2 */
959
960
961/** @name VBGL_IOCL_IDC_CONNECT
962 * IDC client connect request.
963 *
964 * On platforms other than Windows and OS/2, this will also create a kernel
965 * session for the caller.
966 *
967 * @note ring-0 only.
968 */
969#define VBGL_IOCTL_IDC_CONNECT VBGL_IOCTL_CODE_SIZE(63 | VBGL_IOCTL_FLAG_CC, VBGL_IOCL_IDC_CONNECT_SIZE)
970#define VBGL_IOCTL_IDC_CONNECT_SIZE sizeof(VBGLIOCIDCCONNECT)
971#define VBGL_IOCTL_IDC_CONNECT_SIZE_IN RT_UOFFSET_AFTER(VBGLIOCIDCCONNECT, u.In)
972#define VBGL_IOCTL_IDC_CONNECT_SIZE_OUT sizeof(VBGLIOCIDCCONNECT)
973typedef struct VBGLIOCIDCCONNECT
974{
975 /** The header. */
976 VBGLREQHDR Hdr;
977 /** The payload union. */
978 union
979 {
980 struct
981 {
982 /** VBGL_IOCTL_IDC_CONNECT_MAGIC_COOKIE. */
983 uint32_t u32MagicCookie;
984 /** The desired version of the I/O control interface (VBGL_IOC_VERSION). */
985 uint32_t uReqVersion;
986 /** The minimum version of the I/O control interface (VBGL_IOC_VERSION). */
987 uint32_t uMinVersion;
988 /** Reserved, MBZ. */
989 uint32_t uReserved;
990 } In;
991 struct
992 {
993 /** The session handle (opaque). */
994 void *pvSession;
995 /** The version of the I/O control interface for this session
996 * (typically VBGL_IOC_VERSION). */
997 uint32_t uSessionVersion;
998 /** The I/O control interface version for of the driver (VBGL_IOC_VERSION). */
999 uint32_t uDriverVersion;
1000 /** The SVN revision of the driver.
1001 * This will be set to 0 if not compiled into the driver. */
1002 uint32_t uDriverRevision;
1003 /** Reserved \#1 (will be returned as zero until defined). */
1004 uint32_t uReserved1;
1005 /** Reserved \#2 (will be returned as NULL until defined). */
1006 void *pvReserved2;
1007 } Out;
1008 } u;
1009} VBGLIOCIDCCONNECT, *PVBGLIOCIDCCONNECT;
1010AssertCompileSize(VBGLIOCIDCCONNECT, 24 + 16 + ARCH_BITS / 8 * 2);
1011AssertCompile(VBGL_IOCTL_IDC_CONNECT_SIZE_IN == 24 + 16);
1012#define VBGL_IOCTL_IDC_CONNECT_MAGIC_COOKIE UINT32_C(0x55aa4d5a) /**< Magic value for doing an IDC connect. */
1013/** @} */
1014
1015
1016/** @name VBGL_IOCL_IDC_DISCONNECT
1017 * IDC client disconnect request.
1018 *
1019 * This will destroy the kernel session associated with the IDC connection.
1020 *
1021 * @note ring-0 only.
1022 */
1023#define VBGL_IOCTL_IDC_DISCONNECT VBGL_IOCTL_CODE_SIZE(62 | VBGL_IOCTL_FLAG_CC, VBGL_IOCL_IDC_DISCONNECT_SIZE)
1024#define VBGL_IOCTL_IDC_DISCONNECT_SIZE sizeof(VBGLIOCIDCDISCONNECT)
1025#define VBGL_IOCTL_IDC_DISCONNECT_SIZE_IN sizeof(VBGLIOCIDCDISCONNECT)
1026#define VBGL_IOCTL_IDC_DISCONNECT_SIZE_OUT sizeof(VBGLREQHDR)
1027typedef struct VBGLIOCIDCDISCONNECT
1028{
1029 /** The header. */
1030 VBGLREQHDR Hdr;
1031 union
1032 {
1033 struct
1034 {
1035 /** The session handle for platforms where this is needed. */
1036 void *pvSession;
1037 } In;
1038 } u;
1039} VBGLIOCIDCDISCONNECT, *PVBGLIOCIDCDISCONNECT;
1040AssertCompileSize(VBGLIOCIDCDISCONNECT, 24 + ARCH_BITS / 8);
1041/** @} */
1042
1043
1044#if defined(RT_OS_LINUX) || defined(RT_OS_SOLARIS) || defined(RT_OS_FREEBSD)
1045
1046/* Private IOCtls between user space and the kernel video driver. DRM private
1047 * IOCtls always have the type 'd' and a number between 0x40 and 0x99 (0x9F?) */
1048
1049# define VBOX_DRM_IOCTL(a) (0x40 + DRM_VBOX_ ## a)
1050
1051/** Stop using HGSMI in the kernel driver until it is re-enabled, so that a
1052 * user-space driver can use it. It must be re-enabled before the kernel
1053 * driver can be used again in a sensible way. */
1054/** @note These IOCtls was removed from the code, but are left here as
1055 * templates as we may need similar ones in future. */
1056# define DRM_VBOX_DISABLE_HGSMI 0
1057# define DRM_IOCTL_VBOX_DISABLE_HGSMI VBOX_DRM_IOCTL(DISABLE_HGSMI)
1058# define VBOXVIDEO_IOCTL_DISABLE_HGSMI _IO('d', DRM_IOCTL_VBOX_DISABLE_HGSMI)
1059/** Enable HGSMI in the kernel driver after it was previously disabled. */
1060# define DRM_VBOX_ENABLE_HGSMI 1
1061# define DRM_IOCTL_VBOX_ENABLE_HGSMI VBOX_DRM_IOCTL(ENABLE_HGSMI)
1062# define VBOXVIDEO_IOCTL_ENABLE_HGSMI _IO('d', DRM_IOCTL_VBOX_ENABLE_HGSMI)
1063
1064#endif /* RT_OS_LINUX || RT_OS_SOLARIS || RT_OS_FREEBSD */
1065
1066#endif /* !defined(IN_RC) && !defined(IN_RING0_AGNOSTIC) && !defined(IPRT_NO_CRT) */
1067
1068/** @} */
1069
1070/** @} */
1071#endif
1072
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