~ubuntu-branches/ubuntu/raring/virtualbox-ose/raring

« back to all changes in this revision

Viewing changes to src/VBox/Additions/common/VBoxGuest/VBoxGuestInternal.h

  • Committer: Bazaar Package Importer
  • Author(s): Felix Geyer
  • Date: 2011-01-30 23:27:25 UTC
  • mfrom: (0.3.12 upstream)
  • Revision ID: james.westby@ubuntu.com-20110130232725-2ouajjd2ggdet0zd
Tags: 4.0.2-dfsg-1ubuntu1
* Merge from Debian unstable, remaining changes:
  - Add Apport hook.
    - debian/virtualbox-ose.files/source_virtualbox-ose.py
    - debian/virtualbox-ose.install
  - Drop *-source packages.
* Drop ubuntu-01-fix-build-gcc45.patch, fixed upstream.
* Drop ubuntu-02-as-needed.patch, added to the Debian package.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $Id: VBoxGuestInternal.h $ */
 
1
/* $Id: VBoxGuestInternal.h 33750 2010-11-03 21:00:26Z vboxsync $ */
2
2
/** @file
3
3
 * VBoxGuest - Guest Additions Driver.
4
4
 */
5
5
 
6
6
/*
7
 
 * Copyright (C) 2007 Oracle Corporation
 
7
 * Copyright (C) 2010 Oracle Corporation
8
8
 *
9
9
 * This file is part of VirtualBox Open Source Edition (OSE), as
10
10
 * available from http://www.virtualbox.org. This file is free software;
19
19
#define ___VBoxGuestInternal_h
20
20
 
21
21
#include <iprt/types.h>
 
22
#include <iprt/list.h>
22
23
#include <iprt/semaphore.h>
23
24
#include <iprt/spinlock.h>
24
25
#include <VBox/VMMDev.h>
25
26
#include <VBox/VBoxGuest.h>
26
27
#include <VBox/VBoxGuestLib.h>
27
28
 
 
29
/** @def VBOXGUEST_USE_WAKE_UP_LIST
 
30
 * Defer wake-up of waiting thread when defined. */
 
31
#if defined(RT_OS_SOLARIS) || defined(RT_OS_WINDOWS) || defined(DOXYGEN_RUNNING)
 
32
# define VBOXGUEST_USE_DEFERRED_WAKE_UP
 
33
#endif
 
34
 
28
35
 
29
36
/** Pointer to the VBoxGuest per session data. */
30
37
typedef struct VBOXGUESTSESSION *PVBOXGUESTSESSION;
40
47
 */
41
48
typedef struct VBOXGUESTWAIT
42
49
{
43
 
    /** The next entry in the list. */
44
 
    PVBOXGUESTWAIT volatile     pNext;
45
 
    /** The previous entry in the list. */
46
 
    PVBOXGUESTWAIT volatile     pPrev;
47
 
    /** The event semaphore. */
48
 
    RTSEMEVENTMULTI             Event;
 
50
    /** The list node. */
 
51
    RTLISTNODE                  ListNode;
49
52
    /** The events we are waiting on. */
50
53
    uint32_t                    fReqEvents;
51
54
    /** The events we received. */
52
55
    uint32_t volatile           fResEvents;
 
56
#ifdef VBOXGUEST_USE_DEFERRED_WAKE_UP
 
57
    /** Set by VBoxGuestWaitDoWakeUps before leaving the spinlock to call
 
58
     *  RTSemEventMultiSignal. */
 
59
    bool volatile               fPendingWakeUp;
 
60
    /** Set by the requestor thread if it got the spinlock before the
 
61
     * signaller.  Deals with the race in VBoxGuestWaitDoWakeUps. */
 
62
    bool volatile               fFreeMe;
 
63
#endif
 
64
    /** The event semaphore. */
 
65
    RTSEMEVENTMULTI             Event;
53
66
    /** The session that's waiting. */
54
67
    PVBOXGUESTSESSION           pSession;
55
68
#ifdef VBOX_WITH_HGCM
58
71
#endif
59
72
} VBOXGUESTWAIT;
60
73
 
61
 
/**
62
 
 * VBox guest wait for event list.
63
 
 */
64
 
typedef struct VBOXGUESTWAITLIST
65
 
{
66
 
    /** The head. */
67
 
    PVBOXGUESTWAIT volatile     pHead;
68
 
    /** The tail. */
69
 
    PVBOXGUESTWAIT volatile     pTail;
70
 
} VBOXGUESTWAITLIST;
71
 
/** Pointer to a wait list. */
72
 
typedef VBOXGUESTWAITLIST *PVBOXGUESTWAITLIST;
73
 
 
74
74
 
75
75
/**
76
76
 * VBox guest memory balloon.
77
77
 */
