VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/VBoxGuest/VBoxGuest_Internal.h@ 8155

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

The Big Sun Rebranding Header Change

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.3 KB
Line 
1/** @file
2 *
3 * VBoxGuest -- VirtualBox Win32 guest support driver
4 *
5 * Copyright (C) 2006-2007 Sun Microsystems, Inc.
6 *
7 * This file is part of VirtualBox Open Source Edition (OSE), as
8 * available from http://www.virtualbox.org. This file is free software;
9 * you can redistribute it and/or modify it under the terms of the GNU
10 * General Public License (GPL) as published by the Free Software
11 * Foundation, in version 2 as it comes in the "COPYING" file of the
12 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
13 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
14 *
15 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
16 * Clara, CA 95054 USA or visit http://www.sun.com if you need
17 * additional information or have any questions.
18 */
19
20#ifndef __VBOXGUESTINTERNAL_h__
21#define __VBOXGUESTINTERNAL_h__
22
23
24/*******************************************************************************
25* Header Files *
26*******************************************************************************/
27
28#include <iprt/cdefs.h>
29
30#ifdef IN_RING0
31# if (_MSC_VER >= 1400) && !defined(VBOX_WITH_PATCHED_DDK)
32# include <iprt/asm.h>
33# define _InterlockedExchange _InterlockedExchange_StupidDDKVsCompilerCrap
34# define _InterlockedExchangeAdd _InterlockedExchangeAdd_StupidDDKVsCompilerCrap
35# define _InterlockedCompareExchange _InterlockedCompareExchange_StupidDDKVsCompilerCrap
36# define _InterlockedAddLargeStatistic _InterlockedAddLargeStatistic_StupidDDKVsCompilerCrap
37__BEGIN_DECLS
38# include <ntddk.h>
39__END_DECLS
40# undef _InterlockedExchange
41# undef _InterlockedExchangeAdd
42# undef _InterlockedCompareExchange
43# undef _InterlockedAddLargeStatistic
44# else
45__BEGIN_DECLS
46# include <ntddk.h>
47__END_DECLS
48# endif
49#endif
50
51#include <VBox/VBoxGuest.h>
52
53/*******************************************************************************
54* Defined Constants And Macros *
55*******************************************************************************/
56
57
58/* debug printf */
59# define OSDBGPRINT(a) DbgPrint a
60
61/* dprintf */
62#if (defined(DEBUG) && !defined(NO_LOGGING)) || defined(LOG_ENABLED)
63# ifdef LOG_TO_BACKDOOR
64# include <VBox/log.h>
65# define dprintf(a) RTLogBackdoorPrintf a
66# else
67# define dprintf(a) OSDBGPRINT(a)
68# endif
69#else
70# define dprintf(a) do {} while (0)
71#endif
72
73/* dprintf2 - extended logging. */
74#if 0
75# define dprintf2 dprintf
76#else
77# define dprintf2(a) do { } while (0)
78#endif
79
80// the maximum scatter/gather transfer length
81#define MAXIMUM_TRANSFER_LENGTH 64*1024
82
83#define PCI_MAX_BUSES 256
84
85/*
86 * Error codes.
87 */
88
89
90/*******************************************************************************
91* Structures and Typedefs *
92*******************************************************************************/
93
94// possible device states for our state machine
95enum DEVSTATE
96{
97 STOPPED,
98 WORKING,
99 PENDINGSTOP,
100 PENDINGREMOVE,
101 SURPRISEREMOVED,
102 REMOVED
103};
104
105// undocumented API to set the system time
106extern "C"
107{
108NTSYSAPI NTSTATUS NTAPI ZwSetSystemTime(IN PLARGE_INTEGER NewTime, OUT PLARGE_INTEGER OldTime OPTIONAL);
109}
110
111#ifdef IN_RING0
112typedef struct _BASE_ADDRESS {
113
114 PHYSICAL_ADDRESS RangeStart; // Original device physical address
115 ULONG RangeLength; // Length of I/O or memory range
116 BOOLEAN RangeInMemory; // Flag: unmapped range is I/O or memory range
117
118 PVOID MappedRangeStart; // Mapped I/O or memory range
119 BOOLEAN MappedRangeInMemory; // Flag: mapped range is I/O or memory range
120
121 BOOLEAN ResourceMapped; // Flag: resource is mapped (i.e. MmMapIoSpace called)
122
123} BASE_ADDRESS, *PBASE_ADDRESS;
124
125
126/**
127 * Device extension.
128 */
129typedef struct VBOXGUESTDEVEXT
130{
131//// legacy stuff
132 // bus number where the device is located
133 ULONG busNumber;
134 // slot number where the device is located
135 ULONG slotNumber;
136 // device interrupt level
137 ULONG interruptLevel;
138 // device interrupt vector
139 ULONG interruptVector;
140 // affinity mask
141 KAFFINITY interruptAffinity;
142 // LevelSensitive or Latched
143 KINTERRUPT_MODE interruptMode;
144
145 // PCI base address information
146 ULONG addressCount;
147 BASE_ADDRESS baseAddress[PCI_TYPE0_ADDRESSES];
148
149 // adapter object pointer, returned by HalGetAdapter
150 PADAPTER_OBJECT adapterObject;
151
152 // interrupt object pointer
153 PKINTERRUPT interruptObject;
154/////
155
156
157 // our functional driver object
158 PDEVICE_OBJECT deviceObject;
159 // the top of the stack
160 PDEVICE_OBJECT nextLowerDriver;
161 // currently active Irp
162 IRP *currentIrp;
163 PKTHREAD workerThread;
164 PKTHREAD idleThread;
165 KEVENT workerThreadRequest;
166 BOOLEAN stopThread;
167 // device state
168 DEVSTATE devState;
169 // start port address
170 ULONG startPortAddress;
171 // start of hypervisor mapping
172 PVOID hypervisorMapping;
173 // size in bytes of the hypervisor mapping
174 ULONG hypervisorMappingSize;
175
176 /* Physical address and length of VMMDev memory */
177 PHYSICAL_ADDRESS memoryAddress;
178 ULONG memoryLength;
179
180 /* Virtual address of VMMDev memory */
181 VMMDevMemory *pVMMDevMemory;
182
183 /* Pending event flags signalled by host */
184 ULONG u32Events;
185
186 /* Notification semaphore */
187 KEVENT keventNotification;
188
189 /* Old Windows session id */
190 ULONG ulOldActiveConsoleId;
191
192 /* VRDP hook state */
193 BOOLEAN fVRDPEnabled;
194
195 /* Preallocated VMMDevEvents for IRQ handler */
196 VMMDevEvents *irqAckEvents;
197
198
199 struct
200 {
201 uint32_t cBalloons;
202 uint32_t cMaxBalloons;
203 PMDL *paMdlMemBalloon;
204 } MemBalloon;
205
206} VBOXGUESTDEVEXT, *PVBOXGUESTDEVEXT;
207
208// Windows version identifier
209typedef enum
210{
211 WINNT4 = 1,
212 WIN2K = 2,
213 WINXP = 3,
214 WIN2K3 = 4,
215 WINVISTA = 5
216} winVersion_t;
217extern winVersion_t winVersion;
218
219extern "C"
220{
221VOID VBoxGuestDpcHandler(PKDPC dpc, PDEVICE_OBJECT pDevObj,
222 PIRP irp, PVOID context);
223BOOLEAN VBoxGuestIsrHandler(PKINTERRUPT interrupt, PVOID serviceContext);
224NTSTATUS createThreads(PVBOXGUESTDEVEXT pDevExt);
225VOID unreserveHypervisorMemory(PVBOXGUESTDEVEXT pDevExt);
226void VBoxInitMemBalloon(PVBOXGUESTDEVEXT pDevExt);
227void VBoxCleanupMemBalloon(PVBOXGUESTDEVEXT pDevExt);
228}
229
230#endif
231
232#endif // __H_VBOXGUESTINTERNAL
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