1 | /* $Id: GIMDev.cpp 91968 2021-10-21 15:52:28Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * Guest Interface Manager Device.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2014-2020 Oracle Corporation
|
---|
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 (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 |
|
---|
18 |
|
---|
19 | /*********************************************************************************************************************************
|
---|
20 | * Header Files *
|
---|
21 | *********************************************************************************************************************************/
|
---|
22 | #define LOG_GROUP LOG_GROUP_DEV_GIM
|
---|
23 | #include <VBox/vmm/pdmdev.h>
|
---|
24 | #include <VBox/vmm/gim.h>
|
---|
25 |
|
---|
26 | #include "VBoxDD.h"
|
---|
27 | #include <iprt/alloc.h>
|
---|
28 | #include <iprt/semaphore.h>
|
---|
29 | #include <iprt/uuid.h>
|
---|
30 |
|
---|
31 |
|
---|
32 | /*********************************************************************************************************************************
|
---|
33 | * Defined Constants And Macros *
|
---|
34 | *********************************************************************************************************************************/
|
---|
35 | #define GIMDEV_DEBUG_LUN 998
|
---|
36 |
|
---|
37 |
|
---|
38 | /*********************************************************************************************************************************
|
---|
39 | * Structures and Typedefs *
|
---|
40 | *********************************************************************************************************************************/
|
---|
41 | /**
|
---|
42 | * GIM device.
|
---|
43 | */
|
---|
44 | typedef struct GIMDEV
|
---|
45 | {
|
---|
46 | /** Pointer to the device instance.
|
---|
47 | * @note Only for getting our bearings when arriving in an interface method. */
|
---|
48 | PPDMDEVINSR3 pDevIns;
|
---|
49 |
|
---|
50 | /** LUN\#998: The debug interface. */
|
---|
51 | PDMIBASE IDbgBase;
|
---|
52 | /** LUN\#998: The stream port interface. */
|
---|
53 | PDMISTREAM IDbgStreamPort;
|
---|
54 | /** Pointer to the attached base debug driver. */
|
---|
55 | R3PTRTYPE(PPDMIBASE) pDbgDrvBase;
|
---|
56 | /** The debug receive thread. */
|
---|
57 | RTTHREAD hDbgRecvThread;
|
---|
58 | /** Flag to indicate shutdown of the debug receive thread. */
|
---|
59 | bool volatile fDbgRecvThreadShutdown;
|
---|
60 | bool afAlignment1[ARCH_BITS / 8 - 1];
|
---|
61 | /** The debug setup parameters. */
|
---|
62 | GIMDEBUGSETUP DbgSetup;
|
---|
63 | /** The debug transfer struct. */
|
---|
64 | GIMDEBUG Dbg;
|
---|
65 | } GIMDEV;
|
---|
66 | /** Pointer to the GIM device state. */
|
---|
67 | typedef GIMDEV *PGIMDEV;
|
---|
68 | AssertCompileMemberAlignment(GIMDEV, IDbgBase, 8);
|
---|
69 |
|
---|
70 | #ifndef VBOX_DEVICE_STRUCT_TESTCASE
|
---|
71 |
|
---|
72 | #ifdef IN_RING3
|
---|
73 |
|
---|
74 |
|
---|
75 | /* -=-=-=-=-=-=-=-=- PDMIBASE on LUN#GIMDEV_DEBUG_LUN -=-=-=-=-=-=-=-=- */
|
---|
76 |
|
---|
77 | /**
|
---|
78 | * @interface_method_impl{PDMIBASE,pfnQueryInterface}
|
---|
79 | */
|
---|
80 | static DECLCALLBACK(void *) gimdevR3QueryInterface(PPDMIBASE pInterface, const char *pszIID)
|
---|
81 | {
|
---|
82 | PGIMDEV pThis = RT_FROM_MEMBER(pInterface, GIMDEV, IDbgBase);
|
---|
83 | PDMIBASE_RETURN_INTERFACE(pszIID, PDMIBASE, &pThis->IDbgBase);
|
---|
84 | PDMIBASE_RETURN_INTERFACE(pszIID, PDMISTREAM, &pThis->IDbgStreamPort);
|
---|
85 | return NULL;
|
---|
86 | }
|
---|
87 |
|
---|
88 |
|
---|
89 | static DECLCALLBACK(int) gimDevR3DbgRecvThread(RTTHREAD hThreadSelf, void *pvUser)
|
---|
90 | {
|
---|
91 | RT_NOREF1(hThreadSelf);
|
---|
92 |
|
---|
93 | /*
|
---|
94 | * Validate.
|
---|
95 | */
|
---|
96 | PPDMDEVINS pDevIns = (PPDMDEVINS)pvUser;
|
---|
97 | AssertReturn(pDevIns, VERR_INVALID_PARAMETER);
|
---|
98 | PDMDEV_CHECK_VERSIONS_RETURN(pDevIns);
|
---|
99 |
|
---|
100 | PGIMDEV pThis = PDMDEVINS_2_DATA(pDevIns, PGIMDEV);
|
---|
101 | AssertReturn(pThis, VERR_INVALID_POINTER);
|
---|
102 | AssertReturn(pThis->DbgSetup.cbDbgRecvBuf, VERR_INTERNAL_ERROR);
|
---|
103 | AssertReturn(pThis->Dbg.hDbgRecvThreadSem != NIL_RTSEMEVENTMULTI, VERR_INTERNAL_ERROR_2);
|
---|
104 | AssertReturn(pThis->Dbg.pvDbgRecvBuf, VERR_INTERNAL_ERROR_3);
|
---|
105 |
|
---|
106 | PVM pVM = PDMDevHlpGetVM(pDevIns);
|
---|
107 | AssertReturn(pVM, VERR_INVALID_POINTER);
|
---|
108 |
|
---|
109 | PPDMISTREAM pDbgDrvStream = pThis->Dbg.pDbgDrvStream;
|
---|
110 | AssertReturn(pDbgDrvStream, VERR_INVALID_POINTER);
|
---|
111 |
|
---|
112 | for (;;)
|
---|
113 | {
|
---|
114 | /*
|
---|
115 | * Read incoming debug data.
|
---|
116 | */
|
---|
117 | size_t cbRead = pThis->DbgSetup.cbDbgRecvBuf;
|
---|
118 | int rc = pDbgDrvStream->pfnRead(pDbgDrvStream, pThis->Dbg.pvDbgRecvBuf, &cbRead);
|
---|
119 | if ( RT_SUCCESS(rc)
|
---|
120 | && cbRead > 0)
|
---|
121 | {
|
---|
122 | /*
|
---|
123 | * Notify the consumer thread.
|
---|
124 | */
|
---|
125 | if (ASMAtomicReadBool(&pThis->Dbg.fDbgRecvBufRead) == false)
|
---|
126 | {
|
---|
127 | if (pThis->DbgSetup.pfnDbgRecvBufAvail)
|
---|
128 | pThis->DbgSetup.pfnDbgRecvBufAvail(pVM);
|
---|
129 | pThis->Dbg.cbDbgRecvBufRead = cbRead;
|
---|
130 | RTSemEventMultiReset(pThis->Dbg.hDbgRecvThreadSem);
|
---|
131 | ASMAtomicWriteBool(&pThis->Dbg.fDbgRecvBufRead, true);
|
---|
132 | }
|
---|
133 |
|
---|
134 | /*
|
---|
135 | * Wait until the consumer thread has acknowledged reading of the
|
---|
136 | * current buffer or we're asked to shut down.
|
---|
137 | *
|
---|
138 | * It is important that we do NOT re-invoke 'pfnRead' before the
|
---|
139 | * current buffer is consumed, otherwise we risk data corruption.
|
---|
140 | */
|
---|
141 | while ( ASMAtomicReadBool(&pThis->Dbg.fDbgRecvBufRead) == true
|
---|
142 | && !pThis->fDbgRecvThreadShutdown)
|
---|
143 | {
|
---|
144 | RTSemEventMultiWait(pThis->Dbg.hDbgRecvThreadSem, RT_INDEFINITE_WAIT);
|
---|
145 | }
|
---|
146 | }
|
---|
147 | #ifdef RT_OS_LINUX
|
---|
148 | else if (rc == VERR_NET_CONNECTION_REFUSED)
|
---|
149 | {
|
---|
150 | /*
|
---|
151 | * With the current, simplistic PDMISTREAM interface, this is the best we can do.
|
---|
152 | * Even using RTSocketSelectOne[Ex] on Linux returns immediately with 'ready-to-read'
|
---|
153 | * on localhost UDP sockets that are not connected on the other end.
|
---|
154 | */
|
---|
155 | /** @todo Fix socket waiting semantics on localhost Linux unconnected UDP sockets. */
|
---|
156 | RTThreadSleep(400);
|
---|
157 | }
|
---|
158 | #endif
|
---|
159 | else if ( rc != VINF_TRY_AGAIN
|
---|
160 | && rc != VERR_TRY_AGAIN
|
---|
161 | && rc != VERR_NET_CONNECTION_RESET_BY_PEER)
|
---|
162 | {
|
---|
163 | LogRel(("GIMDev: Debug thread terminating with rc=%Rrc\n", rc));
|
---|
164 | break;
|
---|
165 | }
|
---|
166 |
|
---|
167 | if (pThis->fDbgRecvThreadShutdown)
|
---|
168 | {
|
---|
169 | LogRel(("GIMDev: Debug thread shutting down\n"));
|
---|
170 | break;
|
---|
171 | }
|
---|
172 | }
|
---|
173 |
|
---|
174 | return VINF_SUCCESS;
|
---|
175 | }
|
---|
176 |
|
---|
177 | /**
|
---|
178 | * @interface_method_impl{PDMDEVREG,pfnReset}
|
---|
179 | */
|
---|
180 | static DECLCALLBACK(void) gimdevR3Reset(PPDMDEVINS pDevIns)
|
---|
181 | {
|
---|
182 | NOREF(pDevIns);
|
---|
183 | /* We do not deregister any MMIO2 regions as the regions are expected to be static. */
|
---|
184 | }
|
---|
185 |
|
---|
186 |
|
---|
187 |
|
---|
188 | /**
|
---|
189 | * @interface_method_impl{PDMDEVREG,pfnRelocate}
|
---|
190 | */
|
---|
191 | static DECLCALLBACK(void) gimdevR3Relocate(PPDMDEVINS pDevIns, RTGCINTPTR offDelta)
|
---|
192 | {
|
---|
193 | NOREF(pDevIns);
|
---|
194 | NOREF(offDelta);
|
---|
195 | #ifdef VBOX_WITH_RAW_MODE_KEEP
|
---|
196 | # error relocate pvPageRC
|
---|
197 | #endif
|
---|
198 | }
|
---|
199 |
|
---|
200 |
|
---|
201 | /**
|
---|
202 | * @interface_method_impl{PDMDEVREG,pfnDestruct}
|
---|
203 | */
|
---|
204 | static DECLCALLBACK(int) gimdevR3Destruct(PPDMDEVINS pDevIns)
|
---|
205 | {
|
---|
206 | PDMDEV_CHECK_VERSIONS_RETURN_QUIET(pDevIns);
|
---|
207 | PGIMDEV pThis = PDMDEVINS_2_DATA(pDevIns, PGIMDEV);
|
---|
208 |
|
---|
209 | /*
|
---|
210 | * Signal and wait for the debug thread to terminate.
|
---|
211 | */
|
---|
212 | if (pThis->hDbgRecvThread != NIL_RTTHREAD)
|
---|
213 | {
|
---|
214 | pThis->fDbgRecvThreadShutdown = true;
|
---|
215 | if (pThis->Dbg.hDbgRecvThreadSem != NIL_RTSEMEVENT)
|
---|
216 | RTSemEventMultiSignal(pThis->Dbg.hDbgRecvThreadSem);
|
---|
217 |
|
---|
218 | int rc = RTThreadWait(pThis->hDbgRecvThread, 20000, NULL /*prc*/);
|
---|
219 | if (RT_SUCCESS(rc))
|
---|
220 | pThis->hDbgRecvThread = NIL_RTTHREAD;
|
---|
221 | else
|
---|
222 | {
|
---|
223 | LogRel(("GIMDev: Debug thread did not terminate, rc=%Rrc!\n", rc));
|
---|
224 | return VERR_RESOURCE_BUSY;
|
---|
225 | }
|
---|
226 | }
|
---|
227 |
|
---|
228 | /*
|
---|
229 | * Now clean up the semaphore & buffer now that the thread is gone.
|
---|
230 | */
|
---|
231 | if (pThis->Dbg.hDbgRecvThreadSem != NIL_RTSEMEVENT)
|
---|
232 | {
|
---|
233 | RTSemEventMultiDestroy(pThis->Dbg.hDbgRecvThreadSem);
|
---|
234 | pThis->Dbg.hDbgRecvThreadSem = NIL_RTSEMEVENTMULTI;
|
---|
235 | }
|
---|
236 | if (pThis->Dbg.pvDbgRecvBuf)
|
---|
237 | {
|
---|
238 | RTMemFree(pThis->Dbg.pvDbgRecvBuf);
|
---|
239 | pThis->Dbg.pvDbgRecvBuf = NULL;
|
---|
240 | }
|
---|
241 |
|
---|
242 | return VINF_SUCCESS;
|
---|
243 | }
|
---|
244 |
|
---|
245 |
|
---|
246 | /**
|
---|
247 | * @interface_method_impl{PDMDEVREG,pfnConstruct}
|
---|
248 | */
|
---|
249 | static DECLCALLBACK(int) gimdevR3Construct(PPDMDEVINS pDevIns, int iInstance, PCFGMNODE pCfg)
|
---|
250 | {
|
---|
251 | PDMDEV_CHECK_VERSIONS_RETURN(pDevIns);
|
---|
252 | PGIMDEV pThis = PDMDEVINS_2_DATA(pDevIns, PGIMDEV);
|
---|
253 | RT_NOREF2(iInstance, pCfg);
|
---|
254 |
|
---|
255 | Assert(iInstance == 0);
|
---|
256 |
|
---|
257 | /*
|
---|
258 | * Initialize relevant state bits.
|
---|
259 | */
|
---|
260 | pThis->pDevIns = pDevIns;
|
---|
261 | pThis->hDbgRecvThread = NIL_RTTHREAD;
|
---|
262 | pThis->Dbg.hDbgRecvThreadSem = NIL_RTSEMEVENT;
|
---|
263 |
|
---|
264 | /*
|
---|
265 | * Get debug setup requirements from GIM.
|
---|
266 | */
|
---|
267 | int rc = PDMDevHlpGIMGetDebugSetup(pDevIns, &pThis->DbgSetup);
|
---|
268 | if ( RT_SUCCESS(rc)
|
---|
269 | && pThis->DbgSetup.cbDbgRecvBuf > 0)
|
---|
270 | {
|
---|
271 | /*
|
---|
272 | * Attach the stream driver for the debug connection.
|
---|
273 | */
|
---|
274 | PPDMISTREAM pDbgDrvStream = NULL;
|
---|
275 | pThis->IDbgBase.pfnQueryInterface = gimdevR3QueryInterface;
|
---|
276 | rc = PDMDevHlpDriverAttach(pDevIns, GIMDEV_DEBUG_LUN, &pThis->IDbgBase, &pThis->pDbgDrvBase, "GIM Debug Port");
|
---|
277 | if (RT_SUCCESS(rc))
|
---|
278 | {
|
---|
279 | pDbgDrvStream = PDMIBASE_QUERY_INTERFACE(pThis->pDbgDrvBase, PDMISTREAM);
|
---|
280 | if (pDbgDrvStream)
|
---|
281 | LogRel(("GIMDev: LUN#%u: Debug port configured\n", GIMDEV_DEBUG_LUN));
|
---|
282 | else
|
---|
283 | {
|
---|
284 | LogRel(("GIMDev: LUN#%u: No unit\n", GIMDEV_DEBUG_LUN));
|
---|
285 | rc = VERR_INTERNAL_ERROR_2;
|
---|
286 | }
|
---|
287 | }
|
---|
288 | else
|
---|
289 | {
|
---|
290 | pThis->pDbgDrvBase = NULL;
|
---|
291 | LogRel(("GIMDev: LUN#%u: No debug port configured! rc=%Rrc\n", GIMDEV_DEBUG_LUN, rc));
|
---|
292 | }
|
---|
293 |
|
---|
294 | if (!pDbgDrvStream)
|
---|
295 | {
|
---|
296 | Assert(rc != VINF_SUCCESS);
|
---|
297 | return PDMDevHlpVMSetError(pDevIns, rc, RT_SRC_POS,
|
---|
298 | N_("Debug port configuration expected when GIM configured with debugging support"));
|
---|
299 | }
|
---|
300 |
|
---|
301 | void *pvDbgRecvBuf = RTMemAllocZ(pThis->DbgSetup.cbDbgRecvBuf);
|
---|
302 | if (RT_UNLIKELY(!pvDbgRecvBuf))
|
---|
303 | {
|
---|
304 | LogRel(("GIMDev: Failed to alloc %u bytes for debug receive buffer\n", pThis->DbgSetup.cbDbgRecvBuf));
|
---|
305 | return VERR_NO_MEMORY;
|
---|
306 | }
|
---|
307 |
|
---|
308 | /*
|
---|
309 | * Update the shared debug struct.
|
---|
310 | */
|
---|
311 | pThis->Dbg.pDbgDrvStream = pDbgDrvStream;
|
---|
312 | pThis->Dbg.pvDbgRecvBuf = pvDbgRecvBuf;
|
---|
313 | pThis->Dbg.cbDbgRecvBufRead = 0;
|
---|
314 | pThis->Dbg.fDbgRecvBufRead = false;
|
---|
315 |
|
---|
316 | /*
|
---|
317 | * Create the semaphore and the debug receive thread itself.
|
---|
318 | */
|
---|
319 | rc = RTSemEventMultiCreate(&pThis->Dbg.hDbgRecvThreadSem);
|
---|
320 | AssertRCReturn(rc, rc);
|
---|
321 | rc = RTThreadCreate(&pThis->hDbgRecvThread, gimDevR3DbgRecvThread, pDevIns, 0 /*cbStack*/, RTTHREADTYPE_IO,
|
---|
322 | RTTHREADFLAGS_WAITABLE, "GIMDebugRecv");
|
---|
323 | if (RT_FAILURE(rc))
|
---|
324 | {
|
---|
325 | RTSemEventMultiDestroy(pThis->Dbg.hDbgRecvThreadSem);
|
---|
326 | pThis->Dbg.hDbgRecvThreadSem = NIL_RTSEMEVENTMULTI;
|
---|
327 |
|
---|
328 | RTMemFree(pThis->Dbg.pvDbgRecvBuf);
|
---|
329 | pThis->Dbg.pvDbgRecvBuf = NULL;
|
---|
330 | return rc;
|
---|
331 | }
|
---|
332 | }
|
---|
333 |
|
---|
334 | /*
|
---|
335 | * Register this device with the GIM component.
|
---|
336 | */
|
---|
337 | PDMDevHlpGIMDeviceRegister(pDevIns, pThis->DbgSetup.cbDbgRecvBuf ? &pThis->Dbg : NULL);
|
---|
338 |
|
---|
339 | /*
|
---|
340 | * Get the MMIO2 regions from the GIM provider and make the registrations.
|
---|
341 | */
|
---|
342 | /** @todo r=bird: consider ditching this as GIM doesn't actually make use of it */
|
---|
343 | uint32_t cRegions = 0;
|
---|
344 | PGIMMMIO2REGION paRegions = PDMDevHlpGIMGetMmio2Regions(pDevIns, &cRegions);
|
---|
345 | if ( cRegions
|
---|
346 | && paRegions)
|
---|
347 | {
|
---|
348 | for (uint32_t i = 0; i < cRegions; i++)
|
---|
349 | {
|
---|
350 | PGIMMMIO2REGION pCur = &paRegions[i];
|
---|
351 | Assert(pCur->iRegion < 8);
|
---|
352 | rc = PDMDevHlpMmio2Create(pDevIns, NULL, pCur->iRegion << 16, pCur->cbRegion, 0 /* fFlags */, pCur->szDescription,
|
---|
353 | &pCur->pvPageR3, &pCur->hMmio2);
|
---|
354 | AssertLogRelMsgRCReturn(rc, ("rc=%Rrc iRegion=%u cbRegion=%#x %s\n",
|
---|
355 | rc, pCur->iRegion, pCur->cbRegion, pCur->szDescription),
|
---|
356 | rc);
|
---|
357 | pCur->fRegistered = true;
|
---|
358 | pCur->pvPageR0 = NIL_RTR0PTR;
|
---|
359 | # ifdef VBOX_WITH_RAW_MODE_KEEP
|
---|
360 | pCur->pvPageRC = NIL_RTRCPTR;
|
---|
361 | # endif
|
---|
362 |
|
---|
363 | LogRel(("GIMDev: Registered %s\n", pCur->szDescription));
|
---|
364 | }
|
---|
365 | }
|
---|
366 | else
|
---|
367 | Assert(cRegions == 0);
|
---|
368 |
|
---|
369 | /** @todo Register SSM: PDMDevHlpSSMRegister(). */
|
---|
370 | /** @todo Register statistics: STAM_REG(). */
|
---|
371 | /** @todo Register DBGFInfo: PDMDevHlpDBGFInfoRegister(). */
|
---|
372 |
|
---|
373 | return VINF_SUCCESS;
|
---|
374 | }
|
---|
375 |
|
---|
376 |
|
---|
377 | #else /* !IN_RING3 */
|
---|
378 |
|
---|
379 | /**
|
---|
380 | * @callback_method_impl{PDMDEVREGR0,pfnConstruct}
|
---|
381 | */
|
---|
382 | static DECLCALLBACK(int) gimdevRZConstruct(PPDMDEVINS pDevIns)
|
---|
383 | {
|
---|
384 | PDMDEV_CHECK_VERSIONS_RETURN(pDevIns);
|
---|
385 | //PGIMDEV pThis = PDMDEVINS_2_DATA(pDevIns, PGIMDEV);
|
---|
386 |
|
---|
387 | /*
|
---|
388 | * Map the MMIO2 regions into the context.
|
---|
389 | */
|
---|
390 | /** @todo r=bird: consider ditching this as GIM doesn't actually make use of it */
|
---|
391 | PVMCC pVM = PDMDevHlpGetVM(pDevIns);
|
---|
392 | uint32_t cRegions = 0;
|
---|
393 | PGIMMMIO2REGION paRegions = GIMGetMmio2Regions(pVM, &cRegions);
|
---|
394 | if ( cRegions
|
---|
395 | && paRegions)
|
---|
396 | {
|
---|
397 | for (uint32_t i = 0; i < cRegions; i++)
|
---|
398 | {
|
---|
399 | PGIMMMIO2REGION pCur = &paRegions[i];
|
---|
400 | int rc = PDMDevHlpMmio2SetUpContext(pDevIns, pCur->hMmio2, 0, 0, &pCur->CTX_SUFF(pvPage));
|
---|
401 | AssertLogRelMsgRCReturn(rc, ("rc=%Rrc iRegion=%u cbRegion=%#x %s\n",
|
---|
402 | rc, pCur->iRegion, pCur->cbRegion, pCur->szDescription),
|
---|
403 | rc);
|
---|
404 | Assert(pCur->fRegistered);
|
---|
405 | }
|
---|
406 | }
|
---|
407 | else
|
---|
408 | Assert(cRegions == 0);
|
---|
409 |
|
---|
410 | return VINF_SUCCESS;
|
---|
411 | }
|
---|
412 |
|
---|
413 | #endif /* !IN_RING3 */
|
---|
414 |
|
---|
415 | /**
|
---|
416 | * The device registration structure.
|
---|
417 | */
|
---|
418 | const PDMDEVREG g_DeviceGIMDev =
|
---|
419 | {
|
---|
420 | /* .u32Version = */ PDM_DEVREG_VERSION,
|
---|
421 | /* .uReserved0 = */ 0,
|
---|
422 | /* .szName = */ "GIMDev",
|
---|
423 | /* .fFlags = */ PDM_DEVREG_FLAGS_DEFAULT_BITS | PDM_DEVREG_FLAGS_RZ | PDM_DEVREG_FLAGS_REQUIRE_R0
|
---|
424 | | PDM_DEVREG_FLAGS_NEW_STYLE,
|
---|
425 | /* .fClass = */ PDM_DEVREG_CLASS_MISC,
|
---|
426 | /* .cMaxInstances = */ 1,
|
---|
427 | /* .uSharedVersion = */ 42,
|
---|
428 | /* .cbInstanceShared = */ sizeof(GIMDEV),
|
---|
429 | /* .cbInstanceCC = */ 0,
|
---|
430 | /* .cbInstanceRC = */ 0,
|
---|
431 | /* .cMaxPciDevices = */ 0,
|
---|
432 | /* .cMaxMsixVectors = */ 0,
|
---|
433 | /* .pszDescription = */ "VirtualBox GIM Device",
|
---|
434 | #if defined(IN_RING3)
|
---|
435 | /* .pszRCMod = */ "VBoxDDRC.rc",
|
---|
436 | /* .pszR0Mod = */ "VBoxDDR0.r0",
|
---|
437 | /* .pfnConstruct = */ gimdevR3Construct,
|
---|
438 | /* .pfnDestruct = */ gimdevR3Destruct,
|
---|
439 | /* .pfnRelocate = */ gimdevR3Relocate,
|
---|
440 | /* .pfnMemSetup = */ NULL,
|
---|
441 | /* .pfnPowerOn = */ NULL,
|
---|
442 | /* .pfnReset = */ gimdevR3Reset,
|
---|
443 | /* .pfnSuspend = */ NULL,
|
---|
444 | /* .pfnResume = */ NULL,
|
---|
445 | /* .pfnAttach = */ NULL,
|
---|
446 | /* .pfnDetach = */ NULL,
|
---|
447 | /* .pfnQueryInterface = */ NULL,
|
---|
448 | /* .pfnInitComplete = */ NULL,
|
---|
449 | /* .pfnPowerOff = */ NULL,
|
---|
450 | /* .pfnSoftReset = */ NULL,
|
---|
451 | /* .pfnReserved0 = */ NULL,
|
---|
452 | /* .pfnReserved1 = */ NULL,
|
---|
453 | /* .pfnReserved2 = */ NULL,
|
---|
454 | /* .pfnReserved3 = */ NULL,
|
---|
455 | /* .pfnReserved4 = */ NULL,
|
---|
456 | /* .pfnReserved5 = */ NULL,
|
---|
457 | /* .pfnReserved6 = */ NULL,
|
---|
458 | /* .pfnReserved7 = */ NULL,
|
---|
459 | #elif defined(IN_RING0)
|
---|
460 | /* .pfnEarlyConstruct = */ NULL,
|
---|
461 | /* .pfnConstruct = */ gimdevRZConstruct,
|
---|
462 | /* .pfnDestruct = */ NULL,
|
---|
463 | /* .pfnFinalDestruct = */ NULL,
|
---|
464 | /* .pfnRequest = */ NULL,
|
---|
465 | /* .pfnReserved0 = */ NULL,
|
---|
466 | /* .pfnReserved1 = */ NULL,
|
---|
467 | /* .pfnReserved2 = */ NULL,
|
---|
468 | /* .pfnReserved3 = */ NULL,
|
---|
469 | /* .pfnReserved4 = */ NULL,
|
---|
470 | /* .pfnReserved5 = */ NULL,
|
---|
471 | /* .pfnReserved6 = */ NULL,
|
---|
472 | /* .pfnReserved7 = */ NULL,
|
---|
473 | #elif defined(IN_RC)
|
---|
474 | /* .pfnConstruct = */ gimdevRZConstruct,
|
---|
475 | /* .pfnReserved0 = */ NULL,
|
---|
476 | /* .pfnReserved1 = */ NULL,
|
---|
477 | /* .pfnReserved2 = */ NULL,
|
---|
478 | /* .pfnReserved3 = */ NULL,
|
---|
479 | /* .pfnReserved4 = */ NULL,
|
---|
480 | /* .pfnReserved5 = */ NULL,
|
---|
481 | /* .pfnReserved6 = */ NULL,
|
---|
482 | /* .pfnReserved7 = */ NULL,
|
---|
483 | #else
|
---|
484 | # error "Not in IN_RING3, IN_RING0 or IN_RC!"
|
---|
485 | #endif
|
---|
486 | /* .u32VersionEnd = */ PDM_DEVREG_VERSION
|
---|
487 | };
|
---|
488 |
|
---|
489 | #endif /* VBOX_DEVICE_STRUCT_TESTCASE */
|
---|
490 |
|
---|