VirtualBox

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

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

bugref:8524: Additions/linux: play nicely with distribution-installed Additions
Update the documentation of VBOXGUEST_IOCTL_CANCEL_ALL_WAITEVENTS

This change updates the documentation of VBOXGUEST_IOCTL_CANCEL_ALL_WAITEVENTS
to reflect the fact that inside a given VBoxGuest session, calls to
VBOXGUEST_IOCTL_WAITEVENT after a call to CANCEL_ALL_WAITEVENTS are not
allowed, and may be actively blocked at some future point.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 23.5 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/cdefs.h>
32#include <VBox/types.h>
33#include <iprt/assert.h>
34#include <VBox/VMMDev2.h>
35#include <VBox/VBoxGuest2.h>
36
37
38/** @defgroup grp_vboxguest VirtualBox Guest Additions Device Driver
39 *
40 * Also know as VBoxGuest.
41 *
42 * @{
43 */
44
45/** @defgroup grp_vboxguest_ioc VirtualBox Guest Additions Driver Interface
46 * @{
47 */
48
49/** @todo It would be nice if we could have two defines without paths. */
50
51/** @def VBOXGUEST_DEVICE_NAME
52 * The support device name. */
53/** @def VBOXGUEST_USER_DEVICE_NAME
54 * The support device name of the user accessible device node. */
55
56#if defined(RT_OS_OS2)
57# define VBOXGUEST_DEVICE_NAME "\\Dev\\VBoxGst$"
58
59#elif defined(RT_OS_WINDOWS)
60# define VBOXGUEST_DEVICE_NAME "\\\\.\\VBoxGuest"
61
62/** The support service name. */
63# define VBOXGUEST_SERVICE_NAME "VBoxGuest"
64/** Global name for Win2k+ */
65# define VBOXGUEST_DEVICE_NAME_GLOBAL "\\\\.\\Global\\VBoxGuest"
66/** Win32 driver name */
67# define VBOXGUEST_DEVICE_NAME_NT L"\\Device\\VBoxGuest"
68/** Device name. */
69# define VBOXGUEST_DEVICE_NAME_DOS L"\\DosDevices\\VBoxGuest"
70
71#elif defined(RT_OS_HAIKU)
72# define VBOXGUEST_DEVICE_NAME "/dev/misc/vboxguest"
73
74#else /* (PORTME) */
75# define VBOXGUEST_DEVICE_NAME "/dev/vboxguest"
76# if defined(RT_OS_LINUX)
77# define VBOXGUEST_USER_DEVICE_NAME "/dev/vboxuser"
78# endif
79#endif
80
81#ifndef VBOXGUEST_USER_DEVICE_NAME
82# define VBOXGUEST_USER_DEVICE_NAME VBOXGUEST_DEVICE_NAME
83#endif
84
85/** Fictive start address of the hypervisor physical memory for MmMapIoSpace. */
86#define VBOXGUEST_HYPERVISOR_PHYSICAL_START UINT32_C(0xf8000000)
87
88#ifdef RT_OS_DARWIN
89/** Cookie used to fend off some unwanted clients to the IOService. */
90# define VBOXGUEST_DARWIN_IOSERVICE_COOKIE UINT32_C(0x56426f78) /* 'VBox' */
91#endif
92
93#if !defined(IN_RC) && !defined(IN_RING0_AGNOSTIC) && !defined(IPRT_NO_CRT)
94
95/** @name VBoxGuest IOCTL codes and structures.
96 *
97 * The range 0..15 is for basic driver communication.
98 * The range 16..31 is for HGCM communication.
99 * The range 32..47 is reserved for future use.
100 * The range 48..63 is for OS specific communication.
101 * The 7th bit is reserved for future hacks.
102 * The 8th bit is reserved for distinguishing between 32-bit and 64-bit
103 * processes in future 64-bit guest additions.
104 *
105 * @remarks When creating new IOCtl interfaces keep in mind that not all OSes supports
106 * reporting back the output size. (This got messed up a little bit in VBoxDrv.)
107 *
108 * The request size is also a little bit tricky as it's passed as part of the
109 * request code on unix. The size field is 14 bits on Linux, 12 bits on *BSD,
110 * 13 bits Darwin, and 8-bits on Solaris. All the BSDs and Darwin kernels
111 * will make use of the size field, while Linux and Solaris will not. We're of
112 * course using the size to validate and/or map/lock the request, so it has
113 * to be valid.
114 *
115 * For Solaris we will have to do something special though, 255 isn't
116 * sufficient for all we need. A 4KB restriction (BSD) is probably not
117 * too problematic (yet) as a general one.
118 *
119 * More info can be found in SUPDRVIOC.h and related sources.
120 *
121 * @remarks If adding interfaces that only has input or only has output, some new macros
122 * needs to be created so the most efficient IOCtl data buffering method can be
123 * used.
124 * @{
125 */
126#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_SPARC64)
127# define VBOXGUEST_IOCTL_FLAG 128
128#elif defined(RT_ARCH_X86) || defined(RT_ARCH_SPARC)
129# define VBOXGUEST_IOCTL_FLAG 0
130#else
131# error "dunno which arch this is!"
132#endif
133/** @} */
134
135/** Ring-3 request wrapper for big requests.
136 *
137 * This is necessary because the ioctl number scheme on many Unixy OSes (esp. Solaris)
138 * only allows a relatively small size to be encoded into the request. So, for big
139 * request this generic form is used instead. */
140typedef struct VBGLBIGREQ
141{
142 /** Magic value (VBGLBIGREQ_MAGIC). */
143 uint32_t u32Magic;
144 /** The size of the data buffer. */
145 uint32_t cbData;
146 /** The user address of the data buffer. */
147 RTR3PTR pvDataR3;
148#if HC_ARCH_BITS == 32
149 uint32_t u32Padding;
150#endif
151/** @todo r=bird: We need a 'rc' field for passing VBox status codes. Reused
152 * some input field as rc on output. */
153} VBGLBIGREQ;
154/** Pointer to a request wrapper for solaris guests. */
155typedef VBGLBIGREQ *PVBGLBIGREQ;
156/** Pointer to a const request wrapper for solaris guests. */
157typedef const VBGLBIGREQ *PCVBGLBIGREQ;
158
159/** The VBGLBIGREQ::u32Magic value (Ryuu Murakami). */
160#define VBGLBIGREQ_MAGIC 0x19520219
161
162
163#if defined(RT_OS_WINDOWS)
164/** @todo Remove IOCTL_CODE later! Integrate it in VBOXGUEST_IOCTL_CODE below. */
165/** @todo r=bird: IOCTL_CODE is supposedly defined in some header included by Windows.h or ntddk.h, which is why it wasn't in the #if 0 earlier. See HostDrivers/Support/SUPDrvIOC.h... */
166# define IOCTL_CODE(DeviceType, Function, Method, Access, DataSize_ignored) \
167 ( ((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method))
168# define VBOXGUEST_IOCTL_CODE_(Function, Size) IOCTL_CODE(FILE_DEVICE_UNKNOWN, 2048 + (Function), METHOD_BUFFERED, FILE_WRITE_ACCESS, 0)
169# define VBOXGUEST_IOCTL_STRIP_SIZE(Code) (Code)
170
171#elif defined(RT_OS_OS2)
172 /* No automatic buffering, size not encoded. */
173# define VBOXGUEST_IOCTL_CATEGORY 0xc2
174# define VBOXGUEST_IOCTL_CODE_(Function, Size) ((unsigned char)(Function))
175# define VBOXGUEST_IOCTL_CATEGORY_FAST 0xc3 /**< Also defined in VBoxGuestA-os2.asm. */
176# define VBOXGUEST_IOCTL_CODE_FAST_(Function) ((unsigned char)(Function))
177# define VBOXGUEST_IOCTL_STRIP_SIZE(Code) (Code)
178
179#elif defined(RT_OS_SOLARIS)
180 /* No automatic buffering, size limited to 255 bytes => use VBGLBIGREQ for everything. */
181# include <sys/ioccom.h>
182# define VBOXGUEST_IOCTL_CODE_(Function, Size) _IOWRN('V', (Function), sizeof(VBGLBIGREQ))
183# define VBOXGUEST_IOCTL_CODE_FAST_(Function) _IO( 'V', (Function))
184# define VBOXGUEST_IOCTL_STRIP_SIZE(Code) (Code)
185
186#elif defined(RT_OS_LINUX)
187 /* No automatic buffering, size limited to 16KB. */
188# include <linux/ioctl.h>
189# define VBOXGUEST_IOCTL_CODE_(Function, Size) _IOC(_IOC_READ|_IOC_WRITE, 'V', (Function), (Size))
190# define VBOXGUEST_IOCTL_CODE_FAST_(Function) _IO( 'V', (Function))
191# define VBOXGUEST_IOCTL_STRIP_SIZE(Code) VBOXGUEST_IOCTL_CODE_(_IOC_NR((Code)), 0)
192
193#elif defined(RT_OS_HAIKU)
194 /* No automatic buffering, size not encoded. */
195 /** @todo do something better */
196# define VBOXGUEST_IOCTL_CODE_(Function, Size) (0x56420000 | (Function))
197# define VBOXGUEST_IOCTL_CODE_FAST_(Function) (0x56420000 | (Function))
198# define VBOXGUEST_IOCTL_STRIP_SIZE(Code) (Code)
199
200#elif defined(RT_OS_FREEBSD) || defined(RT_OS_NETBSD) /** @todo r=bird: Please do it like SUPDRVIOC to keep it as similar as possible. */
201# include <sys/ioccom.h>
202
203# define VBOXGUEST_IOCTL_CODE_(Function, Size) _IOWR('V', (Function), VBGLBIGREQ)
204# define VBOXGUEST_IOCTL_CODE_FAST_(Function) _IO( 'V', (Function))
205# define VBOXGUEST_IOCTL_STRIP_SIZE(Code) IOCBASECMD(Code)
206
207#else /* BSD Like */
208 /* Automatic buffering, size limited to 4KB on *BSD and 8KB on Darwin - commands the limit, 4KB. */
209# include <sys/ioccom.h>
210# define VBOXGUEST_IOCTL_CODE_(Function, Size) _IOC(IOC_INOUT, 'V', (Function), (Size))
211# define VBOXGUEST_IOCTL_CODE_FAST_(Function) _IO('V', (Function))
212# define VBOXGUEST_IOCTL_STRIP_SIZE(uIOCtl) ( (uIOCtl) & ~_IOC(0,0,0,IOCPARM_MASK) )
213#endif
214
215#define VBOXGUEST_IOCTL_CODE(Function, Size) VBOXGUEST_IOCTL_CODE_((Function) | VBOXGUEST_IOCTL_FLAG, Size)
216#define VBOXGUEST_IOCTL_CODE_FAST(Function) VBOXGUEST_IOCTL_CODE_FAST_((Function) | VBOXGUEST_IOCTL_FLAG)
217
218/* Define 32 bit codes to support 32 bit applications requests in the 64 bit guest driver. */
219#ifdef RT_ARCH_AMD64
220# define VBOXGUEST_IOCTL_CODE_32(Function, Size) VBOXGUEST_IOCTL_CODE_(Function, Size)
221# define VBOXGUEST_IOCTL_CODE_FAST_32(Function) VBOXGUEST_IOCTL_CODE_FAST_(Function)
222#endif /* RT_ARCH_AMD64 */
223
224
225
226/** IOCTL to VBoxGuest to query the VMMDev IO port region start.
227 * @remarks Ring-0 only. */
228#define VBOXGUEST_IOCTL_GETVMMDEVPORT VBOXGUEST_IOCTL_CODE(1, sizeof(VBoxGuestPortInfo))
229
230#pragma pack(4)
231typedef struct VBoxGuestPortInfo
232{
233 uint32_t portAddress;
234 struct VMMDevMemory *pVMMDevMemory;
235} VBoxGuestPortInfo;
236
237
238/** IOCTL to VBoxGuest to wait for a VMMDev host notification */
239#define VBOXGUEST_IOCTL_WAITEVENT VBOXGUEST_IOCTL_CODE_(2, sizeof(VBoxGuestWaitEventInfo))
240
241/** @name Result codes for VBoxGuestWaitEventInfo::u32Result
242 * @{
243 */
244/** Successful completion, an event occurred. */
245#define VBOXGUEST_WAITEVENT_OK (0)
246/** Successful completion, timed out. */
247#define VBOXGUEST_WAITEVENT_TIMEOUT (1)
248/** Wait was interrupted. */
249#define VBOXGUEST_WAITEVENT_INTERRUPTED (2)
250/** An error occurred while processing the request. */
251#define VBOXGUEST_WAITEVENT_ERROR (3)
252/** @} */
253
254/** Input and output buffers layout of the IOCTL_VBOXGUEST_WAITEVENT */
255typedef struct VBoxGuestWaitEventInfo
256{
257 /** timeout in milliseconds */
258 uint32_t u32TimeoutIn;
259 /** events to wait for */
260 uint32_t u32EventMaskIn;
261 /** result code */
262 uint32_t u32Result;
263 /** events occurred */
264 uint32_t u32EventFlagsOut;
265} VBoxGuestWaitEventInfo;
266AssertCompileSize(VBoxGuestWaitEventInfo, 16);
267
268
269/** IOCTL to VBoxGuest to perform a VMM request
270 * @remark The data buffer for this IOCtl has an variable size, keep this in mind
271 * on systems where this matters. */
272#define VBOXGUEST_IOCTL_VMMREQUEST(Size) VBOXGUEST_IOCTL_CODE_(3, (Size))
273
274
275/** IOCTL to VBoxGuest to control event filter mask. */
276#define VBOXGUEST_IOCTL_CTL_FILTER_MASK VBOXGUEST_IOCTL_CODE_(4, sizeof(VBoxGuestFilterMaskInfo))
277
278/** Input and output buffer layout of the IOCTL_VBOXGUEST_CTL_FILTER_MASK. */
279typedef struct VBoxGuestFilterMaskInfo
280{
281 uint32_t u32OrMask;
282 uint32_t u32NotMask;
283} VBoxGuestFilterMaskInfo;
284AssertCompileSize(VBoxGuestFilterMaskInfo, 8);
285#pragma pack()
286
287/** IOCTL to VBoxGuest to interrupt (cancel) any pending WAITEVENTs and return.
288 * Handled inside the guest additions and not seen by the host at all.
289 * After calling this, VBOXGUEST_IOCTL_WAITEVENT should no longer be called in
290 * the same session. At the time of writing this is not enforced; at the time
291 * of reading it may be.
292 * @see VBOXGUEST_IOCTL_WAITEVENT */
293#define VBOXGUEST_IOCTL_CANCEL_ALL_WAITEVENTS VBOXGUEST_IOCTL_CODE_(5, 0)
294
295/** IOCTL to VBoxGuest to perform backdoor logging.
296 * The argument is a string buffer of the specified size. */
297#define VBOXGUEST_IOCTL_LOG(Size) VBOXGUEST_IOCTL_CODE_(6, (Size))
298
299/** IOCTL to VBoxGuest to check memory ballooning.
300 * The guest kernel module / device driver will ask the host for the current size of
301 * the balloon and adjust the size. Or it will set fHandledInR0 = false and R3 is
302 * responsible for allocating memory and calling R0 (VBOXGUEST_IOCTL_CHANGE_BALLOON). */
303#define VBOXGUEST_IOCTL_CHECK_BALLOON VBOXGUEST_IOCTL_CODE_(7, sizeof(VBoxGuestCheckBalloonInfo))
304
305/** Output buffer layout of the VBOXGUEST_IOCTL_CHECK_BALLOON. */
306typedef struct VBoxGuestCheckBalloonInfo
307{
308 /** The size of the balloon in chunks of 1MB. */
309 uint32_t cBalloonChunks;
310 /** false = handled in R0, no further action required.
311 * true = allocate balloon memory in R3. */
312 uint32_t fHandleInR3;
313} VBoxGuestCheckBalloonInfo;
314AssertCompileSize(VBoxGuestCheckBalloonInfo, 8);
315
316
317/** IOCTL to VBoxGuest to supply or revoke one chunk for ballooning.
318 * The guest kernel module / device driver will lock down supplied memory or
319 * unlock reclaimed memory and then forward the physical addresses of the
320 * changed balloon chunk to the host. */
321#define VBOXGUEST_IOCTL_CHANGE_BALLOON VBOXGUEST_IOCTL_CODE_(8, sizeof(VBoxGuestChangeBalloonInfo))
322
323/** Input buffer layout of the VBOXGUEST_IOCTL_CHANGE_BALLOON request.
324 * Information about a memory chunk used to inflate or deflate the balloon. */
325typedef struct VBoxGuestChangeBalloonInfo
326{
327 /** Address of the chunk. */
328 uint64_t u64ChunkAddr;
329 /** true = inflate, false = deflate. */
330 uint32_t fInflate;
331 /** Alignment padding. */
332 uint32_t u32Align;
333} VBoxGuestChangeBalloonInfo;
334AssertCompileSize(VBoxGuestChangeBalloonInfo, 16);
335
336/** IOCTL to VBoxGuest to write guest core. */
337#define VBOXGUEST_IOCTL_WRITE_CORE_DUMP VBOXGUEST_IOCTL_CODE(9, sizeof(VBoxGuestWriteCoreDump))
338
339/** Input and output buffer layout of the VBOXGUEST_IOCTL_WRITE_CORE
340 * request. */
341typedef struct VBoxGuestWriteCoreDump
342{
343 /** Flags (reserved, MBZ). */
344 uint32_t fFlags;
345} VBoxGuestWriteCoreDump;
346AssertCompileSize(VBoxGuestWriteCoreDump, 4);
347
348/** IOCTL to VBoxGuest to update the mouse status features. */
349# define VBOXGUEST_IOCTL_SET_MOUSE_STATUS VBOXGUEST_IOCTL_CODE_(10, sizeof(uint32_t))
350
351#ifdef VBOX_WITH_HGCM
352/** IOCTL to VBoxGuest to connect to a HGCM service. */
353# define VBOXGUEST_IOCTL_HGCM_CONNECT VBOXGUEST_IOCTL_CODE(16, sizeof(VBoxGuestHGCMConnectInfo))
354
355/** IOCTL to VBoxGuest to disconnect from a HGCM service. */
356# define VBOXGUEST_IOCTL_HGCM_DISCONNECT VBOXGUEST_IOCTL_CODE(17, sizeof(VBoxGuestHGCMDisconnectInfo))
357
358/** IOCTL to VBoxGuest to make a call to a HGCM service.
359 * @see VBoxGuestHGCMCallInfo */
360# define VBOXGUEST_IOCTL_HGCM_CALL(Size) VBOXGUEST_IOCTL_CODE(18, (Size))
361
362/** IOCTL to VBoxGuest to make a timed call to a HGCM service. */
363# define VBOXGUEST_IOCTL_HGCM_CALL_TIMED(Size) VBOXGUEST_IOCTL_CODE(20, (Size))
364
365/** IOCTL to VBoxGuest passed from the Kernel Mode driver, but containing a user mode data in VBoxGuestHGCMCallInfo
366 * the driver received from the UM. Called in the context of the process passing the data.
367 * @see VBoxGuestHGCMCallInfo */
368# define VBOXGUEST_IOCTL_HGCM_CALL_USERDATA(Size) VBOXGUEST_IOCTL_CODE(21, (Size))
369
370# ifdef RT_ARCH_AMD64
371/** @name IOCTL numbers that 32-bit clients, like the Windows OpenGL guest
372 * driver, will use when taking to a 64-bit driver.
373 * @remarks These are only used by the driver implementation!
374 * @{*/
375# define VBOXGUEST_IOCTL_HGCM_CONNECT_32 VBOXGUEST_IOCTL_CODE_32(16, sizeof(VBoxGuestHGCMConnectInfo))
376# define VBOXGUEST_IOCTL_HGCM_DISCONNECT_32 VBOXGUEST_IOCTL_CODE_32(17, sizeof(VBoxGuestHGCMDisconnectInfo))
377# define VBOXGUEST_IOCTL_HGCM_CALL_32(Size) VBOXGUEST_IOCTL_CODE_32(18, (Size))
378# define VBOXGUEST_IOCTL_HGCM_CALL_TIMED_32(Size) VBOXGUEST_IOCTL_CODE_32(20, (Size))
379/** @} */
380# endif /* RT_ARCH_AMD64 */
381
382/** Get the pointer to the first HGCM parameter. */
383# define VBOXGUEST_HGCM_CALL_PARMS(a) ( (HGCMFunctionParameter *)((uint8_t *)(a) + sizeof(VBoxGuestHGCMCallInfo)) )
384/** Get the pointer to the first HGCM parameter in a 32-bit request. */
385# define VBOXGUEST_HGCM_CALL_PARMS32(a) ( (HGCMFunctionParameter32 *)((uint8_t *)(a) + sizeof(VBoxGuestHGCMCallInfo)) )
386
387#endif /* VBOX_WITH_HGCM */
388
389#ifdef VBOX_WITH_DPC_LATENCY_CHECKER
390/** IOCTL to VBoxGuest to perform DPC latency tests, printing the result in
391 * the release log on the host. Takes no data, returns no data. */
392# define VBOXGUEST_IOCTL_DPC_LATENCY_CHECKER VBOXGUEST_IOCTL_CODE_(30, 0)
393#endif
394
395/** IOCTL to for setting the mouse driver callback. (kernel only) */
396/** @note The callback will be called in interrupt context with the VBoxGuest
397 * device event spinlock held. */
398#define VBOXGUEST_IOCTL_SET_MOUSE_NOTIFY_CALLBACK VBOXGUEST_IOCTL_CODE(31, sizeof(VBoxGuestMouseSetNotifyCallback))
399
400typedef DECLCALLBACK(void) FNVBOXGUESTMOUSENOTIFY(void *pfnUser);
401typedef FNVBOXGUESTMOUSENOTIFY *PFNVBOXGUESTMOUSENOTIFY;
402
403/** Input buffer for VBOXGUEST_IOCTL_INTERNAL_SET_MOUSE_NOTIFY_CALLBACK. */
404typedef struct VBoxGuestMouseSetNotifyCallback
405{
406 /**
407 * Mouse notification callback.
408 *
409 * @param pvUser The callback argument.
410 */
411 PFNVBOXGUESTMOUSENOTIFY pfnNotify;
412 /** The callback argument*/
413 void *pvUser;
414} VBoxGuestMouseSetNotifyCallback;
415
416
417typedef enum VBOXGUESTCAPSACQUIRE_FLAGS
418{
419 VBOXGUESTCAPSACQUIRE_FLAGS_NONE = 0,
420 /* configures VBoxGuest to use the specified caps in Acquire mode, w/o making any caps acquisition/release.
421 * so far it is only possible to set acquire mode for caps, but not clear it,
422 * so u32NotMask is ignored for this request */
423 VBOXGUESTCAPSACQUIRE_FLAGS_CONFIG_ACQUIRE_MODE,
424 /* to ensure enum is 32bit*/
425 VBOXGUESTCAPSACQUIRE_FLAGS_32bit = 0x7fffffff
426} VBOXGUESTCAPSACQUIRE_FLAGS;
427
428typedef struct VBoxGuestCapsAquire
429{
430 /* result status
431 * VINF_SUCCESS - on success
432 * VERR_RESOURCE_BUSY - some caps in the u32OrMask are acquired by some other VBoxGuest connection.
433 * NOTE: no u32NotMask caps are cleaned in this case, i.e. no modifications are done on failure
434 * VER_INVALID_PARAMETER - invalid Caps are specified with either u32OrMask or u32NotMask. No modifications are done on failure.
435 */
436 int32_t rc;
437 /* Acquire command */
438 VBOXGUESTCAPSACQUIRE_FLAGS enmFlags;
439 /* caps to acquire, OR-ed VMMDEV_GUEST_SUPPORTS_XXX flags */
440 uint32_t u32OrMask;
441 /* caps to release, OR-ed VMMDEV_GUEST_SUPPORTS_XXX flags */
442 uint32_t u32NotMask;
443} VBoxGuestCapsAquire;
444
445/** IOCTL to for Acquiring/Releasing Guest Caps
446 * This is used for multiple purposes:
447 * 1. By doing Acquire r3 client application (e.g. VBoxTray) claims it will use
448 * the given connection for performing operations like Seamles or Auto-resize,
449 * thus, if the application terminates, the driver will automatically cleanup the caps reported to host,
450 * so that host knows guest does not support them anymore
451 * 2. In a multy-user environment this will not allow r3 applications (like VBoxTray)
452 * running in different user sessions simultaneously to interfere with each other.
453 * An r3 client application (like VBoxTray) is responsible for Acquiring/Releasing caps properly as needed.
454 **/
455#define VBOXGUEST_IOCTL_GUEST_CAPS_ACQUIRE VBOXGUEST_IOCTL_CODE(32, sizeof(VBoxGuestCapsAquire))
456
457/** IOCTL to VBoxGuest to set guest capabilities. */
458#define VBOXGUEST_IOCTL_SET_GUEST_CAPABILITIES VBOXGUEST_IOCTL_CODE_(33, sizeof(VBoxGuestSetCapabilitiesInfo))
459
460/** Input and output buffer layout of the VBOXGUEST_IOCTL_SET_GUEST_CAPABILITIES
461 * IOCtl. */
462typedef struct VBoxGuestSetCapabilitiesInfo
463{
464 uint32_t u32OrMask;
465 uint32_t u32NotMask;
466} VBoxGuestSetCapabilitiesInfo;
467AssertCompileSize(VBoxGuestSetCapabilitiesInfo, 8);
468
469
470#ifdef RT_OS_OS2
471
472/**
473 * The data buffer layout for the IDC entry point (AttachDD).
474 *
475 * @remark This is defined in multiple 16-bit headers / sources.
476 * Some places it's called VBGOS2IDC to short things a bit.
477 */
478typedef struct VBOXGUESTOS2IDCCONNECT
479{
480 /** VMMDEV_VERSION. */
481 uint32_t u32Version;
482 /** Opaque session handle. */
483 uint32_t u32Session;
484
485 /**
486 * The 32-bit service entry point.
487 *
488 * @returns VBox status code.
489 * @param u32Session The above session handle.
490 * @param iFunction The requested function.
491 * @param pvData The input/output data buffer. The caller ensures that this
492 * cannot be swapped out, or that it's acceptable to take a
493 * page in fault in the current context. If the request doesn't
494 * take input or produces output, apssing NULL is okay.
495 * @param cbData The size of the data buffer.
496 * @param pcbDataReturned Where to store the amount of data that's returned.
497 * This can be NULL if pvData is NULL.
498 */
499 DECLCALLBACKMEMBER(int, pfnServiceEP)(uint32_t u32Session, unsigned iFunction, void *pvData, size_t cbData, size_t *pcbDataReturned);
500
501 /** The 16-bit service entry point for C code (cdecl).
502 *
503 * It's the same as the 32-bit entry point, but the types has
504 * changed to 16-bit equivalents.
505 *
506 * @code
507 * int far cdecl
508 * VBoxGuestOs2IDCService16(uint32_t u32Session, uint16_t iFunction,
509 * void far *fpvData, uint16_t cbData, uint16_t far *pcbDataReturned);
510 * @endcode
511 */
512 RTFAR16 fpfnServiceEP;
513
514 /** The 16-bit service entry point for Assembly code (register).
515 *
516 * This is just a wrapper around fpfnServiceEP to simplify calls
517 * from 16-bit assembly code.
518 *
519 * @returns (e)ax: VBox status code; cx: The amount of data returned.
520 *
521 * @param u32Session eax - The above session handle.
522 * @param iFunction dl - The requested function.
523 * @param pvData es:bx - The input/output data buffer.
524 * @param cbData cx - The size of the data buffer.
525 */
526 RTFAR16 fpfnServiceAsmEP;
527} VBOXGUESTOS2IDCCONNECT;
528/** Pointer to VBOXGUESTOS2IDCCONNECT buffer. */
529typedef VBOXGUESTOS2IDCCONNECT *PVBOXGUESTOS2IDCCONNECT;
530
531/** OS/2 specific: IDC client disconnect request.
532 *
533 * This takes no input and it doesn't return anything. Obviously this
534 * is only recognized if it arrives thru the IDC service EP.
535 */
536# define VBOXGUEST_IOCTL_OS2_IDC_DISCONNECT VBOXGUEST_IOCTL_CODE(48, sizeof(uint32_t))
537
538#endif /* RT_OS_OS2 */
539
540#if defined(RT_OS_LINUX) || defined(RT_OS_SOLARIS) || defined(RT_OS_FREEBSD)
541
542/* Private IOCtls between user space and the kernel video driver. DRM private
543 * IOCtls always have the type 'd' and a number between 0x40 and 0x99 (0x9F?) */
544
545# define VBOX_DRM_IOCTL(a) (0x40 + DRM_VBOX_ ## a)
546
547/** Stop using HGSMI in the kernel driver until it is re-enabled, so that a
548 * user-space driver can use it. It must be re-enabled before the kernel
549 * driver can be used again in a sensible way. */
550/** @note These IOCtls was removed from the code, but are left here as
551 * templates as we may need similar ones in future. */
552# define DRM_VBOX_DISABLE_HGSMI 0
553# define DRM_IOCTL_VBOX_DISABLE_HGSMI VBOX_DRM_IOCTL(DISABLE_HGSMI)
554# define VBOXVIDEO_IOCTL_DISABLE_HGSMI _IO('d', DRM_IOCTL_VBOX_DISABLE_HGSMI)
555/** Enable HGSMI in the kernel driver after it was previously disabled. */
556# define DRM_VBOX_ENABLE_HGSMI 1
557# define DRM_IOCTL_VBOX_ENABLE_HGSMI VBOX_DRM_IOCTL(ENABLE_HGSMI)
558# define VBOXVIDEO_IOCTL_ENABLE_HGSMI _IO('d', DRM_IOCTL_VBOX_ENABLE_HGSMI)
559
560#endif /* RT_OS_LINUX || RT_OS_SOLARIS || RT_OS_FREEBSD */
561
562#endif /* !defined(IN_RC) && !defined(IN_RING0_AGNOSTIC) && !defined(IPRT_NO_CRT) */
563
564/** @} */
565
566/** @} */
567#endif
568
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