78
78
typedef struct VBOXGUESTMEMBALLOON
79
79
{
80
 
    /** Mutext protecting the members below from concurrent access.. */
 
80
    /** Mutex protecting the members below from concurrent access.. */
81
81
    RTSEMFASTMUTEX              hMtx;
82
82
    /** The current number of chunks in the balloon. */
83
83
    uint32_t                    cChunks;
121
121
    /** The physical address of pIrqAckEvents. */
122
122
    RTCCPHYS                    PhysIrqAckEvents;
123
123
    /** Wait-for-event list for threads waiting for multiple events. */
124
 
    VBOXGUESTWAITLIST           WaitList;
 
124
    RTLISTNODE                  WaitList;
125
125
#ifdef VBOX_WITH_HGCM
126
126
    /** Wait-for-event list for threads waiting on HGCM async completion.
127
127
     * The entire list is evaluated upon the arrival of an HGCM event, unlike
128
128
     * the other lists which are only evaluated till the first thread has been woken up. */
129
 
    VBOXGUESTWAITLIST           HGCMWaitList;
130
 
#endif
 
129
    RTLISTNODE                  HGCMWaitList;
 
130
#endif
 
131
#ifdef VBOXGUEST_USE_DEFERRED_WAKE_UP
 
132
    /** List of wait-for-event entries that needs waking up. */
 
133
    RTLISTNODE                  WakeUpList;
 
134
#endif
 
135
    /** List of wait-for-event entries that has been woken up. */
 
136
    RTLISTNODE                  WokenUpList;
131
137
    /** List of free wait-for-event entries. */
132
 
    VBOXGUESTWAITLIST           FreeList;
 
138
    RTLISTNODE                  FreeList;
133
139
    /** Mask of pending events. */
134
140
    uint32_t volatile           f32PendingEvents;
135
141
    /** Current VMMDEV_EVENT_MOUSE_POSITION_CHANGED sequence number.
142
148
    /** The current clipboard client ID, 0 if no client.
143
149
     * For implementing the VBOXGUEST_IOCTL_CLIPBOARD_CONNECT interface. */
144
150
    uint32_t                    u32ClipboardClientId;
145
 
 
 
151
#ifdef VBOX_WITH_VRDP_SESSION_HANDLING
 
152
    BOOL                        fVRDPEnabled;
 
153
#endif
146
154
    /** Memory balloon information for RTR0MemObjAllocPhysNC(). */
147
155
    VBOXGUESTMEMBALLOON         MemBalloon;
 
156
    /** Align the next bit on a 64-byte boundary and make sure it starts at the same
 
157
     *  offset in both 64-bit and 32-bit builds.
 
158
     *
 
159
     * @remarks The alignments of the members that are larger than 48 bytes should be
 
160
     *          64-byte for cache line reasons. structs containing small amounts of
 
161
     *          data could be lumped together at the end with a < 64 byte padding
 
162
     *          following it (to grow into and align the struct size).
 
163
     */
 
164
    uint8_t abAlignment1[HC_ARCH_BITS == 32 ? 24 : 4];
 
165
 
 
166
    /** Windows part. */
 
167
    union
 
168
    {
 
169
#ifdef ___VBoxGuest_win_h
 
170
        VBOXGUESTDEVEXTWIN          s;
 
171
#endif
 
172
        uint8_t                     padding[256];      /* Multiple of 64; fix me! */
 
173
    } win;
148
174
 
149
175
} VBOXGUESTDEVEXT;
150
176
/** Pointer to the VBoxGuest driver data. */
181
207
#ifdef VBOX_WITH_HGCM
182
208
    /** Array containing HGCM client IDs associated with this session.
183
209
     * This will be automatically disconnected when the session is closed. */
184
 
    uint32_t volatile           aHGCMClientIds[8];
 
210
    uint32_t volatile           aHGCMClientIds[64];
185
211
#endif
186
212
    /** The last consumed VMMDEV_EVENT_MOUSE_POSITION_CHANGED sequence number.
187
213
     * Used to implement polling.  */
192
218
RT_C_DECLS_BEGIN
193
219
 
194
220
int  VBoxGuestInitDevExt(PVBOXGUESTDEVEXT pDevExt, uint16_t IOPortBase, void *pvMMIOBase, uint32_t cbMMIO, VBOXOSTYPE enmOSType, uint32_t fEvents);
 
221
bool VBoxGuestCommonISR(PVBOXGUESTDEVEXT pDevExt);
195
222
void VBoxGuestDeleteDevExt(PVBOXGUESTDEVEXT pDevExt);
196
 
bool VBoxGuestCommonISR(PVBOXGUESTDEVEXT pDevExt);
 
223
int  VBoxGuestReinitDevExtAfterHibernation(PVBOXGUESTDEVEXT pDevExt, VBOXOSTYPE enmOSType);
197
224
int  VBoxGuestSetGuestCapabilities(uint32_t fOr, uint32_t fNot);
 
225
#ifdef VBOXGUEST_USE_DEFERRED_WAKE_UP
 
226
void VBoxGuestWaitDoWakeUps(PVBOXGUESTDEVEXT pDevExt);
 
227
#endif
198
228
 
199
229
int  VBoxGuestCreateUserSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION *ppSession);
200
230
int  VBoxGuestCreateKernelSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION *ppSession);