VirtualBox

source: vbox/trunk/src/VBox/Additions/os2/VBoxGuest/VBoxGuestInternal.h@ 4968

Last change on this file since 4968 was 4071, checked in by vboxsync, 17 years ago

Biggest check-in ever. New source code headers for all (C) innotek files.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 5.7 KB
Line 
1/* $Id: VBoxGuestInternal.h 4071 2007-08-07 17:07:59Z vboxsync $ */
2/** @file
3 * VBoxGuest - Guest Additions Driver.
4 */
5
6/*
7 * Copyright (C) 2007 innotek GmbH
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License as published by the Free Software Foundation,
13 * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
14 * distribution. VirtualBox OSE is distributed in the hope that it will
15 * be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#ifndef ___VBoxGuestInternal_h
19#define ___VBoxGuestInternal_h
20
21#include <iprt/types.h>
22#include <iprt/semaphore.h>
23#include <iprt/spinlock.h>
24#include <VBox/VBoxGuest.h>
25#include <VBox/VBoxGuestLib.h>
26
27
28/** Pointer to a wait-for-event entry. */
29typedef struct VBOXGUESTWAIT *PVBOXGUESTWAIT;
30
31/**
32 * VBox guest wait for event entry.
33 *
34 * Each waiting thread allocates one of these items and adds
35 * it to the wait list before going to sleep on the event sem.
36 */
37typedef struct VBOXGUESTWAIT
38{
39 /** The next entry in the list. */
40 PVBOXGUESTWAIT volatile pNext;
41 /** The previous entry in the list. */
42 PVBOXGUESTWAIT volatile pPrev;
43 /** The event semaphore. */
44 RTSEMEVENTMULTI Event;
45 /** The events we are waiting on. */
46 uint32_t fReqEvents;
47 /** The events we received. */
48 uint32_t volatile fResEvents;
49#ifdef VBOX_HGCM
50 /** The HGCM request we're waiting for to complete. */
51 VMMDevHGCMRequestHeader volatile *pHGCMReq;
52#endif
53} VBOXGUESTWAIT;
54
55/**
56 * VBox guest wait for event list.
57 */
58typedef struct VBOXGUESTWAITLIST
59{
60 /** The head. */
61 PVBOXGUESTWAIT volatile pHead;
62 /** The tail. */
63 PVBOXGUESTWAIT volatile pTail;
64} VBOXGUESTWAITLIST;
65/** Pointer to a wait list. */
66typedef VBOXGUESTWAITLIST *PVBOXGUESTWAITLIST;
67
68
69/**
70 * VBox guest device (data) extension.
71 */
72typedef struct VBOXGUESTDEVEXT
73{
74 /** The base of the adapter I/O ports. */
75 RTCCPHYS PhysMMIOBase;
76 /** The base of the adapter I/O ports. */
77 RTIOPORT IOPortBase;
78 /** The memory object for the MMIO memory. */
79 RTR0MEMOBJ MemObjMMIO;
80 /** The memory mapping object the MMIO memory. */
81 RTR0MEMOBJ MemMapMMIO;
82 /** Pointer to the mapping of the VMMDev adapter memory. */
83 VMMDevMemory volatile *pVMMDevMemory;
84
85 /** Preallocated VMMDevEvents for the IRQ handler. */
86 VMMDevEvents *pIrqAckEvents;
87 /** Spinlock protecting the signaling and resetting of the wait-for-event semaphores. */
88 RTSPINLOCK WaitSpinlock;
89 /** Wait-for-event list for threads waiting for multiple events. */
90 VBOXGUESTWAITLIST WaitList;
91#ifdef VBOX_HGCM
92 /** Wait-for-event list for threads waiting on HGCM async completion.
93 * The entire list is evaluated upon the arrival of an HGCM event, unlike
94 * the other lists which are only evaluated till the first thread has been woken up. */
95 VBOXGUESTWAITLIST HGCMWaitList;
96#endif
97 /** List of free wait-for-event entries. */
98 VBOXGUESTWAITLIST FreeList;
99 /** Mask of pending events. */
100 uint32_t volatile f32PendingEvents;
101
102 /** Spinlock various items in the VBOXGUESTSESSION. */
103 RTSPINLOCK SessionSpinlock;
104
105 /** The current clipboard client ID, 0 if no client.
106 * For implementing the VBOXGUEST_IOCTL_CLIPBOARD_CONNECT interface. */
107 uint32_t u32ClipboardClientId;
108
109
110} VBOXGUESTDEVEXT;
111/** Pointer to the VBoxGuest driver data. */
112typedef VBOXGUESTDEVEXT *PVBOXGUESTDEVEXT;
113
114
115/** Pointer to the VBoxGuest per session data. */
116typedef struct VBOXGUESTSESSION *PVBOXGUESTSESSION;
117
118/**
119 * The VBoxGuest per session data.
120 *
121 * @remark Not quite sure whether this will be useful or not, but since
122 * its already there let's keep it for now in case it might come
123 * in handy later.
124 */
125typedef struct VBOXGUESTSESSION
126{
127#if defined(RT_OS_OS2) || defined(RT_OS_FREEBSD)
128 /** Pointer to the next session with the same hash. */
129 PVBOXGUESTSESSION pNextHash;
130#endif
131#if defined(RT_OS_OS2)
132 /** The system file number of this session. */
133 uint16_t sfn;
134 uint16_t Alignment; /**< Alignment */
135#endif
136 /** The process (id) of the session.
137 * This is NIL if it's a kernel session. */
138 RTPROCESS Process;
139 /** Which process this session is associated with.
140 * This is NIL if it's a kernel session. */
141 RTR0PROCESS R0Process;
142 /** Pointer to the device extension. */
143 PVBOXGUESTDEVEXT pDevExt;
144
145#ifdef VBOX_HGCM
146 /** Array containing HGCM client IDs associated with this session.
147 * This will be automatically disconnected when the session is closed. */
148 uint32_t volatile aHGCMClientIds[8];
149#endif
150} VBOXGUESTSESSION;
151
152
153__BEGIN_DECLS
154
155int VBoxGuestInitDevExt(PVBOXGUESTDEVEXT pDevExt, uint16_t IOPortBase, RTCCPHYS PhysMMIOBase, VBOXOSTYPE enmOSType);
156void VBoxGuestDeleteDevExt(PVBOXGUESTDEVEXT pDevExt);
157bool VBoxGuestCommonISR(PVBOXGUESTDEVEXT pDevExt);
158
159int VBoxGuestCreateUserSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION *ppSession);
160int VBoxGuestCreateKernelSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION *ppSession);
161void VBoxGuestCloseSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession);
162
163int VBoxGuestCommonIOCtlFast(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession);
164int VBoxGuestCommonIOCtl(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
165 void *pvData, size_t cbData, size_t *pcbDataReturned);
166
167__END_DECLS
168
169#endif
170
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