VirtualBox

Changeset 7731 in vbox


Ignore:
Timestamp:
Apr 3, 2008 5:05:29 PM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
29267
Message:

MMIO cleanup in progress.

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/pgm.h

    r7635 r7731  
    467467#endif /* !VBOX_WITH_NEW_PHYS_CODE */
    468468PGMR3DECL(int)  PGMR3PhysRegisterRam(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cb, const char *pszDesc);
     469PDMR3DECL(int)  PGMR3PhysMMIORegister(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cb,
     470                                      R3PTRTYPE(PFNPGMR3PHYSHANDLER) pfnHandlerR3, RTR3PTR pvUserR3,
     471                                      R0PTRTYPE(PFNPGMR0PHYSHANDLER) pfnHandlerR0, RTR0PTR pvUserR0,
     472                                      GCPTRTYPE(PFNPGMGCPHYSHANDLER) pfnHandlerGC, RTGCPTR pvUserGC,
     473                                      R3PTRTYPE(const char *) pszDesc);
     474PDMR3DECL(int)  PGMR3PhysMMIODeregister(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cb);
    469475PDMR3DECL(int)  PGMR3PhysMMIO2Register(PVM pVM, PPDMDEVINS pDevIns, uint32_t iRegion, RTGCPHYS cb, void **ppv, const char *pszDesc);
    470476PDMR3DECL(int)  PGMR3PhysMMIO2Deregister(PVM pVM, PPDMDEVINS pDevIns, uint32_t iRegion);
  • trunk/src/VBox/VMM/IOM.cpp

    r7726 r7731  
    5353#include <VBox/stam.h>
    5454#include <VBox/dbgf.h>
     55#include <VBox/pdm.h>
    5556#include "IOMInternal.h"
    5657#include <VBox/vm.h>
     
    110111    {
    111112        pVM->iom.s.pTreesGC = MMHyperHC2GC(pVM, pVM->iom.s.pTreesHC);
     113        pVM->iom.s.pfnMMIOHandlerGC = NIL_RTGCPTR;
     114        pVM->iom.s.pfnMMIOHandlerR0 = NIL_RTR0PTR;
    112115
    113116        /*
     
    14121415    LogFlow(("IOMR3MMIORegisterR3: pDevIns=%p GCPhysStart=%VGp cbRange=%#x pvUser=%VHv pfnWriteCallback=%#x pfnReadCallback=%#x pfnFillCallback=%#x pszDesc=%s\n",
    14131416             pDevIns, GCPhysStart, cbRange, pvUser, pfnWriteCallback, pfnReadCallback, pfnFillCallback, pszDesc));
     1417    int rc;
    14141418
    14151419    /*
     
    14231427
    14241428    /*
     1429     * Resolve the GC/R0 handler addresses lazily because of init order.
     1430     */
     1431    if (pVM->iom.s.pfnMMIOHandlerR0 == NIL_RTR0PTR)
     1432    {
     1433        rc = PDMR3GetSymbolGCLazy(pVM, NULL, "IOMMMIOHandler", &pVM->iom.s.pfnMMIOHandlerGC);
     1434        AssertLogRelRCReturn(rc, rc);
     1435        rc = PDMR3GetSymbolR0Lazy(pVM, NULL, "IOMMMIOHandler", &pVM->iom.s.pfnMMIOHandlerR0);
     1436        AssertLogRelRCReturn(rc, rc);
     1437    }
     1438
     1439    /*
    14251440     * Allocate new range record and initialize it.
    14261441     */
    14271442    PIOMMMIORANGER3 pRange;
    1428     int rc = MMHyperAlloc(pVM, sizeof(*pRange), 0, MM_TAG_IOM, (void **)&pRange);
     1443    rc = MMHyperAlloc(pVM, sizeof(*pRange), 0, MM_TAG_IOM, (void **)&pRange);
    14291444    if (VBOX_SUCCESS(rc))
    14301445    {
     
    14321447        pRange->Core.KeyLast    = GCPhysStart + (cbRange - 1);
    14331448        pRange->GCPhys          = GCPhysStart;
    1434         pRange->cbSize          = cbRange;
     1449        pRange->cb              = cbRange;
    14351450        pRange->pvUser          = pvUser;
    14361451        pRange->pDevIns         = pDevIns;
     
    14431458         * Try register it with PGM and then insert it into the tree.
    14441459         */
    1445         //rc = PGMR3PhysMMIORegister(pVM, GCPhysStart, cbRange);
    1446         //if (RT_SUCCESS(rc))
    1447             rc = PGMR3HandlerPhysicalRegister(pVM, PGMPHYSHANDLERTYPE_MMIO, GCPhysStart, GCPhysStart + (cbRange - 1),
    1448                                               /*IOMR3MMIOHandler*/ NULL, pRange,
    1449                                               NULL, "IOMMMIOHandler", MMHyperR3ToR0(pVM, pRange),
    1450                                               NULL, "IOMMMIOHandler", MMHyperR3ToGC(pVM, pRange), pszDesc);
     1460        rc = PGMR3PhysMMIORegister(pVM, GCPhysStart, cbRange,
     1461                                   /*IOMR3MMIOHandler*/ NULL, pRange,
     1462                                   pVM->iom.s.pfnMMIOHandlerR0, MMHyperR3ToR0(pVM, pRange),
     1463                                   pVM->iom.s.pfnMMIOHandlerGC, MMHyperR3ToGC(pVM, pRange), pszDesc);
    14511464        if (RT_SUCCESS(rc))
    14521465        {
     
    14891502{
    14901503    LogFlow(("IOMR3MMIORegisterGC: pDevIns=%p GCPhysStart=%VGp cbRange=%#x pvUser=%VGv pfnWriteCallback=%#x pfnReadCallback=%#x pfnFillCallback=%#x pszDesc=%s\n",
    1491              pDevIns, GCPhysStart, cbRange, pvUser, pfnWriteCallback, pfnReadCallback, pfnFillCallback, pszDesc));
    1492 
    1493     /*
    1494      * Validate input.
    1495      */
    1496     if (!pfnWriteCallback && !pfnReadCallback)
    1497     {
    1498         AssertMsgFailed(("No callbacks! %VGp LB%#x %s\n", GCPhysStart, cbRange, pszDesc));
    1499         return VERR_INVALID_PARAMETER;
    1500     }
    1501     RTGCPHYS GCPhysLast = GCPhysStart + (cbRange - 1);
    1502     if (GCPhysLast < GCPhysStart)
    1503     {
    1504         AssertMsgFailed(("Wrapped! %VGp LB%#x %s\n", GCPhysStart, cbRange, pszDesc));
    1505         return VERR_IOM_INVALID_MMIO_RANGE;
    1506     }
    1507 
    1508     /*
    1509      * Check that a ring-3 MMIO range exists.
    1510      */
    1511     RTGCPHYS GCPhys = GCPhysStart;
    1512     while (GCPhys <= GCPhysLast && GCPhys >= GCPhysStart)
    1513     {
    1514         PIOMMMIORANGER3 pRange = (PIOMMMIORANGER3)RTAvlroGCPhysRangeGet(&pVM->iom.s.CTXSUFF(pTrees)->MMIOTreeR3, GCPhys);
    1515         if (!pRange)
    1516         {
    1517             AssertMsgFailed(("No R3 range! GCPhys=%VGp %VGp LB%#x %s\n", GCPhys, GCPhysStart, cbRange, pszDesc));
    1518             return VERR_IOM_NO_HC_MMIO_RANGE;
    1519         }
    1520 #ifndef IOM_NO_PDMINS_CHECKS
    1521         #ifndef IN_GC
    1522         if (pRange->pDevIns != pDevIns)
    1523         #else
    1524         if (pRange->pDevIns != MMHyperGC2HC(pVM, pDevIns))
    1525         #endif
    1526         {
    1527             AssertMsgFailed(("Not owner! GCPhys=%VGp %VGp LB%#x %s / %#x-%#x %s\n", GCPhys, GCPhysStart, cbRange, pszDesc,
    1528                              pRange->Core.Key, pRange->Core.KeyLast, MMHyper2HC(pVM, (uintptr_t)pRange->pszDesc)));
    1529             return VERR_IOM_NOT_MMIO_RANGE_OWNER;
    1530         }
    1531 #endif /* !IOM_NO_PDMINS_CHECKS */
    1532         /* next */
    1533         Assert(GCPhys <= pRange->Core.KeyLast);
    1534         GCPhys = pRange->Core.KeyLast + 1;
    1535     }
    1536 
    1537 
    1538     /*
    1539      * Allocate new range record and initialize it.
    1540      */
    1541     PIOMMMIORANGEGC pRange;
    1542     int rc = MMHyperAlloc(pVM, sizeof(*pRange), 0, MM_TAG_IOM, (void **)&pRange);
    1543     if (VBOX_SUCCESS(rc))
    1544     {
    1545         pRange->Core.Key        = GCPhysStart;
    1546         pRange->Core.KeyLast    = GCPhysStart + (cbRange - 1);
    1547         pRange->GCPhys          = GCPhysStart;
    1548         pRange->cbSize          = cbRange;
    1549         pRange->pvUser          = pvUser;
    1550         pRange->pfnReadCallback = pfnReadCallback;
    1551         pRange->pfnWriteCallback= pfnWriteCallback;
    1552         pRange->pfnFillCallback = pfnFillCallback;
    1553 #ifdef IN_GC
    1554         pRange->pDevIns         = pDevIns;
    1555         pRange->pszDesc         = MMHyperGC2HC(pVM, (void *)pszDesc);
    1556 #else
    1557         pRange->pDevIns         = MMHyperHC2GC(pVM, pDevIns);
    1558         pRange->pszDesc         = pszDesc;
    1559 #endif
    1560 
    1561         /*
    1562          * Try insert it.
    1563          */
    1564         if (RTAvlroGCPhysInsert(&pVM->iom.s.CTXSUFF(pTrees)->MMIOTreeGC, &pRange->Core))
    1565             return VINF_SUCCESS;
    1566 
    1567         AssertMsgFailed(("Conflict! %VGp LB%#x %s\n", GCPhysStart, cbRange, pszDesc));
    1568         MMHyperFree(pVM, pRange);
    1569         rc = VERR_IOM_MMIO_RANGE_CONFLICT;
    1570     }
    1571 
    1572     return rc;
    1573 }
    1574 
    1575 
    1576 /**
    1577  * Registers a Memory Mapped I/O R0 handler range.
    1578  *
    1579  * This API is called by PDM on behalf of a device. Devices must first register ring-3 ranges
    1580  * using IOMMR3MIORegisterHC() before calling this function.
    1581  *
    1582  *
    1583  * @returns VBox status code.
    1584  *
    1585  * @param   pVM                 VM handle.
    1586  * @param   pDevIns             PDM device instance owning the MMIO range.
    1587  * @param   GCPhysStart         First physical address in the range.
    1588  * @param   cbRange             The size of the range (in bytes).
    1589  * @param   pvUser              User argument for the callbacks.
    1590  * @param   pfnWriteCallback    Pointer to function which is gonna handle Write operations.
    1591  * @param   pfnReadCallback     Pointer to function which is gonna handle Read operations.
    1592  * @param   pfnFillCallback     Pointer to function which is gonna handle Fill/memset operations.
    1593  * @param   pszDesc             Pointer to description string. This must not be freed.
    1594  */
    1595 IOMR3DECL(int)  IOMR3MMIORegisterR0(PVM pVM, PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTUINT cbRange, RTR0PTR pvUser,
    1596                                     R0PTRTYPE(PFNIOMMMIOWRITE) pfnWriteCallback, R0PTRTYPE(PFNIOMMMIOREAD) pfnReadCallback,
    1597                                     R0PTRTYPE(PFNIOMMMIOFILL) pfnFillCallback, const char *pszDesc)
    1598 {
    1599     LogFlow(("IOMR3MMIORegisterR0: pDevIns=%p GCPhysStart=%VGp cbRange=%#x pvUser=%VHv pfnWriteCallback=%#x pfnReadCallback=%#x pfnFillCallback=%#x pszDesc=%s\n",
    16001504             pDevIns, GCPhysStart, cbRange, pvUser, pfnWriteCallback, pfnReadCallback, pfnFillCallback, pszDesc));
    16011505
     
    16481552     * Allocate new range record and initialize it.
    16491553     */
     1554    PIOMMMIORANGEGC pRange;
     1555    int rc = MMHyperAlloc(pVM, sizeof(*pRange), 0, MM_TAG_IOM, (void **)&pRange);
     1556    if (VBOX_SUCCESS(rc))
     1557    {
     1558        pRange->Core.Key        = GCPhysStart;
     1559        pRange->Core.KeyLast    = GCPhysStart + (cbRange - 1);
     1560        pRange->GCPhys          = GCPhysStart;
     1561        pRange->cb              = cbRange;
     1562        pRange->pvUser          = pvUser;
     1563        pRange->pfnReadCallback = pfnReadCallback;
     1564        pRange->pfnWriteCallback= pfnWriteCallback;
     1565        pRange->pfnFillCallback = pfnFillCallback;
     1566#ifdef IN_GC
     1567        pRange->pDevIns         = pDevIns;
     1568        pRange->pszDesc         = MMHyperGC2HC(pVM, (void *)pszDesc);
     1569#else
     1570        pRange->pDevIns         = MMHyperHC2GC(pVM, pDevIns);
     1571        pRange->pszDesc         = pszDesc;
     1572#endif
     1573
     1574        /*
     1575         * Try insert it.
     1576         */
     1577        if (RTAvlroGCPhysInsert(&pVM->iom.s.CTXSUFF(pTrees)->MMIOTreeGC, &pRange->Core))
     1578            return VINF_SUCCESS;
     1579
     1580        AssertMsgFailed(("Conflict! %VGp LB%#x %s\n", GCPhysStart, cbRange, pszDesc));
     1581        MMHyperFree(pVM, pRange);
     1582        rc = VERR_IOM_MMIO_RANGE_CONFLICT;
     1583    }
     1584
     1585    return rc;
     1586}
     1587
     1588
     1589/**
     1590 * Registers a Memory Mapped I/O R0 handler range.
     1591 *
     1592 * This API is called by PDM on behalf of a device. Devices must first register ring-3 ranges
     1593 * using IOMMR3MIORegisterHC() before calling this function.
     1594 *
     1595 *
     1596 * @returns VBox status code.
     1597 *
     1598 * @param   pVM                 VM handle.
     1599 * @param   pDevIns             PDM device instance owning the MMIO range.
     1600 * @param   GCPhysStart         First physical address in the range.
     1601 * @param   cbRange             The size of the range (in bytes).
     1602 * @param   pvUser              User argument for the callbacks.
     1603 * @param   pfnWriteCallback    Pointer to function which is gonna handle Write operations.
     1604 * @param   pfnReadCallback     Pointer to function which is gonna handle Read operations.
     1605 * @param   pfnFillCallback     Pointer to function which is gonna handle Fill/memset operations.
     1606 * @param   pszDesc             Pointer to description string. This must not be freed.
     1607 */
     1608IOMR3DECL(int)  IOMR3MMIORegisterR0(PVM pVM, PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTUINT cbRange, RTR0PTR pvUser,
     1609                                    R0PTRTYPE(PFNIOMMMIOWRITE) pfnWriteCallback, R0PTRTYPE(PFNIOMMMIOREAD) pfnReadCallback,
     1610                                    R0PTRTYPE(PFNIOMMMIOFILL) pfnFillCallback, const char *pszDesc)
     1611{
     1612    LogFlow(("IOMR3MMIORegisterR0: pDevIns=%p GCPhysStart=%VGp cbRange=%#x pvUser=%VHv pfnWriteCallback=%#x pfnReadCallback=%#x pfnFillCallback=%#x pszDesc=%s\n",
     1613             pDevIns, GCPhysStart, cbRange, pvUser, pfnWriteCallback, pfnReadCallback, pfnFillCallback, pszDesc));
     1614
     1615    /*
     1616     * Validate input.
     1617     */
     1618    if (!pfnWriteCallback && !pfnReadCallback)
     1619    {
     1620        AssertMsgFailed(("No callbacks! %VGp LB%#x %s\n", GCPhysStart, cbRange, pszDesc));
     1621        return VERR_INVALID_PARAMETER;
     1622    }
     1623    RTGCPHYS GCPhysLast = GCPhysStart + (cbRange - 1);
     1624    if (GCPhysLast < GCPhysStart)
     1625    {
     1626        AssertMsgFailed(("Wrapped! %VGp LB%#x %s\n", GCPhysStart, cbRange, pszDesc));
     1627        return VERR_IOM_INVALID_MMIO_RANGE;
     1628    }
     1629
     1630    /*
     1631     * Check that a ring-3 MMIO range exists.
     1632     */
     1633    RTGCPHYS GCPhys = GCPhysStart;
     1634    while (GCPhys <= GCPhysLast && GCPhys >= GCPhysStart)
     1635    {
     1636        PIOMMMIORANGER3 pRange = (PIOMMMIORANGER3)RTAvlroGCPhysRangeGet(&pVM->iom.s.CTXSUFF(pTrees)->MMIOTreeR3, GCPhys);
     1637        if (!pRange)
     1638        {
     1639            AssertMsgFailed(("No R3 range! GCPhys=%VGp %VGp LB%#x %s\n", GCPhys, GCPhysStart, cbRange, pszDesc));
     1640            return VERR_IOM_NO_HC_MMIO_RANGE;
     1641        }
     1642#ifndef IOM_NO_PDMINS_CHECKS
     1643# ifndef IN_GC
     1644        if (pRange->pDevIns != pDevIns)
     1645# else
     1646        if (pRange->pDevIns != MMHyperGC2HC(pVM, pDevIns))
     1647# endif
     1648        {
     1649            AssertMsgFailed(("Not owner! GCPhys=%VGp %VGp LB%#x %s / %#x-%#x %s\n", GCPhys, GCPhysStart, cbRange, pszDesc,
     1650                             pRange->Core.Key, pRange->Core.KeyLast, MMHyper2HC(pVM, (uintptr_t)pRange->pszDesc)));
     1651            return VERR_IOM_NOT_MMIO_RANGE_OWNER;
     1652        }
     1653#endif /* !IOM_NO_PDMINS_CHECKS */
     1654        /* next */
     1655        Assert(GCPhys <= pRange->Core.KeyLast);
     1656        GCPhys = pRange->Core.KeyLast + 1;
     1657    }
     1658
     1659
     1660    /*
     1661     * Allocate new range record and initialize it.
     1662     */
    16501663    PIOMMMIORANGER0 pRange;
    16511664    int rc = MMHyperAlloc(pVM, sizeof(*pRange), 0, MM_TAG_IOM, (void **)&pRange);
     
    16551668        pRange->Core.KeyLast    = GCPhysStart + (cbRange - 1);
    16561669        pRange->GCPhys          = GCPhysStart;
    1657         pRange->cbSize          = cbRange;
     1670        pRange->cb              = cbRange;
    16581671        pRange->pvUser          = pvUser;
    16591672        pRange->pfnReadCallback = pfnReadCallback;
     
    17901803
    17911804        /* remove it from PGM */
    1792         int rc = PGMHandlerPhysicalDeregister(pVM, GCPhys);
     1805        int rc = PGMR3PhysMMIODeregister(pVM, GCPhys, pRange->cb);
    17931806        AssertRC(rc);
    17941807
  • trunk/src/VBox/VMM/IOMInternal.h

    r7620 r7731  
    2323#include <VBox/iom.h>
    2424#include <VBox/stam.h>
     25#include <VBox/pgm.h>
    2526#include <iprt/avl.h>
    2627
     
    4950    RTGCPHYS                    GCPhys;
    5051    /** Size of the range. */
    51     RTUINT                      cbSize;
     52    RTUINT                      cb;
    5253    /** Pointer to user argument. */
    5354    RTR3PTR                     pvUser;
     
    7980#endif
    8081    /** Size of the range. */
    81     RTUINT                      cbSize;
     82    RTUINT                      cb;
    8283    /** Pointer to user argument. */
    8384    RTR0PTR                     pvUser;
     
    106107    RTGCPHYS                    GCPhys;
    107108    /** Size of the range. */
    108     RTUINT                      cbSize;
     109    RTUINT                      cb;
    109110#if HC_ARCH_BITS == 64
    110111    uint32_t                    u32Alignment;
     
    122123#if HC_ARCH_BITS == 64 && GC_ARCH_BITS == 32
    123124    RTGCPTR                     GCPtrAlignment; /**< pszDesc is 8 byte aligned. */
    124 #endif 
     125#endif
    125126    /** Description / Name. For easing debugging. */
    126127    R3PTRTYPE(const char *)     pszDesc;
     
    266267#if HC_ARCH_BITS == 64 && GC_ARCH_BITS == 32
    267268    RTGCPTR                     GCPtrAlignment; /**< pszDesc is 8 byte aligned. */
    268 #endif 
     269#endif
    269270    /** Description / Name. For easing debugging. */
    270271    R3PTRTYPE(const char *)     pszDesc;
     
    375376    R3R0PTRTYPE(PIOMTREES)          pTreesHC;
    376377
     378    /** The ring-0 address of IOMMMIOHandler. */
     379    R0PTRTYPE(PFNPGMR0PHYSHANDLER)  pfnMMIOHandlerR0;
     380    /** The GC address of IOMMMIOHandler. */
     381    GCPTRTYPE(PFNPGMGCPHYSHANDLER)  pfnMMIOHandlerGC;
     382    RTGCPTR                         Alignment;
    377383
    378384    /** @name Caching of I/O Port ranges and statistics.
  • trunk/src/VBox/VMM/PGMPhys.cpp

    r7635 r7731  
    278278 *
    279279 */
    280 PDMR3DECL(int) PGMR3PhysMMIORegister(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cb)
    281 {
    282     return -1;
     280PDMR3DECL(int) PGMR3PhysMMIORegister(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cb,
     281                                     R3PTRTYPE(PFNPGMR3PHYSHANDLER) pfnHandlerR3, RTR3PTR pvUserR3,
     282                                     R0PTRTYPE(PFNPGMR0PHYSHANDLER) pfnHandlerR0, RTR0PTR pvUserR0,
     283                                     GCPTRTYPE(PFNPGMGCPHYSHANDLER) pfnHandlerGC, RTGCPTR pvUserGC,
     284                                     R3PTRTYPE(const char *) pszDesc)
     285{
     286
     287    int rc = PGMHandlerPhysicalRegisterEx(pVM, PGMPHYSHANDLERTYPE_MMIO, GCPhys, GCPhys + (cb - 1),
     288                                          pfnHandlerR3, pvUserR3,
     289                                          pfnHandlerR0, pvUserR0,
     290                                          pfnHandlerGC, pvUserGC, pszDesc);
     291    return rc;
    283292}
    284293
     
    293302PDMR3DECL(int) PGMR3PhysMMIODeregister(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cb)
    294303{
    295     return -1;
     304    int rc = PGMHandlerPhysicalDeregister(pVM, GCPhys);
     305
     306    return rc;
    296307}
    297308
  • trunk/src/VBox/VMM/VMMAll/IOMAllMMIO.cpp

    r7723 r7731  
    159159 * @warning VBOX_SUCCESS(rc=VINF_IOM_HC_MMIO_WRITE) is TRUE!
    160160 */
    161 DECLINLINE(int) iomMMIODoWrite(PVM pVM, CTXALLSUFF(PIOMMMIORANGE) pRange, RTGCPHYS GCPhysFault, const void *pvData, unsigned cbSize)
     161DECLINLINE(int) iomMMIODoWrite(PVM pVM, CTXALLSUFF(PIOMMMIORANGE) pRange, RTGCPHYS GCPhysFault, const void *pvData, unsigned cb)
    162162{
    163163#ifdef VBOX_WITH_STATISTICS
    164     if (pRange->cbSize <= PAGE_SIZE)
     164    if (pRange->cb <= PAGE_SIZE)
    165165    {
    166166        PIOMMMIOSTATS pStats = iomMMIOGetStats(&pVM->iom.s, GCPhysFault);
     
    168168            return VINF_IOM_HC_MMIO_WRITE;
    169169
    170         int rc = pRange->pfnWriteCallback(pRange->pDevIns, pRange->pvUser, GCPhysFault, (void *)pvData, cbSize); /* @todo fix const!! */
     170        int rc = pRange->pfnWriteCallback(pRange->pDevIns, pRange->pvUser, GCPhysFault, (void *)pvData, cb); /* @todo fix const!! */
    171171        if (rc != VINF_IOM_HC_MMIO_WRITE)
    172172            STAM_COUNTER_INC(&pStats->WriteGC);
     
    174174    }
    175175#endif
    176     return pRange->pfnWriteCallback(pRange->pDevIns, pRange->pvUser, GCPhysFault, (void *)pvData, cbSize);
     176    return pRange->pfnWriteCallback(pRange->pDevIns, pRange->pvUser, GCPhysFault, (void *)pvData, cb);
    177177}
    178178
     
    180180 * Wrapper which does the read and updates range statistics when such are enabled.
    181181 */
    182 DECLINLINE(int) iomMMIODoRead(PVM pVM, CTXALLSUFF(PIOMMMIORANGE) pRange, RTGCPHYS GCPhysFault, void *pvData, unsigned cbSize)
     182DECLINLINE(int) iomMMIODoRead(PVM pVM, CTXALLSUFF(PIOMMMIORANGE) pRange, RTGCPHYS GCPhysFault, void *pvData, unsigned cb)
    183183{
    184184#ifdef VBOX_WITH_STATISTICS
    185     if (pRange->cbSize <= PAGE_SIZE)
     185    if (pRange->cb <= PAGE_SIZE)
    186186    {
    187187        PIOMMMIOSTATS pStats = iomMMIOGetStats(&pVM->iom.s, GCPhysFault);
     
    189189            return VINF_IOM_HC_MMIO_READ;
    190190
    191         int rc = pRange->pfnReadCallback(pRange->pDevIns, pRange->pvUser, GCPhysFault, pvData, cbSize);
     191        int rc = pRange->pfnReadCallback(pRange->pDevIns, pRange->pvUser, GCPhysFault, pvData, cb);
    192192        if (rc != VINF_IOM_HC_MMIO_READ)
    193193            STAM_COUNTER_INC(&pStats->ReadGC);
     
    195195    }
    196196#endif
    197     return pRange->pfnReadCallback(pRange->pDevIns, pRange->pvUser, GCPhysFault, pvData, cbSize);
     197    return pRange->pfnReadCallback(pRange->pDevIns, pRange->pvUser, GCPhysFault, pvData, cb);
    198198}
    199199
     
    373373     * and call the handler function to get the data.
    374374     */
    375     unsigned cbSize = DISGetParamSize(pCpu, &pCpu->param2);
    376     AssertMsg(cbSize > 0 && cbSize <= sizeof(uint32_t), ("cbSize=%d\n", cbSize));
     375    unsigned cb = DISGetParamSize(pCpu, &pCpu->param2);
     376    AssertMsg(cb > 0 && cb <= sizeof(uint32_t), ("cb=%d\n", cb));
    377377
    378378    uint32_t u32Data = 0;
    379     int rc = iomMMIODoRead(pVM, pRange, GCPhysFault, &u32Data, cbSize);
     379    int rc = iomMMIODoRead(pVM, pRange, GCPhysFault, &u32Data, cb);
    380380    if (rc == VINF_SUCCESS)
    381381    {
     
    386386        if (pCpu->pCurInstr->opcode == OP_MOVSX)
    387387        {
    388             if (cbSize == 1)
     388            if (cb == 1)
    389389            {
    390390                /* DWORD <- BYTE */
     
    408408
    409409    if (rc == VINF_SUCCESS)
    410         iomMMIOStatLength(pVM, cbSize);
     410        iomMMIOStatLength(pVM, cb);
    411411    return rc;
    412412}
     
    436436     * and call the callback to write it.
    437437     */
    438     unsigned cbSize = 0;
     438    unsigned cb = 0;
    439439    uint32_t u32Data  = 0;
    440     bool fRc = iomGetRegImmData(pCpu, &pCpu->param2, pRegFrame, &u32Data, &cbSize);
     440    bool fRc = iomGetRegImmData(pCpu, &pCpu->param2, pRegFrame, &u32Data, &cb);
    441441    AssertMsg(fRc, ("Failed to get reg/imm port number!\n")); NOREF(fRc);
    442442
    443     int rc = iomMMIODoWrite(pVM, pRange, GCPhysFault, &u32Data, cbSize);
     443    int rc = iomMMIODoWrite(pVM, pRange, GCPhysFault, &u32Data, cb);
    444444    if (rc == VINF_SUCCESS)
    445         iomMMIOStatLength(pVM, cbSize);
     445        iomMMIOStatLength(pVM, cb);
    446446    return rc;
    447447}
     
    523523     * Get data size.
    524524     */
    525     unsigned cbSize = DISGetParamSize(pCpu, &pCpu->param1);
    526     Assert(cbSize);
    527     int      offIncrement = pRegFrame->eflags.Bits.u1DF ? -(signed)cbSize : (signed)cbSize;
     525    unsigned cb = DISGetParamSize(pCpu, &pCpu->param1);
     526    Assert(cb);
     527    int      offIncrement = pRegFrame->eflags.Bits.u1DF ? -(signed)cb : (signed)cb;
    528528
    529529#ifdef VBOX_WITH_STATISTICS
    530     if (pVM->iom.s.cMovsMaxBytes < (cTransfers << SIZE_2_SHIFT(cbSize)))
    531         pVM->iom.s.cMovsMaxBytes = cTransfers << SIZE_2_SHIFT(cbSize);
     530    if (pVM->iom.s.cMovsMaxBytes < (cTransfers << SIZE_2_SHIFT(cb)))
     531        pVM->iom.s.cMovsMaxBytes = cTransfers << SIZE_2_SHIFT(cb);
    532532#endif
    533533
     
    558558
    559559            /* Access verification first; we currently can't recover properly from traps inside this instruction */
    560             rc = PGMVerifyAccess(pVM, pu8Virt, cTransfers * cbSize, (cpl == 3) ? X86_PTE_US : 0);
     560            rc = PGMVerifyAccess(pVM, pu8Virt, cTransfers * cb, (cpl == 3) ? X86_PTE_US : 0);
    561561            if (rc != VINF_SUCCESS)
    562562            {
     
    574574            {
    575575                uint32_t u32Data = 0;
    576                 rc = iomRamRead(pVM, &u32Data, (RTGCPTR)pu8Virt, cbSize);
     576                rc = iomRamRead(pVM, &u32Data, (RTGCPTR)pu8Virt, cb);
    577577                if (rc != VINF_SUCCESS)
    578578                    break;
    579                 rc = iomMMIODoWrite(pVM, pRange, Phys, &u32Data, cbSize);
     579                rc = iomMMIODoWrite(pVM, pRange, Phys, &u32Data, cb);
    580580                if (rc != VINF_SUCCESS)
    581581                    break;
     
    642642            {
    643643                uint32_t u32Data;
    644                 rc = iomMMIODoRead(pVM, pRange, Phys, &u32Data, cbSize);
     644                rc = iomMMIODoRead(pVM, pRange, Phys, &u32Data, cb);
    645645                if (rc != VINF_SUCCESS)
    646646                    break;
    647                 rc = iomMMIODoWrite(pVM, pMMIODst, PhysDst, &u32Data, cbSize);
     647                rc = iomMMIODoWrite(pVM, pMMIODst, PhysDst, &u32Data, cb);
    648648                if (rc != VINF_SUCCESS)
    649649                    break;
     
    666666
    667667            /* Access verification first; we currently can't recover properly from traps inside this instruction */
    668             rc = PGMVerifyAccess(pVM, pu8Virt, cTransfers * cbSize, X86_PTE_RW | ((cpl == 3) ? X86_PTE_US : 0));
     668            rc = PGMVerifyAccess(pVM, pu8Virt, cTransfers * cb, X86_PTE_RW | ((cpl == 3) ? X86_PTE_US : 0));
    669669            if (rc != VINF_SUCCESS)
    670670            {
     
    681681            {
    682682                uint32_t u32Data;
    683                 rc = iomMMIODoRead(pVM, pRange, Phys, &u32Data, cbSize);
     683                rc = iomMMIODoRead(pVM, pRange, Phys, &u32Data, cb);
    684684                if (rc != VINF_SUCCESS)
    685685                    break;
    686                 rc = iomRamWrite(pVM, (RTGCPTR)pu8Virt, &u32Data, cbSize);
     686                rc = iomRamWrite(pVM, (RTGCPTR)pu8Virt, &u32Data, cb);
    687687                if (rc != VINF_SUCCESS)
    688688                {
    689                     Log(("iomRamWrite %08X size=%d failed with %d\n", pu8Virt, cbSize, rc));
     689                    Log(("iomRamWrite %08X size=%d failed with %d\n", pu8Virt, cb, rc));
    690690                    break;
    691691                }
     
    712712    {
    713713        STAM_PROFILE_STOP(&pVM->iom.s.StatGCInstMovs, a);
    714         iomMMIOStatLength(pVM, cbSize);
     714        iomMMIOStatLength(pVM, cb);
    715715    }
    716716    return rc;
     
    763763     * Get data size.
    764764     */
    765     unsigned cbSize = DISGetParamSize(pCpu, &pCpu->param1);
    766     Assert(cbSize);
    767     int      offIncrement = pRegFrame->eflags.Bits.u1DF ? -(signed)cbSize : (signed)cbSize;
     765    unsigned cb = DISGetParamSize(pCpu, &pCpu->param1);
     766    Assert(cb);
     767    int      offIncrement = pRegFrame->eflags.Bits.u1DF ? -(signed)cb : (signed)cb;
    768768
    769769#ifdef VBOX_WITH_STATISTICS
    770     if (pVM->iom.s.cStosMaxBytes < (cTransfers << SIZE_2_SHIFT(cbSize)))
    771         pVM->iom.s.cStosMaxBytes = cTransfers << SIZE_2_SHIFT(cbSize);
     770    if (pVM->iom.s.cStosMaxBytes < (cTransfers << SIZE_2_SHIFT(cb)))
     771        pVM->iom.s.cStosMaxBytes = cTransfers << SIZE_2_SHIFT(cb);
    772772#endif
    773773
     
    785785        {
    786786            /* addr++ variant. */
    787             rc = pRange->pfnFillCallback(pRange->pDevIns, pRange->pvUser, Phys, u32Data, cbSize, cTransfers);
     787            rc = pRange->pfnFillCallback(pRange->pDevIns, pRange->pvUser, Phys, u32Data, cb, cTransfers);
    788788            if (rc == VINF_SUCCESS)
    789789            {
    790790                /* Update registers. */
    791                 pRegFrame->edi += cTransfers << SIZE_2_SHIFT(cbSize);
     791                pRegFrame->edi += cTransfers << SIZE_2_SHIFT(cb);
    792792                if (pCpu->prefix & PREFIX_REP)
    793793                    pRegFrame->ecx = 0;
     
    797797        {
    798798            /* addr-- variant. */
    799             rc = pRange->pfnFillCallback(pRange->pDevIns, pRange->pvUser, (Phys - (cTransfers - 1)) << SIZE_2_SHIFT(cbSize), u32Data, cbSize, cTransfers);
     799            rc = pRange->pfnFillCallback(pRange->pDevIns, pRange->pvUser, (Phys - (cTransfers - 1)) << SIZE_2_SHIFT(cb), u32Data, cb, cTransfers);
    800800            if (rc == VINF_SUCCESS)
    801801            {
    802802                /* Update registers. */
    803                 pRegFrame->edi -= cTransfers << SIZE_2_SHIFT(cbSize);
     803                pRegFrame->edi -= cTransfers << SIZE_2_SHIFT(cb);
    804804                if (pCpu->prefix & PREFIX_REP)
    805805                    pRegFrame->ecx = 0;
     
    819819        do
    820820        {
    821             rc = iomMMIODoWrite(pVM, pRange, Phys, &u32Data, cbSize);
     821            rc = iomMMIODoWrite(pVM, pRange, Phys, &u32Data, cb);
    822822            if (rc != VINF_SUCCESS)
    823823                break;
     
    839839    {
    840840        STAM_PROFILE_STOP(&pVM->iom.s.StatGCInstStos, a);
    841         iomMMIOStatLength(pVM, cbSize);
     841        iomMMIOStatLength(pVM, cb);
    842842    }
    843843    return rc;
     
    878878     * Get data size.
    879879     */
    880     unsigned cbSize = DISGetParamSize(pCpu, &pCpu->param2);
    881     Assert(cbSize);
    882     int     offIncrement = pRegFrame->eflags.Bits.u1DF ? -(signed)cbSize : (signed)cbSize;
     880    unsigned cb = DISGetParamSize(pCpu, &pCpu->param2);
     881    Assert(cb);
     882    int     offIncrement = pRegFrame->eflags.Bits.u1DF ? -(signed)cb : (signed)cb;
    883883
    884884    /*
    885885     * Perform read.
    886886     */
    887     int rc = iomMMIODoRead(pVM, pRange, GCPhysFault, &pRegFrame->eax, cbSize);
     887    int rc = iomMMIODoRead(pVM, pRange, GCPhysFault, &pRegFrame->eax, cb);
    888888    if (rc == VINF_SUCCESS)
    889889        pRegFrame->esi += offIncrement;
     
    895895    {
    896896        STAM_PROFILE_STOP(&pVM->iom.s.StatGCInstLods, a1);
    897         iomMMIOStatLength(pVM, cbSize);
     897        iomMMIOStatLength(pVM, cb);
    898898    }
    899899    return rc;
     
    927927     * Get the operands.
    928928     */
    929     unsigned cbSize = 0;
     929    unsigned cb = 0;
    930930    uint32_t uData1;
    931931    uint32_t uData2;
    932932    int rc;
    933     if (iomGetRegImmData(pCpu, &pCpu->param1, pRegFrame, &uData1, &cbSize))
     933    if (iomGetRegImmData(pCpu, &pCpu->param1, pRegFrame, &uData1, &cb))
    934934        /* cmp reg, [MMIO]. */
    935         rc = iomMMIODoRead(pVM, pRange, GCPhysFault, &uData2, cbSize);
    936     else if (iomGetRegImmData(pCpu, &pCpu->param2, pRegFrame, &uData2, &cbSize))
     935        rc = iomMMIODoRead(pVM, pRange, GCPhysFault, &uData2, cb);
     936    else if (iomGetRegImmData(pCpu, &pCpu->param2, pRegFrame, &uData2, &cb))
    937937        /* cmp [MMIO], reg|imm. */
    938         rc = iomMMIODoRead(pVM, pRange, GCPhysFault, &uData1, cbSize);
     938        rc = iomMMIODoRead(pVM, pRange, GCPhysFault, &uData1, cb);
    939939    else
    940940    {
     
    946946    {
    947947        /* Emulate CMP and update guest flags. */
    948         uint32_t eflags = EMEmulateCmp(uData1, uData2, cbSize);
     948        uint32_t eflags = EMEmulateCmp(uData1, uData2, cb);
    949949        pRegFrame->eflags.u32 = (pRegFrame->eflags.u32 & ~(X86_EFL_CF | X86_EFL_PF | X86_EFL_AF | X86_EFL_ZF | X86_EFL_SF | X86_EFL_OF))
    950950                              | (eflags                &  (X86_EFL_CF | X86_EFL_PF | X86_EFL_AF | X86_EFL_ZF | X86_EFL_SF | X86_EFL_OF));
    951951
    952952        STAM_PROFILE_STOP(&pVM->iom.s.StatGCInstCmp, a1);
    953         iomMMIOStatLength(pVM, cbSize);
     953        iomMMIOStatLength(pVM, cb);
    954954    }
    955955
     
    979979    /* Check read callback. */
    980980
    981     unsigned    cbSize = 0;
     981    unsigned    cb = 0;
    982982    uint32_t    uData1;
    983983    uint32_t    uData2;
    984984    bool        fAndWrite;
    985985    int         rc;
    986     if (iomGetRegImmData(pCpu, &pCpu->param1, pRegFrame, &uData1, &cbSize))
     986    if (iomGetRegImmData(pCpu, &pCpu->param1, pRegFrame, &uData1, &cb))
    987987    {
    988988        /* and reg, [MMIO]. */
    989989        fAndWrite = false;
    990990        if (pRange->pfnReadCallback)
    991             rc = iomMMIODoRead(pVM, pRange, GCPhysFault, &uData2, cbSize);
     991            rc = iomMMIODoRead(pVM, pRange, GCPhysFault, &uData2, cb);
    992992        else
    993993            rc = VINF_IOM_HC_MMIO_READ;
    994994    }
    995     else if (iomGetRegImmData(pCpu, &pCpu->param2, pRegFrame, &uData2, &cbSize))
     995    else if (iomGetRegImmData(pCpu, &pCpu->param2, pRegFrame, &uData2, &cb))
    996996    {
    997997        /* and [MMIO], reg|imm. */
    998998        fAndWrite = true;
    999999        if (pRange->pfnReadCallback && pRange->pfnWriteCallback)
    1000             rc = iomMMIODoRead(pVM, pRange, GCPhysFault, &uData1, cbSize);
     1000            rc = iomMMIODoRead(pVM, pRange, GCPhysFault, &uData1, cb);
    10011001        else
    10021002            rc = VINF_IOM_HC_MMIO_READ_WRITE;
     
    10111011    {
    10121012        /* Emulate AND and update guest flags. */
    1013         uint32_t eflags = EMEmulateAnd(&uData1, uData2, cbSize);
     1013        uint32_t eflags = EMEmulateAnd(&uData1, uData2, cb);
    10141014        if (fAndWrite)
    10151015            /* Store result to MMIO. */
    1016             rc = iomMMIODoWrite(pVM, pRange, GCPhysFault, &uData1, cbSize);
     1016            rc = iomMMIODoWrite(pVM, pRange, GCPhysFault, &uData1, cb);
    10171017        else
    10181018        {
     
    10271027                                  | (eflags                &  (X86_EFL_CF | X86_EFL_PF | X86_EFL_AF | X86_EFL_ZF | X86_EFL_SF | X86_EFL_OF));
    10281028            STAM_PROFILE_STOP(&pVM->iom.s.StatGCInstAnd, a1);
    1029             iomMMIOStatLength(pVM, cbSize);
     1029            iomMMIOStatLength(pVM, cb);
    10301030        }
    10311031    }
     
    10571057    /* Check read callback. */
    10581058
    1059     unsigned    cbSize = 0;
     1059    unsigned    cb = 0;
    10601060    uint32_t    uData1;
    10611061    uint32_t    uData2;
    10621062    int         rc;
    10631063
    1064     if (iomGetRegImmData(pCpu, &pCpu->param1, pRegFrame, &uData1, &cbSize))
     1064    if (iomGetRegImmData(pCpu, &pCpu->param1, pRegFrame, &uData1, &cb))
    10651065    {
    10661066        /* and test, [MMIO]. */
    10671067        if (pRange->pfnReadCallback)
    1068             rc = iomMMIODoRead(pVM, pRange, GCPhysFault, &uData2, cbSize);
     1068            rc = iomMMIODoRead(pVM, pRange, GCPhysFault, &uData2, cb);
    10691069        else
    10701070            rc = VINF_IOM_HC_MMIO_READ;
    10711071    }
    1072     else if (iomGetRegImmData(pCpu, &pCpu->param2, pRegFrame, &uData2, &cbSize))
     1072    else if (iomGetRegImmData(pCpu, &pCpu->param2, pRegFrame, &uData2, &cb))
    10731073    {
    10741074        /* test [MMIO], reg|imm. */
    10751075        if (pRange->pfnReadCallback)
    1076             rc = iomMMIODoRead(pVM, pRange, GCPhysFault, &uData1, cbSize);
     1076            rc = iomMMIODoRead(pVM, pRange, GCPhysFault, &uData1, cb);
    10771077        else
    10781078            rc = VINF_IOM_HC_MMIO_READ;
     
    10871087    {
    10881088        /* Emulate TEST (=AND without write back) and update guest EFLAGS. */
    1089         uint32_t eflags = EMEmulateAnd(&uData1, uData2, cbSize);
     1089        uint32_t eflags = EMEmulateAnd(&uData1, uData2, cb);
    10901090        pRegFrame->eflags.u32 = (pRegFrame->eflags.u32 & ~(X86_EFL_CF | X86_EFL_PF | X86_EFL_AF | X86_EFL_ZF | X86_EFL_SF | X86_EFL_OF))
    10911091                              | (eflags                &  (X86_EFL_CF | X86_EFL_PF | X86_EFL_AF | X86_EFL_ZF | X86_EFL_SF | X86_EFL_OF));
    10921092        STAM_PROFILE_STOP(&pVM->iom.s.StatGCInstTest, a1);
    1093         iomMMIOStatLength(pVM, cbSize);
     1093        iomMMIOStatLength(pVM, cb);
    10941094    }
    10951095
     
    11171117
    11181118    /* Check read callback. */
    1119     unsigned    cbSize = 0;
     1119    unsigned    cb = 0;
    11201120    uint32_t    uData1;
    11211121    uint32_t    uData2;
     
    11281128    }
    11291129
    1130     if (iomGetRegImmData(pCpu, &pCpu->param1, pRegFrame, &uData1, &cbSize))
     1130    if (iomGetRegImmData(pCpu, &pCpu->param1, pRegFrame, &uData1, &cb))
    11311131    {
    11321132        /* xchg reg, [MMIO]. */
    1133         rc = iomMMIODoRead(pVM, pRange, GCPhysFault, &uData2, cbSize);
     1133        rc = iomMMIODoRead(pVM, pRange, GCPhysFault, &uData2, cb);
    11341134        if (rc == VINF_SUCCESS)
    11351135        {
    11361136            /* Store result to MMIO. */
    1137             rc = iomMMIODoWrite(pVM, pRange, GCPhysFault, &uData1, cbSize);
     1137            rc = iomMMIODoWrite(pVM, pRange, GCPhysFault, &uData1, cb);
    11381138
    11391139            if (rc == VINF_SUCCESS)
     
    11501150    }
    11511151    else
    1152     if (iomGetRegImmData(pCpu, &pCpu->param2, pRegFrame, &uData2, &cbSize))
     1152    if (iomGetRegImmData(pCpu, &pCpu->param2, pRegFrame, &uData2, &cb))
    11531153    {
    11541154        /* xchg [MMIO], reg. */
    1155         rc = iomMMIODoRead(pVM, pRange, GCPhysFault, &uData1, cbSize);
     1155        rc = iomMMIODoRead(pVM, pRange, GCPhysFault, &uData1, cb);
    11561156        if (rc == VINF_SUCCESS)
    11571157        {
    11581158            /* Store result to MMIO. */
    1159             rc = iomMMIODoWrite(pVM, pRange, GCPhysFault, &uData2, cbSize);
     1159            rc = iomMMIODoWrite(pVM, pRange, GCPhysFault, &uData2, cb);
    11601160
    11611161            if (rc == VINF_SUCCESS)
     
    14121412#ifdef VBOX_WITH_STATISTICS
    14131413    PIOMMMIOSTATS pStats = iomMMIOGetStats(&pVM->iom.s, GCPhys);
    1414     if (!pStats && (!pRange || pRange->cbSize <= PAGE_SIZE))
     1414    if (!pStats && (!pRange || pRange->cb <= PAGE_SIZE))
    14151415# ifdef IN_RING3
    14161416        pStats = iomR3MMIOStatsCreate(pVM, GCPhys, pRange ? pRange->pszDesc : NULL);
     
    15131513#ifdef VBOX_WITH_STATISTICS
    15141514    PIOMMMIOSTATS pStats = iomMMIOGetStats(&pVM->iom.s, GCPhys);
    1515     if (!pStats && (!pRange || pRange->cbSize <= PAGE_SIZE))
     1515    if (!pStats && (!pRange || pRange->cb <= PAGE_SIZE))
    15161516# ifdef IN_RING3
    15171517        pStats = iomR3MMIOStatsCreate(pVM, GCPhys, pRange ? pRange->pszDesc : NULL);
     
    17071707     * disassembler). And get the I/O register size from the opcode / prefix.
    17081708     */
    1709     uint32_t    uPort = pRegFrame->edx & 0xffff;
    1710     unsigned    cbSize = 0;
     1709    RTIOPORT    Port = pRegFrame->edx & 0xffff;
     1710    unsigned    cb = 0;
    17111711    if (pCpu->pCurInstr->opcode == OP_INSB)
    1712         cbSize = 1;
     1712        cb = 1;
    17131713    else
    1714         cbSize = pCpu->opmode == CPUMODE_32BIT ? 4 : 2;
    1715 
    1716     int rc = IOMInterpretCheckPortIOAccess(pVM, pRegFrame, uPort, cbSize);
     1714        cb = pCpu->opmode == CPUMODE_32BIT ? 4 : 2;
     1715
     1716    int rc = IOMInterpretCheckPortIOAccess(pVM, pRegFrame, Port, cb);
    17171717    if (RT_UNLIKELY(rc != VINF_SUCCESS))
    17181718    {
     
    17211721    }
    17221722
    1723     return IOMInterpretINSEx(pVM, pRegFrame, uPort, pCpu->prefix, cbSize);
     1723    return IOMInterpretINSEx(pVM, pRegFrame, Port, pCpu->prefix, cb);
    17241724}
    17251725
     
    18651865     * And get the I/O register size from the opcode / prefix.
    18661866     */
    1867     uint32_t    uPort = 0;
    1868     unsigned    cbSize = 0;
    1869     bool fRc = iomGetRegImmData(pCpu, &pCpu->param1, pRegFrame, &uPort, &cbSize);
     1867    uint32_t    Port = 0;
     1868    unsigned    cb = 0;
     1869    bool fRc = iomGetRegImmData(pCpu, &pCpu->param1, pRegFrame, &Port, &cb);
    18701870    AssertMsg(fRc, ("Failed to get reg/imm port number!\n")); NOREF(fRc);
    18711871    if (pCpu->pCurInstr->opcode == OP_OUTSB)
    1872         cbSize = 1;
     1872        cb = 1;
    18731873    else
    1874         cbSize = (pCpu->opmode == CPUMODE_32BIT) ? 4 : 2;
    1875 
    1876     int rc = IOMInterpretCheckPortIOAccess(pVM, pRegFrame, uPort, cbSize);
     1874        cb = (pCpu->opmode == CPUMODE_32BIT) ? 4 : 2;
     1875
     1876    int rc = IOMInterpretCheckPortIOAccess(pVM, pRegFrame, Port, cb);
    18771877    if (RT_UNLIKELY(rc != VINF_SUCCESS))
    18781878    {
     
    18811881    }
    18821882
    1883     return IOMInterpretOUTSEx(pVM, pRegFrame, uPort, pCpu->prefix, cbSize);
    1884 }
    1885 
     1883    return IOMInterpretOUTSEx(pVM, pRegFrame, Port, pCpu->prefix, cb);
     1884}
     1885
  • trunk/src/VBox/VMM/testcase/tstVMStructGC.cpp

    r7715 r7731  
    125125    GEN_CHECK_SIZE(IOMMMIORANGER0);
    126126    GEN_CHECK_OFF(IOMMMIORANGER0, GCPhys);
    127     GEN_CHECK_OFF(IOMMMIORANGER0, cbSize);
     127    GEN_CHECK_OFF(IOMMMIORANGER0, cb);
    128128    GEN_CHECK_OFF(IOMMMIORANGER0, pvUser);
    129129    GEN_CHECK_OFF(IOMMMIORANGER0, pDevIns);
     
    133133    GEN_CHECK_SIZE(IOMMMIORANGEGC);
    134134    GEN_CHECK_OFF(IOMMMIORANGEGC, GCPhys);
    135     GEN_CHECK_OFF(IOMMMIORANGEGC, cbSize);
     135    GEN_CHECK_OFF(IOMMMIORANGEGC, cb);
    136136    GEN_CHECK_OFF(IOMMMIORANGEGC, pvUser);
    137137    GEN_CHECK_OFF(IOMMMIORANGEGC, pDevIns);
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette