VirtualBox

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

最後變更 在這個檔案從105848是 100267,由 vboxsync 提交於 17 月 前

Additions: Make the R0 physical heap configurable to allow for allocations >= 4GiB if supported by the VBox device (the MMIO request path is available), add support for the MMIO request path required for ARM, bugref:10457

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

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