VirtualBox

Changeset 12970 in vbox for trunk/src/VBox/VMM/PDMDevice.cpp


Ignore:
Timestamp:
Oct 3, 2008 7:04:11 AM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
37403
Message:

#1865: PDMINS.

File:
1 edited

Legend:

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

    r12807 r12970  
    8080/* VSlick regex:
    8181search : \om/\*\*.+?\*\/\nDECLCALLBACKMEMBER\(([^,]*), *pfn([^)]*)\)\(
    82 replace: \/\*\* @copydoc PDMDEVHLP::pfn\2 \*\/\nstatic DECLCALLBACK\(\1\) pdmR3DevHlp_\2\(
     82replace: \/\*\* @copydoc PDMDEVHLPR3::pfn\2 \*\/\nstatic DECLCALLBACK\(\1\) pdmR3DevHlp_\2\(
    8383 */
    8484
     
    298298 * The device helper structure for trusted devices.
    299299 */
    300 const PDMDEVHLP g_pdmR3DevHlpTrusted =
     300const PDMDEVHLPR3 g_pdmR3DevHlpTrusted =
    301301{
    302302    PDM_DEVHLP_VERSION,
     
    394394 * The device helper structure for non-trusted devices.
    395395 */
    396 const PDMDEVHLP g_pdmR3DevHlpUnTrusted =
     396const PDMDEVHLPR3 g_pdmR3DevHlpUnTrusted =
    397397{
    398398    PDM_DEVHLP_VERSION,
     
    601601
    602602    /*
    603      * Get the GC & R0 devhlps and create the devhlp R3 task queue.
    604      */
    605     RCPTRTYPE(PCPDMDEVHLPGC) pDevHlpGC;
    606     int rc = PDMR3GetSymbolGC(pVM, NULL, "g_pdmGCDevHlp", &pDevHlpGC);
     603     * Get the RC & R0 devhlps and create the devhlp R3 task queue.
     604     */
     605    PCPDMDEVHLPRC pDevHlpRC;
     606    int rc = PDMR3GetSymbolGC(pVM, NULL, "g_pdmRCDevHlp", &pDevHlpRC);
    607607    AssertReleaseRCReturn(rc, rc);
    608608
    609     R0PTRTYPE(PCPDMDEVHLPR0) pDevHlpR0;
     609    PCPDMDEVHLPR0 pDevHlpR0;
    610610    rc = PDMR3GetSymbolR0(pVM, NULL, "g_pdmR0DevHlp", &pDevHlpR0);
    611611    AssertReleaseRCReturn(rc, rc);
     
    883883         */
    884884        pDevIns->u32Version                     = PDM_DEVINS_VERSION;
    885         //pDevIns->Internal.s.pNextHC             = NULL;
    886         //pDevIns->Internal.s.pPerDeviceNextHC    = NULL;
    887         pDevIns->Internal.s.pDevHC              = paDevs[i].pDev;
    888         pDevIns->Internal.s.pVMHC               = pVM;
    889         pDevIns->Internal.s.pVMGC               = pVM->pVMGC;
    890         //pDevIns->Internal.s.pLunsHC             = NULL;
     885        //pDevIns->Internal.s.pNextR3             = NULL;
     886        //pDevIns->Internal.s.pPerDeviceNextR3    = NULL;
     887        pDevIns->Internal.s.pDevR3              = paDevs[i].pDev;
     888        pDevIns->Internal.s.pVMR3               = pVM;
     889        pDevIns->Internal.s.pVMR0               = pVM->pVMR0;
     890        pDevIns->Internal.s.pVMRC               = pVM->pVMRC;
     891        //pDevIns->Internal.s.pLunsR3             = NULL;
    891892        pDevIns->Internal.s.pCfgHandle          = paDevs[i].pNode;
    892         //pDevIns->Internal.s.pPciDevice          = NULL;
    893         //pDevIns->Internal.s.pPciBus             = NULL; /** @todo pci bus selection. (in 2008 perhaps) */
    894         pDevIns->pDevHlp                        = fTrusted ? &g_pdmR3DevHlpTrusted : &g_pdmR3DevHlpUnTrusted;
    895         pDevIns->pDevHlpGC                      = pDevHlpGC;
     893        //pDevIns->Internal.s.pPciDeviceR3        = NULL;
     894        //pDevIns->Internal.s.pPciBusR3           = NULL; /** @todo pci bus selection. (in 2008 perhaps) */
     895        //pDevIns->Internal.s.pPciDeviceR0        = 0;
     896        //pDevIns->Internal.s.pPciBusR0           = 0;
     897        //pDevIns->Internal.s.pPciDeviceRC        = 0;
     898        //pDevIns->Internal.s.pPciBusRC           = 0;
     899        pDevIns->pDevHlpR3                      = fTrusted ? &g_pdmR3DevHlpTrusted : &g_pdmR3DevHlpUnTrusted;
     900        pDevIns->pDevHlpRC                      = pDevHlpRC;
    896901        pDevIns->pDevHlpR0                      = pDevHlpR0;
    897902        pDevIns->pDevReg                        = paDevs[i].pDev->pDevReg;
     
    899904        pDevIns->iInstance                      = paDevs[i].iInstance;
    900905        pDevIns->pvInstanceDataR3               = &pDevIns->achInstanceData[0];
    901         pDevIns->pvInstanceDataGC               = pDevIns->pDevReg->fFlags & PDM_DEVREG_FLAGS_GC
    902                                                    ? MMHyperHC2GC(pVM, pDevIns->pvInstanceDataR3) : 0;
    903         pDevIns->pvInstanceDataR0               =  pDevIns->pDevReg->fFlags & PDM_DEVREG_FLAGS_R0
    904                                                    ? MMHyperR3ToR0(pVM, pDevIns->pvInstanceDataR3) : 0;
     906        pDevIns->pvInstanceDataRC               = pDevIns->pDevReg->fFlags & PDM_DEVREG_FLAGS_GC
     907                                                ? MMHyperR3ToRC(pVM, pDevIns->pvInstanceDataR3) : NIL_RTRCPTR;
     908        pDevIns->pvInstanceDataR0               = pDevIns->pDevReg->fFlags & PDM_DEVREG_FLAGS_R0
     909                                                ? MMHyperR3ToR0(pVM, pDevIns->pvInstanceDataR3) : NIL_RTR0PTR;
    905910
    906911        /*
     
    913918        else
    914919        {
    915             while (pPrev1->Internal.s.pNextHC)
    916                 pPrev1 = pPrev1->Internal.s.pNextHC;
    917             pPrev1->Internal.s.pNextHC = pDevIns;
     920            while (pPrev1->Internal.s.pNextR3)
     921                pPrev1 = pPrev1->Internal.s.pNextR3;
     922            pPrev1->Internal.s.pNextR3 = pDevIns;
    918923        }
    919924
     
    924929        else
    925930        {
    926             while (pPrev2->Internal.s.pPerDeviceNextHC)
    927                 pPrev2 = pPrev2->Internal.s.pPerDeviceNextHC;
    928             pPrev2->Internal.s.pPerDeviceNextHC = pDevIns;
     931            while (pPrev2->Internal.s.pPerDeviceNextR3)
     932                pPrev2 = pPrev2->Internal.s.pPerDeviceNextR3;
     933            pPrev2->Internal.s.pPerDeviceNextR3 = pDevIns;
    929934        }
    930935
     
    967972    }
    968973
    969     for (PPDMDEVINS pDevIns = pVM->pdm.s.pDevInstances; pDevIns; pDevIns = pDevIns->Internal.s.pNextHC)
     974    for (PPDMDEVINS pDevIns = pVM->pdm.s.pDevInstances; pDevIns; pDevIns = pDevIns->Internal.s.pNextR3)
    970975    {
    971976        if (pDevIns->pDevReg->pfnInitComplete)
     
    12221227
    12231228
    1224 /** @copydoc PDMDEVHLP::pfnIOPortRegister */
     1229/** @copydoc PDMDEVHLPR3::pfnIOPortRegister */
    12251230static DECLCALLBACK(int) pdmR3DevHlp_IOPortRegister(PPDMDEVINS pDevIns, RTIOPORT Port, RTUINT cPorts, RTHCPTR pvUser, PFNIOMIOPORTOUT pfnOut, PFNIOMIOPORTIN pfnIn,
    12261231                                                    PFNIOMIOPORTOUTSTRING pfnOutStr, PFNIOMIOPORTINSTRING pfnInStr, const char *pszDesc)
     
    12291234    LogFlow(("pdmR3DevHlp_IOPortRegister: caller='%s'/%d: Port=%#x cPorts=%#x pvUser=%p pfnOut=%p pfnIn=%p pfnOutStr=%p pfnInStr=%p p32_tszDesc=%p:{%s}\n", pDevIns->pDevReg->szDeviceName, pDevIns->iInstance,
    12301235             Port, cPorts, pvUser, pfnOut, pfnIn, pfnOutStr, pfnInStr, pszDesc, pszDesc));
    1231     VM_ASSERT_EMT(pDevIns->Internal.s.pVMHC);
    1232 
    1233     int rc = IOMR3IOPortRegisterR3(pDevIns->Internal.s.pVMHC, pDevIns, Port, cPorts, pvUser, pfnOut, pfnIn, pfnOutStr, pfnInStr, pszDesc);
     1236    VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
     1237
     1238    int rc = IOMR3IOPortRegisterR3(pDevIns->Internal.s.pVMR3, pDevIns, Port, cPorts, pvUser, pfnOut, pfnIn, pfnOutStr, pfnInStr, pszDesc);
    12341239
    12351240    LogFlow(("pdmR3DevHlp_IOPortRegister: caller='%s'/%d: returns %Vrc\n", pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, rc));
     
    12381243
    12391244
    1240 /** @copydoc PDMDEVHLP::pfnIOPortRegisterGC */
     1245/** @copydoc PDMDEVHLPR3::pfnIOPortRegisterGC */
    12411246static DECLCALLBACK(int) pdmR3DevHlp_IOPortRegisterGC(PPDMDEVINS pDevIns, RTIOPORT Port, RTUINT cPorts, RTRCPTR pvUser,
    12421247                                                      const char *pszOut, const char *pszIn,
     
    12441249{
    12451250    PDMDEV_ASSERT_DEVINS(pDevIns);
    1246     VM_ASSERT_EMT(pDevIns->Internal.s.pVMHC);
     1251    VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
    12471252    LogFlow(("pdmR3DevHlp_IOPortRegister: caller='%s'/%d: Port=%#x cPorts=%#x pvUser=%p pszOut=%p:{%s} pszIn=%p:{%s} pszOutStr=%p:{%s} pszInStr=%p:{%s} pszDesc=%p:{%s}\n", pDevIns->pDevReg->szDeviceName, pDevIns->iInstance,
    12481253             Port, cPorts, pvUser, pszOut, pszOut, pszIn, pszIn, pszOutStr, pszOutStr, pszInStr, pszInStr, pszDesc, pszDesc));
     
    12581263        if (pszIn)
    12591264        {
    1260             rc = PDMR3GetSymbolGCLazy(pDevIns->Internal.s.pVMHC, pDevIns->pDevReg->szGCMod, pszIn, &GCPtrIn);
     1265            rc = PDMR3GetSymbolGCLazy(pDevIns->Internal.s.pVMR3, pDevIns->pDevReg->szGCMod, pszIn, &GCPtrIn);
    12611266            AssertMsgRC(rc, ("Failed to resolve %s.%s (pszIn)\n", pDevIns->pDevReg->szGCMod, pszIn));
    12621267        }
     
    12641269        if (pszOut && VBOX_SUCCESS(rc))
    12651270        {
    1266             rc = PDMR3GetSymbolGCLazy(pDevIns->Internal.s.pVMHC, pDevIns->pDevReg->szGCMod, pszOut, &GCPtrOut);
     1271            rc = PDMR3GetSymbolGCLazy(pDevIns->Internal.s.pVMR3, pDevIns->pDevReg->szGCMod, pszOut, &GCPtrOut);
    12671272            AssertMsgRC(rc, ("Failed to resolve %s.%s (pszOut)\n", pDevIns->pDevReg->szGCMod, pszOut));
    12681273        }
     
    12701275        if (pszInStr && VBOX_SUCCESS(rc))
    12711276        {
    1272             rc = PDMR3GetSymbolGCLazy(pDevIns->Internal.s.pVMHC, pDevIns->pDevReg->szGCMod, pszInStr, &GCPtrInStr);
     1277            rc = PDMR3GetSymbolGCLazy(pDevIns->Internal.s.pVMR3, pDevIns->pDevReg->szGCMod, pszInStr, &GCPtrInStr);
    12731278            AssertMsgRC(rc, ("Failed to resolve %s.%s (pszInStr)\n", pDevIns->pDevReg->szGCMod, pszInStr));
    12741279        }
     
    12761281        if (pszOutStr && VBOX_SUCCESS(rc))
    12771282        {
    1278             rc = PDMR3GetSymbolGCLazy(pDevIns->Internal.s.pVMHC, pDevIns->pDevReg->szGCMod, pszOutStr, &GCPtrOutStr);
     1283            rc = PDMR3GetSymbolGCLazy(pDevIns->Internal.s.pVMR3, pDevIns->pDevReg->szGCMod, pszOutStr, &GCPtrOutStr);
    12791284            AssertMsgRC(rc, ("Failed to resolve %s.%s (pszOutStr)\n", pDevIns->pDevReg->szGCMod, pszOutStr));
    12801285        }
    12811286
    12821287        if (VBOX_SUCCESS(rc))
    1283             rc = IOMR3IOPortRegisterRC(pDevIns->Internal.s.pVMHC, pDevIns, Port, cPorts, pvUser, GCPtrOut, GCPtrIn, GCPtrOutStr, GCPtrInStr, pszDesc);
     1288            rc = IOMR3IOPortRegisterRC(pDevIns->Internal.s.pVMR3, pDevIns, Port, cPorts, pvUser, GCPtrOut, GCPtrIn, GCPtrOutStr, GCPtrInStr, pszDesc);
    12841289    }
    12851290    else
     
    12941299
    12951300
    1296 /** @copydoc PDMDEVHLP::pfnIOPortRegisterR0 */
     1301/** @copydoc PDMDEVHLPR3::pfnIOPortRegisterR0 */
    12971302static DECLCALLBACK(int) pdmR3DevHlp_IOPortRegisterR0(PPDMDEVINS pDevIns, RTIOPORT Port, RTUINT cPorts, RTR0PTR pvUser,
    12981303                                                      const char *pszOut, const char *pszIn,
     
    13001305{
    13011306    PDMDEV_ASSERT_DEVINS(pDevIns);
    1302     VM_ASSERT_EMT(pDevIns->Internal.s.pVMHC);
     1307    VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
    13031308    LogFlow(("pdmR3DevHlp_IOPortRegisterR0: caller='%s'/%d: Port=%#x cPorts=%#x pvUser=%p pszOut=%p:{%s} pszIn=%p:{%s} pszOutStr=%p:{%s} pszInStr=%p:{%s} pszDesc=%p:{%s}\n", pDevIns->pDevReg->szDeviceName, pDevIns->iInstance,
    13041309             Port, cPorts, pvUser, pszOut, pszOut, pszIn, pszIn, pszOutStr, pszOutStr, pszInStr, pszInStr, pszDesc, pszDesc));
     
    13141319        if (pszIn)
    13151320        {
    1316             rc = PDMR3GetSymbolR0Lazy(pDevIns->Internal.s.pVMHC, pDevIns->pDevReg->szR0Mod, pszIn, &pfnR0PtrIn);
     1321            rc = PDMR3GetSymbolR0Lazy(pDevIns->Internal.s.pVMR3, pDevIns->pDevReg->szR0Mod, pszIn, &pfnR0PtrIn);
    13171322            AssertMsgRC(rc, ("Failed to resolve %s.%s (pszIn)\n", pDevIns->pDevReg->szR0Mod, pszIn));
    13181323        }
     
    13201325        if (pszOut && VBOX_SUCCESS(rc))
    13211326        {
    1322             rc = PDMR3GetSymbolR0Lazy(pDevIns->Internal.s.pVMHC, pDevIns->pDevReg->szR0Mod, pszOut, &pfnR0PtrOut);
     1327            rc = PDMR3GetSymbolR0Lazy(pDevIns->Internal.s.pVMR3, pDevIns->pDevReg->szR0Mod, pszOut, &pfnR0PtrOut);
    13231328            AssertMsgRC(rc, ("Failed to resolve %s.%s (pszOut)\n", pDevIns->pDevReg->szR0Mod, pszOut));
    13241329        }
     
    13261331        if (pszInStr && VBOX_SUCCESS(rc))
    13271332        {
    1328             rc = PDMR3GetSymbolR0Lazy(pDevIns->Internal.s.pVMHC, pDevIns->pDevReg->szR0Mod, pszInStr, &pfnR0PtrInStr);
     1333            rc = PDMR3GetSymbolR0Lazy(pDevIns->Internal.s.pVMR3, pDevIns->pDevReg->szR0Mod, pszInStr, &pfnR0PtrInStr);
    13291334            AssertMsgRC(rc, ("Failed to resolve %s.%s (pszInStr)\n", pDevIns->pDevReg->szR0Mod, pszInStr));
    13301335        }
     
    13321337        if (pszOutStr && VBOX_SUCCESS(rc))
    13331338        {
    1334             rc = PDMR3GetSymbolR0Lazy(pDevIns->Internal.s.pVMHC, pDevIns->pDevReg->szR0Mod, pszOutStr, &pfnR0PtrOutStr);
     1339            rc = PDMR3GetSymbolR0Lazy(pDevIns->Internal.s.pVMR3, pDevIns->pDevReg->szR0Mod, pszOutStr, &pfnR0PtrOutStr);
    13351340            AssertMsgRC(rc, ("Failed to resolve %s.%s (pszOutStr)\n", pDevIns->pDevReg->szR0Mod, pszOutStr));
    13361341        }
    13371342
    13381343        if (VBOX_SUCCESS(rc))
    1339             rc = IOMR3IOPortRegisterR0(pDevIns->Internal.s.pVMHC, pDevIns, Port, cPorts, pvUser, pfnR0PtrOut, pfnR0PtrIn, pfnR0PtrOutStr, pfnR0PtrInStr, pszDesc);
     1344            rc = IOMR3IOPortRegisterR0(pDevIns->Internal.s.pVMR3, pDevIns, Port, cPorts, pvUser, pfnR0PtrOut, pfnR0PtrIn, pfnR0PtrOutStr, pfnR0PtrInStr, pszDesc);
    13401345    }
    13411346    else
     
    13501355
    13511356
    1352 /** @copydoc PDMDEVHLP::pfnIOPortDeregister */
     1357/** @copydoc PDMDEVHLPR3::pfnIOPortDeregister */
    13531358static DECLCALLBACK(int) pdmR3DevHlp_IOPortDeregister(PPDMDEVINS pDevIns, RTIOPORT Port, RTUINT cPorts)
    13541359{
    13551360    PDMDEV_ASSERT_DEVINS(pDevIns);
    1356     VM_ASSERT_EMT(pDevIns->Internal.s.pVMHC);
     1361    VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
    13571362    LogFlow(("pdmR3DevHlp_IOPortDeregister: caller='%s'/%d: Port=%#x cPorts=%#x\n", pDevIns->pDevReg->szDeviceName, pDevIns->iInstance,
    13581363             Port, cPorts));
    13591364
    1360     int rc = IOMR3IOPortDeregister(pDevIns->Internal.s.pVMHC, pDevIns, Port, cPorts);
     1365    int rc = IOMR3IOPortDeregister(pDevIns->Internal.s.pVMR3, pDevIns, Port, cPorts);
    13611366
    13621367    LogFlow(("pdmR3DevHlp_IOPortDeregister: caller='%s'/%d: returns %Vrc\n", pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, rc));
     
    13651370
    13661371
    1367 /** @copydoc PDMDEVHLP::pfnMMIORegister */
     1372/** @copydoc PDMDEVHLPR3::pfnMMIORegister */
    13681373static DECLCALLBACK(int) pdmR3DevHlp_MMIORegister(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTUINT cbRange, RTHCPTR pvUser,
    13691374                                                  PFNIOMMMIOWRITE pfnWrite, PFNIOMMMIOREAD pfnRead, PFNIOMMMIOFILL pfnFill,
     
    13711376{
    13721377    PDMDEV_ASSERT_DEVINS(pDevIns);
    1373     VM_ASSERT_EMT(pDevIns->Internal.s.pVMHC);
     1378    VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
    13741379    LogFlow(("pdmR3DevHlp_MMIORegister: caller='%s'/%d: GCPhysStart=%VGp cbRange=%#x pvUser=%p pfnWrite=%p pfnRead=%p pfnFill=%p pszDesc=%p:{%s}\n",
    13751380             pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, GCPhysStart, cbRange, pvUser, pfnWrite, pfnRead, pfnFill, pszDesc, pszDesc));
    13761381
    1377     int rc = IOMR3MMIORegisterR3(pDevIns->Internal.s.pVMHC, pDevIns, GCPhysStart, cbRange, pvUser, pfnWrite, pfnRead, pfnFill, pszDesc);
     1382    int rc = IOMR3MMIORegisterR3(pDevIns->Internal.s.pVMR3, pDevIns, GCPhysStart, cbRange, pvUser, pfnWrite, pfnRead, pfnFill, pszDesc);
    13781383
    13791384    LogFlow(("pdmR3DevHlp_MMIORegister: caller='%s'/%d: returns %Vrc\n", pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, rc));
     
    13821387
    13831388
    1384 /** @copydoc PDMDEVHLP::pfnMMIORegisterGC */
     1389/** @copydoc PDMDEVHLPR3::pfnMMIORegisterGC */
    13851390static DECLCALLBACK(int) pdmR3DevHlp_MMIORegisterGC(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTUINT cbRange, RTGCPTR pvUser,
    13861391                                                    const char *pszWrite, const char *pszRead, const char *pszFill,
     
    13881393{
    13891394    PDMDEV_ASSERT_DEVINS(pDevIns);
    1390     VM_ASSERT_EMT(pDevIns->Internal.s.pVMHC);
     1395    VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
    13911396    LogFlow(("pdmR3DevHlp_MMIORegisterGC: caller='%s'/%d: GCPhysStart=%VGp cbRange=%#x pvUser=%p pszWrite=%p:{%s} pszRead=%p:{%s} pszFill=%p:{%s}\n",
    13921397             pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, GCPhysStart, cbRange, pvUser, pszWrite, pszWrite, pszRead, pszRead, pszFill, pszFill));
     
    14021407        RTGCPTR32 GCPtrWrite = 0;
    14031408        if (pszWrite)
    1404             rc = PDMR3GetSymbolGCLazy(pDevIns->Internal.s.pVMHC, pDevIns->pDevReg->szGCMod, pszWrite, &GCPtrWrite);
     1409            rc = PDMR3GetSymbolGCLazy(pDevIns->Internal.s.pVMR3, pDevIns->pDevReg->szGCMod, pszWrite, &GCPtrWrite);
    14051410        RTGCPTR32 GCPtrRead = 0;
    14061411        int rc2 = VINF_SUCCESS;
    14071412        if (pszRead)
    1408             rc2 = PDMR3GetSymbolGCLazy(pDevIns->Internal.s.pVMHC, pDevIns->pDevReg->szGCMod, pszRead, &GCPtrRead);
     1413            rc2 = PDMR3GetSymbolGCLazy(pDevIns->Internal.s.pVMR3, pDevIns->pDevReg->szGCMod, pszRead, &GCPtrRead);
    14091414        RTGCPTR32 GCPtrFill = 0;
    14101415        int rc3 = VINF_SUCCESS;
    14111416        if (pszFill)
    1412             rc3 = PDMR3GetSymbolGCLazy(pDevIns->Internal.s.pVMHC, pDevIns->pDevReg->szGCMod, pszFill, &GCPtrFill);
     1417            rc3 = PDMR3GetSymbolGCLazy(pDevIns->Internal.s.pVMR3, pDevIns->pDevReg->szGCMod, pszFill, &GCPtrFill);
    14131418        if (VBOX_SUCCESS(rc) && VBOX_SUCCESS(rc2) && VBOX_SUCCESS(rc3))
    1414             rc = IOMR3MMIORegisterRC(pDevIns->Internal.s.pVMHC, pDevIns, GCPhysStart, cbRange, pvUser, GCPtrWrite, GCPtrRead, GCPtrFill);
     1419            rc = IOMR3MMIORegisterRC(pDevIns->Internal.s.pVMR3, pDevIns, GCPhysStart, cbRange, pvUser, GCPtrWrite, GCPtrRead, GCPtrFill);
    14151420        else
    14161421        {
     
    14341439}
    14351440
    1436 /** @copydoc PDMDEVHLP::pfnMMIORegisterR0 */
     1441/** @copydoc PDMDEVHLPR3::pfnMMIORegisterR0 */
    14371442static DECLCALLBACK(int) pdmR3DevHlp_MMIORegisterR0(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTUINT cbRange, RTR0PTR pvUser,
    14381443                                                    const char *pszWrite, const char *pszRead, const char *pszFill,
     
    14401445{
    14411446    PDMDEV_ASSERT_DEVINS(pDevIns);
    1442     VM_ASSERT_EMT(pDevIns->Internal.s.pVMHC);
     1447    VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
    14431448    LogFlow(("pdmR3DevHlp_MMIORegisterHC: caller='%s'/%d: GCPhysStart=%VGp cbRange=%#x pvUser=%p pszWrite=%p:{%s} pszRead=%p:{%s} pszFill=%p:{%s}\n",
    14441449             pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, GCPhysStart, cbRange, pvUser, pszWrite, pszWrite, pszRead, pszRead, pszFill, pszFill));
     
    14541459        R0PTRTYPE(PFNIOMMMIOWRITE) pfnR0PtrWrite = 0;
    14551460        if (pszWrite)
    1456             rc = PDMR3GetSymbolR0Lazy(pDevIns->Internal.s.pVMHC, pDevIns->pDevReg->szR0Mod, pszWrite, &pfnR0PtrWrite);
     1461            rc = PDMR3GetSymbolR0Lazy(pDevIns->Internal.s.pVMR3, pDevIns->pDevReg->szR0Mod, pszWrite, &pfnR0PtrWrite);
    14571462        R0PTRTYPE(PFNIOMMMIOREAD) pfnR0PtrRead = 0;
    14581463        int rc2 = VINF_SUCCESS;
    14591464        if (pszRead)
    1460             rc2 = PDMR3GetSymbolR0Lazy(pDevIns->Internal.s.pVMHC, pDevIns->pDevReg->szR0Mod, pszRead, &pfnR0PtrRead);
     1465            rc2 = PDMR3GetSymbolR0Lazy(pDevIns->Internal.s.pVMR3, pDevIns->pDevReg->szR0Mod, pszRead, &pfnR0PtrRead);
    14611466        R0PTRTYPE(PFNIOMMMIOFILL) pfnR0PtrFill = 0;
    14621467        int rc3 = VINF_SUCCESS;
    14631468        if (pszFill)
    1464             rc3 = PDMR3GetSymbolR0Lazy(pDevIns->Internal.s.pVMHC, pDevIns->pDevReg->szR0Mod, pszFill, &pfnR0PtrFill);
     1469            rc3 = PDMR3GetSymbolR0Lazy(pDevIns->Internal.s.pVMR3, pDevIns->pDevReg->szR0Mod, pszFill, &pfnR0PtrFill);
    14651470        if (VBOX_SUCCESS(rc) && VBOX_SUCCESS(rc2) && VBOX_SUCCESS(rc3))
    1466             rc = IOMR3MMIORegisterR0(pDevIns->Internal.s.pVMHC, pDevIns, GCPhysStart, cbRange, pvUser, pfnR0PtrWrite, pfnR0PtrRead, pfnR0PtrFill);
     1471            rc = IOMR3MMIORegisterR0(pDevIns->Internal.s.pVMR3, pDevIns, GCPhysStart, cbRange, pvUser, pfnR0PtrWrite, pfnR0PtrRead, pfnR0PtrFill);
    14671472        else
    14681473        {
     
    14871492
    14881493
    1489 /** @copydoc PDMDEVHLP::pfnMMIODeregister */
     1494/** @copydoc PDMDEVHLPR3::pfnMMIODeregister */
    14901495static DECLCALLBACK(int) pdmR3DevHlp_MMIODeregister(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTUINT cbRange)
    14911496{
    14921497    PDMDEV_ASSERT_DEVINS(pDevIns);
    1493     VM_ASSERT_EMT(pDevIns->Internal.s.pVMHC);
     1498    VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
    14941499    LogFlow(("pdmR3DevHlp_MMIODeregister: caller='%s'/%d: GCPhysStart=%VGp cbRange=%#x\n",
    14951500             pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, GCPhysStart, cbRange));
    14961501
    1497     int rc = IOMR3MMIODeregister(pDevIns->Internal.s.pVMHC, pDevIns, GCPhysStart, cbRange);
     1502    int rc = IOMR3MMIODeregister(pDevIns->Internal.s.pVMR3, pDevIns, GCPhysStart, cbRange);
    14981503
    14991504    LogFlow(("pdmR3DevHlp_MMIODeregister: caller='%s'/%d: returns %Vrc\n", pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, rc));
     
    15021507
    15031508
    1504 /** @copydoc PDMDEVHLP::pfnROMRegister */
     1509/** @copydoc PDMDEVHLPR3::pfnROMRegister */
    15051510static DECLCALLBACK(int) pdmR3DevHlp_ROMRegister(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTUINT cbRange, const void *pvBinary, bool fShadow, const char *pszDesc)
    15061511{
    15071512    PDMDEV_ASSERT_DEVINS(pDevIns);
    1508     VM_ASSERT_EMT(pDevIns->Internal.s.pVMHC);
     1513    VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
    15091514    LogFlow(("pdmR3DevHlp_ROMRegister: caller='%s'/%d: GCPhysStart=%VGp cbRange=%#x pvBinary=%p fShadow=%RTbool pszDesc=%p:{%s}\n",
    15101515             pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, GCPhysStart, cbRange, pvBinary, fShadow, pszDesc, pszDesc));
    15111516
    1512     int rc = MMR3PhysRomRegister(pDevIns->Internal.s.pVMHC, pDevIns, GCPhysStart, cbRange, pvBinary, fShadow, pszDesc);
     1517    int rc = MMR3PhysRomRegister(pDevIns->Internal.s.pVMR3, pDevIns, GCPhysStart, cbRange, pvBinary, fShadow, pszDesc);
    15131518
    15141519    LogFlow(("pdmR3DevHlp_ROMRegister: caller='%s'/%d: returns %Vrc\n", pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, rc));
     
    15171522
    15181523
    1519 /** @copydoc PDMDEVHLP::pfnSSMRegister */
     1524/** @copydoc PDMDEVHLPR3::pfnSSMRegister */
    15201525static DECLCALLBACK(int) pdmR3DevHlp_SSMRegister(PPDMDEVINS pDevIns, const char *pszName, uint32_t u32Instance, uint32_t u32Version, size_t cbGuess,
    15211526                                                 PFNSSMDEVSAVEPREP pfnSavePrep, PFNSSMDEVSAVEEXEC pfnSaveExec, PFNSSMDEVSAVEDONE pfnSaveDone,
     
    15231528{
    15241529    PDMDEV_ASSERT_DEVINS(pDevIns);
    1525     VM_ASSERT_EMT(pDevIns->Internal.s.pVMHC);
     1530    VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
    15261531    LogFlow(("pdmR3DevHlp_SSMRegister: caller='%s'/%d: pszName=%p:{%s} u32Instance=%#x u32Version=#x cbGuess=%#x pfnSavePrep=%p pfnSaveExec=%p pfnSaveDone=%p pszLoadPrep=%p pfnLoadExec=%p pfnLoaddone=%p\n",
    15271532             pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, pszName, pszName, u32Instance, u32Version, cbGuess, pfnSavePrep, pfnSaveExec, pfnSaveDone, pfnLoadPrep, pfnLoadExec, pfnLoadDone));
    15281533
    1529     int rc = SSMR3Register(pDevIns->Internal.s.pVMHC, pDevIns, pszName, u32Instance, u32Version, cbGuess,
     1534    int rc = SSMR3Register(pDevIns->Internal.s.pVMR3, pDevIns, pszName, u32Instance, u32Version, cbGuess,
    15301535                           pfnSavePrep, pfnSaveExec, pfnSaveDone,
    15311536                           pfnLoadPrep, pfnLoadExec, pfnLoadDone);
     
    15361541
    15371542
    1538 /** @copydoc PDMDEVHLP::pfnTMTimerCreate */
     1543/** @copydoc PDMDEVHLPR3::pfnTMTimerCreate */
    15391544static DECLCALLBACK(int) pdmR3DevHlp_TMTimerCreate(PPDMDEVINS pDevIns, TMCLOCK enmClock, PFNTMTIMERDEV pfnCallback, const char *pszDesc, PPTMTIMERR3 ppTimer)
    15401545{
    15411546    PDMDEV_ASSERT_DEVINS(pDevIns);
    1542     VM_ASSERT_EMT(pDevIns->Internal.s.pVMHC);
     1547    VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
    15431548    LogFlow(("pdmR3DevHlp_TMTimerCreate: caller='%s'/%d: enmClock=%d pfnCallback=%p pszDesc=%p:{%s} ppTimer=%p\n",
    15441549             pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, enmClock, pfnCallback, pszDesc, pszDesc, ppTimer));
    15451550
    1546     int rc = TMR3TimerCreateDevice(pDevIns->Internal.s.pVMHC, pDevIns, enmClock, pfnCallback, pszDesc, ppTimer);
     1551    int rc = TMR3TimerCreateDevice(pDevIns->Internal.s.pVMR3, pDevIns, enmClock, pfnCallback, pszDesc, ppTimer);
    15471552
    15481553    LogFlow(("pdmR3DevHlp_TMTimerCreate: caller='%s'/%d: returns %Vrc\n", pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, rc));
     
    15511556
    15521557
    1553 /** @copydoc PDMDEVHLP::pfnTMTimerCreateExternal */
     1558/** @copydoc PDMDEVHLPR3::pfnTMTimerCreateExternal */
    15541559static DECLCALLBACK(PTMTIMERR3) pdmR3DevHlp_TMTimerCreateExternal(PPDMDEVINS pDevIns, TMCLOCK enmClock, PFNTMTIMEREXT pfnCallback, void *pvUser, const char *pszDesc)
    15551560{
    15561561    PDMDEV_ASSERT_DEVINS(pDevIns);
    1557     VM_ASSERT_EMT(pDevIns->Internal.s.pVMHC);
    1558 
    1559     return TMR3TimerCreateExternal(pDevIns->Internal.s.pVMHC, enmClock, pfnCallback, pvUser, pszDesc);
    1560 }
    1561 
    1562 /** @copydoc PDMDEVHLP::pfnPCIRegister */
     1562    VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
     1563
     1564    return TMR3TimerCreateExternal(pDevIns->Internal.s.pVMR3, enmClock, pfnCallback, pvUser, pszDesc);
     1565}
     1566
     1567/** @copydoc PDMDEVHLPR3::pfnPCIRegister */
    15631568static DECLCALLBACK(int) pdmR3DevHlp_PCIRegister(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev)
    15641569{
    15651570    PDMDEV_ASSERT_DEVINS(pDevIns);
    1566     PVM pVM = pDevIns->Internal.s.pVMHC;
     1571    PVM pVM = pDevIns->Internal.s.pVMR3;
    15671572    VM_ASSERT_EMT(pVM);
    15681573    LogFlow(("pdmR3DevHlp_PCIRegister: caller='%s'/%d: pPciDev=%p:{.config={%#.256Vhxs}\n",
     
    15841589        return VERR_INVALID_PARAMETER;
    15851590    }
    1586     if (pDevIns->Internal.s.pPciDeviceHC)
     1591    if (pDevIns->Internal.s.pPciDeviceR3)
    15871592    {
    15881593        /** @todo the PCI device vs. PDM device designed is a bit flawed if we have to
     
    15991604     * already have one. If not, we'll just take the first one.
    16001605     */
    1601     PPDMPCIBUS pBus = pDevIns->Internal.s.pPciBusHC;
     1606    PPDMPCIBUS pBus = pDevIns->Internal.s.pPciBusR3;
    16021607    if (!pBus)
    1603         pBus = pDevIns->Internal.s.pPciBusHC = &pVM->pdm.s.aPciBuses[0];
     1608        pBus = pDevIns->Internal.s.pPciBusR3 = &pVM->pdm.s.aPciBuses[0];
    16041609    int rc;
    16051610    if (pBus)
    16061611    {
    16071612        if (pDevIns->pDevReg->fFlags & PDM_DEVREG_FLAGS_GC)
    1608             pDevIns->Internal.s.pPciBusGC = MMHyperHC2GC(pVM, pDevIns->Internal.s.pPciBusHC);
     1613            pDevIns->Internal.s.pPciBusR0 = MMHyperR3ToR0(pVM, pDevIns->Internal.s.pPciBusR3);
     1614        else
     1615            pDevIns->Internal.s.pPciBusR0 = NIL_RTR0PTR;
     1616
     1617        if (pDevIns->pDevReg->fFlags & PDM_DEVREG_FLAGS_GC)
     1618            pDevIns->Internal.s.pPciBusRC = MMHyperR3ToRC(pVM, pDevIns->Internal.s.pPciBusR3);
     1619        else
     1620            pDevIns->Internal.s.pPciBusRC = NIL_RTRCPTR;
    16091621
    16101622        /*
     
    16541666        if (VBOX_SUCCESS(rc))
    16551667        {
    1656             pDevIns->Internal.s.pPciDeviceHC = pPciDev;
     1668            pPciDev->pDevIns = pDevIns;
     1669
     1670            pDevIns->Internal.s.pPciDeviceR3 = pPciDev;
     1671            if (pDevIns->pDevReg->fFlags & PDM_DEVREG_FLAGS_R0)
     1672                pDevIns->Internal.s.pPciDeviceR0 = MMHyperR3ToR0(pVM, pPciDev);
     1673            else
     1674                pDevIns->Internal.s.pPciDeviceR0 = NIL_RTR0PTR;
     1675
    16571676            if (pDevIns->pDevReg->fFlags & PDM_DEVREG_FLAGS_GC)
    1658                 pDevIns->Internal.s.pPciDeviceGC = MMHyperHC2GC(pVM, pPciDev);
     1677                pDevIns->Internal.s.pPciDeviceRC = MMHyperR3ToRC(pVM, pPciDev);
    16591678            else
    1660                 pDevIns->Internal.s.pPciDeviceGC = 0;
    1661             pPciDev->pDevIns = pDevIns;
     1679                pDevIns->Internal.s.pPciDeviceRC = NIL_RTRCPTR;
     1680
    16621681            Log(("PDM: Registered device '%s'/%d as PCI device %d on bus %d\n",
    1663                  pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, pPciDev->devfn, pDevIns->Internal.s.pPciBusHC->iBus));
     1682                 pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, pPciDev->devfn, pDevIns->Internal.s.pPciBusR3->iBus));
    16641683        }
    16651684    }
     
    16751694
    16761695
    1677 /** @copydoc PDMDEVHLP::pfnPCIIORegionRegister */
     1696/** @copydoc PDMDEVHLPR3::pfnPCIIORegionRegister */
    16781697static DECLCALLBACK(int) pdmR3DevHlp_PCIIORegionRegister(PPDMDEVINS pDevIns, int iRegion, uint32_t cbRegion, PCIADDRESSSPACE enmType, PFNPCIIOREGIONMAP pfnCallback)
    16791698{
    16801699    PDMDEV_ASSERT_DEVINS(pDevIns);
    1681     PVM pVM = pDevIns->Internal.s.pVMHC;
     1700    PVM pVM = pDevIns->Internal.s.pVMR3;
    16821701    VM_ASSERT_EMT(pVM);
    16831702    LogFlow(("pdmR3DevHlp_PCIIORegionRegister: caller='%s'/%d: iRegion=%d cbRegion=%#x enmType=%d pfnCallback=%p\n",
     
    17161735     */
    17171736    int rc;
    1718     PPCIDEVICE pPciDev = pDevIns->Internal.s.pPciDeviceHC;
     1737    PPCIDEVICE pPciDev = pDevIns->Internal.s.pPciDeviceR3;
    17191738    if (pPciDev)
    17201739    {
     
    17301749        }
    17311750
    1732         PPDMPCIBUS pBus = pDevIns->Internal.s.pPciBusHC;
     1751        PPDMPCIBUS pBus = pDevIns->Internal.s.pPciBusR3;
    17331752        Assert(pBus);
    17341753        pdmLock(pVM);
     
    17471766
    17481767
    1749 /** @copydoc PDMDEVHLP::pfnPCISetConfigCallbacks */
     1768/** @copydoc PDMDEVHLPR3::pfnPCISetConfigCallbacks */
    17501769static DECLCALLBACK(void) pdmR3DevHlp_PCISetConfigCallbacks(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, PFNPCICONFIGREAD pfnRead, PPFNPCICONFIGREAD ppfnReadOld,
    17511770                                                            PFNPCICONFIGWRITE pfnWrite, PPFNPCICONFIGWRITE ppfnWriteOld)
    17521771{
    17531772    PDMDEV_ASSERT_DEVINS(pDevIns);
    1754     PVM pVM = pDevIns->Internal.s.pVMHC;
     1773    PVM pVM = pDevIns->Internal.s.pVMR3;
    17551774    VM_ASSERT_EMT(pVM);
    17561775    LogFlow(("pdmR3DevHlp_PCISetConfigCallbacks: caller='%s'/%d: pPciDev=%p pfnRead=%p ppfnReadOld=%p pfnWrite=%p ppfnWriteOld=%p\n",
     
    17671786
    17681787    if (!pPciDev)
    1769         pPciDev = pDevIns->Internal.s.pPciDeviceHC;
     1788        pPciDev = pDevIns->Internal.s.pPciDeviceR3;
    17701789    AssertReleaseMsg(pPciDev, ("You must register your device first!\n"));
    1771     PPDMPCIBUS pBus = pDevIns->Internal.s.pPciBusHC;
     1790    PPDMPCIBUS pBus = pDevIns->Internal.s.pPciBusR3;
    17721791    AssertRelease(pBus);
    17731792    AssertRelease(VMR3GetState(pVM) != VMSTATE_RUNNING);
     
    17841803
    17851804
    1786 /** @copydoc PDMDEVHLP::pfnPCISetIrq */
     1805/** @copydoc PDMDEVHLPR3::pfnPCISetIrq */
    17871806static DECLCALLBACK(void) pdmR3DevHlp_PCISetIrq(PPDMDEVINS pDevIns, int iIrq, int iLevel)
    17881807{
     
    17981817     * Must have a PCI device registered!
    17991818     */
    1800     PPCIDEVICE pPciDev = pDevIns->Internal.s.pPciDeviceHC;
     1819    PPCIDEVICE pPciDev = pDevIns->Internal.s.pPciDeviceR3;
    18011820    if (pPciDev)
    18021821    {
    1803         PPDMPCIBUS pBus = pDevIns->Internal.s.pPciBusHC; /** @todo the bus should be associated with the PCI device not the PDM device. */
     1822        PPDMPCIBUS pBus = pDevIns->Internal.s.pPciBusR3; /** @todo the bus should be associated with the PCI device not the PDM device. */
    18041823        Assert(pBus);
    1805         PVM pVM = pDevIns->Internal.s.pVMHC;
     1824        PVM pVM = pDevIns->Internal.s.pVMR3;
    18061825        pdmLock(pVM);
    18071826        pBus->pfnSetIrqR3(pBus->pDevInsR3, pPciDev, iIrq, iLevel);
     
    18151834
    18161835
    1817 /** @copydoc PDMDEVHLP::pfnPCISetIrqNoWait */
     1836/** @copydoc PDMDEVHLPR3::pfnPCISetIrqNoWait */
    18181837static DECLCALLBACK(void) pdmR3DevHlp_PCISetIrqNoWait(PPDMDEVINS pDevIns, int iIrq, int iLevel)
    18191838{
     
    18221841
    18231842
    1824 /** @copydoc PDMDEVHLP::pfnISASetIrq */
     1843/** @copydoc PDMDEVHLPR3::pfnISASetIrq */
    18251844static DECLCALLBACK(void) pdmR3DevHlp_ISASetIrq(PPDMDEVINS pDevIns, int iIrq, int iLevel)
    18261845{
     
    18331852    /** @todo iIrq and iLevel checks. */
    18341853
    1835     PVM pVM = pDevIns->Internal.s.pVMHC;
     1854    PVM pVM = pDevIns->Internal.s.pVMR3;
    18361855    PDMIsaSetIrq(pVM, iIrq, iLevel);    /* (The API takes the lock.) */
    18371856
     
    18401859
    18411860
    1842 /** @copydoc PDMDEVHLP::pfnISASetIrqNoWait */
     1861/** @copydoc PDMDEVHLPR3::pfnISASetIrqNoWait */
    18431862static DECLCALLBACK(void) pdmR3DevHlp_ISASetIrqNoWait(PPDMDEVINS pDevIns, int iIrq, int iLevel)
    18441863{
     
    18471866
    18481867
    1849 /** @copydoc PDMDEVHLP::pfnDriverAttach */
     1868/** @copydoc PDMDEVHLPR3::pfnDriverAttach */
    18501869static DECLCALLBACK(int) pdmR3DevHlp_DriverAttach(PPDMDEVINS pDevIns, RTUINT iLun, PPDMIBASE pBaseInterface, PPDMIBASE *ppBaseInterface, const char *pszDesc)
    18511870{
    18521871    PDMDEV_ASSERT_DEVINS(pDevIns);
    1853     PVM pVM = pDevIns->Internal.s.pVMHC;
     1872    PVM pVM = pDevIns->Internal.s.pVMR3;
    18541873    VM_ASSERT_EMT(pVM);
    18551874    LogFlow(("pdmR3DevHlp_DriverAttach: caller='%s'/%d: iLun=%d pBaseInterface=%p ppBaseInterface=%p pszDesc=%p:{%s}\n",
     
    18601879     */
    18611880    PPDMLUN pLunPrev = NULL;
    1862     PPDMLUN pLun = pDevIns->Internal.s.pLunsHC;
     1881    PPDMLUN pLun = pDevIns->Internal.s.pLunsR3;
    18631882    for (; pLun; pLunPrev = pLun, pLun = pLun->pNext)
    18641883        if (pLun->iLun == iLun)
     
    18911910        pLun->pBase     = pBaseInterface;
    18921911        if (!pLunPrev)
    1893             pDevIns->Internal.s.pLunsHC = pLun;
     1912            pDevIns->Internal.s.pLunsR3 = pLun;
    18941913        else
    18951914            pLunPrev->pNext = pLun;
     
    20182037
    20192038
    2020 /** @copydoc PDMDEVHLP::pfnMMHeapAlloc */
     2039/** @copydoc PDMDEVHLPR3::pfnMMHeapAlloc */
    20212040static DECLCALLBACK(void *) pdmR3DevHlp_MMHeapAlloc(PPDMDEVINS pDevIns, size_t cb)
    20222041{
     
    20242043    LogFlow(("pdmR3DevHlp_MMHeapAlloc: caller='%s'/%d: cb=%#x\n", pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, cb));
    20252044
    2026     void *pv = MMR3HeapAlloc(pDevIns->Internal.s.pVMHC, MM_TAG_PDM_DEVICE_USER, cb);
     2045    void *pv = MMR3HeapAlloc(pDevIns->Internal.s.pVMR3, MM_TAG_PDM_DEVICE_USER, cb);
    20272046
    20282047    LogFlow(("pdmR3DevHlp_MMHeapAlloc: caller='%s'/%d: returns %p\n", pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, pv));
     
    20312050
    20322051
    2033 /** @copydoc PDMDEVHLP::pfnMMHeapAllocZ */
     2052/** @copydoc PDMDEVHLPR3::pfnMMHeapAllocZ */
    20342053static DECLCALLBACK(void *) pdmR3DevHlp_MMHeapAllocZ(PPDMDEVINS pDevIns, size_t cb)
    20352054{
     
    20372056    LogFlow(("pdmR3DevHlp_MMHeapAllocZ: caller='%s'/%d: cb=%#x\n", pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, cb));
    20382057
    2039     void *pv = MMR3HeapAllocZ(pDevIns->Internal.s.pVMHC, MM_TAG_PDM_DEVICE_USER, cb);
     2058    void *pv = MMR3HeapAllocZ(pDevIns->Internal.s.pVMR3, MM_TAG_PDM_DEVICE_USER, cb);
    20402059
    20412060    LogFlow(("pdmR3DevHlp_MMHeapAllocZ: caller='%s'/%d: returns %p\n", pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, pv));
     
    20442063
    20452064
    2046 /** @copydoc PDMDEVHLP::pfnMMHeapFree */
     2065/** @copydoc PDMDEVHLPR3::pfnMMHeapFree */
    20472066static DECLCALLBACK(void) pdmR3DevHlp_MMHeapFree(PPDMDEVINS pDevIns, void *pv)
    20482067{
     
    20562075
    20572076
    2058 /** @copydoc PDMDEVHLP::pfnVMSetError */
     2077/** @copydoc PDMDEVHLPR3::pfnVMSetError */
    20592078static DECLCALLBACK(int) pdmR3DevHlp_VMSetError(PPDMDEVINS pDevIns, int rc, RT_SRC_POS_DECL, const char *pszFormat, ...)
    20602079{
     
    20622081    va_list args;
    20632082    va_start(args, pszFormat);
    2064     int rc2 = VMSetErrorV(pDevIns->Internal.s.pVMHC, rc, RT_SRC_POS_ARGS, pszFormat, args); Assert(rc2 == rc); NOREF(rc2);
     2083    int rc2 = VMSetErrorV(pDevIns->Internal.s.pVMR3, rc, RT_SRC_POS_ARGS, pszFormat, args); Assert(rc2 == rc); NOREF(rc2);
    20652084    va_end(args);
    20662085    return rc;
     
    20682087
    20692088
    2070 /** @copydoc PDMDEVHLP::pfnVMSetErrorV */
     2089/** @copydoc PDMDEVHLPR3::pfnVMSetErrorV */
    20712090static DECLCALLBACK(int) pdmR3DevHlp_VMSetErrorV(PPDMDEVINS pDevIns, int rc, RT_SRC_POS_DECL, const char *pszFormat, va_list va)
    20722091{
    20732092    PDMDEV_ASSERT_DEVINS(pDevIns);
    2074     int rc2 = VMSetErrorV(pDevIns->Internal.s.pVMHC, rc, RT_SRC_POS_ARGS, pszFormat, va); Assert(rc2 == rc); NOREF(rc2);
    2075     return rc;
    2076 }
    2077 
    2078 
    2079 /** @copydoc PDMDEVHLP::pfnVMSetRuntimeError */
     2093    int rc2 = VMSetErrorV(pDevIns->Internal.s.pVMR3, rc, RT_SRC_POS_ARGS, pszFormat, va); Assert(rc2 == rc); NOREF(rc2);
     2094    return rc;
     2095}
     2096
     2097
     2098/** @copydoc PDMDEVHLPR3::pfnVMSetRuntimeError */
    20802099static DECLCALLBACK(int) pdmR3DevHlp_VMSetRuntimeError(PPDMDEVINS pDevIns, bool fFatal, const char *pszErrorID, const char *pszFormat, ...)
    20812100{
     
    20832102    va_list args;
    20842103    va_start(args, pszFormat);
    2085     int rc = VMSetRuntimeErrorV(pDevIns->Internal.s.pVMHC, fFatal, pszErrorID, pszFormat, args);
     2104    int rc = VMSetRuntimeErrorV(pDevIns->Internal.s.pVMR3, fFatal, pszErrorID, pszFormat, args);
    20862105    va_end(args);
    20872106    return rc;
     
    20892108
    20902109
    2091 /** @copydoc PDMDEVHLP::pfnVMSetRuntimeErrorV */
     2110/** @copydoc PDMDEVHLPR3::pfnVMSetRuntimeErrorV */
    20922111static DECLCALLBACK(int) pdmR3DevHlp_VMSetRuntimeErrorV(PPDMDEVINS pDevIns, bool fFatal, const char *pszErrorID, const char *pszFormat, va_list va)
    20932112{
    20942113    PDMDEV_ASSERT_DEVINS(pDevIns);
    2095     int rc = VMSetRuntimeErrorV(pDevIns->Internal.s.pVMHC, fFatal, pszErrorID, pszFormat, va);
    2096     return rc;
    2097 }
    2098 
    2099 
    2100 /** @copydoc PDMDEVHLP::pfnAssertEMT */
     2114    int rc = VMSetRuntimeErrorV(pDevIns->Internal.s.pVMR3, fFatal, pszErrorID, pszFormat, va);
     2115    return rc;
     2116}
     2117
     2118
     2119/** @copydoc PDMDEVHLPR3::pfnAssertEMT */
    21012120static DECLCALLBACK(bool) pdmR3DevHlp_AssertEMT(PPDMDEVINS pDevIns, const char *pszFile, unsigned iLine, const char *pszFunction)
    21022121{
    21032122    PDMDEV_ASSERT_DEVINS(pDevIns);
    2104     if (VM_IS_EMT(pDevIns->Internal.s.pVMHC))
     2123    if (VM_IS_EMT(pDevIns->Internal.s.pVMR3))
    21052124        return true;
    21062125
     
    21132132
    21142133
    2115 /** @copydoc PDMDEVHLP::pfnAssertOther */
     2134/** @copydoc PDMDEVHLPR3::pfnAssertOther */
    21162135static DECLCALLBACK(bool) pdmR3DevHlp_AssertOther(PPDMDEVINS pDevIns, const char *pszFile, unsigned iLine, const char *pszFunction)
    21172136{
    21182137    PDMDEV_ASSERT_DEVINS(pDevIns);
    2119     if (!VM_IS_EMT(pDevIns->Internal.s.pVMHC))
     2138    if (!VM_IS_EMT(pDevIns->Internal.s.pVMR3))
    21202139        return true;
    21212140
     
    21282147
    21292148
    2130 /** @copydoc PDMDEVHLP::pfnDBGFStopV */
     2149/** @copydoc PDMDEVHLPR3::pfnDBGFStopV */
    21312150static DECLCALLBACK(int) pdmR3DevHlp_DBGFStopV(PPDMDEVINS pDevIns, const char *pszFile, unsigned iLine, const char *pszFunction, const char *pszFormat, va_list args)
    21322151{
     
    21402159#endif
    21412160
    2142     PVM pVM = pDevIns->Internal.s.pVMHC;
     2161    PVM pVM = pDevIns->Internal.s.pVMR3;
    21432162    VM_ASSERT_EMT(pVM);
    21442163    int rc = DBGFR3EventSrcV(pVM, DBGFEVENT_DEV_STOP, pszFile, iLine, pszFunction, pszFormat, args);
     
    21492168
    21502169
    2151 /** @copydoc PDMDEVHLP::pfnDBGFInfoRegister */
     2170/** @copydoc PDMDEVHLPR3::pfnDBGFInfoRegister */
    21522171static DECLCALLBACK(int) pdmR3DevHlp_DBGFInfoRegister(PPDMDEVINS pDevIns, const char *pszName, const char *pszDesc, PFNDBGFHANDLERDEV pfnHandler)
    21532172{
     
    21562175             pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, pszName, pszName, pszDesc, pszDesc, pfnHandler));
    21572176
    2158     PVM pVM = pDevIns->Internal.s.pVMHC;
     2177    PVM pVM = pDevIns->Internal.s.pVMR3;
    21592178    VM_ASSERT_EMT(pVM);
    21602179    int rc = DBGFR3InfoRegisterDevice(pVM, pszName, pszDesc, pfnHandler, pDevIns);
     
    21652184
    21662185
    2167 /** @copydoc PDMDEVHLP::pfnSTAMRegister */
     2186/** @copydoc PDMDEVHLPR3::pfnSTAMRegister */
    21682187static DECLCALLBACK(void) pdmR3DevHlp_STAMRegister(PPDMDEVINS pDevIns, void *pvSample, STAMTYPE enmType, const char *pszName, STAMUNIT enmUnit, const char *pszDesc)
    21692188{
    21702189    PDMDEV_ASSERT_DEVINS(pDevIns);
    2171     PVM pVM = pDevIns->Internal.s.pVMHC;
     2190    PVM pVM = pDevIns->Internal.s.pVMR3;
    21722191    VM_ASSERT_EMT(pVM);
    21732192
     
    21782197
    21792198
    2180 /** @copydoc PDMDEVHLP::pfnSTAMRegisterF */
     2199/** @copydoc PDMDEVHLPR3::pfnSTAMRegisterF */
    21812200static DECLCALLBACK(void) pdmR3DevHlp_STAMRegisterF(PPDMDEVINS pDevIns, void *pvSample, STAMTYPE enmType, STAMVISIBILITY enmVisibility,
    21822201                                                    STAMUNIT enmUnit, const char *pszDesc, const char *pszName, ...)
    21832202{
    21842203    PDMDEV_ASSERT_DEVINS(pDevIns);
    2185     PVM pVM = pDevIns->Internal.s.pVMHC;
     2204    PVM pVM = pDevIns->Internal.s.pVMR3;
    21862205    VM_ASSERT_EMT(pVM);
    21872206
     
    21962215
    21972216
    2198 /** @copydoc PDMDEVHLP::pfnSTAMRegisterV */
     2217/** @copydoc PDMDEVHLPR3::pfnSTAMRegisterV */
    21992218static DECLCALLBACK(void) pdmR3DevHlp_STAMRegisterV(PPDMDEVINS pDevIns, void *pvSample, STAMTYPE enmType, STAMVISIBILITY enmVisibility,
    22002219                                                    STAMUNIT enmUnit, const char *pszDesc, const char *pszName, va_list args)
    22012220{
    22022221    PDMDEV_ASSERT_DEVINS(pDevIns);
    2203     PVM pVM = pDevIns->Internal.s.pVMHC;
     2222    PVM pVM = pDevIns->Internal.s.pVMR3;
    22042223    VM_ASSERT_EMT(pVM);
    22052224
     
    22112230
    22122231
    2213 /** @copydoc PDMDEVHLP::pfnRTCRegister */
     2232/** @copydoc PDMDEVHLPR3::pfnRTCRegister */
    22142233static DECLCALLBACK(int) pdmR3DevHlp_RTCRegister(PPDMDEVINS pDevIns, PCPDMRTCREG pRtcReg, PCPDMRTCHLP *ppRtcHlp)
    22152234{
    22162235    PDMDEV_ASSERT_DEVINS(pDevIns);
    2217     VM_ASSERT_EMT(pDevIns->Internal.s.pVMHC);
     2236    VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
    22182237    LogFlow(("pdmR3DevHlp_RTCRegister: caller='%s'/%d: pRtcReg=%p:{.u32Version=%#x, .pfnWrite=%p, .pfnRead=%p} ppRtcHlp=%p\n",
    22192238             pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, pRtcReg, pRtcReg->u32Version, pRtcReg->pfnWrite,
     
    22522271     * Only one DMA device.
    22532272     */
    2254     PVM pVM = pDevIns->Internal.s.pVMHC;
     2273    PVM pVM = pDevIns->Internal.s.pVMR3;
    22552274    if (pVM->pdm.s.pRtc)
    22562275    {
     
    22652284     */
    22662285    int rc = VINF_SUCCESS;
    2267     PPDMRTC pRtc = (PPDMRTC)MMR3HeapAlloc(pDevIns->Internal.s.pVMHC, MM_TAG_PDM_DEVICE, sizeof(*pRtc));
     2286    PPDMRTC pRtc = (PPDMRTC)MMR3HeapAlloc(pDevIns->Internal.s.pVMR3, MM_TAG_PDM_DEVICE, sizeof(*pRtc));
    22682287    if (pRtc)
    22692288    {
     
    22862305
    22872306
    2288 /** @copydoc PDMDEVHLP::pfnPDMQueueCreate */
     2307/** @copydoc PDMDEVHLPR3::pfnPDMQueueCreate */
    22892308static DECLCALLBACK(int) pdmR3DevHlp_PDMQueueCreate(PPDMDEVINS pDevIns, RTUINT cbItem, RTUINT cItems, uint32_t cMilliesInterval,
    22902309                                                    PFNPDMQUEUEDEV pfnCallback, bool fGCEnabled, PPDMQUEUE *ppQueue)
     
    22942313             pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, cbItem, cItems, cMilliesInterval, pfnCallback, fGCEnabled, ppQueue));
    22952314
    2296     PVM pVM = pDevIns->Internal.s.pVMHC;
     2315    PVM pVM = pDevIns->Internal.s.pVMR3;
    22972316    VM_ASSERT_EMT(pVM);
    22982317    int rc = PDMR3QueueCreateDevice(pVM, pDevIns, cbItem, cItems, cMilliesInterval, pfnCallback, fGCEnabled, ppQueue);
     
    23032322
    23042323
    2305 /** @copydoc PDMDEVHLP::pfnCritSectInit */
     2324/** @copydoc PDMDEVHLPR3::pfnCritSectInit */
    23062325static DECLCALLBACK(int) pdmR3DevHlp_CritSectInit(PPDMDEVINS pDevIns, PPDMCRITSECT pCritSect, const char *pszName)
    23072326{
     
    23102329             pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, pCritSect, pszName, pszName));
    23112330
    2312     PVM pVM = pDevIns->Internal.s.pVMHC;
     2331    PVM pVM = pDevIns->Internal.s.pVMR3;
    23132332    VM_ASSERT_EMT(pVM);
    23142333    int rc = pdmR3CritSectInitDevice(pVM, pDevIns, pCritSect, pszName);
     
    23192338
    23202339
    2321 /** @copydoc PDMDEVHLP::pfnUTCNow */
     2340/** @copydoc PDMDEVHLPR3::pfnUTCNow */
    23222341static DECLCALLBACK(PRTTIMESPEC) pdmR3DevHlp_UTCNow(PPDMDEVINS pDevIns, PRTTIMESPEC pTime)
    23232342{
     
    23262345             pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, pTime));
    23272346
    2328     pTime = TMR3UTCNow(pDevIns->Internal.s.pVMHC, pTime);
     2347    pTime = TMR3UTCNow(pDevIns->Internal.s.pVMR3, pTime);
    23292348
    23302349    LogFlow(("pdmR3DevHlp_UTCNow: caller='%s'/%d: returns %RU64\n", pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, RTTimeSpecGetNano(pTime)));
     
    23332352
    23342353
    2335 /** @copydoc PDMDEVHLP::pfnPDMThreadCreate */
     2354/** @copydoc PDMDEVHLPR3::pfnPDMThreadCreate */
    23362355static DECLCALLBACK(int) pdmR3DevHlp_PDMThreadCreate(PPDMDEVINS pDevIns, PPPDMTHREAD ppThread, void *pvUser, PFNPDMTHREADDEV pfnThread,
    23372356                                                     PFNPDMTHREADWAKEUPDEV pfnWakeup, size_t cbStack, RTTHREADTYPE enmType, const char *pszName)
    23382357{
    23392358    PDMDEV_ASSERT_DEVINS(pDevIns);
    2340     VM_ASSERT_EMT(pDevIns->Internal.s.pVMHC);
     2359    VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
    23412360    LogFlow(("pdmR3DevHlp_PDMThreadCreate: caller='%s'/%d: ppThread=%p pvUser=%p pfnThread=%p pfnWakeup=%p cbStack=%#zx enmType=%d pszName=%p:{%s}\n",
    23422361             pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, ppThread, pvUser, pfnThread, pfnWakeup, cbStack, enmType, pszName, pszName));
    23432362
    2344     int rc = pdmR3ThreadCreateDevice(pDevIns->Internal.s.pVMHC, pDevIns, ppThread, pvUser, pfnThread, pfnWakeup, cbStack, enmType, pszName);
     2363    int rc = pdmR3ThreadCreateDevice(pDevIns->Internal.s.pVMR3, pDevIns, ppThread, pvUser, pfnThread, pfnWakeup, cbStack, enmType, pszName);
    23452364
    23462365    LogFlow(("pdmR3DevHlp_PDMThreadCreate: caller='%s'/%d: returns %Vrc *ppThread=%RTthrd\n", pDevIns->pDevReg->szDeviceName, pDevIns->iInstance,
     
    23502369
    23512370
    2352 /** @copydoc PDMDEVHLP::pfnGetVM */
     2371/** @copydoc PDMDEVHLPR3::pfnGetVM */
    23532372static DECLCALLBACK(PVM) pdmR3DevHlp_GetVM(PPDMDEVINS pDevIns)
    23542373{
    23552374    PDMDEV_ASSERT_DEVINS(pDevIns);
    2356     LogFlow(("pdmR3DevHlp_GetVM: caller='%s'/%d: returns %p\n", pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, pDevIns->Internal.s.pVMHC));
    2357     return pDevIns->Internal.s.pVMHC;
    2358 }
    2359 
    2360 
    2361 /** @copydoc PDMDEVHLP::pfnPCIBusRegister */
     2375    LogFlow(("pdmR3DevHlp_GetVM: caller='%s'/%d: returns %p\n", pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, pDevIns->Internal.s.pVMR3));
     2376    return pDevIns->Internal.s.pVMR3;
     2377}
     2378
     2379
     2380/** @copydoc PDMDEVHLPR3::pfnPCIBusRegister */
    23622381static DECLCALLBACK(int) pdmR3DevHlp_PCIBusRegister(PPDMDEVINS pDevIns, PPDMPCIBUSREG pPciBusReg, PCPDMPCIHLPR3 *ppPciHlpR3)
    23632382{
    23642383    PDMDEV_ASSERT_DEVINS(pDevIns);
    2365     PVM pVM = pDevIns->Internal.s.pVMHC;
     2384    PVM pVM = pDevIns->Internal.s.pVMR3;
    23662385    VM_ASSERT_EMT(pVM);
    23672386    LogFlow(("pdmR3DevHlp_PCIBusRegister: caller='%s'/%d: pPciBusReg=%p:{.u32Version=%#x, .pfnRegisterR3=%p, .pfnIORegionRegisterR3=%p, .pfnSetIrqR3=%p, "
     
    24942513
    24952514
    2496 /** @copydoc PDMDEVHLP::pfnPICRegister */
     2515/** @copydoc PDMDEVHLPR3::pfnPICRegister */
    24972516static DECLCALLBACK(int) pdmR3DevHlp_PICRegister(PPDMDEVINS pDevIns, PPDMPICREG pPicReg, PCPDMPICHLPR3 *ppPicHlpR3)
    24982517{
    24992518    PDMDEV_ASSERT_DEVINS(pDevIns);
    2500     VM_ASSERT_EMT(pDevIns->Internal.s.pVMHC);
     2519    VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
    25012520    LogFlow(("pdmR3DevHlp_PICRegister: caller='%s'/%d: pPicReg=%p:{.u32Version=%#x, .pfnSetIrqR3=%p, .pfnGetInterruptR3=%p, .pszGetIrqRC=%p:{%s}, .pszGetInterruptRC=%p:{%s}, .pszGetIrqR0=%p:{%s}, .pszGetInterruptR0=%p:{%s} } ppPicHlpR3=%p\n",
    25022521             pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, pPicReg, pPicReg->u32Version, pPicReg->pfnSetIrqR3, pPicReg->pfnGetInterruptR3,
     
    25572576     * Only one PIC device.
    25582577     */
    2559     PVM pVM = pDevIns->Internal.s.pVMHC;
     2578    PVM pVM = pDevIns->Internal.s.pVMR3;
    25602579    if (pVM->pdm.s.Pic.pDevInsR3)
    25612580    {
     
    26332652
    26342653
    2635 /** @copydoc PDMDEVHLP::pfnAPICRegister */
     2654/** @copydoc PDMDEVHLPR3::pfnAPICRegister */
    26362655static DECLCALLBACK(int) pdmR3DevHlp_APICRegister(PPDMDEVINS pDevIns, PPDMAPICREG pApicReg, PCPDMAPICHLPR3 *ppApicHlpR3)
    26372656{
    26382657    PDMDEV_ASSERT_DEVINS(pDevIns);
    2639     VM_ASSERT_EMT(pDevIns->Internal.s.pVMHC);
     2658    VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
    26402659    LogFlow(("pdmR3DevHlp_APICRegister: caller='%s'/%d: pApicReg=%p:{.u32Version=%#x, .pfnGetInterruptR3=%p, .pfnSetBaseR3=%p, .pfnGetBaseR3=%p, "
    26412660             ".pfnSetTPRR3=%p, .pfnGetTPRR3=%p, .pfnBusDeliverR3=%p, pszGetInterruptRC=%p:{%s}, pszSetBaseRC=%p:{%s}, pszGetBaseRC=%p:{%s}, "
     
    27362755     * Only one APIC device. (malc: only in UP case actually)
    27372756     */
    2738     PVM pVM = pDevIns->Internal.s.pVMHC;
     2757    PVM pVM = pDevIns->Internal.s.pVMR3;
    27392758    if (pVM->pdm.s.Apic.pDevInsR3)
    27402759    {
     
    28772896
    28782897
    2879 /** @copydoc PDMDEVHLP::pfnIOAPICRegister */
     2898/** @copydoc PDMDEVHLPR3::pfnIOAPICRegister */
    28802899static DECLCALLBACK(int) pdmR3DevHlp_IOAPICRegister(PPDMDEVINS pDevIns, PPDMIOAPICREG pIoApicReg, PCPDMIOAPICHLPR3 *ppIoApicHlpR3)
    28812900{
    28822901    PDMDEV_ASSERT_DEVINS(pDevIns);
    2883     VM_ASSERT_EMT(pDevIns->Internal.s.pVMHC);
     2902    VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
    28842903    LogFlow(("pdmR3DevHlp_IOAPICRegister: caller='%s'/%d: pIoApicReg=%p:{.u32Version=%#x, .pfnSetIrqR3=%p, .pszSetIrqRC=%p:{%s}, .pszSetIrqR0=%p:{%s}} ppIoApicHlpR3=%p\n",
    28852904             pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, pIoApicReg, pIoApicReg->u32Version, pIoApicReg->pfnSetIrqR3,
     
    29262945     * If the I/O APIC does GC stuff so must the APIC.
    29272946     */
    2928     PVM pVM = pDevIns->Internal.s.pVMHC;
     2947    PVM pVM = pDevIns->Internal.s.pVMR3;
    29292948    if (!pVM->pdm.s.Apic.pDevInsR3)
    29302949    {
     
    30063025
    30073026
    3008 /** @copydoc PDMDEVHLP::pfnDMACRegister */
     3027/** @copydoc PDMDEVHLPR3::pfnDMACRegister */
    30093028static DECLCALLBACK(int) pdmR3DevHlp_DMACRegister(PPDMDEVINS pDevIns, PPDMDMACREG pDmacReg, PCPDMDMACHLP *ppDmacHlp)
    30103029{
    30113030    PDMDEV_ASSERT_DEVINS(pDevIns);
    3012     VM_ASSERT_EMT(pDevIns->Internal.s.pVMHC);
     3031    VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
    30133032    LogFlow(("pdmR3DevHlp_DMACRegister: caller='%s'/%d: pDmacReg=%p:{.u32Version=%#x, .pfnRun=%p, .pfnRegister=%p, .pfnReadMemory=%p, .pfnWriteMemory=%p, .pfnSetDREQ=%p, .pfnGetChannelMode=%p} ppDmacHlp=%p\n",
    30143033             pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, pDmacReg, pDmacReg->u32Version, pDmacReg->pfnRun, pDmacReg->pfnRegister,
     
    30553074     * Only one DMA device.
    30563075     */
    3057     PVM pVM = pDevIns->Internal.s.pVMHC;
     3076    PVM pVM = pDevIns->Internal.s.pVMR3;
    30583077    if (pVM->pdm.s.pDmac)
    30593078    {
     
    30683087     */
    30693088    int rc = VINF_SUCCESS;
    3070     PPDMDMAC  pDmac = (PPDMDMAC)MMR3HeapAlloc(pDevIns->Internal.s.pVMHC, MM_TAG_PDM_DEVICE, sizeof(*pDmac));
     3089    PPDMDMAC  pDmac = (PPDMDMAC)MMR3HeapAlloc(pDevIns->Internal.s.pVMR3, MM_TAG_PDM_DEVICE, sizeof(*pDmac));
    30713090    if (pDmac)
    30723091    {
     
    30893108
    30903109
    3091 /** @copydoc PDMDEVHLP::pfnPhysRead */
     3110/** @copydoc PDMDEVHLPR3::pfnPhysRead */
    30923111static DECLCALLBACK(void) pdmR3DevHlp_PhysRead(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead)
    30933112{
     
    31013120     */
    31023121#ifdef PDM_PHYS_READWRITE_FROM_ANY_THREAD
    3103     PGMPhysRead(pDevIns->Internal.s.pVMHC, GCPhys, pvBuf, cbRead);
     3122    PGMPhysRead(pDevIns->Internal.s.pVMR3, GCPhys, pvBuf, cbRead);
    31043123#else
    3105     if (VM_IS_EMT(pDevIns->Internal.s.pVMHC) || VMMR3LockIsOwner(pDevIns->Internal.s.pVMHC))
    3106         PGMPhysRead(pDevIns->Internal.s.pVMHC, GCPhys, pvBuf, cbRead);
     3124    if (VM_IS_EMT(pDevIns->Internal.s.pVMR3) || VMMR3LockIsOwner(pDevIns->Internal.s.pVMR3))
     3125        PGMPhysRead(pDevIns->Internal.s.pVMR3, GCPhys, pvBuf, cbRead);
    31073126    else
    31083127    {
     
    31103129        PVMREQ pReq;
    31113130        AssertCompileSize(RTGCPHYS, 4);
    3112         int rc = VMR3ReqCallVoid(pDevIns->Internal.s.pVMHC, &pReq, RT_INDEFINITE_WAIT,
    3113                                  (PFNRT)PGMPhysRead, 4, pDevIns->Internal.s.pVMHC, GCPhys, pvBuf, cbRead);
     3131        int rc = VMR3ReqCallVoid(pDevIns->Internal.s.pVMR3, &pReq, RT_INDEFINITE_WAIT,
     3132                                 (PFNRT)PGMPhysRead, 4, pDevIns->Internal.s.pVMR3, GCPhys, pvBuf, cbRead);
    31143133        while (rc == VERR_TIMEOUT)
    31153134            rc = VMR3ReqWait(pReq, RT_INDEFINITE_WAIT);
     
    31223141
    31233142
    3124 /** @copydoc PDMDEVHLP::pfnPhysWrite */
     3143/** @copydoc PDMDEVHLPR3::pfnPhysWrite */
    31253144static DECLCALLBACK(void) pdmR3DevHlp_PhysWrite(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite)
    31263145{
     
    31343153     */
    31353154#ifdef PDM_PHYS_READWRITE_FROM_ANY_THREAD
    3136     PGMPhysWrite(pDevIns->Internal.s.pVMHC, GCPhys, pvBuf, cbWrite);
     3155    PGMPhysWrite(pDevIns->Internal.s.pVMR3, GCPhys, pvBuf, cbWrite);
    31373156#else
    3138     if (VM_IS_EMT(pDevIns->Internal.s.pVMHC) || VMMR3LockIsOwner(pDevIns->Internal.s.pVMHC))
    3139         PGMPhysWrite(pDevIns->Internal.s.pVMHC, GCPhys, pvBuf, cbWrite);
     3157    if (VM_IS_EMT(pDevIns->Internal.s.pVMR3) || VMMR3LockIsOwner(pDevIns->Internal.s.pVMR3))
     3158        PGMPhysWrite(pDevIns->Internal.s.pVMR3, GCPhys, pvBuf, cbWrite);
    31403159    else
    31413160    {
     
    31433162        PVMREQ pReq;
    31443163        AssertCompileSize(RTGCPHYS, 4);
    3145         int rc = VMR3ReqCallVoid(pDevIns->Internal.s.pVMHC, &pReq, RT_INDEFINITE_WAIT,
    3146                                  (PFNRT)PGMPhysWrite, 4, pDevIns->Internal.s.pVMHC, GCPhys, pvBuf, cbWrite);
     3164        int rc = VMR3ReqCallVoid(pDevIns->Internal.s.pVMR3, &pReq, RT_INDEFINITE_WAIT,
     3165                                 (PFNRT)PGMPhysWrite, 4, pDevIns->Internal.s.pVMR3, GCPhys, pvBuf, cbWrite);
    31473166        while (rc == VERR_TIMEOUT)
    31483167            rc = VMR3ReqWait(pReq, RT_INDEFINITE_WAIT);
     
    31553174
    31563175
    3157 /** @copydoc PDMDEVHLP::pfnPhysReadGCVirt */
     3176/** @copydoc PDMDEVHLPR3::pfnPhysReadGCVirt */
    31583177static DECLCALLBACK(int) pdmR3DevHlp_PhysReadGCVirt(PPDMDEVINS pDevIns, void *pvDst, RTGCPTR GCVirtSrc, size_t cb)
    31593178{
    31603179    PDMDEV_ASSERT_DEVINS(pDevIns);
    3161     PVM pVM = pDevIns->Internal.s.pVMHC;
     3180    PVM pVM = pDevIns->Internal.s.pVMR3;
    31623181    VM_ASSERT_EMT(pVM);
    31633182    LogFlow(("pdmR3DevHlp_PhysReadGCVirt: caller='%s'/%d: pvDst=%p GCVirt=%VGv cb=%#x\n",
     
    31753194
    31763195
    3177 /** @copydoc PDMDEVHLP::pfnPhysWriteGCVirt */
     3196/** @copydoc PDMDEVHLPR3::pfnPhysWriteGCVirt */
    31783197static DECLCALLBACK(int) pdmR3DevHlp_PhysWriteGCVirt(PPDMDEVINS pDevIns, RTGCPTR GCVirtDst, const void *pvSrc, size_t cb)
    31793198{
    31803199    PDMDEV_ASSERT_DEVINS(pDevIns);
    3181     PVM pVM = pDevIns->Internal.s.pVMHC;
     3200    PVM pVM = pDevIns->Internal.s.pVMR3;
    31823201    VM_ASSERT_EMT(pVM);
    31833202    LogFlow(("pdmR3DevHlp_PhysWriteGCVirt: caller='%s'/%d: GCVirtDst=%VGv pvSrc=%p cb=%#x\n",
     
    31953214
    31963215
    3197 /** @copydoc PDMDEVHLP::pfnPhysReserve */
     3216/** @copydoc PDMDEVHLPR3::pfnPhysReserve */
    31983217static DECLCALLBACK(int) pdmR3DevHlp_PhysReserve(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, RTUINT cbRange, const char *pszDesc)
    31993218{
    32003219    PDMDEV_ASSERT_DEVINS(pDevIns);
    3201     VM_ASSERT_EMT(pDevIns->Internal.s.pVMHC);
     3220    VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
    32023221    LogFlow(("pdmR3DevHlp_PhysReserve: caller='%s'/%d: GCPhys=%VGp cbRange=%#x pszDesc=%p:{%s}\n",
    32033222             pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, GCPhys, cbRange, pszDesc, pszDesc));
    32043223
    3205     int rc = MMR3PhysReserve(pDevIns->Internal.s.pVMHC, GCPhys, cbRange, pszDesc);
     3224    int rc = MMR3PhysReserve(pDevIns->Internal.s.pVMR3, GCPhys, cbRange, pszDesc);
    32063225
    32073226    LogFlow(("pdmR3DevHlp_PhysReserve: caller='%s'/%d: returns %Vrc\n", pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, rc));
     
    32113230
    32123231
    3213 /** @copydoc PDMDEVHLP::pfnPhysGCPtr2GCPhys */
     3232/** @copydoc PDMDEVHLPR3::pfnPhysGCPtr2GCPhys */
    32143233static DECLCALLBACK(int) pdmR3DevHlp_PhysGCPtr2GCPhys(PPDMDEVINS pDevIns, RTGCPTR GCPtr, PRTGCPHYS pGCPhys)
    32153234{
    32163235    PDMDEV_ASSERT_DEVINS(pDevIns);
    3217     PVM pVM = pDevIns->Internal.s.pVMHC;
     3236    PVM pVM = pDevIns->Internal.s.pVMR3;
    32183237    VM_ASSERT_EMT(pVM);
    32193238    LogFlow(("pdmR3DevHlp_PhysGCPtr2GCPhys: caller='%s'/%d: GCPtr=%VGv pGCPhys=%p\n",
     
    32313250
    32323251
    3233 /** @copydoc PDMDEVHLP::pfnVMState */
     3252/** @copydoc PDMDEVHLPR3::pfnVMState */
    32343253static DECLCALLBACK(VMSTATE) pdmR3DevHlp_VMState(PPDMDEVINS pDevIns)
    32353254{
    32363255    PDMDEV_ASSERT_DEVINS(pDevIns);
    32373256
    3238     VMSTATE enmVMState = VMR3GetState(pDevIns->Internal.s.pVMHC);
     3257    VMSTATE enmVMState = VMR3GetState(pDevIns->Internal.s.pVMR3);
    32393258
    32403259    LogFlow(("pdmR3DevHlp_VMState: caller='%s'/%d: returns %d (%s)\n", pDevIns->pDevReg->szDeviceName, pDevIns->iInstance,
     
    32443263
    32453264
    3246 /** @copydoc PDMDEVHLP::pfnA20IsEnabled */
     3265/** @copydoc PDMDEVHLPR3::pfnA20IsEnabled */
    32473266static DECLCALLBACK(bool) pdmR3DevHlp_A20IsEnabled(PPDMDEVINS pDevIns)
    32483267{
    32493268    PDMDEV_ASSERT_DEVINS(pDevIns);
    3250     VM_ASSERT_EMT(pDevIns->Internal.s.pVMHC);
    3251 
    3252     bool fRc = PGMPhysIsA20Enabled(pDevIns->Internal.s.pVMHC);
     3269    VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
     3270
     3271    bool fRc = PGMPhysIsA20Enabled(pDevIns->Internal.s.pVMR3);
    32533272
    32543273    LogFlow(("pdmR3DevHlp_A20IsEnabled: caller='%s'/%d: returns %d\n", pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, fRc));
     
    32573276
    32583277
    3259 /** @copydoc PDMDEVHLP::pfnA20Set */
     3278/** @copydoc PDMDEVHLPR3::pfnA20Set */
    32603279static DECLCALLBACK(void) pdmR3DevHlp_A20Set(PPDMDEVINS pDevIns, bool fEnable)
    32613280{
    32623281    PDMDEV_ASSERT_DEVINS(pDevIns);
    3263     VM_ASSERT_EMT(pDevIns->Internal.s.pVMHC);
     3282    VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
    32643283    LogFlow(("pdmR3DevHlp_A20Set: caller='%s'/%d: fEnable=%d\n", pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, fEnable));
    32653284    //Assert(*(unsigned *)&fEnable <= 1);
    3266     PGMR3PhysSetA20(pDevIns->Internal.s.pVMHC, fEnable);
    3267 }
    3268 
    3269 
    3270 /** @copydoc PDMDEVHLP::pfnVMReset */
     3285    PGMR3PhysSetA20(pDevIns->Internal.s.pVMR3, fEnable);
     3286}
     3287
     3288
     3289/** @copydoc PDMDEVHLPR3::pfnVMReset */
    32713290static DECLCALLBACK(int) pdmR3DevHlp_VMReset(PPDMDEVINS pDevIns)
    32723291{
    32733292    PDMDEV_ASSERT_DEVINS(pDevIns);
    3274     PVM pVM = pDevIns->Internal.s.pVMHC;
     3293    PVM pVM = pDevIns->Internal.s.pVMR3;
    32753294    VM_ASSERT_EMT(pVM);
    32763295    LogFlow(("pdmR3DevHlp_VMReset: caller='%s'/%d: VM_FF_RESET %d -> 1\n",
     
    33003319
    33013320
    3302 /** @copydoc PDMDEVHLP::pfnVMSuspend */
     3321/** @copydoc PDMDEVHLPR3::pfnVMSuspend */
    33033322static DECLCALLBACK(int) pdmR3DevHlp_VMSuspend(PPDMDEVINS pDevIns)
    33043323{
    33053324    PDMDEV_ASSERT_DEVINS(pDevIns);
    3306     VM_ASSERT_EMT(pDevIns->Internal.s.pVMHC);
     3325    VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
    33073326    LogFlow(("pdmR3DevHlp_VMSuspend: caller='%s'/%d:\n",
    33083327             pDevIns->pDevReg->szDeviceName, pDevIns->iInstance));
    33093328
    3310     int rc = VMR3Suspend(pDevIns->Internal.s.pVMHC);
     3329    int rc = VMR3Suspend(pDevIns->Internal.s.pVMR3);
    33113330
    33123331    LogFlow(("pdmR3DevHlp_VMSuspend: caller='%s'/%d: returns %Vrc\n", pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, rc));
     
    33153334
    33163335
    3317 /** @copydoc PDMDEVHLP::pfnVMPowerOff */
     3336/** @copydoc PDMDEVHLPR3::pfnVMPowerOff */
    33183337static DECLCALLBACK(int) pdmR3DevHlp_VMPowerOff(PPDMDEVINS pDevIns)
    33193338{
    33203339    PDMDEV_ASSERT_DEVINS(pDevIns);
    3321     VM_ASSERT_EMT(pDevIns->Internal.s.pVMHC);
     3340    VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
    33223341    LogFlow(("pdmR3DevHlp_VMPowerOff: caller='%s'/%d:\n",
    33233342             pDevIns->pDevReg->szDeviceName, pDevIns->iInstance));
    33243343
    3325     int rc = VMR3PowerOff(pDevIns->Internal.s.pVMHC);
     3344    int rc = VMR3PowerOff(pDevIns->Internal.s.pVMR3);
    33263345
    33273346    LogFlow(("pdmR3DevHlp_VMPowerOff: caller='%s'/%d: returns %Vrc\n", pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, rc));
     
    33303349
    33313350
    3332 /** @copydoc PDMDEVHLP::pfnLockVM */
     3351/** @copydoc PDMDEVHLPR3::pfnLockVM */
    33333352static DECLCALLBACK(int) pdmR3DevHlp_LockVM(PPDMDEVINS pDevIns)
    33343353{
    3335     return VMMR3Lock(pDevIns->Internal.s.pVMHC);
    3336 }
    3337 
    3338 
    3339 /** @copydoc PDMDEVHLP::pfnUnlockVM */
     3354    return VMMR3Lock(pDevIns->Internal.s.pVMR3);
     3355}
     3356
     3357
     3358/** @copydoc PDMDEVHLPR3::pfnUnlockVM */
    33403359static DECLCALLBACK(int) pdmR3DevHlp_UnlockVM(PPDMDEVINS pDevIns)
    33413360{
    3342     return VMMR3Unlock(pDevIns->Internal.s.pVMHC);
    3343 }
    3344 
    3345 
    3346 /** @copydoc PDMDEVHLP::pfnAssertVMLock */
     3361    return VMMR3Unlock(pDevIns->Internal.s.pVMR3);
     3362}
     3363
     3364
     3365/** @copydoc PDMDEVHLPR3::pfnAssertVMLock */
    33473366static DECLCALLBACK(bool) pdmR3DevHlp_AssertVMLock(PPDMDEVINS pDevIns, const char *pszFile, unsigned iLine, const char *pszFunction)
    33483367{
    3349     PVM pVM = pDevIns->Internal.s.pVMHC;
     3368    PVM pVM = pDevIns->Internal.s.pVMR3;
    33503369    if (VMMR3LockIsOwner(pVM))
    33513370        return true;
     
    33623381}
    33633382
    3364 /** @copydoc PDMDEVHLP::pfnDMARegister */
     3383/** @copydoc PDMDEVHLPR3::pfnDMARegister */
    33653384static DECLCALLBACK(int) pdmR3DevHlp_DMARegister(PPDMDEVINS pDevIns, unsigned uChannel, PFNDMATRANSFERHANDLER pfnTransferHandler, void *pvUser)
    33663385{
    33673386    PDMDEV_ASSERT_DEVINS(pDevIns);
    3368     PVM pVM = pDevIns->Internal.s.pVMHC;
     3387    PVM pVM = pDevIns->Internal.s.pVMR3;
    33693388    VM_ASSERT_EMT(pVM);
    33703389    LogFlow(("pdmR3DevHlp_DMARegister: caller='%s'/%d: uChannel=%d pfnTransferHandler=%p pvUser=%p\n",
     
    33833402}
    33843403
    3385 /** @copydoc PDMDEVHLP::pfnDMAReadMemory */
     3404/** @copydoc PDMDEVHLPR3::pfnDMAReadMemory */
    33863405static DECLCALLBACK(int) pdmR3DevHlp_DMAReadMemory(PPDMDEVINS pDevIns, unsigned uChannel, void *pvBuffer, uint32_t off, uint32_t cbBlock, uint32_t *pcbRead)
    33873406{
    33883407    PDMDEV_ASSERT_DEVINS(pDevIns);
    3389     PVM pVM = pDevIns->Internal.s.pVMHC;
     3408    PVM pVM = pDevIns->Internal.s.pVMR3;
    33903409    VM_ASSERT_EMT(pVM);
    33913410    LogFlow(("pdmR3DevHlp_DMAReadMemory: caller='%s'/%d: uChannel=%d pvBuffer=%p off=%#x cbBlock=%#x pcbRead=%p\n",
     
    34083427}
    34093428
    3410 /** @copydoc PDMDEVHLP::pfnDMAWriteMemory */
     3429/** @copydoc PDMDEVHLPR3::pfnDMAWriteMemory */
    34113430static DECLCALLBACK(int) pdmR3DevHlp_DMAWriteMemory(PPDMDEVINS pDevIns, unsigned uChannel, const void *pvBuffer, uint32_t off, uint32_t cbBlock, uint32_t *pcbWritten)
    34123431{
    34133432    PDMDEV_ASSERT_DEVINS(pDevIns);
    3414     PVM pVM = pDevIns->Internal.s.pVMHC;
     3433    PVM pVM = pDevIns->Internal.s.pVMR3;
    34153434    VM_ASSERT_EMT(pVM);
    34163435    LogFlow(("pdmR3DevHlp_DMAWriteMemory: caller='%s'/%d: uChannel=%d pvBuffer=%p off=%#x cbBlock=%#x pcbWritten=%p\n",
     
    34333452}
    34343453
    3435 /** @copydoc PDMDEVHLP::pfnDMASetDREQ */
     3454/** @copydoc PDMDEVHLPR3::pfnDMASetDREQ */
    34363455static DECLCALLBACK(int) pdmR3DevHlp_DMASetDREQ(PPDMDEVINS pDevIns, unsigned uChannel, unsigned uLevel)
    34373456{
    34383457    PDMDEV_ASSERT_DEVINS(pDevIns);
    3439     PVM pVM = pDevIns->Internal.s.pVMHC;
     3458    PVM pVM = pDevIns->Internal.s.pVMR3;
    34403459    VM_ASSERT_EMT(pVM);
    34413460    LogFlow(("pdmR3DevHlp_DMASetDREQ: caller='%s'/%d: uChannel=%d uLevel=%d\n",
     
    34543473}
    34553474
    3456 /** @copydoc PDMDEVHLP::pfnDMAGetChannelMode */
     3475/** @copydoc PDMDEVHLPR3::pfnDMAGetChannelMode */
    34573476static DECLCALLBACK(uint8_t) pdmR3DevHlp_DMAGetChannelMode(PPDMDEVINS pDevIns, unsigned uChannel)
    34583477{
    34593478    PDMDEV_ASSERT_DEVINS(pDevIns);
    3460     PVM pVM = pDevIns->Internal.s.pVMHC;
     3479    PVM pVM = pDevIns->Internal.s.pVMR3;
    34613480    VM_ASSERT_EMT(pVM);
    34623481    LogFlow(("pdmR3DevHlp_DMAGetChannelMode: caller='%s'/%d: uChannel=%d\n",
     
    34753494}
    34763495
    3477 /** @copydoc PDMDEVHLP::pfnDMASchedule */
     3496/** @copydoc PDMDEVHLPR3::pfnDMASchedule */
    34783497static DECLCALLBACK(void) pdmR3DevHlp_DMASchedule(PPDMDEVINS pDevIns)
    34793498{
    34803499    PDMDEV_ASSERT_DEVINS(pDevIns);
    3481     PVM pVM = pDevIns->Internal.s.pVMHC;
     3500    PVM pVM = pDevIns->Internal.s.pVMR3;
    34823501    VM_ASSERT_EMT(pVM);
    34833502    LogFlow(("pdmR3DevHlp_DMASchedule: caller='%s'/%d: VM_FF_PDM_DMA %d -> 1\n",
     
    34913510
    34923511
    3493 /** @copydoc PDMDEVHLP::pfnCMOSWrite */
     3512/** @copydoc PDMDEVHLPR3::pfnCMOSWrite */
    34943513static DECLCALLBACK(int) pdmR3DevHlp_CMOSWrite(PPDMDEVINS pDevIns, unsigned iReg, uint8_t u8Value)
    34953514{
    34963515    PDMDEV_ASSERT_DEVINS(pDevIns);
    3497     PVM pVM = pDevIns->Internal.s.pVMHC;
     3516    PVM pVM = pDevIns->Internal.s.pVMR3;
    34983517    VM_ASSERT_EMT(pVM);
    34993518
     
    35123531
    35133532
    3514 /** @copydoc PDMDEVHLP::pfnCMOSRead */
     3533/** @copydoc PDMDEVHLPR3::pfnCMOSRead */
    35153534static DECLCALLBACK(int) pdmR3DevHlp_CMOSRead(PPDMDEVINS pDevIns, unsigned iReg, uint8_t *pu8Value)
    35163535{
    35173536    PDMDEV_ASSERT_DEVINS(pDevIns);
    3518     PVM pVM = pDevIns->Internal.s.pVMHC;
     3537    PVM pVM = pDevIns->Internal.s.pVMR3;
    35193538    VM_ASSERT_EMT(pVM);
    35203539
     
    35333552
    35343553
    3535 /** @copydoc PDMDEVHLP::pfnGetCpuId */
     3554/** @copydoc PDMDEVHLPR3::pfnGetCpuId */
    35363555static DECLCALLBACK(void) pdmR3DevHlp_GetCpuId(PPDMDEVINS pDevIns, uint32_t iLeaf,
    35373556                                               uint32_t *pEax, uint32_t *pEbx, uint32_t *pEcx, uint32_t *pEdx)
     
    35423561    AssertPtr(pEax); AssertPtr(pEbx); AssertPtr(pEcx); AssertPtr(pEdx);
    35433562
    3544     CPUMGetGuestCpuId(pDevIns->Internal.s.pVMHC, iLeaf, pEax, pEbx, pEcx, pEdx);
     3563    CPUMGetGuestCpuId(pDevIns->Internal.s.pVMR3, iLeaf, pEax, pEbx, pEcx, pEdx);
    35453564
    35463565    LogFlow(("pdmR3DevHlp_GetCpuId: caller='%s'/%d: returns void - *pEax=%#x *pEbx=%#x *pEcx=%#x *pEdx=%#x\n",
     
    35493568
    35503569
    3551 /** @copydoc PDMDEVHLP::pfnROMProtectShadow */
     3570/** @copydoc PDMDEVHLPR3::pfnROMProtectShadow */
    35523571static DECLCALLBACK(int) pdmR3DevHlp_ROMProtectShadow(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTUINT cbRange)
    35533572{
     
    35563575             pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, GCPhysStart, cbRange));
    35573576
    3558     int rc = MMR3PhysRomProtect(pDevIns->Internal.s.pVMHC, GCPhysStart, cbRange);
     3577    int rc = MMR3PhysRomProtect(pDevIns->Internal.s.pVMR3, GCPhysStart, cbRange);
    35593578
    35603579    LogFlow(("pdmR3DevHlp_ROMProtectShadow: caller='%s'/%d: returns %Vrc\n", pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, rc));
     
    35643583
    35653584/**
    3566  * @copydoc PDMDEVHLP::pfnMMIO2Register
     3585 * @copydoc PDMDEVHLPR3::pfnMMIO2Register
    35673586 */
    35683587static DECLCALLBACK(int) pdmR3DevHlp_MMIO2Register(PPDMDEVINS pDevIns, uint32_t iRegion, RTGCPHYS cb, uint32_t fFlags, void **ppv, const char *pszDesc)
    35693588{
    35703589    PDMDEV_ASSERT_DEVINS(pDevIns);
    3571     VM_ASSERT_EMT(pDevIns->Internal.s.pVMHC);
     3590    VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
    35723591    LogFlow(("pdmR3DevHlp_MMIO2Register: caller='%s'/%d: iRegion=#x cb=%#RGp fFlags=%RX32 ppv=%p pszDescp=%p:{%s}\n",
    35733592             pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, iRegion, cb, fFlags, ppv, pszDesc, pszDesc));
    35743593
    3575     int rc = PGMR3PhysMMIO2Register(pDevIns->Internal.s.pVMHC, pDevIns, iRegion, cb, fFlags, ppv, pszDesc);
     3594    int rc = PGMR3PhysMMIO2Register(pDevIns->Internal.s.pVMR3, pDevIns, iRegion, cb, fFlags, ppv, pszDesc);
    35763595
    35773596    LogFlow(("pdmR3DevHlp_MMIO2Register: caller='%s'/%d: returns %Rrc\n", pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, rc));
     
    35813600
    35823601/**
    3583  * @copydoc PDMDEVHLP::pfnMMIO2Deregister
     3602 * @copydoc PDMDEVHLPR3::pfnMMIO2Deregister
    35843603 */
    35853604static DECLCALLBACK(int) pdmR3DevHlp_MMIO2Deregister(PPDMDEVINS pDevIns, uint32_t iRegion)
    35863605{
    35873606    PDMDEV_ASSERT_DEVINS(pDevIns);
    3588     VM_ASSERT_EMT(pDevIns->Internal.s.pVMHC);
     3607    VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
    35893608    LogFlow(("pdmR3DevHlp_MMIO2Deregister: caller='%s'/%d: iRegion=#x\n",
    35903609             pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, iRegion));
     
    35923611    AssertReturn(iRegion == UINT32_MAX, VERR_INVALID_PARAMETER);
    35933612
    3594     int rc = PGMR3PhysMMIO2Deregister(pDevIns->Internal.s.pVMHC, pDevIns, iRegion);
     3613    int rc = PGMR3PhysMMIO2Deregister(pDevIns->Internal.s.pVMR3, pDevIns, iRegion);
    35953614
    35963615    LogFlow(("pdmR3DevHlp_MMIO2Deregister: caller='%s'/%d: returns %Rrc\n", pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, rc));
     
    36003619
    36013620/**
    3602  * @copydoc PDMDEVHLP::pfnMMIO2Map
     3621 * @copydoc PDMDEVHLPR3::pfnMMIO2Map
    36033622 */
    36043623static DECLCALLBACK(int) pdmR3DevHlp_MMIO2Map(PPDMDEVINS pDevIns, uint32_t iRegion, RTGCPHYS GCPhys)
    36053624{
    36063625    PDMDEV_ASSERT_DEVINS(pDevIns);
    3607     VM_ASSERT_EMT(pDevIns->Internal.s.pVMHC);
     3626    VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
    36083627    LogFlow(("pdmR3DevHlp_MMIO2Map: caller='%s'/%d: iRegion=#x GCPhys=%#RGp\n",
    36093628             pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, iRegion, GCPhys));
    36103629
    3611     int rc = PGMR3PhysMMIO2Map(pDevIns->Internal.s.pVMHC, pDevIns, iRegion, GCPhys);
     3630    int rc = PGMR3PhysMMIO2Map(pDevIns->Internal.s.pVMR3, pDevIns, iRegion, GCPhys);
    36123631
    36133632    LogFlow(("pdmR3DevHlp_MMIO2Map: caller='%s'/%d: returns %Rrc\n", pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, rc));
     
    36173636
    36183637/**
    3619  * @copydoc PDMDEVHLP::pfnMMIO2Unmap
     3638 * @copydoc PDMDEVHLPR3::pfnMMIO2Unmap
    36203639 */
    36213640static DECLCALLBACK(int) pdmR3DevHlp_MMIO2Unmap(PPDMDEVINS pDevIns, uint32_t iRegion, RTGCPHYS GCPhys)
    36223641{
    36233642    PDMDEV_ASSERT_DEVINS(pDevIns);
    3624     VM_ASSERT_EMT(pDevIns->Internal.s.pVMHC);
     3643    VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
    36253644    LogFlow(("pdmR3DevHlp_MMIO2Unmap: caller='%s'/%d: iRegion=#x GCPhys=%#RGp\n",
    36263645             pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, iRegion, GCPhys));
    36273646
    3628     int rc = PGMR3PhysMMIO2Unmap(pDevIns->Internal.s.pVMHC, pDevIns, iRegion, GCPhys);
     3647    int rc = PGMR3PhysMMIO2Unmap(pDevIns->Internal.s.pVMR3, pDevIns, iRegion, GCPhys);
    36293648
    36303649    LogFlow(("pdmR3DevHlp_MMIO2Unmap: caller='%s'/%d: returns %Rrc\n", pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, rc));
     
    36343653
    36353654/**
    3636  * @copydoc PDMDEVHLP::pfnMMHyperMapMMIO2
     3655 * @copydoc PDMDEVHLPR3::pfnMMHyperMapMMIO2
    36373656 */
    36383657static DECLCALLBACK(int) pdmR3DevHlp_MMHyperMapMMIO2(PPDMDEVINS pDevIns, uint32_t iRegion, RTGCPHYS off, RTGCPHYS cb,
     
    36403659{
    36413660    PDMDEV_ASSERT_DEVINS(pDevIns);
    3642     VM_ASSERT_EMT(pDevIns->Internal.s.pVMHC);
     3661    VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
    36433662    LogFlow(("pdmR3DevHlp_MMHyperMapMMIO2: caller='%s'/%d: iRegion=#x off=%RGp cb=%RGp pszDesc=%p:{%s} pRCPtr=%p\n",
    36443663             pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, iRegion, off, cb, pszDesc, pszDesc, pRCPtr));
    36453664
    3646     int rc = MMR3HyperMapMMIO2(pDevIns->Internal.s.pVMHC, pDevIns, iRegion, off, cb, pszDesc, pRCPtr);
     3665    int rc = MMR3HyperMapMMIO2(pDevIns->Internal.s.pVMR3, pDevIns, iRegion, off, cb, pszDesc, pRCPtr);
    36473666
    36483667    LogFlow(("pdmR3DevHlp_MMHyperMapMMIO2: caller='%s'/%d: returns %Rrc *pRCPtr=%RRv\n", pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, rc, *pRCPtr));
     
    36523671
    36533672/**
    3654  * @copydoc PDMDEVHLP::pfnRegisterVMMDevHeap
     3673 * @copydoc PDMDEVHLPR3::pfnRegisterVMMDevHeap
    36553674 */
    36563675static DECLCALLBACK(int) pdmR3DevHlp_RegisterVMMDevHeap(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, RTR3PTR pvHeap, unsigned cbSize)
    36573676{
    36583677    PDMDEV_ASSERT_DEVINS(pDevIns);
    3659     VM_ASSERT_EMT(pDevIns->Internal.s.pVMHC);
    3660 
    3661     int rc = PDMR3RegisterVMMDevHeap(pDevIns->Internal.s.pVMHC, GCPhys, pvHeap, cbSize);
     3678    VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
     3679
     3680    int rc = PDMR3RegisterVMMDevHeap(pDevIns->Internal.s.pVMR3, GCPhys, pvHeap, cbSize);
    36623681    return rc;
    36633682}
     
    36653684
    36663685/**
    3667  * @copydoc PDMDEVHLP::pfnUnregisterVMMDevHeap
     3686 * @copydoc PDMDEVHLPR3::pfnUnregisterVMMDevHeap
    36683687 */
    36693688static DECLCALLBACK(int) pdmR3DevHlp_UnregisterVMMDevHeap(PPDMDEVINS pDevIns, RTGCPHYS GCPhys)
    36703689{
    36713690    PDMDEV_ASSERT_DEVINS(pDevIns);
    3672     VM_ASSERT_EMT(pDevIns->Internal.s.pVMHC);
    3673 
    3674     int rc = PDMR3UnregisterVMMDevHeap(pDevIns->Internal.s.pVMHC, GCPhys);
    3675     return rc;
    3676 }
    3677 
    3678 
    3679 
    3680 
    3681 
    3682 /** @copydoc PDMDEVHLP::pfnGetVM */
     3691    VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
     3692
     3693    int rc = PDMR3UnregisterVMMDevHeap(pDevIns->Internal.s.pVMR3, GCPhys);
     3694    return rc;
     3695}
     3696
     3697
     3698
     3699
     3700
     3701/** @copydoc PDMDEVHLPR3::pfnGetVM */
    36833702static DECLCALLBACK(PVM) pdmR3DevHlp_Untrusted_GetVM(PPDMDEVINS pDevIns)
    36843703{
     
    36893708
    36903709
    3691 /** @copydoc PDMDEVHLP::pfnPCIBusRegister */
     3710/** @copydoc PDMDEVHLPR3::pfnPCIBusRegister */
    36923711static DECLCALLBACK(int) pdmR3DevHlp_Untrusted_PCIBusRegister(PPDMDEVINS pDevIns, PPDMPCIBUSREG pPciBusReg, PCPDMPCIHLPR3 *ppPciHlpR3)
    36933712{
     
    37003719
    37013720
    3702 /** @copydoc PDMDEVHLP::pfnPICRegister */
     3721/** @copydoc PDMDEVHLPR3::pfnPICRegister */
    37033722static DECLCALLBACK(int) pdmR3DevHlp_Untrusted_PICRegister(PPDMDEVINS pDevIns, PPDMPICREG pPicReg, PCPDMPICHLPR3 *ppPicHlpR3)
    37043723{
     
    37113730
    37123731
    3713 /** @copydoc PDMDEVHLP::pfnAPICRegister */
     3732/** @copydoc PDMDEVHLPR3::pfnAPICRegister */
    37143733static DECLCALLBACK(int) pdmR3DevHlp_Untrusted_APICRegister(PPDMDEVINS pDevIns, PPDMAPICREG pApicReg, PCPDMAPICHLPR3 *ppApicHlpR3)
    37153734{
     
    37223741
    37233742
    3724 /** @copydoc PDMDEVHLP::pfnIOAPICRegister */
     3743/** @copydoc PDMDEVHLPR3::pfnIOAPICRegister */
    37253744static DECLCALLBACK(int) pdmR3DevHlp_Untrusted_IOAPICRegister(PPDMDEVINS pDevIns, PPDMIOAPICREG pIoApicReg, PCPDMIOAPICHLPR3 *ppIoApicHlpR3)
    37263745{
     
    37333752
    37343753
    3735 /** @copydoc PDMDEVHLP::pfnDMACRegister */
     3754/** @copydoc PDMDEVHLPR3::pfnDMACRegister */
    37363755static DECLCALLBACK(int) pdmR3DevHlp_Untrusted_DMACRegister(PPDMDEVINS pDevIns, PPDMDMACREG pDmacReg, PCPDMDMACHLP *ppDmacHlp)
    37373756{
     
    37443763
    37453764
    3746 /** @copydoc PDMDEVHLP::pfnPhysRead */
     3765/** @copydoc PDMDEVHLPR3::pfnPhysRead */
    37473766static DECLCALLBACK(void) pdmR3DevHlp_Untrusted_PhysRead(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead)
    37483767{
     
    37553774
    37563775
    3757 /** @copydoc PDMDEVHLP::pfnPhysWrite */
     3776/** @copydoc PDMDEVHLPR3::pfnPhysWrite */
    37583777static DECLCALLBACK(void) pdmR3DevHlp_Untrusted_PhysWrite(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite)
    37593778{
     
    37663785
    37673786
    3768 /** @copydoc PDMDEVHLP::pfnPhysReadGCVirt */
     3787/** @copydoc PDMDEVHLPR3::pfnPhysReadGCVirt */
    37693788static DECLCALLBACK(int) pdmR3DevHlp_Untrusted_PhysReadGCVirt(PPDMDEVINS pDevIns, void *pvDst, RTGCPTR GCVirtSrc, size_t cb)
    37703789{
     
    37783797
    37793798
    3780 /** @copydoc PDMDEVHLP::pfnPhysWriteGCVirt */
     3799/** @copydoc PDMDEVHLPR3::pfnPhysWriteGCVirt */
    37813800static DECLCALLBACK(int) pdmR3DevHlp_Untrusted_PhysWriteGCVirt(PPDMDEVINS pDevIns, RTGCPTR GCVirtDst, const void *pvSrc, size_t cb)
    37823801{
     
    37903809
    37913810
    3792 /** @copydoc PDMDEVHLP::pfnPhysReserve */
     3811/** @copydoc PDMDEVHLPR3::pfnPhysReserve */
    37933812static DECLCALLBACK(int) pdmR3DevHlp_Untrusted_PhysReserve(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, RTUINT cbRange, const char *pszDesc)
    37943813{
     
    38013820
    38023821
    3803 /** @copydoc PDMDEVHLP::pfnObsoletePhys2HCVirt */
     3822/** @copydoc PDMDEVHLPR3::pfnObsoletePhys2HCVirt */
    38043823static DECLCALLBACK(int) pdmR3DevHlp_Untrusted_Obsolete_Phys2HCVirt(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, RTUINT cbRange, PRTHCPTR ppvHC)
    38053824{
     
    38133832
    38143833
    3815 /** @copydoc PDMDEVHLP::pfnObsoletePhysGCPtr2HCPtr */
     3834/** @copydoc PDMDEVHLPR3::pfnObsoletePhysGCPtr2HCPtr */
    38163835static DECLCALLBACK(int) pdmR3DevHlp_Untrusted_Obsolete_PhysGCPtr2HCPtr(PPDMDEVINS pDevIns, RTGCPTR GCPtr, PRTHCPTR pHCPtr)
    38173836{
     
    38243843
    38253844
    3826 /** @copydoc PDMDEVHLP::pfnA20IsEnabled */
     3845/** @copydoc PDMDEVHLPR3::pfnA20IsEnabled */
    38273846static DECLCALLBACK(bool) pdmR3DevHlp_Untrusted_A20IsEnabled(PPDMDEVINS pDevIns)
    38283847{
     
    38333852
    38343853
    3835 /** @copydoc PDMDEVHLP::pfnA20Set */
     3854/** @copydoc PDMDEVHLPR3::pfnA20Set */
    38363855static DECLCALLBACK(void) pdmR3DevHlp_Untrusted_A20Set(PPDMDEVINS pDevIns, bool fEnable)
    38373856{
     
    38423861
    38433862
    3844 /** @copydoc PDMDEVHLP::pfnVMReset */
     3863/** @copydoc PDMDEVHLPR3::pfnVMReset */
    38453864static DECLCALLBACK(int) pdmR3DevHlp_Untrusted_VMReset(PPDMDEVINS pDevIns)
    38463865{
     
    38513870
    38523871
    3853 /** @copydoc PDMDEVHLP::pfnVMSuspend */
     3872/** @copydoc PDMDEVHLPR3::pfnVMSuspend */
    38543873static DECLCALLBACK(int) pdmR3DevHlp_Untrusted_VMSuspend(PPDMDEVINS pDevIns)
    38553874{
     
    38603879
    38613880
    3862 /** @copydoc PDMDEVHLP::pfnVMPowerOff */
     3881/** @copydoc PDMDEVHLPR3::pfnVMPowerOff */
    38633882static DECLCALLBACK(int) pdmR3DevHlp_Untrusted_VMPowerOff(PPDMDEVINS pDevIns)
    38643883{
     
    38693888
    38703889
    3871 /** @copydoc PDMDEVHLP::pfnLockVM */
     3890/** @copydoc PDMDEVHLPR3::pfnLockVM */
    38723891static DECLCALLBACK(int) pdmR3DevHlp_Untrusted_LockVM(PPDMDEVINS pDevIns)
    38733892{
     
    38783897
    38793898
    3880 /** @copydoc PDMDEVHLP::pfnUnlockVM */
     3899/** @copydoc PDMDEVHLPR3::pfnUnlockVM */
    38813900static DECLCALLBACK(int) pdmR3DevHlp_Untrusted_UnlockVM(PPDMDEVINS pDevIns)
    38823901{
     
    38873906
    38883907
    3889 /** @copydoc PDMDEVHLP::pfnAssertVMLock */
     3908/** @copydoc PDMDEVHLPR3::pfnAssertVMLock */
    38903909static DECLCALLBACK(bool) pdmR3DevHlp_Untrusted_AssertVMLock(PPDMDEVINS pDevIns, const char *pszFile, unsigned iLine, const char *pszFunction)
    38913910{
     
    38963915
    38973916
    3898 /** @copydoc PDMDEVHLP::pfnDMARegister */
     3917/** @copydoc PDMDEVHLPR3::pfnDMARegister */
    38993918static DECLCALLBACK(int) pdmR3DevHlp_Untrusted_DMARegister(PPDMDEVINS pDevIns, unsigned uChannel, PFNDMATRANSFERHANDLER pfnTransferHandler, void *pvUser)
    39003919{
     
    39053924
    39063925
    3907 /** @copydoc PDMDEVHLP::pfnDMAReadMemory */
     3926/** @copydoc PDMDEVHLPR3::pfnDMAReadMemory */
    39083927static DECLCALLBACK(int) pdmR3DevHlp_Untrusted_DMAReadMemory(PPDMDEVINS pDevIns, unsigned uChannel, void *pvBuffer, uint32_t off, uint32_t cbBlock, uint32_t *pcbRead)
    39093928{
     
    39163935
    39173936
    3918 /** @copydoc PDMDEVHLP::pfnDMAWriteMemory */
     3937/** @copydoc PDMDEVHLPR3::pfnDMAWriteMemory */
    39193938static DECLCALLBACK(int) pdmR3DevHlp_Untrusted_DMAWriteMemory(PPDMDEVINS pDevIns, unsigned uChannel, const void *pvBuffer, uint32_t off, uint32_t cbBlock, uint32_t *pcbWritten)
    39203939{
     
    39273946
    39283947
    3929 /** @copydoc PDMDEVHLP::pfnDMASetDREQ */
     3948/** @copydoc PDMDEVHLPR3::pfnDMASetDREQ */
    39303949static DECLCALLBACK(int) pdmR3DevHlp_Untrusted_DMASetDREQ(PPDMDEVINS pDevIns, unsigned uChannel, unsigned uLevel)
    39313950{
     
    39363955
    39373956
    3938 /** @copydoc PDMDEVHLP::pfnDMAGetChannelMode */
     3957/** @copydoc PDMDEVHLPR3::pfnDMAGetChannelMode */
    39393958static DECLCALLBACK(uint8_t) pdmR3DevHlp_Untrusted_DMAGetChannelMode(PPDMDEVINS pDevIns, unsigned uChannel)
    39403959{
     
    39453964
    39463965
    3947 /** @copydoc PDMDEVHLP::pfnDMASchedule */
     3966/** @copydoc PDMDEVHLPR3::pfnDMASchedule */
    39483967static DECLCALLBACK(void) pdmR3DevHlp_Untrusted_DMASchedule(PPDMDEVINS pDevIns)
    39493968{
     
    39533972
    39543973
    3955 /** @copydoc PDMDEVHLP::pfnCMOSWrite */
     3974/** @copydoc PDMDEVHLPR3::pfnCMOSWrite */
    39563975static DECLCALLBACK(int) pdmR3DevHlp_Untrusted_CMOSWrite(PPDMDEVINS pDevIns, unsigned iReg, uint8_t u8Value)
    39573976{
     
    39623981
    39633982
    3964 /** @copydoc PDMDEVHLP::pfnCMOSRead */
     3983/** @copydoc PDMDEVHLPR3::pfnCMOSRead */
    39653984static DECLCALLBACK(int) pdmR3DevHlp_Untrusted_CMOSRead(PPDMDEVINS pDevIns, unsigned iReg, uint8_t *pu8Value)
    39663985{
     
    39713990
    39723991
    3973 /** @copydoc PDMDEVHLP::pfnGetCpuId */
     3992/** @copydoc PDMDEVHLPR3::pfnGetCpuId */
    39743993static DECLCALLBACK(void) pdmR3DevHlp_Untrusted_GetCpuId(PPDMDEVINS pDevIns, uint32_t iLeaf,
    39753994                                                         uint32_t *pEax, uint32_t *pEbx, uint32_t *pEcx, uint32_t *pEdx)
     
    39803999
    39814000
    3982 /** @copydoc PDMDEVHLP::pfnROMProtectShadow */
     4001/** @copydoc PDMDEVHLPR3::pfnROMProtectShadow */
    39834002static DECLCALLBACK(int) pdmR3DevHlp_Untrusted_ROMProtectShadow(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTUINT cbRange)
    39844003{
     
    39894008
    39904009
    3991 /** @copydoc PDMDEVHLP::pfnMMIO2Register */
     4010/** @copydoc PDMDEVHLPR3::pfnMMIO2Register */
    39924011static DECLCALLBACK(int) pdmR3DevHlp_Untrusted_MMIO2Register(PPDMDEVINS pDevIns, uint32_t iRegion, RTGCPHYS cb, uint32_t fFlags, void **ppv, const char *pszDesc)
    39934012{
     
    39984017
    39994018
    4000 /** @copydoc PDMDEVHLP::pfnMMIO2Deregister */
     4019/** @copydoc PDMDEVHLPR3::pfnMMIO2Deregister */
    40014020static DECLCALLBACK(int) pdmR3DevHlp_Untrusted_MMIO2Deregister(PPDMDEVINS pDevIns, uint32_t iRegion)
    40024021{
     
    40074026
    40084027
    4009 /** @copydoc PDMDEVHLP::pfnMMIO2Map */
     4028/** @copydoc PDMDEVHLPR3::pfnMMIO2Map */
    40104029static DECLCALLBACK(int) pdmR3DevHlp_Untrusted_MMIO2Map(PPDMDEVINS pDevIns, uint32_t iRegion, RTGCPHYS GCPhys)
    40114030{
     
    40164035
    40174036
    4018 /** @copydoc PDMDEVHLP::pfnMMIO2Unmap */
     4037/** @copydoc PDMDEVHLPR3::pfnMMIO2Unmap */
    40194038static DECLCALLBACK(int) pdmR3DevHlp_Untrusted_MMIO2Unmap(PPDMDEVINS pDevIns, uint32_t iRegion, RTGCPHYS GCPhys)
    40204039{
     
    40254044
    40264045
    4027 /** @copydoc PDMDEVHLP::pfnMMHyperMapMMIO2 */
     4046/** @copydoc PDMDEVHLPR3::pfnMMHyperMapMMIO2 */
    40284047static DECLCALLBACK(int) pdmR3DevHlp_Untrusted_MMHyperMapMMIO2(PPDMDEVINS pDevIns, uint32_t iRegion, RTGCPHYS off, RTGCPHYS cb, const char *pszDesc, PRTRCPTR pRCPtr)
    40294048{
     
    40344053
    40354054
    4036 /** @copydoc PDMDEVHLP::pfnRegisterVMMDevHeap */
     4055/** @copydoc PDMDEVHLPR3::pfnRegisterVMMDevHeap */
    40374056static DECLCALLBACK(int) pdmR3DevHlp_Untrusted_RegisterVMMDevHeap(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, RTR3PTR pvHeap, unsigned cbSize)
    40384057{
     
    40434062
    40444063
    4045 /** @copydoc PDMDEVHLP::pfnUnregisterVMMDevHeap */
     4064/** @copydoc PDMDEVHLPR3::pfnUnregisterVMMDevHeap */
    40464065static DECLCALLBACK(int) pdmR3DevHlp_Untrusted_UnregisterVMMDevHeap(PPDMDEVINS pDevIns, RTGCPHYS GCPhys)
    40474066{
     
    40594078{
    40604079    PDMDEV_ASSERT_DEVINS(pDevIns);
    4061     PVM pVM = pDevIns->Internal.s.pVMHC;
     4080    PVM pVM = pDevIns->Internal.s.pVMR3;
    40624081    LogFlow(("pdmR3PicHlp_SetInterruptFF: caller='%s'/%d: VM_FF_INTERRUPT_PIC %d -> 1\n",
    40634082             pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, VMCPU_FF_ISSET(pVM, 0, VM_FF_INTERRUPT_PIC)));
     
    40744093    PDMDEV_ASSERT_DEVINS(pDevIns);
    40754094    LogFlow(("pdmR3PicHlp_ClearInterruptFF: caller='%s'/%d: VM_FF_INTERRUPT_PIC %d -> 0\n",
    4076              pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, VMCPU_FF_ISSET(pDevIns->Internal.s.pVMHC, 0, VM_FF_INTERRUPT_PIC)));
     4095             pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, VMCPU_FF_ISSET(pDevIns->Internal.s.pVMR3, 0, VM_FF_INTERRUPT_PIC)));
    40774096    /* for PIC we always deliver to CPU 0, MP use APIC */
    4078     VMCPU_FF_CLEAR(pDevIns->Internal.s.pVMHC, 0, VM_FF_INTERRUPT_PIC);
    4079     REMR3NotifyInterruptClear(pDevIns->Internal.s.pVMHC);
     4097    VMCPU_FF_CLEAR(pDevIns->Internal.s.pVMR3, 0, VM_FF_INTERRUPT_PIC);
     4098    REMR3NotifyInterruptClear(pDevIns->Internal.s.pVMR3);
    40804099}
    40814100
     
    40854104{
    40864105    PDMDEV_ASSERT_DEVINS(pDevIns);
    4087     return pdmLockEx(pDevIns->Internal.s.pVMHC, rc);
     4106    return pdmLockEx(pDevIns->Internal.s.pVMR3, rc);
    40884107}
    40894108
     
    40934112{
    40944113    PDMDEV_ASSERT_DEVINS(pDevIns);
    4095     pdmUnlock(pDevIns->Internal.s.pVMHC);
     4114    pdmUnlock(pDevIns->Internal.s.pVMR3);
    40964115}
    40974116
     
    41014120{
    41024121    PDMDEV_ASSERT_DEVINS(pDevIns);
    4103     VM_ASSERT_EMT(pDevIns->Internal.s.pVMHC);
     4122    VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
    41044123    RTRCPTR pRCHelpers = 0;
    4105     int rc = PDMR3GetSymbolGC(pDevIns->Internal.s.pVMHC, NULL, "g_pdmRCPicHlp", &pRCHelpers);
     4124    int rc = PDMR3GetSymbolGC(pDevIns->Internal.s.pVMR3, NULL, "g_pdmRCPicHlp", &pRCHelpers);
    41064125    AssertReleaseRC(rc);
    41074126    AssertRelease(pRCHelpers);
     
    41164135{
    41174136    PDMDEV_ASSERT_DEVINS(pDevIns);
    4118     VM_ASSERT_EMT(pDevIns->Internal.s.pVMHC);
     4137    VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
    41194138    PCPDMPICHLPR0 pR0Helpers = 0;
    4120     int rc = PDMR3GetSymbolR0(pDevIns->Internal.s.pVMHC, NULL, "g_pdmR0PicHlp", &pR0Helpers);
     4139    int rc = PDMR3GetSymbolR0(pDevIns->Internal.s.pVMR3, NULL, "g_pdmR0PicHlp", &pR0Helpers);
    41214140    AssertReleaseRC(rc);
    41224141    AssertRelease(pR0Helpers);
     
    41314150{
    41324151    PDMDEV_ASSERT_DEVINS(pDevIns);
    4133     PVM pVM = pDevIns->Internal.s.pVMHC;
     4152    PVM pVM = pDevIns->Internal.s.pVMR3;
    41344153    LogFlow(("pdmR3ApicHlp_SetInterruptFF: caller='%s'/%d: VM_FF_INTERRUPT %d -> 1\n",
    41354154             pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, VMCPU_FF_ISSET(pVM, idCpu, VM_FF_INTERRUPT_APIC)));
     
    41454164    PDMDEV_ASSERT_DEVINS(pDevIns);
    41464165    LogFlow(("pdmR3ApicHlp_ClearInterruptFF: caller='%s'/%d: VM_FF_INTERRUPT %d -> 0\n",
    4147              pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, VMCPU_FF_ISSET(pDevIns->Internal.s.pVMHC, idCpu, VM_FF_INTERRUPT_APIC)));
    4148     VMCPU_FF_CLEAR(pDevIns->Internal.s.pVMHC, idCpu, VM_FF_INTERRUPT_APIC);
    4149     REMR3NotifyInterruptClear(pDevIns->Internal.s.pVMHC);
     4166             pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, VMCPU_FF_ISSET(pDevIns->Internal.s.pVMR3, idCpu, VM_FF_INTERRUPT_APIC)));
     4167    VMCPU_FF_CLEAR(pDevIns->Internal.s.pVMR3, idCpu, VM_FF_INTERRUPT_APIC);
     4168    REMR3NotifyInterruptClear(pDevIns->Internal.s.pVMR3);
    41504169}
    41514170
     
    41584177             pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, fEnabled));
    41594178    if (fEnabled)
    4160         CPUMSetGuestCpuIdFeature(pDevIns->Internal.s.pVMHC, CPUMCPUIDFEATURE_APIC);
     4179        CPUMSetGuestCpuIdFeature(pDevIns->Internal.s.pVMR3, CPUMCPUIDFEATURE_APIC);
    41614180    else
    4162         CPUMClearGuestCpuIdFeature(pDevIns->Internal.s.pVMHC, CPUMCPUIDFEATURE_APIC);
     4181        CPUMClearGuestCpuIdFeature(pDevIns->Internal.s.pVMR3, CPUMCPUIDFEATURE_APIC);
    41634182}
    41644183
     
    41674186{
    41684187    PDMDEV_ASSERT_DEVINS(pDevIns);
    4169     return pdmLockEx(pDevIns->Internal.s.pVMHC, rc);
     4188    return pdmLockEx(pDevIns->Internal.s.pVMR3, rc);
    41704189}
    41714190
     
    41754194{
    41764195    PDMDEV_ASSERT_DEVINS(pDevIns);
    4177     pdmUnlock(pDevIns->Internal.s.pVMHC);
     4196    pdmUnlock(pDevIns->Internal.s.pVMR3);
    41784197}
    41794198
     
    41834202{
    41844203    PDMDEV_ASSERT_DEVINS(pDevIns);
    4185     return VMMGetCpuId(pDevIns->Internal.s.pVMHC);
     4204    return VMMGetCpuId(pDevIns->Internal.s.pVMR3);
    41864205}
    41874206
     
    41914210{
    41924211    PDMDEV_ASSERT_DEVINS(pDevIns);
    4193     VM_ASSERT_EMT(pDevIns->Internal.s.pVMHC);
     4212    VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
    41944213    RTRCPTR pRCHelpers = 0;
    4195     int rc = PDMR3GetSymbolGC(pDevIns->Internal.s.pVMHC, NULL, "g_pdmRCApicHlp", &pRCHelpers);
     4214    int rc = PDMR3GetSymbolGC(pDevIns->Internal.s.pVMR3, NULL, "g_pdmRCApicHlp", &pRCHelpers);
    41964215    AssertReleaseRC(rc);
    41974216    AssertRelease(pRCHelpers);
     
    42064225{
    42074226    PDMDEV_ASSERT_DEVINS(pDevIns);
    4208     VM_ASSERT_EMT(pDevIns->Internal.s.pVMHC);
     4227    VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
    42094228    PCPDMAPICHLPR0 pR0Helpers = 0;
    4210     int rc = PDMR3GetSymbolR0(pDevIns->Internal.s.pVMHC, NULL, "g_pdmR0ApicHlp", &pR0Helpers);
     4229    int rc = PDMR3GetSymbolR0(pDevIns->Internal.s.pVMR3, NULL, "g_pdmR0ApicHlp", &pR0Helpers);
    42114230    AssertReleaseRC(rc);
    42124231    AssertRelease(pR0Helpers);
     
    42224241{
    42234242    PDMDEV_ASSERT_DEVINS(pDevIns);
    4224     PVM pVM = pDevIns->Internal.s.pVMHC;
     4243    PVM pVM = pDevIns->Internal.s.pVMR3;
    42254244    LogFlow(("pdmR3IoApicHlp_ApicBusDeliver: caller='%s'/%d: u8Dest=%RX8 u8DestMode=%RX8 u8DeliveryMode=%RX8 iVector=%RX8 u8Polarity=%RX8 u8TriggerMode=%RX8\n",
    42264245             pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, u8Dest, u8DestMode, u8DeliveryMode, iVector, u8Polarity, u8TriggerMode));
     
    42344253{
    42354254    PDMDEV_ASSERT_DEVINS(pDevIns);
    4236     return pdmLockEx(pDevIns->Internal.s.pVMHC, rc);
     4255    return pdmLockEx(pDevIns->Internal.s.pVMR3, rc);
    42374256}
    42384257
     
    42424261{
    42434262    PDMDEV_ASSERT_DEVINS(pDevIns);
    4244     pdmUnlock(pDevIns->Internal.s.pVMHC);
     4263    pdmUnlock(pDevIns->Internal.s.pVMR3);
    42454264}
    42464265
     
    42504269{
    42514270    PDMDEV_ASSERT_DEVINS(pDevIns);
    4252     VM_ASSERT_EMT(pDevIns->Internal.s.pVMHC);
     4271    VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
    42534272    RTRCPTR pRCHelpers = 0;
    4254     int rc = PDMR3GetSymbolGC(pDevIns->Internal.s.pVMHC, NULL, "g_pdmRCIoApicHlp", &pRCHelpers);
     4273    int rc = PDMR3GetSymbolGC(pDevIns->Internal.s.pVMR3, NULL, "g_pdmRCIoApicHlp", &pRCHelpers);
    42554274    AssertReleaseRC(rc);
    42564275    AssertRelease(pRCHelpers);
     
    42654284{
    42664285    PDMDEV_ASSERT_DEVINS(pDevIns);
    4267     VM_ASSERT_EMT(pDevIns->Internal.s.pVMHC);
     4286    VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
    42684287    PCPDMIOAPICHLPR0 pR0Helpers = 0;
    4269     int rc = PDMR3GetSymbolR0(pDevIns->Internal.s.pVMHC, NULL, "g_pdmR0IoApicHlp", &pR0Helpers);
     4288    int rc = PDMR3GetSymbolR0(pDevIns->Internal.s.pVMR3, NULL, "g_pdmR0IoApicHlp", &pR0Helpers);
    42704289    AssertReleaseRC(rc);
    42714290    AssertRelease(pR0Helpers);
     
    42814300    PDMDEV_ASSERT_DEVINS(pDevIns);
    42824301    Log4(("pdmR3PciHlp_IsaSetIrq: iIrq=%d iLevel=%d\n", iIrq, iLevel));
    4283     PDMIsaSetIrq(pDevIns->Internal.s.pVMHC, iIrq, iLevel);
     4302    PDMIsaSetIrq(pDevIns->Internal.s.pVMR3, iIrq, iLevel);
    42844303}
    42854304
     
    42904309    PDMDEV_ASSERT_DEVINS(pDevIns);
    42914310    Log4(("pdmR3PciHlp_IsaSetIrq: iIrq=%d iLevel=%d\n", iIrq, iLevel));
    4292     PDMIoApicSetIrq(pDevIns->Internal.s.pVMHC, iIrq, iLevel);
     4311    PDMIoApicSetIrq(pDevIns->Internal.s.pVMR3, iIrq, iLevel);
    42934312}
    42944313
     
    42984317{
    42994318    PDMDEV_ASSERT_DEVINS(pDevIns);
    4300     VM_ASSERT_EMT(pDevIns->Internal.s.pVMHC);
    4301     bool fRc = PGMR3PhysMMIO2IsBase(pDevIns->Internal.s.pVMHC, pOwner, GCPhys);
     4319    VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
     4320    bool fRc = PGMR3PhysMMIO2IsBase(pDevIns->Internal.s.pVMR3, pOwner, GCPhys);
    43024321    Log4(("pdmR3PciHlp_IsMMIO2Base: pOwner=%p GCPhys=%RGp -> %RTbool\n", pOwner, GCPhys, fRc));
    43034322    return fRc;
     
    43094328{
    43104329    PDMDEV_ASSERT_DEVINS(pDevIns);
    4311     return pdmLockEx(pDevIns->Internal.s.pVMHC, rc);
     4330    return pdmLockEx(pDevIns->Internal.s.pVMR3, rc);
    43124331}
    43134332
     
    43174336{
    43184337    PDMDEV_ASSERT_DEVINS(pDevIns);
    4319     pdmUnlock(pDevIns->Internal.s.pVMHC);
     4338    pdmUnlock(pDevIns->Internal.s.pVMR3);
    43204339}
    43214340
     
    43254344{
    43264345    PDMDEV_ASSERT_DEVINS(pDevIns);
    4327     VM_ASSERT_EMT(pDevIns->Internal.s.pVMHC);
     4346    VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
    43284347    RTRCPTR pRCHelpers = 0;
    4329     int rc = PDMR3GetSymbolGC(pDevIns->Internal.s.pVMHC, NULL, "g_pdmRCPciHlp", &pRCHelpers);
     4348    int rc = PDMR3GetSymbolGC(pDevIns->Internal.s.pVMR3, NULL, "g_pdmRCPciHlp", &pRCHelpers);
    43304349    AssertReleaseRC(rc);
    43314350    AssertRelease(pRCHelpers);
     
    43404359{
    43414360    PDMDEV_ASSERT_DEVINS(pDevIns);
    4342     VM_ASSERT_EMT(pDevIns->Internal.s.pVMHC);
     4361    VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
    43434362    PCPDMPCIHLPR0 pR0Helpers = 0;
    4344     int rc = PDMR3GetSymbolR0(pDevIns->Internal.s.pVMHC, NULL, "g_pdmR0PciHlp", &pR0Helpers);
     4363    int rc = PDMR3GetSymbolR0(pDevIns->Internal.s.pVMR3, NULL, "g_pdmR0PciHlp", &pR0Helpers);
    43454364    AssertReleaseRC(rc);
    43464365    AssertRelease(pR0Helpers);
     
    43764395             * Iterate device instances.
    43774396             */
    4378             for (PPDMDEVINS pDevIns = pDev->pInstances; pDevIns; pDevIns = pDevIns->Internal.s.pPerDeviceNextHC)
     4397            for (PPDMDEVINS pDevIns = pDev->pInstances; pDevIns; pDevIns = pDevIns->Internal.s.pPerDeviceNextR3)
    43794398            {
    43804399                if (pDevIns->iInstance == iInstance)
     
    43834402                     * Iterate luns.
    43844403                     */
    4385                     for (PPDMLUN pLun = pDevIns->Internal.s.pLunsHC; pLun; pLun = pLun->pNext)
     4404                    for (PPDMLUN pLun = pDevIns->Internal.s.pLunsR3; pLun; pLun = pLun->pNext)
    43864405                    {
    43874406                        if (pLun->iLun == iLun)
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