VirtualBox

source: vbox/trunk/src/VBox/VMM/IOMInternal.h@ 34079

Last change on this file since 34079 was 29436, checked in by vboxsync, 15 years ago

IOM: Profile all callbacks, don't bother count the as we can derive that from the profiling. Adjusted the layout so that it easier to navigate in the GUI, adding a total count as a toplevel branch.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 19.4 KB
Line 
1/* $Id: IOMInternal.h 29436 2010-05-12 20:57:57Z 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/iom.h>
24#include <VBox/stam.h>
25#include <VBox/pgm.h>
26#include <VBox/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 */
42typedef 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. */
91typedef 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 */
100typedef 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;
123AssertCompileMemberAlignment(IOMMMIOSTATS, Accesses, 8);
124/** Pointer to I/O port statistics. */
125typedef IOMMMIOSTATS *PIOMMMIOSTATS;
126
127
128/**
129 * I/O port range descriptor, R3 version.
130 */
131typedef 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. */
158typedef IOMIOPORTRANGER3 *PIOMIOPORTRANGER3;
159
160/**
161 * I/O port range descriptor, R0 version.
162 */
163typedef 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. */
190typedef IOMIOPORTRANGER0 *PIOMIOPORTRANGER0;
191
192/**
193 * I/O port range descriptor, RC version.
194 */
195typedef 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. */
222typedef 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 */
231typedef 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;
261AssertCompileMemberAlignment(IOMIOPORTSTATS, InR3, 8);
262/** Pointer to I/O port statistics. */
263typedef 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 */
272typedef 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. */
290typedef 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 */
303typedef 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. */
394typedef IOM *PIOM;
395
396
397/**
398 * IOM per virtual CPU instance data.
399 */
400typedef 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. */
415typedef IOMCPU *PIOMCPU;
416
417
418RT_C_DECLS_BEGIN
419
420#ifdef IN_RING3
421PIOMIOPORTSTATS iomR3IOPortStatsCreate(PVM pVM, RTIOPORT Port, const char *pszDesc);
422PIOMMMIOSTATS iomR3MMIOStatsCreate(PVM pVM, RTGCPHYS GCPhys, const char *pszDesc);
423#endif /* IN_RING3 */
424
425VMMDECL(int) IOMMMIOHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPHYS GCPhysFault, void *pvUser);
426#ifdef IN_RING3
427DECLCALLBACK(int) IOMR3MMIOHandler(PVM pVM, RTGCPHYS GCPhys, void *pvPhys, void *pvBuf, size_t cbBuf, PGMACCESSTYPE enmAccessType, void *pvUser);
428#endif
429
430
431/**
432 * Gets the I/O port range for the specified I/O port in the current context.
433 *
434 * @returns Pointer to I/O port range.
435 * @returns NULL if no port registered.
436 *
437 * @param pIOM IOM instance data.
438 * @param Port Port to lookup.
439 */
440DECLINLINE(CTX_SUFF(PIOMIOPORTRANGE)) iomIOPortGetRange(PIOM pIOM, RTIOPORT Port)
441{
442#ifdef IN_RING3
443 if (PDMCritSectIsInitialized(&pIOM->EmtLock))
444#endif
445 Assert(IOMIsLockOwner(IOM2VM(pIOM)));
446 CTX_SUFF(PIOMIOPORTRANGE) pRange = (CTX_SUFF(PIOMIOPORTRANGE))RTAvlroIOPortRangeGet(&pIOM->CTX_SUFF(pTrees)->CTX_SUFF(IOPortTree), Port);
447 return pRange;
448}
449
450
451/**
452 * Gets the I/O port range for the specified I/O port in the HC.
453 *
454 * @returns Pointer to I/O port range.
455 * @returns NULL if no port registered.
456 *
457 * @param pIOM IOM instance data.
458 * @param Port Port to lookup.
459 */
460DECLINLINE(PIOMIOPORTRANGER3) iomIOPortGetRangeR3(PIOM pIOM, RTIOPORT Port)
461{
462#ifdef IN_RING3
463 if (PDMCritSectIsInitialized(&pIOM->EmtLock))
464#endif
465 Assert(IOMIsLockOwner(IOM2VM(pIOM)));
466 PIOMIOPORTRANGER3 pRange = (PIOMIOPORTRANGER3)RTAvlroIOPortRangeGet(&pIOM->CTX_SUFF(pTrees)->IOPortTreeR3, Port);
467 return pRange;
468}
469
470
471/**
472 * Gets the MMIO range for the specified physical address in the current context.
473 *
474 * @returns Pointer to MMIO range.
475 * @returns NULL if address not in a MMIO range.
476 *
477 * @param pIOM IOM instance data.
478 * @param GCPhys Physical address to lookup.
479 */
480DECLINLINE(PIOMMMIORANGE) iomMMIOGetRange(PIOM pIOM, RTGCPHYS GCPhys)
481{
482#ifdef IN_RING3
483 if (PDMCritSectIsInitialized(&pIOM->EmtLock))
484#endif
485 Assert(IOMIsLockOwner(IOM2VM(pIOM)));
486 PIOMMMIORANGE pRange = pIOM->CTX_SUFF(pMMIORangeLast);
487 if ( !pRange
488 || GCPhys - pRange->GCPhys >= pRange->cb)
489 pIOM->CTX_SUFF(pMMIORangeLast) = pRange = (PIOMMMIORANGE)RTAvlroGCPhysRangeGet(&pIOM->CTX_SUFF(pTrees)->MMIOTree, GCPhys);
490 return pRange;
491}
492
493#ifdef VBOX_STRICT
494/**
495 * Gets the MMIO range for the specified physical address in the current context.
496 *
497 * @returns Pointer to MMIO range.
498 * @returns NULL if address not in a MMIO range.
499 *
500 * @param pIOM IOM instance data.
501 * @param GCPhys Physical address to lookup.
502 */
503DECLINLINE(PIOMMMIORANGE) iomMMIOGetRangeUnsafe(PIOM pIOM, RTGCPHYS GCPhys)
504{
505 PIOMMMIORANGE pRange = pIOM->CTX_SUFF(pMMIORangeLast);
506 if ( !pRange
507 || GCPhys - pRange->GCPhys >= pRange->cb)
508 pIOM->CTX_SUFF(pMMIORangeLast) = pRange = (PIOMMMIORANGE)RTAvlroGCPhysRangeGet(&pIOM->CTX_SUFF(pTrees)->MMIOTree, GCPhys);
509 return pRange;
510}
511#endif
512
513
514#ifdef VBOX_WITH_STATISTICS
515/**
516 * Gets the MMIO statistics record.
517 *
518 * In ring-3 this will lazily create missing records, while in GC/R0 the caller has to
519 * return the appropriate status to defer the operation to ring-3.
520 *
521 * @returns Pointer to MMIO stats.
522 * @returns NULL if not found (R0/GC), or out of memory (R3).
523 *
524 * @param pIOM IOM instance data.
525 * @param GCPhys Physical address to lookup.
526 * @param pRange The MMIO range.
527 */
528DECLINLINE(PIOMMMIOSTATS) iomMMIOGetStats(PIOM pIOM, RTGCPHYS GCPhys, PIOMMMIORANGE pRange)
529{
530 Assert(IOMIsLockOwner(IOM2VM(pIOM)));
531 /* For large ranges, we'll put everything on the first byte. */
532 if (pRange->cb > PAGE_SIZE)
533 GCPhys = pRange->GCPhys;
534
535 PIOMMMIOSTATS pStats = pIOM->CTX_SUFF(pMMIOStatsLast);
536 if ( !pStats
537 || pStats->Core.Key != GCPhys)
538 {
539 pStats = (PIOMMMIOSTATS)RTAvloGCPhysGet(&pIOM->CTX_SUFF(pTrees)->MMIOStatTree, GCPhys);
540# ifdef IN_RING3
541 if (!pStats)
542 pStats = iomR3MMIOStatsCreate(IOM2VM(pIOM), GCPhys, pRange->pszDesc);
543# endif
544 }
545 return pStats;
546}
547#endif
548
549/* IOM locking helpers. */
550int iomLock(PVM pVM);
551int iomTryLock(PVM pVM);
552void iomUnlock(PVM pVM);
553
554/* Disassembly helpers used in IOMAll.cpp & IOMAllMMIO.cpp */
555bool iomGetRegImmData(PDISCPUSTATE pCpu, PCOP_PARAMETER pParam, PCPUMCTXCORE pRegFrame, uint64_t *pu64Data, unsigned *pcbSize);
556bool iomSaveDataToReg(PDISCPUSTATE pCpu, PCOP_PARAMETER pParam, PCPUMCTXCORE pRegFrame, uint64_t u32Data);
557
558RT_C_DECLS_END
559
560
561#ifdef IN_RING3
562
563#endif
564
565/** @} */
566
567#endif /* ___IOMInternal_h */
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