VirtualBox

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

最後變更 在這個檔案從93115是 93115,由 vboxsync 提交於 3 年 前

scm --update-copyright-year

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

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