VirtualBox

Changeset 2270 in vbox for trunk/src/VBox/VMM


Ignore:
Timestamp:
Apr 20, 2007 12:58:15 PM (18 years ago)
Author:
vboxsync
Message:

Stricter pointer typechecking. (R0 vs R3)

Location:
trunk/src/VBox/VMM
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/IOM.cpp

    r707 r2270  
    11901190        int rc = PGMR3HandlerPhysicalRegister(pVM, PGMPHYSHANDLERTYPE_MMIO, GCPhysStart, GCPhysStart + (cbRange - 1),
    11911191                                              /*IOMR3MMIOHandler*/ NULL, pRange,
    1192                                               NULL, "IOMMMIOHandler", pRange,
     1192                                              NULL, "IOMMMIOHandler", MMHyperR3ToR0(pVM, pRange),
    11931193                                              NULL, "IOMMMIOHandler", MMHyperHC2GC(pVM, pRange), pszDesc);
    11941194        if (VBOX_SUCCESS(rc))
  • trunk/src/VBox/VMM/IOMInternal.h

    r706 r2270  
    5252    RTUINT                      cbSize;
    5353    /** Pointer to user argument. */
    54     RTHCPTR                     pvUser;
     54    RTR3PTR                     pvUser;
    5555    /** Pointer to device instance. */
    56     HCPTRTYPE(PPDMDEVINS)       pDevIns;
     56    R3PTRTYPE(PPDMDEVINS)       pDevIns;
    5757    /** Pointer to write callback function. */
    58     HCPTRTYPE(PFNIOMMMIOWRITE)  pfnWriteCallback;
     58    R3PTRTYPE(PFNIOMMMIOWRITE)  pfnWriteCallback;
    5959    /** Pointer to read callback function. */
    60     HCPTRTYPE(PFNIOMMMIOREAD)   pfnReadCallback;
     60    R3PTRTYPE(PFNIOMMMIOREAD)   pfnReadCallback;
    6161    /** Pointer to fill (memset) callback function. */
    62     HCPTRTYPE(PFNIOMMMIOFILL)   pfnFillCallback;
     62    R3PTRTYPE(PFNIOMMMIOFILL)   pfnFillCallback;
    6363    /** Description / Name. For easing debugging. */
    64     HCPTRTYPE(const char *)     pszDesc;
     64    R3PTRTYPE(const char *)     pszDesc;
    6565} IOMMMIORANGER3;
    6666/** Pointer to a MMIO range descriptor, R3 version. */
    6767typedef struct IOMMMIORANGER3 *PIOMMMIORANGER3;
    6868
    69 /** MMIO range descriptor, R0 version. */
    70 typedef IOMMMIORANGER3  IOMMMIORANGER0;
     69/**
     70 * MMIO range descriptor, R0 version.
     71 */
     72typedef struct IOMMMIORANGER0
     73{
     74    /** Avl node core with GCPhys as Key and GCPhys + cbSize - 1 as KeyLast. */
     75    AVLROGCPHYSNODECORE         Core;
     76    /** Start physical address. */
     77    RTGCPHYS                    GCPhys;
     78    /** Size of the range. */
     79    RTUINT                      cbSize;
     80    /** Pointer to user argument. */
     81    RTR0PTR                     pvUser;
     82    /** Pointer to device instance. */
     83    R0PTRTYPE(PPDMDEVINS)       pDevIns;
     84    /** Pointer to write callback function. */
     85    R0PTRTYPE(PFNIOMMMIOWRITE)  pfnWriteCallback;
     86    /** Pointer to read callback function. */
     87    R0PTRTYPE(PFNIOMMMIOREAD)   pfnReadCallback;
     88    /** Pointer to fill (memset) callback function. */
     89    R0PTRTYPE(PFNIOMMMIOFILL)   pfnFillCallback;
     90    /** Description / Name. For easing debugging. */
     91    R3PTRTYPE(const char *)     pszDesc;
     92} IOMMMIORANGER0;
    7193/** Pointer to a MMIO range descriptor, R0 version. */
    72 typedef PIOMMMIORANGER3 PIOMMMIORANGER0;
     94typedef struct IOMMMIORANGER0 *PIOMMMIORANGER0;
    7395
    7496/**
     
    159181    uint16_t                    cPorts;
    160182    /** Pointer to user argument. */
    161     RTHCPTR                     pvUser;
     183    RTR3PTR                     pvUser;
    162184    /** Pointer to the associated device instance. */
    163     HCPTRTYPE(PPDMDEVINS)       pDevIns;
     185    R3PTRTYPE(PPDMDEVINS)       pDevIns;
    164186    /** Pointer to OUT callback function. */
    165     HCPTRTYPE(PFNIOMIOPORTOUT)  pfnOutCallback;
     187    R3PTRTYPE(PFNIOMIOPORTOUT)  pfnOutCallback;
    166188    /** Pointer to IN callback function. */
    167     HCPTRTYPE(PFNIOMIOPORTIN)   pfnInCallback;
     189    R3PTRTYPE(PFNIOMIOPORTIN)   pfnInCallback;
    168190    /** Pointer to string OUT callback function. */
    169     HCPTRTYPE(PFNIOMIOPORTOUTSTRING) pfnOutStrCallback;
     191    R3PTRTYPE(PFNIOMIOPORTOUTSTRING) pfnOutStrCallback;
    170192    /** Pointer to string IN callback function. */
    171     HCPTRTYPE(PFNIOMIOPORTINSTRING) pfnInStrCallback;
     193    R3PTRTYPE(PFNIOMIOPORTINSTRING) pfnInStrCallback;
    172194    /** Description / Name. For easing debugging. */
    173     HCPTRTYPE(const char *)     pszDesc;
     195    R3PTRTYPE(const char *)     pszDesc;
    174196} IOMIOPORTRANGER3;
    175197/** Pointer to I/O port range descriptor, R3 version. */
    176198typedef IOMIOPORTRANGER3 *PIOMIOPORTRANGER3;
    177199
    178 /** I/O port range descriptor, R0 version. */
    179 typedef IOMIOPORTRANGER3  IOMIOPORTRANGER0;
     200/**
     201 * I/O port range descriptor, R0 version.
     202 */
     203typedef struct IOMIOPORTRANGER0
     204{
     205    /** Avl node core with Port as Key and Port + cPorts - 1 as KeyLast. */
     206    AVLROIOPORTNODECORE         Core;
     207    /** Start I/O port address. */
     208    RTIOPORT                    Port;
     209    /** Size of the range. */
     210    uint16_t                    cPorts;
     211    /** Pointer to user argument. */
     212    RTR0PTR                     pvUser;
     213    /** Pointer to the associated device instance. */
     214    R0PTRTYPE(PPDMDEVINS)       pDevIns;
     215    /** Pointer to OUT callback function. */
     216    R0PTRTYPE(PFNIOMIOPORTOUT)  pfnOutCallback;
     217    /** Pointer to IN callback function. */
     218    R0PTRTYPE(PFNIOMIOPORTIN)   pfnInCallback;
     219    /** Pointer to string OUT callback function. */
     220    R0PTRTYPE(PFNIOMIOPORTOUTSTRING) pfnOutStrCallback;
     221    /** Pointer to string IN callback function. */
     222    R0PTRTYPE(PFNIOMIOPORTINSTRING) pfnInStrCallback;
     223    /** Description / Name. For easing debugging. */
     224    R3PTRTYPE(const char *)     pszDesc;
     225} IOMIOPORTRANGER0;
    180226/** Pointer to I/O port range descriptor, R0 version. */
    181 typedef PIOMIOPORTRANGER3 PIOMIOPORTRANGER0;
     227typedef IOMIOPORTRANGER0 *PIOMIOPORTRANGER0;
    182228
    183229/**
  • trunk/src/VBox/VMM/PDM.cpp

    r1812 r2270  
    293293        {
    294294            pDevIns->pDevHlpGC = pDevHlpGC;
    295             pDevIns->pvInstanceDataGC = MMHyperHC2GC(pVM, pDevIns->pvInstanceDataHC);
     295            pDevIns->pvInstanceDataGC = MMHyperHC2GC(pVM, pDevIns->pvInstanceDataR3);
     296            pDevIns->pvInstanceDataR0 = MMHyperR3ToR0(pVM, pDevIns->pvInstanceDataR3);
    296297            pDevIns->Internal.s.pVMGC = pVM->pVMGC;
    297298            if (pDevIns->Internal.s.pPciBusHC)
  • trunk/src/VBox/VMM/PDMDevice.cpp

    r1858 r2270  
    8888static DECLCALLBACK(int) pdmR3DevHlp_IOPortRegister(PPDMDEVINS pDevIns, RTIOPORT Port, RTUINT cPorts, RTHCPTR pvUser, PFNIOMIOPORTOUT pfnOut, PFNIOMIOPORTIN pfnIn, PFNIOMIOPORTOUTSTRING pfnOutStr, PFNIOMIOPORTINSTRING pfnInStr, const char *pszDesc);
    8989static DECLCALLBACK(int) pdmR3DevHlp_IOPortRegisterGC(PPDMDEVINS pDevIns, RTIOPORT Port, RTUINT cPorts, RTGCPTR pvUser, const char *pszOut, const char *pszIn, const char *pszOutStr, const char *pszInStr, const char *pszDesc);
    90 static DECLCALLBACK(int) pdmR3DevHlp_IOPortRegisterR0(PPDMDEVINS pDevIns, RTIOPORT Port, RTUINT cPorts, RTHCPTR pvUser, const char *pszOut, const char *pszIn, const char *pszOutStr, const char *pszInStr, const char *pszDesc);
     90static DECLCALLBACK(int) pdmR3DevHlp_IOPortRegisterR0(PPDMDEVINS pDevIns, RTIOPORT Port, RTUINT cPorts, RTR0PTR pvUser, const char *pszOut, const char *pszIn, const char *pszOutStr, const char *pszInStr, const char *pszDesc);
    9191static DECLCALLBACK(int) pdmR3DevHlp_IOPortDeregister(PPDMDEVINS pDevIns, RTIOPORT Port, RTUINT cPorts);
    9292static DECLCALLBACK(int) pdmR3DevHlp_MMIORegister(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTUINT cbRange, RTHCPTR pvUser,
     
    9696                                           const char *pszWrite, const char *pszRead, const char *pszFill,
    9797                                           const char *pszDesc);
    98 static DECLCALLBACK(int) pdmR3DevHlp_MMIORegisterR0(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTUINT cbRange, RTHCPTR pvUser,
     98static DECLCALLBACK(int) pdmR3DevHlp_MMIORegisterR0(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTUINT cbRange, RTR0PTR pvUser,
    9999                                           const char *pszWrite, const char *pszRead, const char *pszFill,
    100100                                           const char *pszDesc);
     
    252252 */
    253253#ifdef VBOX_STRICT
    254 # define PDMDEV_ASSERT_DEVINS(pDevIns)   do { Assert(pDevIns); Assert(pDevIns->u32Version == PDM_DEVINS_VERSION); Assert(pDevIns->pvInstanceDataHC == (void *)&pDevIns->achInstanceData[0]); } while (0)
     254# define PDMDEV_ASSERT_DEVINS(pDevIns)   do { Assert(pDevIns); Assert(pDevIns->u32Version == PDM_DEVINS_VERSION); Assert(pDevIns->pvInstanceDataR3 == (void *)&pDevIns->achInstanceData[0]); } while (0)
    255255#else
    256256# define PDMDEV_ASSERT_DEVINS(pDevIns)   do { } while (0)
     
    825825        pDevIns->pCfgHandle                     = pConfigNode;
    826826        pDevIns->iInstance                      = paDevs[i].iInstance;
    827         pDevIns->pvInstanceDataHC               = &pDevIns->achInstanceData[0];
     827        pDevIns->pvInstanceDataR3               = &pDevIns->achInstanceData[0];
    828828        pDevIns->pvInstanceDataGC               =  pDevIns->pDevReg->fFlags & PDM_DEVREG_FLAGS_GC
    829                                                    ? MMHyperHC2GC(pVM, pDevIns->pvInstanceDataHC) : 0;
     829                                                   ? MMHyperHC2GC(pVM, pDevIns->pvInstanceDataR3) : 0;
     830        pDevIns->pvInstanceDataR0               =  pDevIns->pDevReg->fFlags & PDM_DEVREG_FLAGS_R0
     831                                                   ? MMHyperR3ToR0(pVM, pDevIns->pvInstanceDataR3) : 0;
    830832
    831833        /*
     
    12061208
    12071209/** @copydoc PDMDEVHLP::pfnIOPortRegisterR0 */
    1208 static DECLCALLBACK(int) pdmR3DevHlp_IOPortRegisterR0(PPDMDEVINS pDevIns, RTIOPORT Port, RTUINT cPorts, RTHCPTR pvUser,
     1210static DECLCALLBACK(int) pdmR3DevHlp_IOPortRegisterR0(PPDMDEVINS pDevIns, RTIOPORT Port, RTUINT cPorts, RTR0PTR pvUser,
    12091211                                                      const char *pszOut, const char *pszIn,
    12101212                                                      const char *pszOutStr, const char *pszInStr, const char *pszDesc)
     
    12251227        &&  (pDevIns->pDevReg->fFlags & PDM_DEVREG_FLAGS_R0))
    12261228    {
    1227         PFNIOMIOPORTIN pfnR0PtrIn = 0;
     1229        R0PTRTYPE(PFNIOMIOPORTIN) pfnR0PtrIn = 0;
    12281230        if (pszIn)
    12291231        {
     
    12311233            AssertMsgRC(rc, ("Failed to resolve %s.%s (pszIn)\n", pDevIns->pDevReg->szR0Mod, pszIn));
    12321234        }
    1233         PFNIOMIOPORTOUT pfnR0PtrOut = 0;
     1235        R0PTRTYPE(PFNIOMIOPORTOUT) pfnR0PtrOut = 0;
    12341236        if (pszOut && VBOX_SUCCESS(rc))
    12351237        {
     
    12371239            AssertMsgRC(rc, ("Failed to resolve %s.%s (pszOut)\n", pDevIns->pDevReg->szR0Mod, pszOut));
    12381240        }
    1239         PFNIOMIOPORTINSTRING pfnR0PtrInStr = 0;
     1241        R0PTRTYPE(PFNIOMIOPORTINSTRING) pfnR0PtrInStr = 0;
    12401242        if (pszInStr && VBOX_SUCCESS(rc))
    12411243        {
     
    12431245            AssertMsgRC(rc, ("Failed to resolve %s.%s (pszInStr)\n", pDevIns->pDevReg->szR0Mod, pszInStr));
    12441246        }
    1245         PFNIOMIOPORTOUTSTRING pfnR0PtrOutStr = 0;
     1247        R0PTRTYPE(PFNIOMIOPORTOUTSTRING) pfnR0PtrOutStr = 0;
    12461248        if (pszOutStr && VBOX_SUCCESS(rc))
    12471249        {
     
    13491351
    13501352/** @copydoc PDMDEVHLP::pfnMMIORegisterR0 */
    1351 static DECLCALLBACK(int) pdmR3DevHlp_MMIORegisterR0(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTUINT cbRange, RTHCPTR pvUser,
     1353static DECLCALLBACK(int) pdmR3DevHlp_MMIORegisterR0(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTUINT cbRange, RTR0PTR pvUser,
    13521354                                                    const char *pszWrite, const char *pszRead, const char *pszFill,
    13531355                                                    const char *pszDesc)
     
    13691371        &&  (pDevIns->pDevReg->fFlags & PDM_DEVREG_FLAGS_R0))
    13701372    {
    1371         PFNIOMMMIOWRITE pfnR0PtrWrite = 0;
     1373        R0PTRTYPE(PFNIOMMMIOWRITE) pfnR0PtrWrite = 0;
    13721374        if (pszWrite)
    13731375            rc = PDMR3GetSymbolR0Lazy(pDevIns->Internal.s.pVMHC, pDevIns->pDevReg->szR0Mod, pszWrite, (void **)&pfnR0PtrWrite);
    1374         PFNIOMMMIOREAD pfnR0PtrRead = 0;
     1376        R0PTRTYPE(PFNIOMMMIOREAD) pfnR0PtrRead = 0;
    13751377        int rc2 = VINF_SUCCESS;
    13761378        if (pszRead)
    13771379            rc2 = PDMR3GetSymbolR0Lazy(pDevIns->Internal.s.pVMHC, pDevIns->pDevReg->szR0Mod, pszRead, (void **)&pfnR0PtrRead);
    1378         PFNIOMMMIOFILL pfnR0PtrFill = 0;
     1380        R0PTRTYPE(PFNIOMMMIOFILL) pfnR0PtrFill = 0;
    13791381        int rc3 = VINF_SUCCESS;
    13801382        if (pszFill)
  • trunk/src/VBox/VMM/PGM.cpp

    r1283 r2270  
    10861086    const unsigned iPT = off >> X86_PD_SHIFT;
    10871087    const unsigned iPG = (off >> X86_PT_SHIFT) & X86_PT_MASK;
    1088     pVM->pgm.s.paDynPageMap32BitPTEsGC = pMapping->aPTs[iPT].pPTGC      + iPG * sizeof(pMapping->aPTs[0].pPTHC->a[0]);
    1089     pVM->pgm.s.paDynPageMapPaePTEsGC   = pMapping->aPTs[iPT].paPaePTsGC + iPG * sizeof(pMapping->aPTs[0].paPaePTsHC->a[0]);
     1088    pVM->pgm.s.paDynPageMap32BitPTEsGC = pMapping->aPTs[iPT].pPTGC      + iPG * sizeof(pMapping->aPTs[0].pPTR3->a[0]);
     1089    pVM->pgm.s.paDynPageMapPaePTEsGC   = pMapping->aPTs[iPT].paPaePTsGC + iPG * sizeof(pMapping->aPTs[0].paPaePTsR3->a[0]);
    10901090
    10911091    /* init cache */
     
    11591159     * (One or more of them have changed, that's why we're here.)
    11601160     */
    1161     pVM->pgm.s.pMappingsGC = MMHyperHC2GC(pVM, pVM->pgm.s.pMappingsHC);
    1162     for (PPGMMAPPING pCur = pVM->pgm.s.pMappingsHC; pCur->pNextHC; pCur = pCur->pNextHC)
    1163         pCur->pNextGC = MMHyperHC2GC(pVM, pCur->pNextHC);
     1161    pVM->pgm.s.pMappingsGC = MMHyperHC2GC(pVM, pVM->pgm.s.pMappingsR3);
     1162    for (PPGMMAPPING pCur = pVM->pgm.s.pMappingsR3; pCur->pNextR3; pCur = pCur->pNextR3)
     1163        pCur->pNextGC = MMHyperHC2GC(pVM, pCur->pNextR3);
    11641164
    11651165    /* Relocate GC addresses of Page Tables. */
    1166     for (PPGMMAPPING pCur = pVM->pgm.s.pMappingsHC; pCur; pCur = pCur->pNextHC)
     1166    for (PPGMMAPPING pCur = pVM->pgm.s.pMappingsR3; pCur; pCur = pCur->pNextR3)
    11671167    {
    11681168        for (RTHCUINT i = 0; i < pCur->cPTs; i++)
    11691169        {
    1170             pCur->aPTs[i].pPTGC = MMHyperHC2GC(pVM, pCur->aPTs[i].pPTHC);
    1171             pCur->aPTs[i].paPaePTsGC = MMHyperHC2GC(pVM, pCur->aPTs[i].paPaePTsHC);
     1170            pCur->aPTs[i].pPTGC = MMHyperHC2GC(pVM, pCur->aPTs[i].pPTR3);
     1171            pCur->aPTs[i].paPaePTsGC = MMHyperHC2GC(pVM, pCur->aPTs[i].paPaePTsR3);
    11721172        }
    11731173    }
     
    13491349     */
    13501350    uint32_t i = 0;
    1351     for (PPGMMAPPING pMapping = pPGM->pMappingsHC; pMapping; pMapping = pMapping->pNextHC, i++)
     1351    for (PPGMMAPPING pMapping = pPGM->pMappingsR3; pMapping; pMapping = pMapping->pNextR3, i++)
    13521352    {
    13531353        SSMR3PutU32(pSSM, i);
     
    15011501        /* find matching range. */
    15021502        PPGMMAPPING pMapping;
    1503         for (pMapping = pPGM->pMappingsHC; pMapping; pMapping = pMapping->pNextHC)
     1503        for (pMapping = pPGM->pMappingsR3; pMapping; pMapping = pMapping->pNextR3)
    15041504            if (    pMapping->cPTs == cPTs
    15051505                &&  !strcmp(pMapping->pszDesc, szDesc))
     
    25772577                    else
    25782578                    {
    2579                         for (PPGMMAPPING pMap = pVM->pgm.s.pMappingsHC; pMap; pMap = pMap->pNextHC)
     2579                        for (PPGMMAPPING pMap = pVM->pgm.s.pMappingsR3; pMap; pMap = pMap->pNextR3)
    25802580                        {
    25812581                            uint64_t off = u64AddressPT - pMap->GCPtr;
     
    25882588                                                    fLongMode ? 16 : 8, u64AddressPT, iPDE,
    25892589                                                    iSub ? pMap->aPTs[iPDE].HCPhysPaePT1 : pMap->aPTs[iPDE].HCPhysPaePT0, HCPhysPT);
    2590                                 pPT = &pMap->aPTs[iPDE].paPaePTsHC[iSub];
     2590                                pPT = &pMap->aPTs[iPDE].paPaePTsR3[iSub];
    25912591                            }
    25922592                        }
     
    28432843                    else
    28442844                    {
    2845                         for (PPGMMAPPING pMap = pVM->pgm.s.pMappingsHC; pMap; pMap = pMap->pNextHC)
     2845                        for (PPGMMAPPING pMap = pVM->pgm.s.pMappingsR3; pMap; pMap = pMap->pNextR3)
    28462846                            if (u32Address - pMap->GCPtr < pMap->cb)
    28472847                            {
     
    28502850                                    pHlp->pfnPrintf(pHlp, "%08x error! Mapping error! PT %d has HCPhysPT=%VHp not %VHp is in the PD.\n",
    28512851                                                    u32Address, iPDE, pMap->aPTs[iPDE].HCPhysPT, HCPhys);
    2852                                 pPT = pMap->aPTs[iPDE].pPTHC;
     2852                                pPT = pMap->aPTs[iPDE].pPTR3;
    28532853                            }
    28542854                    }
     
    31283128    if (!pVM)
    31293129        return pCmdHlp->pfnPrintf(pCmdHlp, NULL, "error: The command requires VM to be selected.\n");
    3130     if (!pVM->pgm.s.pMappingsHC)
     3130    if (!pVM->pgm.s.pMappingsR3)
    31313131        return pCmdHlp->pfnPrintf(pCmdHlp, NULL, "Sorry, no mappings are registered.\n");
    31323132
     
    31423142     */
    31433143    PPGMMAPPING pCur;
    3144     for (pCur = pVM->pgm.s.pMappingsHC; pCur; pCur = pCur->pNextHC)
     3144    for (pCur = pVM->pgm.s.pMappingsR3; pCur; pCur = pCur->pNextR3)
    31453145    {
    31463146        rc = pCmdHlp->pfnPrintf(pCmdHlp, NULL,
  • trunk/src/VBox/VMM/PGMHandler.cpp

    r1997 r2270  
    8686PGMR3DECL(int) PGMR3HandlerPhysicalRegister(PVM pVM, PGMPHYSHANDLERTYPE enmType, RTGCPHYS GCPhys, RTGCPHYS GCPhysLast,
    8787                                            PFNPGMR3PHYSHANDLER pfnHandlerR3, void *pvUserR3,
    88                                             const char *pszModR0, const char *pszHandlerR0, RTHCPTR pvUserR0,
     88                                            const char *pszModR0, const char *pszHandlerR0, RTR0PTR pvUserR0,
    8989                                            const char *pszModGC, const char *pszHandlerGC, RTGCPTR pvUserGC, const char *pszDesc)
    9090{
  • trunk/src/VBox/VMM/PGMInternal.h

    r2089 r2270  
    304304{
    305305    /** Pointer to next entry. */
    306     HCPTRTYPE(struct PGMMAPPING *)  pNextHC;
     306    R3PTRTYPE(struct PGMMAPPING *)  pNextR3;
    307307    /** Pointer to next entry. */
    308308    GCPTRTYPE(struct PGMMAPPING *)  pNextGC;
     309    /** Pointer to next entry. */
     310    R0PTRTYPE(struct PGMMAPPING *)  pNextR0;
    309311    /** Start Virtual address. */
    310312    RTGCUINTPTR                     GCPtr;
     
    314316    RTGCUINTPTR                     cb;
    315317    /** Pointer to relocation callback function. */
    316     HCPTRTYPE(PFNPGMRELOCATE)       pfnRelocate;
     318    R3PTRTYPE(PFNPGMRELOCATE)       pfnRelocate;
    317319    /** User argument to the callback. */
    318     HCPTRTYPE(void *)               pvUser;
     320    R3PTRTYPE(void *)               pvUser;
    319321    /** Mapping description / name. For easing debugging. */
    320     HCPTRTYPE(const char *)         pszDesc;
     322    R3PTRTYPE(const char *)         pszDesc;
    321323    /** Number of page tables. */
    322324    RTUINT                          cPTs;
     
    337339        RTHCPHYS                HCPhysPaePT1;
    338340        /** The HC virtual address of the 32-bit page table. */
    339         HCPTRTYPE(PVBOXPT)      pPTHC;
     341        R3PTRTYPE(PVBOXPT)      pPTR3;
    340342        /** The HC virtual address of the two PAE page table. (i.e 1024 entries instead of 512) */
    341         HCPTRTYPE(PX86PTPAE)    paPaePTsHC;
     343        R3PTRTYPE(PX86PTPAE)    paPaePTsR3;
    342344        /** The GC virtual address of the 32-bit page table. */
    343345        GCPTRTYPE(PVBOXPT)      pPTGC;
    344346        /** The GC virtual address of the two PAE page table. */
    345347        GCPTRTYPE(PX86PTPAE)    paPaePTsGC;
     348        /** The GC virtual address of the 32-bit page table. */
     349        R0PTRTYPE(PVBOXPT)      pPTR0;
     350        /** The GC virtual address of the two PAE page table. */
     351        R0PTRTYPE(PX86PTPAE)    paPaePTsR0;
    346352    } aPTs[1];
    347353} PGMMAPPING;
     
    366372    uint32_t                            cPages;
    367373    /** Pointer to R3 callback function. */
    368     HCPTRTYPE(PFNPGMR3PHYSHANDLER)      pfnHandlerR3;
     374    R3PTRTYPE(PFNPGMR3PHYSHANDLER)      pfnHandlerR3;
    369375    /** User argument for R3 handlers. */
    370     HCPTRTYPE(void *)                   pvUserR3;
     376    R3PTRTYPE(void *)                   pvUserR3;
    371377    /** Pointer to R0 callback function. */
    372378    R0PTRTYPE(PFNPGMR0PHYSHANDLER)      pfnHandlerR0;
    373379    /** User argument for R0 handlers. */
    374     HCPTRTYPE(void *)                   pvUserR0;
     380    R0PTRTYPE(void *)                   pvUserR0;
    375381    /** Pointer to GC callback function. */
    376382    GCPTRTYPE(PFNPGMGCPHYSHANDLER)      pfnHandlerGC;
     
    378384    GCPTRTYPE(void *)                   pvUserGC;
    379385    /** Description / Name. For easing debugging. */
    380     HCPTRTYPE(const char *)             pszDesc;
     386    R3PTRTYPE(const char *)             pszDesc;
    381387#ifdef VBOX_WITH_STATISTICS
    382388    /** Profiling of this handler. */
     
    517523{
    518524    /** HC pointer to physical page */
    519     HCPTRTYPE(uint8_t *)            pbHC;
     525    R3PTRTYPE(uint8_t *)            pbHC;
    520526    /** GC Physical address for cache entry */
    521527    RTGCPHYS                        GCPhys;
     
    787793    R0PTRTYPE(PFNPGMR0PHYSHANDLER)  pfnAccessHandlerR0;
    788794    /** Access handler, R3. */
    789     HCPTRTYPE(PFNPGMR3PHYSHANDLER)  pfnAccessHandlerR3;
     795    R3PTRTYPE(PFNPGMR3PHYSHANDLER)  pfnAccessHandlerR3;
    790796    /** The access handler description (HC ptr). */
    791     HCPTRTYPE(const char *)         pszAccessHandler;
     797    R3PTRTYPE(const char *)         pszAccessHandler;
    792798#endif /* PGMPOOL_WITH_MONITORING */
    793799    /** The number of pages currently in use. */
     
    13681374     * The list is sorted ascending on address.
    13691375     */
    1370     HCPTRTYPE(PPGMMAPPING)          pMappingsHC;
     1376    R3PTRTYPE(PPGMMAPPING)          pMappingsR3;
     1377    /** Linked list of GC mappings - for R0.
     1378     * The list is sorted ascending on address.
     1379     */
     1380    R0PTRTYPE(PPGMMAPPING)          pMappingsR0;
    13711381
    13721382    /** If set no conflict checks are required.  (boolean) */
  • trunk/src/VBox/VMM/PGMMap.cpp

    r1578 r2270  
    9494     */
    9595    PPGMMAPPING pPrev = NULL;
    96     PPGMMAPPING pCur = pVM->pgm.s.pMappingsHC;
     96    PPGMMAPPING pCur = pVM->pgm.s.pMappingsR3;
    9797    while (pCur)
    9898    {
     
    108108            break;
    109109        pPrev = pCur;
    110         pCur = pCur->pNextHC;
     110        pCur = pCur->pNextR3;
    111111    }
    112112
     
    164164         * 32-bit.
    165165         */
    166         pNew->aPTs[i].pPTHC    = (PVBOXPT)pbPTs;
    167         pNew->aPTs[i].pPTGC    = MMHyperHC2GC(pVM, pNew->aPTs[i].pPTHC);
    168         pNew->aPTs[i].HCPhysPT = MMR3HyperHCVirt2HCPhys(pVM, pNew->aPTs[i].pPTHC);
     166        pNew->aPTs[i].pPTR3    = (PVBOXPT)pbPTs;
     167        pNew->aPTs[i].pPTGC    = MMHyperR3ToGC(pVM, pNew->aPTs[i].pPTR3);
     168        pNew->aPTs[i].pPTR0    = MMHyperR3ToR0(pVM, pNew->aPTs[i].pPTR3);
     169        pNew->aPTs[i].HCPhysPT = MMR3HyperHCVirt2HCPhys(pVM, pNew->aPTs[i].pPTR3);
    169170        pbPTs += PAGE_SIZE;
    170171        Log4(("PGMR3MapPT: i=%d: pPTHC=%p pPTGC=%p HCPhysPT=%RHp\n",
    171               i, pNew->aPTs[i].pPTHC, pNew->aPTs[i].pPTGC, pNew->aPTs[i].HCPhysPT));
     172              i, pNew->aPTs[i].pPTR3, pNew->aPTs[i].pPTGC, pNew->aPTs[i].HCPhysPT));
    172173
    173174        /*
     
    176177        pNew->aPTs[i].HCPhysPaePT0 = MMR3HyperHCVirt2HCPhys(pVM, pbPTs);
    177178        pNew->aPTs[i].HCPhysPaePT1 = MMR3HyperHCVirt2HCPhys(pVM, pbPTs + PAGE_SIZE);
    178         pNew->aPTs[i].paPaePTsHC = (PX86PTPAE)pbPTs;
    179         pNew->aPTs[i].paPaePTsGC = MMHyperHC2GC(pVM, pbPTs);
     179        pNew->aPTs[i].paPaePTsR3 = (PX86PTPAE)pbPTs;
     180        pNew->aPTs[i].paPaePTsGC = MMHyperR3ToGC(pVM, pbPTs);
     181        pNew->aPTs[i].paPaePTsR0 = MMHyperR3ToR0(pVM, pbPTs);
    180182        pbPTs += PAGE_SIZE * 2;
    181183        Log4(("PGMR3MapPT: i=%d: paPaePTsHC=%p paPaePTsGC=%p HCPhysPaePT0=%RHp HCPhysPaePT1=%RHp\n",
    182               i, pNew->aPTs[i].paPaePTsHC, pNew->aPTs[i].paPaePTsGC, pNew->aPTs[i].HCPhysPaePT0, pNew->aPTs[i].HCPhysPaePT1));
     184              i, pNew->aPTs[i].paPaePTsR3, pNew->aPTs[i].paPaePTsGC, pNew->aPTs[i].HCPhysPaePT0, pNew->aPTs[i].HCPhysPaePT1));
    183185    }
    184186    pgmR3MapSetPDEs(pVM, pNew, iPageDir);
     
    187189     * Insert the new mapping.
    188190     */
    189     pNew->pNextHC = pCur;
    190     pNew->pNextGC = pCur ? MMHyperHC2GC(pVM, pCur) : 0;
     191    pNew->pNextR3 = pCur;
     192    pNew->pNextGC = pCur ? MMHyperR3ToGC(pVM, pCur) : 0;
     193    pNew->pNextR0 = pCur ? MMHyperR3ToR0(pVM, pCur) : 0;
    191194    if (pPrev)
    192195    {
    193         pPrev->pNextHC = pNew;
    194         pPrev->pNextGC = MMHyperHC2GC(pVM, pNew);
     196        pPrev->pNextR3 = pNew;
     197        pPrev->pNextGC = MMHyperR3ToGC(pVM, pNew);
     198        pPrev->pNextR0 = MMHyperR3ToR0(pVM, pNew);
    195199    }
    196200    else
    197201    {
    198         pVM->pgm.s.pMappingsHC = pNew;
    199         pVM->pgm.s.pMappingsGC = MMHyperHC2GC(pVM, pNew);
     202        pVM->pgm.s.pMappingsR3 = pNew;
     203        pVM->pgm.s.pMappingsGC = MMHyperR3ToGC(pVM, pNew);
     204        pVM->pgm.s.pMappingsR0 = MMHyperR3ToR0(pVM, pNew);
    200205    }
    201206
     
    220225     */
    221226    PPGMMAPPING pPrev = NULL;
    222     PPGMMAPPING pCur = pVM->pgm.s.pMappingsHC;
     227    PPGMMAPPING pCur = pVM->pgm.s.pMappingsR3;
    223228    while (pCur)
    224229    {
     
    230235            if (pPrev)
    231236            {
    232                 pPrev->pNextHC = pCur->pNextHC;
     237                pPrev->pNextR3 = pCur->pNextR3;
    233238                pPrev->pNextGC = pCur->pNextGC;
     239                pPrev->pNextR0 = pCur->pNextR0;
    234240            }
    235241            else
    236242            {
    237                 pVM->pgm.s.pMappingsHC = pCur->pNextHC;
     243                pVM->pgm.s.pMappingsR3 = pCur->pNextR3;
    238244                pVM->pgm.s.pMappingsGC = pCur->pNextGC;
     245                pVM->pgm.s.pMappingsR0 = pCur->pNextR0;
    239246            }
    240247
     
    243250             * and free the page tables and node memory.
    244251             */
    245             MMHyperFree(pVM, pCur->aPTs[0].pPTHC);
     252            MMHyperFree(pVM, pCur->aPTs[0].pPTR3);
    246253            pgmR3MapClearPDEs(&pVM->pgm.s, pCur, pCur->GCPtr >> PGDIR_SHIFT);
    247254            MMHyperFree(pVM, pCur);
     
    257264        /* next */
    258265        pPrev = pCur;
    259         pCur = pCur->pNextHC;
     266        pCur = pCur->pNextR3;
    260267    }
    261268
     
    276283{
    277284    size_t cb = 0;
    278     for (PPGMMAPPING pCur = pVM->pgm.s.pMappingsHC; pCur; pCur = pCur->pNextHC)
     285    for (PPGMMAPPING pCur = pVM->pgm.s.pMappingsR3; pCur; pCur = pCur->pNextR3)
    279286        cb += pCur->cb;
    280287
     
    327334        {
    328335            /* Check that it's not one or our mappings. */
    329             PPGMMAPPING pCur = pVM->pgm.s.pMappingsHC;
     336            PPGMMAPPING pCur = pVM->pgm.s.pMappingsR3;
    330337            while (pCur)
    331338            {
    332339                if (iPDNew + i - (pCur->GCPtr >> PGDIR_SHIFT) < (pCur->cb >> PGDIR_SHIFT))
    333340                    break;
    334                 pCur = pCur->pNextHC;
     341                pCur = pCur->pNextR3;
    335342            }
    336343            if (!pCur)
     
    347354     */
    348355    RTGCPTR     GCPtrCur = GCPtrBase;
    349     PPGMMAPPING pCur = pVM->pgm.s.pMappingsHC;
     356    PPGMMAPPING pCur = pVM->pgm.s.pMappingsR3;
    350357    while (pCur)
    351358    {
     
    357364        /* next */
    358365        GCPtrCur += pCur->cb;
    359         pCur = pCur->pNextHC;
     366        pCur = pCur->pNextR3;
    360367    }
    361368    if (GCPtrCur > GCPtrBase + cb)
     
    370377     */
    371378    GCPtrCur = GCPtrBase;
    372     pCur = pVM->pgm.s.pMappingsHC;
     379    pCur = pVM->pgm.s.pMappingsR3;
    373380    while (pCur)
    374381    {
     
    397404         */
    398405        GCPtrCur += pCur->cb;
    399         pCur = pCur->pNextHC;
     406        pCur = pCur->pNextR3;
    400407    }
    401408
     
    798805    /* Find previous mapping for pMapping, put result into pPrevMap. */
    799806    PPGMMAPPING pPrevMap = NULL;
    800     PPGMMAPPING pCur = pVM->pgm.s.pMappingsHC;
     807    PPGMMAPPING pCur = pVM->pgm.s.pMappingsR3;
    801808    while (pCur && pCur != pMapping)
    802809    {
    803810        /* next */
    804811        pPrevMap = pCur;
    805         pCur = pCur->pNextHC;
     812        pCur = pCur->pNextR3;
    806813    }
    807814    Assert(pCur);
     
    810817    RTGCPTR     GCPtrNew = iPDNew << PGDIR_SHIFT;
    811818    PPGMMAPPING pPrev = NULL;
    812     pCur = pVM->pgm.s.pMappingsHC;
     819    pCur = pVM->pgm.s.pMappingsR3;
    813820    while (pCur && pCur->GCPtr < GCPtrNew)
    814821    {
    815822        /* next */
    816823        pPrev = pCur;
    817         pCur = pCur->pNextHC;
     824        pCur = pCur->pNextR3;
    818825    }
    819826
     
    825832        if (pPrevMap)
    826833        {
    827             pPrevMap->pNextHC = pMapping->pNextHC;
     834            pPrevMap->pNextR3 = pMapping->pNextR3;
    828835            pPrevMap->pNextGC = pMapping->pNextGC;
     836            pPrevMap->pNextR0 = pMapping->pNextR0;
    829837        }
    830838        else
    831839        {
    832             pVM->pgm.s.pMappingsHC = pMapping->pNextHC;
     840            pVM->pgm.s.pMappingsR3 = pMapping->pNextR3;
    833841            pVM->pgm.s.pMappingsGC = pMapping->pNextGC;
     842            pVM->pgm.s.pMappingsR0 = pMapping->pNextR0;
    834843        }
    835844
     
    837846         * Link
    838847         */
    839         pMapping->pNextHC = pCur;
     848        pMapping->pNextR3 = pCur;
    840849        if (pPrev)
    841850        {
    842851            pMapping->pNextGC = pPrev->pNextGC;
    843             pPrev->pNextHC = pMapping;
    844             pPrev->pNextGC = MMHyperHC2GC(pVM, pMapping);
     852            pMapping->pNextR0 = pPrev->pNextR0;
     853            pPrev->pNextR3 = pMapping;
     854            pPrev->pNextGC = MMHyperR3ToGC(pVM, pMapping);
     855            pPrev->pNextR0 = MMHyperR3ToR0(pVM, pMapping);
    845856        }
    846857        else
    847858        {
    848859            pMapping->pNextGC = pVM->pgm.s.pMappingsGC;
    849             pVM->pgm.s.pMappingsHC = pMapping;
    850             pVM->pgm.s.pMappingsGC = MMHyperHC2GC(pVM, pMapping);
     860            pMapping->pNextR0 = pVM->pgm.s.pMappingsR0;
     861            pVM->pgm.s.pMappingsR3 = pMapping;
     862            pVM->pgm.s.pMappingsGC = MMHyperR3ToGC(pVM, pMapping);
     863            pVM->pgm.s.pMappingsR0 = MMHyperR3ToR0(pVM, pMapping);
    851864        }
    852865    }
     
    957970     * Iterate mappings.
    958971     */
    959     for (PPGMMAPPING pCur = pVM->pgm.s.pMappingsHC; pCur; pCur = pCur->pNextHC)
     972    for (PPGMMAPPING pCur = pVM->pgm.s.pMappingsR3; pCur; pCur = pCur->pNextR3)
    960973    {
    961974        unsigned iPDE = pCur->GCPtr >> PGDIR_SHIFT;
     
    10261039     * Find the mapping.
    10271040     */
    1028     PPGMMAPPING pCur = CTXSUFF(pVM->pgm.s.pMappings);
     1041    PPGMMAPPING pCur = CTXALLSUFF(pVM->pgm.s.pMappings);
    10291042    while (pCur)
    10301043    {
     
    10411054            unsigned iPT  = off >> PGDIR_SHIFT;
    10421055            unsigned iPTE = (off >> PAGE_SHIFT) & PTE_MASK;
    1043             while (cb > 0 && iPTE < ELEMENTS(CTXSUFF(pCur->aPTs[iPT].pPT)->a))
     1056            while (cb > 0 && iPTE < ELEMENTS(CTXALLSUFF(pCur->aPTs[iPT].pPT)->a))
    10441057            {
    1045                 if (!CTXSUFF(pCur->aPTs[iPT].paPaePTs)[iPTE / 512].a[iPTE % 512].n.u1Present)
     1058                if (!CTXALLSUFF(pCur->aPTs[iPT].paPaePTs)[iPTE / 512].a[iPTE % 512].n.u1Present)
    10461059                    return VERR_PAGE_NOT_PRESENT;
    1047                 RTHCPHYS HCPhys = CTXSUFF(pCur->aPTs[iPT].paPaePTs)[iPTE / 512].a[iPTE % 512].u & X86_PTE_PAE_PG_MASK;
     1060                RTHCPHYS HCPhys = CTXALLSUFF(pCur->aPTs[iPT].paPaePTs)[iPTE / 512].a[iPTE % 512].u & X86_PTE_PAE_PG_MASK;
    10481061
    10491062                /*
     
    10611074
    10621075        /* next */
    1063         pCur = CTXSUFF(pCur->pNext);
     1076        pCur = CTXALLSUFF(pCur->pNext);
    10641077    }
    10651078
     
    11181131
    11191132    PPGMMAPPING pCur;
    1120     for (pCur = pVM->pgm.s.pMappingsHC; pCur; pCur = pCur->pNextHC)
     1133    for (pCur = pVM->pgm.s.pMappingsR3; pCur; pCur = pCur->pNextR3)
    11211134        RTLogPrintf("%VGv - %VGv  %s\n", pCur->GCPtr, pCur->GCPtrLast, pCur->pszDesc);
    11221135
  • trunk/src/VBox/VMM/VMMAll/IOMAll.cpp

    r2230 r2270  
    435435        pRange->pfnWriteCallback= pfnWriteCallback;
    436436        pRange->pfnFillCallback = pfnFillCallback;
    437         #ifdef IN_GC
     437#ifdef IN_GC
    438438        pRange->pDevIns         = pDevIns;
    439439        pRange->pszDesc         = MMHyperGC2HC(pVM, (void *)pszDesc);
    440         #else
     440#else
    441441        pRange->pDevIns         = MMHyperHC2GC(pVM, pDevIns);
    442442        pRange->pszDesc         = pszDesc;
    443         #endif
     443#endif
    444444
    445445        /*
     
    478478 * @param   pszDesc             Pointer to description string. This must not be freed.
    479479 */
    480 IOMDECL(int)  IOMIOPortRegisterR0(PVM pVM, PPDMDEVINS pDevIns, RTIOPORT PortStart, RTUINT cPorts, RTHCPTR pvUser,
    481                                   HCPTRTYPE(PFNIOMIOPORTOUT) pfnOutCallback, HCPTRTYPE(PFNIOMIOPORTIN) pfnInCallback,
    482                                   HCPTRTYPE(PFNIOMIOPORTOUTSTRING) pfnOutStrCallback, HCPTRTYPE(PFNIOMIOPORTINSTRING) pfnInStrCallback,
     480IOMDECL(int)  IOMIOPortRegisterR0(PVM pVM, PPDMDEVINS pDevIns, RTIOPORT PortStart, RTUINT cPorts, RTR0PTR pvUser,
     481                                  R0PTRTYPE(PFNIOMIOPORTOUT) pfnOutCallback, R0PTRTYPE(PFNIOMIOPORTIN) pfnInCallback,
     482                                  R0PTRTYPE(PFNIOMIOPORTOUTSTRING) pfnOutStrCallback, R0PTRTYPE(PFNIOMIOPORTINSTRING) pfnInStrCallback,
    483483                                  const char *pszDesc)
    484484{
     
    548548        pRange->pfnInStrCallback = pfnInStrCallback;
    549549#ifdef IN_GC
    550         pRange->pDevIns         = MMHyperGC2HC(pVM, pDevIns);
    551         pRange->pszDesc         = MMHyperGC2HC(pVM, (void *)pszDesc);
     550        pRange->pDevIns         = MMHyperGCToR0(pVM, pDevIns);
     551        pRange->pszDesc         = MMHyperGCToR3(pVM, (void *)pszDesc);
     552#elif defined(IN_RING3)
     553        pRange->pDevIns         = MMHyperR3ToR0(pVM, pDevIns);
     554        pRange->pszDesc         = pszDesc;
    552555#else
    553556        pRange->pDevIns         = pDevIns;
    554         pRange->pszDesc         = pszDesc;
     557        pRange->pszDesc         = MMHyperR0ToR3(pVM, (RTR0PTR)pszDesc);
    555558#endif
    556559
     
    590593 * @param   pszDesc             Pointer to description string. This must not be freed.
    591594 */
    592 IOMDECL(int)  IOMMMIORegisterR0(PVM pVM, PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTUINT cbRange, RTHCPTR pvUser,
    593                                 HCPTRTYPE(PFNIOMMMIOWRITE) pfnWriteCallback, HCPTRTYPE(PFNIOMMMIOREAD) pfnReadCallback,
    594                                 HCPTRTYPE(PFNIOMMMIOFILL) pfnFillCallback, const char *pszDesc)
     595IOMDECL(int)  IOMMMIORegisterR0(PVM pVM, PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTUINT cbRange, RTR0PTR pvUser,
     596                                R0PTRTYPE(PFNIOMMMIOWRITE) pfnWriteCallback, R0PTRTYPE(PFNIOMMMIOREAD) pfnReadCallback,
     597                                R0PTRTYPE(PFNIOMMMIOFILL) pfnFillCallback, const char *pszDesc)
    595598{
    596599    LogFlow(("IOMMMIORegisterR0: pDevIns=%p GCPhysStart=%#x cbRange=%#x pvUser=%VHv pfnWriteCallback=%#x pfnReadCallback=%#x pfnFillCallback=%#x pszDesc=%s\n",
     
    658661        pRange->pfnFillCallback = pfnFillCallback;
    659662#ifdef IN_GC
    660         pRange->pDevIns         = MMHyperGC2HC(pVM, pDevIns);
    661         pRange->pszDesc         = MMHyperGC2HC(pVM, (void *)pszDesc);
     663        pRange->pDevIns         = MMHyperGCToR0(pVM, pDevIns);
     664        pRange->pszDesc         = MMHyperGCToR3(pVM, (void *)pszDesc);
     665#elif defined(IN_RING3)
     666        pRange->pDevIns         = MMHyperR3ToR0(pVM, pDevIns);
     667        pRange->pszDesc         = pszDesc;
    662668#else
    663669        pRange->pDevIns         = pDevIns;
    664         pRange->pszDesc         = pszDesc;
     670        pRange->pszDesc         = MMHyperR0ToR3(pVM, (RTR0PTR)pszDesc);
    665671#endif
    666672
  • trunk/src/VBox/VMM/VMMAll/MMAll.cpp

    r1480 r2270  
    336336    if (pLookup)
    337337        return mmHyperLookupCalcR0(pLookup, off);
     338    AssertMsgFailed(("R3Ptr=%p is not inside the hypervisor memory area!\n", R3Ptr));
    338339    return NIL_RTR0PTR;
    339340}
     
    355356    if (pLookup)
    356357        return mmHyperLookupCalcGC(pVM, pLookup, off);
     358    AssertMsgFailed(("R3Ptr=%p is not inside the hypervisor memory area!\n", R3Ptr));
    357359    return NIL_RTGCPTR;
    358360}
     
    630632    return MMHyperHC2GC(pVM, (RTHCPTR)Ptr);
    631633}
     634
    632635#endif /* !IN_GC */
    633 
  • trunk/src/VBox/VMM/VMMAll/PGMAll.cpp

    r1930 r2270  
    343343PPGMMAPPING pgmGetMapping(PVM pVM, RTGCPTR GCPtr)
    344344{
    345     PPGMMAPPING pMapping = CTXSUFF(pVM->pgm.s.pMappings);
     345    PPGMMAPPING pMapping = CTXALLSUFF(pVM->pgm.s.pMappings);
    346346    while (pMapping)
    347347    {
     
    353353            return pMapping;
    354354        }
    355         pMapping = CTXSUFF(pMapping->pNext);
     355        pMapping = CTXALLSUFF(pMapping->pNext);
    356356    }
    357357    return NULL;
     
    16521652     * Check for mapping conflicts.
    16531653     */
    1654     for (PPGMMAPPING pMapping = CTXSUFF(pVM->pgm.s.pMappings);
     1654    for (PPGMMAPPING pMapping = CTXALLSUFF(pVM->pgm.s.pMappings);
    16551655         pMapping;
    1656          pMapping = CTXSUFF(pMapping->pNext))
     1656         pMapping = CTXALLSUFF(pMapping->pNext))
    16571657    {
    16581658        /** @todo This is slow and should be optimized, but since it's just assertions I don't care now. */
  • trunk/src/VBox/VMM/VMMAll/PGMAllBth.h

    r2203 r2270  
    169169    {
    170170        STAM_PROFILE_START(&pVM->pgm.s.StatMapping, a);
    171         PPGMMAPPING pMapping = CTXSUFF(pVM->pgm.s.pMappings);
    172         for ( ; pMapping; pMapping = CTXSUFF(pMapping->pNext))
     171        PPGMMAPPING pMapping = CTXALLSUFF(pVM->pgm.s.pMappings);
     172        for ( ; pMapping; pMapping = CTXALLSUFF(pMapping->pNext))
    173173        {
    174174            if ((RTGCUINTPTR)pvFault < (RTGCUINTPTR)pMapping->GCPtr)
     
    26132613    if (pgmMapAreMappingsEnabled(&pVM->pgm.s))
    26142614    {
    2615         pMapping      = pVM->pgm.s.CTXSUFF(pMappings);
     2615        pMapping      = pVM->pgm.s.CTXALLSUFF(pMappings);
    26162616        iPdNoMapping  = (pMapping) ? pMapping->GCPtr >> PGDIR_SHIFT : ~0U;
    26172617    }
     
    26442644                    iPD += cPTs - 1;
    26452645                    pPDEDst += cPTs + (PGM_SHW_TYPE != PGM_TYPE_32BIT) * cPTs;
    2646                     pMapping = pMapping->CTXSUFF(pNext);
     2646                    pMapping = pMapping->CTXALLSUFF(pNext);
    26472647                    iPdNoMapping = pMapping ? pMapping->GCPtr >> PGDIR_SHIFT : ~0U;
    26482648                    continue;
     
    26572657                 * Update iPdNoMapping and pMapping.
    26582658                 */
    2659                 pMapping = pVM->pgm.s.pMappingsHC;
     2659                pMapping = pVM->pgm.s.pMappingsR3;
    26602660                while (pMapping && pMapping->GCPtr < (iPD << PGDIR_SHIFT))
    2661                     pMapping = pMapping->pNextHC;
     2661                    pMapping = pMapping->pNextR3;
    26622662                iPdNoMapping = pMapping ? pMapping->GCPtr >> PGDIR_SHIFT : ~0U;
    26632663#else
     
    27772777            {
    27782778                /* It's fixed, just skip the mapping. */
    2779                 pMapping = pMapping->CTXSUFF(pNext);
     2779                pMapping = pMapping->CTXALLSUFF(pNext);
    27802780                iPdNoMapping = pMapping ? pMapping->GCPtr >> PGDIR_SHIFT : ~0U;
    27812781            }
     
    28012801                         * Update iPdNoMapping and pMapping.
    28022802                         */
    2803                         pMapping = pVM->pgm.s.CTXSUFF(pMappings);
     2803                        pMapping = pVM->pgm.s.CTXALLSUFF(pMappings);
    28042804                        while (pMapping && pMapping->GCPtr < (iPD << PGDIR_SHIFT))
    2805                             pMapping = pMapping->CTXSUFF(pNext);
     2805                            pMapping = pMapping->CTXALLSUFF(pNext);
    28062806                        iPdNoMapping = pMapping ? pMapping->GCPtr >> PGDIR_SHIFT : ~0U;
    28072807                        break;
     
    28142814                if (iPdNoMapping == ~0U && pMapping)
    28152815                {
    2816                     pMapping = pMapping->CTXSUFF(pNext);
     2816                    pMapping = pMapping->CTXALLSUFF(pNext);
    28172817                    if (pMapping)
    28182818                        iPdNoMapping = pMapping->GCPtr >> PGDIR_SHIFT;
  • trunk/src/VBox/VMM/VMMAll/PGMAllHandler.cpp

    r1793 r2270  
    8181 */
    8282PGMDECL(int) PGMHandlerPhysicalRegisterEx(PVM pVM, PGMPHYSHANDLERTYPE enmType, RTGCPHYS GCPhys, RTGCPHYS GCPhysLast,
    83                                           HCPTRTYPE(PFNPGMR3PHYSHANDLER) pfnHandlerR3, RTHCPTR pvUserR3,
    84                                           R0PTRTYPE(PFNPGMR0PHYSHANDLER) pfnHandlerR0, RTHCPTR pvUserR0,
     83                                          R3PTRTYPE(PFNPGMR3PHYSHANDLER) pfnHandlerR3, RTR3PTR pvUserR3,
     84                                          R0PTRTYPE(PFNPGMR0PHYSHANDLER) pfnHandlerR0, RTR0PTR pvUserR0,
    8585                                          GCPTRTYPE(PFNPGMGCPHYSHANDLER) pfnHandlerGC, RTGCPTR pvUserGC,
    86                                           HCPTRTYPE(const char *) pszDesc)
     86                                          R3PTRTYPE(const char *) pszDesc)
    8787{
    8888    Log(("PGMHandlerPhysicalRegisterEx: enmType=%d GCPhys=%VGp GCPhysLast=%VGp pfnHandlerR3=%VHv pvUserR3=%VHv pfnHandlerR0=%VHv pvUserR0=%VHv pfnHandlerGC=%VGv pvUserGC=%VGv pszDesc=%s\n",
     
    601601 */
    602602PGMDECL(int) PGMHandlerPhysicalChangeCallbacks(PVM pVM, RTGCPHYS GCPhys,
    603                                                HCPTRTYPE(PFNPGMR3PHYSHANDLER) pfnHandlerR3, RTHCPTR pvUserR3,
    604                                                R0PTRTYPE(PFNPGMR0PHYSHANDLER) pfnHandlerR0, RTHCPTR pvUserR0,
     603                                               R3PTRTYPE(PFNPGMR3PHYSHANDLER) pfnHandlerR3, RTR3PTR pvUserR3,
     604                                               R0PTRTYPE(PFNPGMR0PHYSHANDLER) pfnHandlerR0, RTR0PTR pvUserR0,
    605605                                               GCPTRTYPE(PFNPGMGCPHYSHANDLER) pfnHandlerGC, RTGCPTR pvUserGC,
    606                                                HCPTRTYPE(const char *) pszDesc)
     606                                               R3PTRTYPE(const char *) pszDesc)
    607607{
    608608    /*
  • trunk/src/VBox/VMM/VMMAll/PGMAllMap.cpp

    r23 r2270  
    6464     * Find the mapping.
    6565     */
    66     PPGMMAPPING pCur = CTXSUFF(pVM->pgm.s.pMappings);
     66    PPGMMAPPING pCur = CTXALLSUFF(pVM->pgm.s.pMappings);
    6767    while (pCur)
    6868    {
     
    9191
    9292                /* 32-bit */
    93                 CTXSUFF(pCur->aPTs[iPT].pPT)->a[iPageNo].u = (uint32_t)Pte.u;      /* ASSUMES HCPhys < 4GB and/or that we're never gonna do 32-bit on a PAE host! */
     93                CTXALLSUFF(pCur->aPTs[iPT].pPT)->a[iPageNo].u = (uint32_t)Pte.u;      /* ASSUMES HCPhys < 4GB and/or that we're never gonna do 32-bit on a PAE host! */
    9494
    9595                /* pae */
    96                 CTXSUFF(pCur->aPTs[iPT].paPaePTs)[iPageNo / 512].a[iPageNo % 512].u = Pte.u;
     96                CTXALLSUFF(pCur->aPTs[iPT].paPaePTs)[iPageNo / 512].a[iPageNo % 512].u = Pte.u;
    9797
    9898                /* next */
     
    108108
    109109        /* next */
    110         pCur = CTXSUFF(pCur->pNext);
     110        pCur = CTXALLSUFF(pCur->pNext);
    111111    }
    112112
     
    169169     * Find the mapping.
    170170     */
    171     PPGMMAPPING pCur = CTXSUFF(pVM->pgm.s.pMappings);
     171    PPGMMAPPING pCur = CTXALLSUFF(pVM->pgm.s.pMappings);
    172172    while (pCur)
    173173    {
     
    189189                unsigned iPT  = off >> PGDIR_SHIFT;
    190190                unsigned iPTE = (off >> PAGE_SHIFT) & PTE_MASK;
    191                 while (cb > 0 && iPTE < ELEMENTS(CTXSUFF(pCur->aPTs[iPT].pPT)->a))
     191                while (cb > 0 && iPTE < ELEMENTS(CTXALLSUFF(pCur->aPTs[iPT].pPT)->a))
    192192                {
    193193                    /* 32-Bit */
    194                     CTXSUFF(pCur->aPTs[iPT].pPT)->a[iPTE].u &= fMask | X86_PTE_PG_MASK;
    195                     CTXSUFF(pCur->aPTs[iPT].pPT)->a[iPTE].u |= fFlags & ~X86_PTE_PG_MASK;
     194                    CTXALLSUFF(pCur->aPTs[iPT].pPT)->a[iPTE].u &= fMask | X86_PTE_PG_MASK;
     195                    CTXALLSUFF(pCur->aPTs[iPT].pPT)->a[iPTE].u |= fFlags & ~X86_PTE_PG_MASK;
    196196
    197197                    /* PAE */
    198                     CTXSUFF(pCur->aPTs[iPT].paPaePTs)[iPTE / 512].a[iPTE % 512].u &= fMask | X86_PTE_PAE_PG_MASK;
    199                     CTXSUFF(pCur->aPTs[iPT].paPaePTs)[iPTE / 512].a[iPTE % 512].u |= fFlags & ~X86_PTE_PAE_PG_MASK;
     198                    CTXALLSUFF(pCur->aPTs[iPT].paPaePTs)[iPTE / 512].a[iPTE % 512].u &= fMask | X86_PTE_PAE_PG_MASK;
     199                    CTXALLSUFF(pCur->aPTs[iPT].paPaePTs)[iPTE / 512].a[iPTE % 512].u |= fFlags & ~X86_PTE_PAE_PG_MASK;
    200200
    201201                    /* invalidate tls */
     
    212212        }
    213213        /* next */
    214         pCur = CTXSUFF(pCur->pNext);
     214        pCur = CTXALLSUFF(pCur->pNext);
    215215    }
    216216
  • trunk/src/VBox/VMM/VMMAll/PGMAllPool.cpp

    r2236 r2270  
    12051205        rc = PGMHandlerPhysicalRegisterEx(pVM, PGMPHYSHANDLERTYPE_PHYSICAL_WRITE,
    12061206                                          GCPhysPage, GCPhysPage + (PAGE_SIZE - 1),
    1207                                           pPool->pfnAccessHandlerR3, MMHyper2HC(pVM, (uintptr_t)pPage),
    1208                                           pPool->pfnAccessHandlerR0, MMHyper2HC(pVM, (uintptr_t)pPage),
    1209                                           pPool->pfnAccessHandlerGC, MMHyper2GC(pVM, (uintptr_t)pPage),
     1207                                          pPool->pfnAccessHandlerR3, MMHyperCCToR3(pVM, pPage),
     1208                                          pPool->pfnAccessHandlerR0, MMHyperCCToR0(pVM, pPage),
     1209                                          pPool->pfnAccessHandlerGC, MMHyperCCToGC(pVM, pPage),
    12101210                                          pPool->pszAccessHandler);
    12111211        /** @todo we should probably deal with out-of-memory conditions here, but for now increasing
     
    12771277            pNewHead->fCR3Mix = pPage->fCR3Mix;
    12781278            rc = PGMHandlerPhysicalChangeCallbacks(pVM, pPage->GCPhys & ~(RTGCPHYS)(PAGE_SIZE - 1),
    1279                                                    pPool->pfnAccessHandlerR3, MMHyper2HC(pVM, (uintptr_t)pNewHead),
    1280                                                    pPool->pfnAccessHandlerR0, MMHyper2HC(pVM, (uintptr_t)pNewHead),
    1281                                                    pPool->pfnAccessHandlerGC, MMHyper2GC(pVM, (uintptr_t)pNewHead),
     1279                                                   pPool->pfnAccessHandlerR3, MMHyperCCToR3(pVM, pNewHead),
     1280                                                   pPool->pfnAccessHandlerR0, MMHyperCCToR0(pVM, pNewHead),
     1281                                                   pPool->pfnAccessHandlerGC, MMHyperCCToGC(pVM, pNewHead),
    12821282                                                   pPool->pszAccessHandler);
    12831283            AssertFatalRCSuccess(rc);
     
    31493149            PVM pVM = pPool->CTXSUFF(pVM);
    31503150            int rc = PGMHandlerPhysicalChangeCallbacks(pVM, pPage->GCPhys & ~(RTGCPHYS)(PAGE_SIZE - 1),
    3151                                                        pPool->pfnAccessHandlerR3, MMHyper2HC(pVM, (uintptr_t)pPage),
    3152                                                        pPool->pfnAccessHandlerR0, MMHyper2HC(pVM, (uintptr_t)pPage),
    3153                                                        pPool->pfnAccessHandlerGC, MMHyper2GC(pVM, (uintptr_t)pPage),
     3151                                                       pPool->pfnAccessHandlerR3, MMHyperCCToR3(pVM, pPage),
     3152                                                       pPool->pfnAccessHandlerR0, MMHyperCCToR0(pVM, pPage),
     3153                                                       pPool->pfnAccessHandlerGC, MMHyperCCToGC(pVM, pPage),
    31543154                                                       pPool->pszAccessHandler);
    31553155            AssertFatalRCSuccess(rc);
  • trunk/src/VBox/VMM/VMMAll/PGMAllShw.h

    r1930 r2270  
    189189        AssertMsgReturn(pMap, ("GCPtr=%VGv\n", GCPtr), VERR_INTERNAL_ERROR);
    190190#if PGM_SHW_TYPE == PGM_TYPE_32BIT
    191         pPT = pMap->aPTs[(GCPtr - pMap->GCPtr) >> PGDIR_SHIFT].CTXSUFF(pPT);
     191        pPT = pMap->aPTs[(GCPtr - pMap->GCPtr) >> PGDIR_SHIFT].CTXALLSUFF(pPT);
    192192#else /* PAE and AMD64: */
    193         pPT = pMap->aPTs[(GCPtr - pMap->GCPtr) >> PGDIR_SHIFT].CTXSUFF(paPaePTs);
     193        pPT = pMap->aPTs[(GCPtr - pMap->GCPtr) >> PGDIR_SHIFT].CTXALLSUFF(paPaePTs);
    194194#endif
    195195    }
  • trunk/src/VBox/VMM/VMMR0/PDMR0Device.cpp

    r23 r2270  
    4848# define PDMDEV_ASSERT_DEVINS(pDevIns)   do { Assert(VALID_PTR(pDevIns)); \
    4949                                              Assert(pDevIns->u32Version == PDM_DEVINS_VERSION); \
    50                                               Assert(pDevIns->pvInstanceDataHC == (void *)&pDevIns->achInstanceData[0]); \
     50                                              Assert(pDevIns->pvInstanceDataR0 == (void *)&pDevIns->achInstanceData[0]); \
    5151                                         } while (0)
    5252#else
  • trunk/src/VBox/VMM/testcase/tstVMStructGC.cpp

    r2248 r2270  
    378378    GEN_CHECK_OFF(PGM, pTreesHC);
    379379    GEN_CHECK_OFF(PGM, pTreesGC);
    380     GEN_CHECK_OFF(PGM, pMappingsHC);
     380    GEN_CHECK_OFF(PGM, pMappingsR3);
    381381    GEN_CHECK_OFF(PGM, pMappingsGC);
     382    GEN_CHECK_OFF(PGM, pMappingsR0);
    382383    GEN_CHECK_OFF(PGM, fMappingsFixed);
    383384    GEN_CHECK_OFF(PGM, GCPtrMappingFixed);
     
    406407    GEN_CHECK_OFF(PGM, pgmphyswritecache);
    407408    GEN_CHECK_SIZE(PGMMAPPING);
    408     GEN_CHECK_OFF(PGMMAPPING, pNextHC);
     409    GEN_CHECK_OFF(PGMMAPPING, pNextR3);
    409410    GEN_CHECK_OFF(PGMMAPPING, pNextGC);
     411    GEN_CHECK_OFF(PGMMAPPING, pNextR0);
    410412    GEN_CHECK_OFF(PGMMAPPING, GCPtr);
    411413    GEN_CHECK_OFF(PGMMAPPING, GCPtrLast);
     
    416418    GEN_CHECK_OFF(PGMMAPPING, cPTs);
    417419    GEN_CHECK_OFF(PGMMAPPING, aPTs[1].HCPhysPT);
    418     GEN_CHECK_OFF(PGMMAPPING, aPTs[1].pPTHC);
     420    GEN_CHECK_OFF(PGMMAPPING, aPTs[1].pPTR3);
     421    GEN_CHECK_OFF(PGMMAPPING, aPTs[1].pPTR0);
    419422    GEN_CHECK_OFF(PGMMAPPING, aPTs[1].pPTGC);
    420423    GEN_CHECK_OFF(PGMMAPPING, aPTs[1].HCPhysPaePT0);
    421424    GEN_CHECK_OFF(PGMMAPPING, aPTs[1].HCPhysPaePT1);
    422     GEN_CHECK_OFF(PGMMAPPING, aPTs[1].paPaePTsHC);
     425    GEN_CHECK_OFF(PGMMAPPING, aPTs[1].paPaePTsR3);
    423426    GEN_CHECK_OFF(PGMMAPPING, aPTs[1].paPaePTsGC);
     427    GEN_CHECK_OFF(PGMMAPPING, aPTs[1].paPaePTsR0);
    424428    GEN_CHECK_SIZE(PGMPHYSHANDLER);
    425429    GEN_CHECK_OFF(PGMPHYSHANDLER, Core);
Note: See TracChangeset for help on using the changeset viewer.

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