1 | /* $Id: IOMInternal.h 37424 2011-06-12 19:28:11Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * IOM - Internal header file.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2007 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 | #ifndef ___IOMInternal_h
|
---|
19 | #define ___IOMInternal_h
|
---|
20 |
|
---|
21 | #include <VBox/cdefs.h>
|
---|
22 | #include <VBox/types.h>
|
---|
23 | #include <VBox/vmm/iom.h>
|
---|
24 | #include <VBox/vmm/stam.h>
|
---|
25 | #include <VBox/vmm/pgm.h>
|
---|
26 | #include <VBox/vmm/pdmcritsect.h>
|
---|
27 | #include <VBox/param.h>
|
---|
28 | #include <iprt/assert.h>
|
---|
29 | #include <iprt/avl.h>
|
---|
30 |
|
---|
31 |
|
---|
32 |
|
---|
33 | /** @defgroup grp_iom_int Internals
|
---|
34 | * @ingroup grp_iom
|
---|
35 | * @internal
|
---|
36 | * @{
|
---|
37 | */
|
---|
38 |
|
---|
39 | /**
|
---|
40 | * MMIO range descriptor.
|
---|
41 | */
|
---|
42 | typedef struct IOMMMIORANGE
|
---|
43 | {
|
---|
44 | /** Avl node core with GCPhys as Key and GCPhys + cbSize - 1 as KeyLast. */
|
---|
45 | AVLROGCPHYSNODECORE Core;
|
---|
46 | /** Start physical address. */
|
---|
47 | RTGCPHYS GCPhys;
|
---|
48 | /** Size of the range. */
|
---|
49 | uint32_t cb;
|
---|
50 | uint32_t u32Alignment; /**< Alignment padding. */
|
---|
51 |
|
---|
52 | /** Pointer to user argument - R3. */
|
---|
53 | RTR3PTR pvUserR3;
|
---|
54 | /** Pointer to device instance - R3. */
|
---|
55 | PPDMDEVINSR3 pDevInsR3;
|
---|
56 | /** Pointer to write callback function - R3. */
|
---|
57 | R3PTRTYPE(PFNIOMMMIOWRITE) pfnWriteCallbackR3;
|
---|
58 | /** Pointer to read callback function - R3. */
|
---|
59 | R3PTRTYPE(PFNIOMMMIOREAD) pfnReadCallbackR3;
|
---|
60 | /** Pointer to fill (memset) callback function - R3. */
|
---|
61 | R3PTRTYPE(PFNIOMMMIOFILL) pfnFillCallbackR3;
|
---|
62 |
|
---|
63 | /** Pointer to user argument - R0. */
|
---|
64 | RTR0PTR pvUserR0;
|
---|
65 | /** Pointer to device instance - R0. */
|
---|
66 | PPDMDEVINSR0 pDevInsR0;
|
---|
67 | /** Pointer to write callback function - R0. */
|
---|
68 | R0PTRTYPE(PFNIOMMMIOWRITE) pfnWriteCallbackR0;
|
---|
69 | /** Pointer to read callback function - R0. */
|
---|
70 | R0PTRTYPE(PFNIOMMMIOREAD) pfnReadCallbackR0;
|
---|
71 | /** Pointer to fill (memset) callback function - R0. */
|
---|
72 | R0PTRTYPE(PFNIOMMMIOFILL) pfnFillCallbackR0;
|
---|
73 |
|
---|
74 | /** Pointer to user argument - RC. */
|
---|
75 | RTRCPTR pvUserRC;
|
---|
76 | /** Pointer to device instance - RC. */
|
---|
77 | PPDMDEVINSRC pDevInsRC;
|
---|
78 | /** Pointer to write callback function - RC. */
|
---|
79 | RCPTRTYPE(PFNIOMMMIOWRITE) pfnWriteCallbackRC;
|
---|
80 | /** Pointer to read callback function - RC. */
|
---|
81 | RCPTRTYPE(PFNIOMMMIOREAD) pfnReadCallbackRC;
|
---|
82 | /** Pointer to fill (memset) callback function - RC. */
|
---|
83 | RCPTRTYPE(PFNIOMMMIOFILL) pfnFillCallbackRC;
|
---|
84 | /** Alignment padding. */
|
---|
85 | RTRCPTR RCPtrAlignment;
|
---|
86 |
|
---|
87 | /** Description / Name. For easing debugging. */
|
---|
88 | R3PTRTYPE(const char *) pszDesc;
|
---|
89 | } IOMMMIORANGE;
|
---|
90 | /** Pointer to a MMIO range descriptor, R3 version. */
|
---|
91 | typedef struct IOMMMIORANGE *PIOMMMIORANGE;
|
---|
92 |
|
---|
93 |
|
---|
94 | /**
|
---|
95 | * MMIO address statistics. (one address)
|
---|
96 | *
|
---|
97 | * This is a simple way of making on demand statistics, however it's a
|
---|
98 | * bit free with the hypervisor heap memory.
|
---|
99 | */
|
---|
100 | typedef struct IOMMMIOSTATS
|
---|
101 | {
|
---|
102 | /** Avl node core with the address as Key. */
|
---|
103 | AVLOGCPHYSNODECORE Core;
|
---|
104 |
|
---|
105 | /** Number of accesses (subtract ReadRZToR3 and WriteRZToR3 to get the right
|
---|
106 | * number). */
|
---|
107 | STAMCOUNTER Accesses;
|
---|
108 |
|
---|
109 | /** Profiling read handler overhead in R3. */
|
---|
110 | STAMPROFILE ProfReadR3;
|
---|
111 | /** Profiling write handler overhead in R3. */
|
---|
112 | STAMPROFILE ProfWriteR3;
|
---|
113 | /** Counting and profiling reads in R0/RC. */
|
---|
114 | STAMPROFILE ProfReadRZ;
|
---|
115 | /** Counting and profiling writes in R0/RC. */
|
---|
116 | STAMPROFILE ProfWriteRZ;
|
---|
117 |
|
---|
118 | /** Number of reads to this address from R0/RC which was serviced in R3. */
|
---|
119 | STAMCOUNTER ReadRZToR3;
|
---|
120 | /** Number of writes to this address from R0/RC which was serviced in R3. */
|
---|
121 | STAMCOUNTER WriteRZToR3;
|
---|
122 | } IOMMMIOSTATS;
|
---|
123 | AssertCompileMemberAlignment(IOMMMIOSTATS, Accesses, 8);
|
---|
124 | /** Pointer to I/O port statistics. */
|
---|
125 | typedef IOMMMIOSTATS *PIOMMMIOSTATS;
|
---|
126 |
|
---|
127 |
|
---|
128 | /**
|
---|
129 | * I/O port range descriptor, R3 version.
|
---|
130 | */
|
---|
131 | typedef struct IOMIOPORTRANGER3
|
---|
132 | {
|
---|
133 | /** Avl node core with Port as Key and Port + cPorts - 1 as KeyLast. */
|
---|
134 | AVLROIOPORTNODECORE Core;
|
---|
135 | #if HC_ARCH_BITS == 64 && !defined(RT_OS_WINDOWS)
|
---|
136 | uint32_t u32Alignment; /**< The sizeof(Core) differs. */
|
---|
137 | #endif
|
---|
138 | /** Start I/O port address. */
|
---|
139 | RTIOPORT Port;
|
---|
140 | /** Size of the range. */
|
---|
141 | uint16_t cPorts;
|
---|
142 | /** Pointer to user argument. */
|
---|
143 | RTR3PTR pvUser;
|
---|
144 | /** Pointer to the associated device instance. */
|
---|
145 | R3PTRTYPE(PPDMDEVINS) pDevIns;
|
---|
146 | /** Pointer to OUT callback function. */
|
---|
147 | R3PTRTYPE(PFNIOMIOPORTOUT) pfnOutCallback;
|
---|
148 | /** Pointer to IN callback function. */
|
---|
149 | R3PTRTYPE(PFNIOMIOPORTIN) pfnInCallback;
|
---|
150 | /** Pointer to string OUT callback function. */
|
---|
151 | R3PTRTYPE(PFNIOMIOPORTOUTSTRING) pfnOutStrCallback;
|
---|
152 | /** Pointer to string IN callback function. */
|
---|
153 | R3PTRTYPE(PFNIOMIOPORTINSTRING) pfnInStrCallback;
|
---|
154 | /** Description / Name. For easing debugging. */
|
---|
155 | R3PTRTYPE(const char *) pszDesc;
|
---|
156 | } IOMIOPORTRANGER3;
|
---|
157 | /** Pointer to I/O port range descriptor, R3 version. */
|
---|
158 | typedef IOMIOPORTRANGER3 *PIOMIOPORTRANGER3;
|
---|
159 |
|
---|
160 | /**
|
---|
161 | * I/O port range descriptor, R0 version.
|
---|
162 | */
|
---|
163 | typedef struct IOMIOPORTRANGER0
|
---|
164 | {
|
---|
165 | /** Avl node core with Port as Key and Port + cPorts - 1 as KeyLast. */
|
---|
166 | AVLROIOPORTNODECORE Core;
|
---|
167 | #if HC_ARCH_BITS == 64 && !defined(RT_OS_WINDOWS)
|
---|
168 | uint32_t u32Alignment; /**< The sizeof(Core) differs. */
|
---|
169 | #endif
|
---|
170 | /** Start I/O port address. */
|
---|
171 | RTIOPORT Port;
|
---|
172 | /** Size of the range. */
|
---|
173 | uint16_t cPorts;
|
---|
174 | /** Pointer to user argument. */
|
---|
175 | RTR0PTR pvUser;
|
---|
176 | /** Pointer to the associated device instance. */
|
---|
177 | R0PTRTYPE(PPDMDEVINS) pDevIns;
|
---|
178 | /** Pointer to OUT callback function. */
|
---|
179 | R0PTRTYPE(PFNIOMIOPORTOUT) pfnOutCallback;
|
---|
180 | /** Pointer to IN callback function. */
|
---|
181 | R0PTRTYPE(PFNIOMIOPORTIN) pfnInCallback;
|
---|
182 | /** Pointer to string OUT callback function. */
|
---|
183 | R0PTRTYPE(PFNIOMIOPORTOUTSTRING) pfnOutStrCallback;
|
---|
184 | /** Pointer to string IN callback function. */
|
---|
185 | R0PTRTYPE(PFNIOMIOPORTINSTRING) pfnInStrCallback;
|
---|
186 | /** Description / Name. For easing debugging. */
|
---|
187 | R3PTRTYPE(const char *) pszDesc;
|
---|
188 | } IOMIOPORTRANGER0;
|
---|
189 | /** Pointer to I/O port range descriptor, R0 version. */
|
---|
190 | typedef IOMIOPORTRANGER0 *PIOMIOPORTRANGER0;
|
---|
191 |
|
---|
192 | /**
|
---|
193 | * I/O port range descriptor, RC version.
|
---|
194 | */
|
---|
195 | typedef struct IOMIOPORTRANGERC
|
---|
196 | {
|
---|
197 | /** Avl node core with Port as Key and Port + cPorts - 1 as KeyLast. */
|
---|
198 | AVLROIOPORTNODECORE Core;
|
---|
199 | /** Start I/O port address. */
|
---|
200 | RTIOPORT Port;
|
---|
201 | /** Size of the range. */
|
---|
202 | uint16_t cPorts;
|
---|
203 | /** Pointer to user argument. */
|
---|
204 | RTRCPTR pvUser;
|
---|
205 | /** Pointer to the associated device instance. */
|
---|
206 | RCPTRTYPE(PPDMDEVINS) pDevIns;
|
---|
207 | /** Pointer to OUT callback function. */
|
---|
208 | RCPTRTYPE(PFNIOMIOPORTOUT) pfnOutCallback;
|
---|
209 | /** Pointer to IN callback function. */
|
---|
210 | RCPTRTYPE(PFNIOMIOPORTIN) pfnInCallback;
|
---|
211 | /** Pointer to string OUT callback function. */
|
---|
212 | RCPTRTYPE(PFNIOMIOPORTOUTSTRING) pfnOutStrCallback;
|
---|
213 | /** Pointer to string IN callback function. */
|
---|
214 | RCPTRTYPE(PFNIOMIOPORTINSTRING) pfnInStrCallback;
|
---|
215 | #if HC_ARCH_BITS == 64
|
---|
216 | RTRCPTR RCPtrAlignment; /**< pszDesc is 8 byte aligned. */
|
---|
217 | #endif
|
---|
218 | /** Description / Name. For easing debugging. */
|
---|
219 | R3PTRTYPE(const char *) pszDesc;
|
---|
220 | } IOMIOPORTRANGERC;
|
---|
221 | /** Pointer to I/O port range descriptor, RC version. */
|
---|
222 | typedef IOMIOPORTRANGERC *PIOMIOPORTRANGERC;
|
---|
223 |
|
---|
224 |
|
---|
225 | /**
|
---|
226 | * I/O port statistics. (one I/O port)
|
---|
227 | *
|
---|
228 | * This is a simple way of making on demand statistics, however it's a
|
---|
229 | * bit free with the hypervisor heap memory.
|
---|
230 | */
|
---|
231 | typedef struct IOMIOPORTSTATS
|
---|
232 | {
|
---|
233 | /** Avl node core with the port as Key. */
|
---|
234 | AVLOIOPORTNODECORE Core;
|
---|
235 | #if HC_ARCH_BITS != 64 || !defined(RT_OS_WINDOWS)
|
---|
236 | uint32_t u32Alignment; /**< The sizeof(Core) differs. */
|
---|
237 | #endif
|
---|
238 | /** Number of INs to this port from R3. */
|
---|
239 | STAMCOUNTER InR3;
|
---|
240 | /** Profiling IN handler overhead in R3. */
|
---|
241 | STAMPROFILE ProfInR3;
|
---|
242 | /** Number of OUTs to this port from R3. */
|
---|
243 | STAMCOUNTER OutR3;
|
---|
244 | /** Profiling OUT handler overhead in R3. */
|
---|
245 | STAMPROFILE ProfOutR3;
|
---|
246 |
|
---|
247 | /** Number of INs to this port from R0/RC. */
|
---|
248 | STAMCOUNTER InRZ;
|
---|
249 | /** Profiling IN handler overhead in R0/RC. */
|
---|
250 | STAMPROFILE ProfInRZ;
|
---|
251 | /** Number of INs to this port from R0/RC which was serviced in R3. */
|
---|
252 | STAMCOUNTER InRZToR3;
|
---|
253 |
|
---|
254 | /** Number of OUTs to this port from R0/RC. */
|
---|
255 | STAMCOUNTER OutRZ;
|
---|
256 | /** Profiling OUT handler overhead in R0/RC. */
|
---|
257 | STAMPROFILE ProfOutRZ;
|
---|
258 | /** Number of OUTs to this port from R0/RC which was serviced in R3. */
|
---|
259 | STAMCOUNTER OutRZToR3;
|
---|
260 | } IOMIOPORTSTATS;
|
---|
261 | AssertCompileMemberAlignment(IOMIOPORTSTATS, InR3, 8);
|
---|
262 | /** Pointer to I/O port statistics. */
|
---|
263 | typedef IOMIOPORTSTATS *PIOMIOPORTSTATS;
|
---|
264 |
|
---|
265 |
|
---|
266 | /**
|
---|
267 | * The IOM trees.
|
---|
268 | * These are offset based the nodes and root must be in the same
|
---|
269 | * memory block in HC. The locations of IOM structure and the hypervisor heap
|
---|
270 | * are quite different in R3, R0 and RC.
|
---|
271 | */
|
---|
272 | typedef struct IOMTREES
|
---|
273 | {
|
---|
274 | /** Tree containing I/O port range descriptors registered for HC (IOMIOPORTRANGEHC). */
|
---|
275 | AVLROIOPORTTREE IOPortTreeR3;
|
---|
276 | /** Tree containing I/O port range descriptors registered for R0 (IOMIOPORTRANGER0). */
|
---|
277 | AVLROIOPORTTREE IOPortTreeR0;
|
---|
278 | /** Tree containing I/O port range descriptors registered for RC (IOMIOPORTRANGERC). */
|
---|
279 | AVLROIOPORTTREE IOPortTreeRC;
|
---|
280 |
|
---|
281 | /** Tree containing the MMIO range descriptors (IOMMMIORANGE). */
|
---|
282 | AVLROGCPHYSTREE MMIOTree;
|
---|
283 |
|
---|
284 | /** Tree containing I/O port statistics (IOMIOPORTSTATS). */
|
---|
285 | AVLOIOPORTTREE IOPortStatTree;
|
---|
286 | /** Tree containing MMIO statistics (IOMMMIOSTATS). */
|
---|
287 | AVLOGCPHYSTREE MMIOStatTree;
|
---|
288 | } IOMTREES;
|
---|
289 | /** Pointer to the IOM trees. */
|
---|
290 | typedef IOMTREES *PIOMTREES;
|
---|
291 |
|
---|
292 |
|
---|
293 | /**
|
---|
294 | * Converts an IOM pointer into a VM pointer.
|
---|
295 | * @returns Pointer to the VM structure the PGM is part of.
|
---|
296 | * @param pIOM Pointer to IOM instance data.
|
---|
297 | */
|
---|
298 | #define IOM2VM(pIOM) ( (PVM)((char*)pIOM - pIOM->offVM) )
|
---|
299 |
|
---|
300 | /**
|
---|
301 | * IOM Data (part of VM)
|
---|
302 | */
|
---|
303 | typedef struct IOM
|
---|
304 | {
|
---|
305 | /** Offset to the VM structure. */
|
---|
306 | RTINT offVM;
|
---|
307 |
|
---|
308 | /** Pointer to the trees - RC ptr. */
|
---|
309 | RCPTRTYPE(PIOMTREES) pTreesRC;
|
---|
310 | /** Pointer to the trees - R3 ptr. */
|
---|
311 | R3PTRTYPE(PIOMTREES) pTreesR3;
|
---|
312 | /** Pointer to the trees - R0 ptr. */
|
---|
313 | R0PTRTYPE(PIOMTREES) pTreesR0;
|
---|
314 |
|
---|
315 | /** The ring-0 address of IOMMMIOHandler. */
|
---|
316 | R0PTRTYPE(PFNPGMR0PHYSHANDLER) pfnMMIOHandlerR0;
|
---|
317 | /** The RC address of IOMMMIOHandler. */
|
---|
318 | RCPTRTYPE(PFNPGMRCPHYSHANDLER) pfnMMIOHandlerRC;
|
---|
319 | #if HC_ARCH_BITS == 64
|
---|
320 | RTRCPTR padding;
|
---|
321 | #endif
|
---|
322 |
|
---|
323 | /** Lock serializing EMT access to IOM. */
|
---|
324 | PDMCRITSECT EmtLock;
|
---|
325 |
|
---|
326 | /** @name Caching of I/O Port and MMIO ranges and statistics.
|
---|
327 | * (Saves quite some time in rep outs/ins instruction emulation.)
|
---|
328 | * @{ */
|
---|
329 | R3PTRTYPE(PIOMIOPORTRANGER3) pRangeLastReadR3;
|
---|
330 | R3PTRTYPE(PIOMIOPORTRANGER3) pRangeLastWriteR3;
|
---|
331 | R3PTRTYPE(PIOMIOPORTSTATS) pStatsLastReadR3;
|
---|
332 | R3PTRTYPE(PIOMIOPORTSTATS) pStatsLastWriteR3;
|
---|
333 | R3PTRTYPE(PIOMMMIORANGE) pMMIORangeLastR3;
|
---|
334 | R3PTRTYPE(PIOMMMIOSTATS) pMMIOStatsLastR3;
|
---|
335 |
|
---|
336 | R0PTRTYPE(PIOMIOPORTRANGER0) pRangeLastReadR0;
|
---|
337 | R0PTRTYPE(PIOMIOPORTRANGER0) pRangeLastWriteR0;
|
---|
338 | R0PTRTYPE(PIOMIOPORTSTATS) pStatsLastReadR0;
|
---|
339 | R0PTRTYPE(PIOMIOPORTSTATS) pStatsLastWriteR0;
|
---|
340 | R0PTRTYPE(PIOMMMIORANGE) pMMIORangeLastR0;
|
---|
341 | R0PTRTYPE(PIOMMMIOSTATS) pMMIOStatsLastR0;
|
---|
342 |
|
---|
343 | RCPTRTYPE(PIOMIOPORTRANGERC) pRangeLastReadRC;
|
---|
344 | RCPTRTYPE(PIOMIOPORTRANGERC) pRangeLastWriteRC;
|
---|
345 | RCPTRTYPE(PIOMIOPORTSTATS) pStatsLastReadRC;
|
---|
346 | RCPTRTYPE(PIOMIOPORTSTATS) pStatsLastWriteRC;
|
---|
347 | RCPTRTYPE(PIOMMMIORANGE) pMMIORangeLastRC;
|
---|
348 | RCPTRTYPE(PIOMMMIOSTATS) pMMIOStatsLastRC;
|
---|
349 | /** @} */
|
---|
350 |
|
---|
351 | /** @name I/O Port statistics.
|
---|
352 | * @{ */
|
---|
353 | STAMCOUNTER StatInstIn;
|
---|
354 | STAMCOUNTER StatInstOut;
|
---|
355 | STAMCOUNTER StatInstIns;
|
---|
356 | STAMCOUNTER StatInstOuts;
|
---|
357 | /** @} */
|
---|
358 |
|
---|
359 | /** @name MMIO statistics.
|
---|
360 | * @{ */
|
---|
361 | STAMPROFILE StatRZMMIOHandler;
|
---|
362 | STAMCOUNTER StatRZMMIOFailures;
|
---|
363 |
|
---|
364 | STAMPROFILE StatRZInstMov;
|
---|
365 | STAMPROFILE StatRZInstCmp;
|
---|
366 | STAMPROFILE StatRZInstAnd;
|
---|
367 | STAMPROFILE StatRZInstOr;
|
---|
368 | STAMPROFILE StatRZInstXor;
|
---|
369 | STAMPROFILE StatRZInstBt;
|
---|
370 | STAMPROFILE StatRZInstTest;
|
---|
371 | STAMPROFILE StatRZInstXchg;
|
---|
372 | STAMPROFILE StatRZInstStos;
|
---|
373 | STAMPROFILE StatRZInstLods;
|
---|
374 | #ifdef IOM_WITH_MOVS_SUPPORT
|
---|
375 | STAMPROFILEADV StatRZInstMovs;
|
---|
376 | STAMPROFILE StatRZInstMovsToMMIO;
|
---|
377 | STAMPROFILE StatRZInstMovsFromMMIO;
|
---|
378 | STAMPROFILE StatRZInstMovsMMIO;
|
---|
379 | #endif
|
---|
380 | STAMCOUNTER StatRZInstOther;
|
---|
381 |
|
---|
382 | STAMCOUNTER StatRZMMIO1Byte;
|
---|
383 | STAMCOUNTER StatRZMMIO2Bytes;
|
---|
384 | STAMCOUNTER StatRZMMIO4Bytes;
|
---|
385 | STAMCOUNTER StatRZMMIO8Bytes;
|
---|
386 |
|
---|
387 | STAMCOUNTER StatR3MMIOHandler;
|
---|
388 |
|
---|
389 | RTUINT cMovsMaxBytes;
|
---|
390 | RTUINT cStosMaxBytes;
|
---|
391 | /** @} */
|
---|
392 | } IOM;
|
---|
393 | /** Pointer to IOM instance data. */
|
---|
394 | typedef IOM *PIOM;
|
---|
395 |
|
---|
396 |
|
---|
397 | /**
|
---|
398 | * IOM per virtual CPU instance data.
|
---|
399 | */
|
---|
400 | typedef struct IOMCPU
|
---|
401 | {
|
---|
402 | /** For saving stack space, the disassembler state is allocated here instead of
|
---|
403 | * on the stack.
|
---|
404 | * @note The DISCPUSTATE structure is not R3/R0/RZ clean! */
|
---|
405 | union
|
---|
406 | {
|
---|
407 | /** The disassembler scratch space. */
|
---|
408 | DISCPUSTATE DisState;
|
---|
409 | /** Padding. */
|
---|
410 | uint8_t abDisStatePadding[DISCPUSTATE_PADDING_SIZE];
|
---|
411 | };
|
---|
412 | uint8_t Dummy[16];
|
---|
413 | } IOMCPU;
|
---|
414 | /** Pointer to IOM per virtual CPU instance data. */
|
---|
415 | typedef IOMCPU *PIOMCPU;
|
---|
416 |
|
---|
417 |
|
---|
418 | RT_C_DECLS_BEGIN
|
---|
419 |
|
---|
420 | #ifdef IN_RING3
|
---|
421 | PIOMIOPORTSTATS iomR3IOPortStatsCreate(PVM pVM, RTIOPORT Port, const char *pszDesc);
|
---|
422 | PIOMMMIOSTATS iomR3MMIOStatsCreate(PVM pVM, RTGCPHYS GCPhys, const char *pszDesc);
|
---|
423 | #endif /* IN_RING3 */
|
---|
424 |
|
---|
425 | VMMDECL(int) IOMMMIOHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPHYS GCPhysFault, void *pvUser);
|
---|
426 | #ifdef IN_RING3
|
---|
427 | DECLCALLBACK(int) IOMR3MMIOHandler(PVM pVM, RTGCPHYS GCPhys, void *pvPhys, void *pvBuf, size_t cbBuf, PGMACCESSTYPE enmAccessType, void *pvUser);
|
---|
428 | #endif
|
---|
429 |
|
---|
430 | /* IOM locking helpers. */
|
---|
431 | int iomLock(PVM pVM);
|
---|
432 | int iomTryLock(PVM pVM);
|
---|
433 | void iomUnlock(PVM pVM);
|
---|
434 |
|
---|
435 | /* Disassembly helpers used in IOMAll.cpp & IOMAllMMIO.cpp */
|
---|
436 | bool iomGetRegImmData(PDISCPUSTATE pCpu, PCOP_PARAMETER pParam, PCPUMCTXCORE pRegFrame, uint64_t *pu64Data, unsigned *pcbSize);
|
---|
437 | bool iomSaveDataToReg(PDISCPUSTATE pCpu, PCOP_PARAMETER pParam, PCPUMCTXCORE pRegFrame, uint64_t u32Data);
|
---|
438 |
|
---|
439 | RT_C_DECLS_END
|
---|
440 |
|
---|
441 |
|
---|
442 | #ifdef IN_RING3
|
---|
443 |
|
---|
444 | #endif
|
---|
445 |
|
---|
446 | /** @} */
|
---|
447 |
|
---|
448 | #endif /* ___IOMInternal_h */
|
---|