Index: /trunk/include/VBox/vmm/iom.h
===================================================================
--- /trunk/include/VBox/vmm/iom.h	(revision 82310)
+++ /trunk/include/VBox/vmm/iom.h	(revision 82311)
@@ -507,20 +507,4 @@
  * @deprecated
  * @{ */
-VMMR3_INT_DECL(int)  IOMR3IOPortRegisterR3(PVM pVM, PPDMDEVINS pDevIns, RTIOPORT PortStart, RTUINT cPorts, RTHCPTR pvUser,
-                                           R3PTRTYPE(PFNIOMIOPORTOUT) pfnOutCallback, R3PTRTYPE(PFNIOMIOPORTIN) pfnInCallback,
-                                           R3PTRTYPE(PFNIOMIOPORTOUTSTRING) pfnOutStringCallback, R3PTRTYPE(PFNIOMIOPORTINSTRING) pfnInStringCallback,
-                                           const char *pszDesc);
-#if 0
-VMMR3_INT_DECL(int)  IOMR3IOPortRegisterRC(PVM pVM, PPDMDEVINS pDevIns, RTIOPORT PortStart, RTUINT cPorts, RTRCPTR pvUser,
-                                           RCPTRTYPE(PFNIOMIOPORTOUT) pfnOutCallback, RCPTRTYPE(PFNIOMIOPORTIN) pfnInCallback,
-                                           RCPTRTYPE(PFNIOMIOPORTOUTSTRING) pfnOutStrCallback, RCPTRTYPE(PFNIOMIOPORTINSTRING) pfnInStrCallback,
-                                           const char *pszDesc);
-#endif
-VMMR3_INT_DECL(int)  IOMR3IOPortRegisterR0(PVM pVM, PPDMDEVINS pDevIns, RTIOPORT PortStart, RTUINT cPorts, RTR0PTR pvUser,
-                                           R0PTRTYPE(PFNIOMIOPORTOUT) pfnOutCallback, R0PTRTYPE(PFNIOMIOPORTIN) pfnInCallback,
-                                           R0PTRTYPE(PFNIOMIOPORTOUTSTRING) pfnOutStrCallback, R0PTRTYPE(PFNIOMIOPORTINSTRING) pfnInStrCallback,
-                                           const char *pszDesc);
-VMMR3_INT_DECL(int)  IOMR3IOPortDeregister(PVM pVM, PPDMDEVINS pDevIns, RTIOPORT PortStart, RTUINT cPorts);
-
 VMMR3_INT_DECL(int)  IOMR3MmioRegisterR3(PVM pVM, PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTGCPHYS cbRange, RTHCPTR pvUser,
                                          R3PTRTYPE(PFNIOMMMIOWRITE) pfnWriteCallback,
Index: /trunk/include/VBox/vmm/pdmdev.h
===================================================================
--- /trunk/include/VBox/vmm/pdmdev.h	(revision 82310)
+++ /trunk/include/VBox/vmm/pdmdev.h	(revision 82311)
@@ -1975,5 +1975,5 @@
 
 /** Current PDMDEVHLPR3 version number. */
-#define PDM_DEVHLPR3_VERSION                    PDM_VERSION_MAKE_PP(0xffe7, 38, 0)
+#define PDM_DEVHLPR3_VERSION                    PDM_VERSION_MAKE_PP(0xffe7, 39, 0)
 
 /**
@@ -2061,92 +2061,4 @@
     /** @}  */
 
-    /**
-     * Register a number of I/O ports with a device.
-     *
-     * These callbacks are of course for the host context (HC).
-     * Register HC handlers before guest context (GC) handlers! There must be a
-     * HC handler for every GC handler!
-     *
-     * @returns VBox status.
-     * @param   pDevIns             The device instance to register the ports with.
-     * @param   Port                First port number in the range.
-     * @param   cPorts              Number of ports to register.
-     * @param   pvUser              User argument.
-     * @param   pfnOut              Pointer to function which is gonna handle OUT operations.
-     * @param   pfnIn               Pointer to function which is gonna handle IN operations.
-     * @param   pfnOutStr           Pointer to function which is gonna handle string OUT operations.
-     * @param   pfnInStr            Pointer to function which is gonna handle string IN operations.
-     * @param   pszDesc             Pointer to description string. This must not be freed.
-     * @remarks Caller enters the device critical section prior to invoking the
-     *          registered callback methods.
-     * @deprecated
-     */
-    DECLR3CALLBACKMEMBER(int, pfnIOPortRegister,(PPDMDEVINS pDevIns, RTIOPORT Port, RTIOPORT cPorts, RTHCPTR pvUser,
-                                                 PFNIOMIOPORTOUT pfnOut, PFNIOMIOPORTIN pfnIn,
-                                                 PFNIOMIOPORTOUTSTRING pfnOutStr, PFNIOMIOPORTINSTRING pfnInStr, const char *pszDesc));
-
-    /**
-     * Register a number of I/O ports with a device for RC.
-     *
-     * These callbacks are for the raw-mode context (RC).  Register ring-3 context
-     * (R3) handlers before raw-mode context handlers!  There must be a R3 handler
-     * for every RC handler!
-     *
-     * @returns VBox status.
-     * @param   pDevIns             The device instance to register the ports with
-     *                              and which RC module to resolve the names
-     *                              against.
-     * @param   Port                First port number in the range.
-     * @param   cPorts              Number of ports to register.
-     * @param   pvUser              User argument.
-     * @param   pszOut              Name of the RC function which is gonna handle OUT operations.
-     * @param   pszIn               Name of the RC function which is gonna handle IN operations.
-     * @param   pszOutStr           Name of the RC function which is gonna handle string OUT operations.
-     * @param   pszInStr            Name of the RC function which is gonna handle string IN operations.
-     * @param   pszDesc             Pointer to description string. This must not be freed.
-     * @remarks Caller enters the device critical section prior to invoking the
-     *          registered callback methods.
-     * @deprecated
-     */
-    DECLR3CALLBACKMEMBER(int, pfnIOPortRegisterRC,(PPDMDEVINS pDevIns, RTIOPORT Port, RTIOPORT cPorts, RTRCPTR pvUser,
-                                                   const char *pszOut, const char *pszIn,
-                                                   const char *pszOutStr, const char *pszInStr, const char *pszDesc));
-
-    /**
-     * Register a number of I/O ports with a device.
-     *
-     * These callbacks are of course for the ring-0 host context (R0).
-     * Register R3 (HC) handlers before R0 (R0) handlers! There must be a R3 (HC) handler for every R0 handler!
-     *
-     * @returns VBox status.
-     * @param   pDevIns             The device instance to register the ports with.
-     * @param   Port                First port number in the range.
-     * @param   cPorts              Number of ports to register.
-     * @param   pvUser              User argument. (if pointer, then it must be in locked memory!)
-     * @param   pszOut              Name of the R0 function which is gonna handle OUT operations.
-     * @param   pszIn               Name of the R0 function which is gonna handle IN operations.
-     * @param   pszOutStr           Name of the R0 function which is gonna handle string OUT operations.
-     * @param   pszInStr            Name of the R0 function which is gonna handle string IN operations.
-     * @param   pszDesc             Pointer to description string. This must not be freed.
-     * @remarks Caller enters the device critical section prior to invoking the
-     *          registered callback methods.
-     * @deprecated
-     */
-    DECLR3CALLBACKMEMBER(int, pfnIOPortRegisterR0,(PPDMDEVINS pDevIns, RTIOPORT Port, RTIOPORT cPorts, RTR0PTR pvUser,
-                                                   const char *pszOut, const char *pszIn,
-                                                   const char *pszOutStr, const char *pszInStr, const char *pszDesc));
-
-    /**
-     * Deregister I/O ports.
-     *
-     * This naturally affects both guest context (GC), ring-0 (R0) and ring-3 (R3/HC) handlers.
-     *
-     * @returns VBox status.
-     * @param   pDevIns             The device instance owning the ports.
-     * @param   Port                First port number in the range.
-     * @param   cPorts              Number of ports to deregister.
-     */
-    DECLR3CALLBACKMEMBER(int, pfnIOPortDeregister,(PPDMDEVINS pDevIns, RTIOPORT Port, RTIOPORT cPorts));
-
     /** @name MMIO
      * @{ */
@@ -2437,143 +2349,4 @@
     DECLR3CALLBACKMEMBER(int, pfnMmio2ChangeRegionNo,(PPDMDEVINS pDevIns, PGMMMIO2HANDLE hRegion, uint32_t iNewRegion));
     /** @} */
-
-    /**
-     * Allocate and register a MMIO2 region.
-     *
-     * As mentioned elsewhere, MMIO2 is just RAM spelled differently.  It's RAM
-     * associated with a device.  It is also non-shared memory with a permanent
-     * ring-3 mapping and page backing (presently).
-     *
-     * @returns VBox status.
-     * @param   pDevIns             The device instance.
-     * @param   pPciDev             The PCI device the region is associated with, or
-     *                              NULL if no PCI device association.
-     * @param   iRegion             The region number. Use the PCI region number as
-     *                              this must be known to the PCI bus device too. If
-     *                              it's not associated with the PCI device, then
-     *                              any number up to UINT8_MAX is fine.
-     * @param   cb                  The size (in bytes) of the region.
-     * @param   fFlags              Reserved for future use, must be zero.
-     * @param   ppv                 Where to store the address of the ring-3 mapping
-     *                              of the memory.
-     * @param   pszDesc             Pointer to description string. This must not be
-     *                              freed.
-     * @thread  EMT.
-     * @deprecated
-     */
-    DECLR3CALLBACKMEMBER(int, pfnMMIO2Register,(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iRegion, RTGCPHYS cb,
-                                                uint32_t fFlags, void **ppv, const char *pszDesc));
-
-    /**
-     * Deregisters and frees a MMIO or MMIO2 region.
-     *
-     * Any physical (and virtual) access handlers registered for the region must
-     * be deregistered before calling this function (MMIO2 only).
-     *
-     * @returns VBox status code.
-     * @param   pDevIns             The device instance.
-     * @param   pPciDev             The PCI device the region is associated with, or
-     *                              NULL if not associated with any.
-     * @param   iRegion             The region number used during registration.
-     * @thread  EMT.
-     * @deprecated
-     */
-    DECLR3CALLBACKMEMBER(int, pfnMMIOExDeregister,(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iRegion));
-
-    /**
-     * Maps a MMIO or MMIO2 region into the physical memory space.
-     *
-     * A MMIO2 range or a pre-registered MMIO range may overlap with base memory if
-     * a lot of RAM is configured for the VM, in  which case we'll drop the base
-     * memory pages.  Presently we will make no attempt to preserve anything that
-     * happens to be present in the base memory that is replaced, this is of course
-     * incorrect but it's too much effort.
-     *
-     * @returns VBox status code.
-     * @param   pDevIns             The device instance.
-     * @param   pPciDev             The PCI device the region is associated with, or
-     *                              NULL if not associated with any.
-     * @param   iRegion             The region number used during registration.
-     * @param   GCPhys              The physical address to map it at.
-     * @thread  EMT.
-     * @deprecated for MMIO
-     */
-    DECLR3CALLBACKMEMBER(int, pfnMMIOExMap,(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iRegion, RTGCPHYS GCPhys));
-
-    /**
-     * Unmaps a MMIO or MMIO2 region previously mapped using pfnMMIOExMap.
-     *
-     * @returns VBox status code.
-     * @param   pDevIns             The device instance.
-     * @param   pPciDev             The PCI device the region is associated with, or
-     *                              NULL if not associated with any.
-     * @param   iRegion             The region number used during registration.
-     * @param   GCPhys              The physical address it's currently mapped at.
-     * @thread  EMT.
-     * @deprecated for MMIO
-     */
-    DECLR3CALLBACKMEMBER(int, pfnMMIOExUnmap,(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iRegion, RTGCPHYS GCPhys));
-
-    /**
-     * Reduces the length of a MMIO2 or pre-registered MMIO range.
-     *
-     * This is for implementations of PDMPCIDEV::pfnRegionLoadChangeHookR3 and will
-     * only work during saved state restore.  It will not call the PCI bus code, as
-     * that is expected to restore the saved resource configuration.
-     *
-     * It just adjusts the mapping length of the region so that when pfnMMIOExMap is
-     * called it will only map @a cbRegion bytes and not the value set during
-     * registration.
-     *
-     * @return VBox status code.
-     * @param   pDevIns             The device owning the range.
-     * @param   pPciDev             The PCI device the region is associated with, or
-     *                              NULL if not associated with any.
-     * @param   iRegion             The region.
-     * @param   cbRegion            The new size, must be smaller.
-     */
-    DECLR3CALLBACKMEMBER(int, pfnMMIOExReduce,(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iRegion, RTGCPHYS cbRegion));
-
-    /**
-     * Maps a portion of an MMIO2 region into the hypervisor region.
-     *
-     * Callers of this API must never deregister the MMIO2 region before the
-     * VM is powered off.
-     *
-     * @return VBox status code.
-     * @param   pDevIns             The device owning the MMIO2 memory.
-     * @param   pPciDev             The PCI device the region is associated with, or
-     *                              NULL if not associated with any.
-     * @param   iRegion             The region.
-     * @param   off                 The offset into the region. Will be rounded down
-     *                              to closest page boundary.
-     * @param   cb                  The number of bytes to map. Will be rounded up
-     *                              to the closest page boundary.
-     * @param   pszDesc             Mapping description.
-     * @param   pRCPtr              Where to store the RC address.
-     */
-    DECLR3CALLBACKMEMBER(int, pfnMMHyperMapMMIO2,(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iRegion, RTGCPHYS off,
-                                                  RTGCPHYS cb, const char *pszDesc, PRTRCPTR pRCPtr));
-
-    /**
-     * Maps a portion of an MMIO2 region into kernel space (host).
-     *
-     * The kernel mapping will become invalid when the MMIO2 memory is deregistered
-     * or the VM is terminated.
-     *
-     * @return VBox status code.
-     * @param   pDevIns             The device owning the MMIO2 memory.
-     * @param   pPciDev             The PCI device the region is associated with, or
-     *                              NULL if not associated with any.
-     * @param   iRegion             The region.
-     * @param   off                 The offset into the region. Must be page
-     *                              aligned.
-     * @param   cb                  The number of bytes to map. Must be page
-     *                              aligned.
-     * @param   pszDesc             Mapping description.
-     * @param   pR0Ptr              Where to store the R0 address.
-     */
-    DECLR3CALLBACKMEMBER(int, pfnMMIO2MapKernel,(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iRegion, RTGCPHYS off,
-                                                 RTGCPHYS cb, const char *pszDesc, PRTR0PTR pR0Ptr));
 
     /**
@@ -3227,5 +3000,6 @@
      *                              This must be kept in the instance data.
      *                              The PCI configuration must be initialized before registration.
-     * @param   fFlags              Reserved for future use, PDMPCIDEVREG_F_MBZ.
+     * @param   fFlags              0, PDMPCIDEVREG_F_PCI_BRIDGE or
+     *                              PDMPCIDEVREG_F_NOT_MANDATORY_NO.
      * @param   uPciDevNo           PDMPCIDEVREG_DEV_NO_FIRST_UNUSED,
      *                              PDMPCIDEVREG_DEV_NO_SAME_AS_PREV, or a specific
@@ -4088,22 +3862,4 @@
     DECLR3CALLBACKMEMBER(void, pfnPhysBulkReleasePageMappingLocks,(PPDMDEVINS pDevIns, uint32_t cPages, PPGMPAGEMAPLOCK paLocks));
 
-    /**
-     * Changes the number of an MMIO2 or pre-registered MMIO region.
-     *
-     * This should only be used to deal with saved state problems, so there is no
-     * convenience inline wrapper for this method.
-     *
-     * @returns VBox status code.
-     * @param   pDevIns             The device instance.
-     * @param   pPciDev             The PCI device the region is associated with, or
-     *                              NULL if not associated with any.
-     * @param   iRegion             The region.
-     * @param   iNewRegion          The new region index.
-     *
-     * @sa      @bugref{9359}
-     */
-    DECLR3CALLBACKMEMBER(int, pfnMMIOExChangeRegionNo,(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iRegion,
-                                                       uint32_t iNewRegion));
-
     /** Space reserved for future members.
      * @{ */
@@ -5727,42 +5483,4 @@
 
 /**
- * @copydoc PDMDEVHLPR3::pfnIOPortRegister
- */
-DECLINLINE(int) PDMDevHlpIOPortRegister(PPDMDEVINS pDevIns, RTIOPORT Port, RTIOPORT cPorts, RTHCPTR pvUser,
-                                        PFNIOMIOPORTOUT pfnOut, PFNIOMIOPORTIN pfnIn,
-                                        PFNIOMIOPORTOUTSTRING pfnOutStr, PFNIOMIOPORTINSTRING pfnInStr, const char *pszDesc)
-{
-    return pDevIns->pHlpR3->pfnIOPortRegister(pDevIns, Port, cPorts, pvUser, pfnOut, pfnIn, pfnOutStr, pfnInStr, pszDesc);
-}
-
-/**
- * @copydoc PDMDEVHLPR3::pfnIOPortRegisterRC
- */
-DECLINLINE(int) PDMDevHlpIOPortRegisterRC(PPDMDEVINS pDevIns, RTIOPORT Port, RTIOPORT cPorts, RTRCPTR pvUser,
-                                          const char *pszOut, const char *pszIn, const char *pszOutStr,
-                                          const char *pszInStr, const char *pszDesc)
-{
-    return pDevIns->pHlpR3->pfnIOPortRegisterRC(pDevIns, Port, cPorts, pvUser, pszOut, pszIn, pszOutStr, pszInStr, pszDesc);
-}
-
-/**
- * @copydoc PDMDEVHLPR3::pfnIOPortRegisterR0
- */
-DECLINLINE(int) PDMDevHlpIOPortRegisterR0(PPDMDEVINS pDevIns, RTIOPORT Port, RTIOPORT cPorts, RTR0PTR pvUser,
-                                          const char *pszOut, const char *pszIn, const char *pszOutStr,
-                                          const char *pszInStr, const char *pszDesc)
-{
-    return pDevIns->pHlpR3->pfnIOPortRegisterR0(pDevIns, Port, cPorts, pvUser, pszOut, pszIn, pszOutStr, pszInStr, pszDesc);
-}
-
-/**
- * @copydoc PDMDEVHLPR3::pfnIOPortDeregister
- */
-DECLINLINE(int) PDMDevHlpIOPortDeregister(PPDMDEVINS pDevIns, RTIOPORT Port, RTIOPORT cPorts)
-{
-    return pDevIns->pHlpR3->pfnIOPortDeregister(pDevIns, Port, cPorts);
-}
-
-/**
  * Combines PDMDevHlpIoPortCreate() & PDMDevHlpIoPortMap().
  */
@@ -6174,71 +5892,4 @@
 #endif /* !IN_RING3 || DOXYGEN_RUNNING */
 #ifdef IN_RING3
-
-/**
- * @copydoc PDMDEVHLPR3::pfnMMIO2Register
- */
-DECLINLINE(int) PDMDevHlpMMIO2Register(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iRegion, RTGCPHYS cb,
-                                       uint32_t fFlags, void **ppv, const char *pszDesc)
-{
-    return pDevIns->pHlpR3->pfnMMIO2Register(pDevIns, pPciDev, iRegion, cb, fFlags, ppv, pszDesc);
-}
-
-/**
- * @copydoc PDMDEVHLPR3::pfnMMIOExDeregister
- * @param   pPciDev             The PCI device the region is associated with, use
- *                              NULL to indicate it is not associated with a device.
- */
-DECLINLINE(int) PDMDevHlpMMIOExDeregister(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iRegion)
-{
-    return pDevIns->pHlpR3->pfnMMIOExDeregister(pDevIns, pPciDev, iRegion);
-}
-
-/**
- * @copydoc PDMDEVHLPR3::pfnMMIOExMap
- * @param   pPciDev             The PCI device the region is associated with, use
- *                              NULL to indicate it is not associated with a device.
- */
-DECLINLINE(int) PDMDevHlpMMIOExMap(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iRegion, RTGCPHYS GCPhys)
-{
-    return pDevIns->pHlpR3->pfnMMIOExMap(pDevIns, pPciDev, iRegion, GCPhys);
-}
-
-/**
- * @copydoc PDMDEVHLPR3::pfnMMIOExUnmap
- * @param   pPciDev             The PCI device the region is associated with, use
- *                              NULL to indicate it is not associated with a device.
- */
-DECLINLINE(int) PDMDevHlpMMIOExUnmap(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iRegion, RTGCPHYS GCPhys)
-{
-    return pDevIns->pHlpR3->pfnMMIOExUnmap(pDevIns, pPciDev, iRegion, GCPhys);
-}
-
-/**
- * @copydoc PDMDEVHLPR3::pfnMMIOExReduce
- */
-DECLINLINE(int) PDMDevHlpMMIOExReduce(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iRegion, RTGCPHYS cbRegion)
-{
-    return pDevIns->pHlpR3->pfnMMIOExReduce(pDevIns, pPciDev, iRegion, cbRegion);
-}
-
-#ifdef VBOX_WITH_RAW_MODE_KEEP
-/**
- * @copydoc PDMDEVHLPR3::pfnMMHyperMapMMIO2
- */
-DECLINLINE(int) PDMDevHlpMMHyperMapMMIO2(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iRegion, RTGCPHYS off, RTGCPHYS cb,
-                                         const char *pszDesc, PRTRCPTR pRCPtr)
-{
-    return pDevIns->pHlpR3->pfnMMHyperMapMMIO2(pDevIns, pPciDev, iRegion, off, cb, pszDesc, pRCPtr);
-}
-#endif
-
-/**
- * @copydoc PDMDEVHLPR3::pfnMMIO2MapKernel
- */
-DECLINLINE(int) PDMDevHlpMMIO2MapKernel(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iRegion, RTGCPHYS off, RTGCPHYS cb,
-                                         const char *pszDesc, PRTR0PTR pR0Ptr)
-{
-    return pDevIns->pHlpR3->pfnMMIO2MapKernel(pDevIns, pPciDev, iRegion, off, cb, pszDesc, pR0Ptr);
-}
 
 /**
@@ -6831,36 +6482,4 @@
 
 /**
- * Registers a I/O region (memory mapped or I/O ports) for the default PCI
- * device.
- *
- * @returns VBox status code.
- * @param   pDevIns             The device instance.
- * @param   iRegion             The region number.
- * @param   cbRegion            Size of the region.
- * @param   enmType             PCI_ADDRESS_SPACE_MEM, PCI_ADDRESS_SPACE_IO or PCI_ADDRESS_SPACE_MEM_PREFETCH.
- * @param   pfnMapUnmap         Callback for doing the mapping.
- * @remarks The callback will be invoked holding the PDM lock. The device lock
- *          is NOT take because that is very likely be a lock order violation.
- * @remarks Old callback style, won't get unmap calls.
- */
-DECLINLINE(int) PDMDevHlpPCIIORegionRegister(PPDMDEVINS pDevIns, uint32_t iRegion, RTGCPHYS cbRegion,
-                                             PCIADDRESSSPACE enmType, PFNPCIIOREGIONMAP pfnMapUnmap)
-{
-    return pDevIns->pHlpR3->pfnPCIIORegionRegister(pDevIns, NULL, iRegion, cbRegion, enmType,
-                                                   PDMPCIDEV_IORGN_F_NO_HANDLE, UINT64_MAX, pfnMapUnmap);
-}
-
-/**
- * @sa PDMDEVHLPR3::pfnPCIIORegionRegister
- * @remarks Old callback style, won't get unmap calls.
- */
-DECLINLINE(int) PDMDevHlpPCIIORegionRegisterEx(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iRegion, RTGCPHYS cbRegion,
-                                               PCIADDRESSSPACE enmType, PFNPCIIOREGIONMAP pfnMapUnmap)
-{
-    return pDevIns->pHlpR3->pfnPCIIORegionRegister(pDevIns, pPciDev, iRegion, cbRegion, enmType,
-                                                   PDMPCIDEV_IORGN_F_NO_HANDLE, UINT64_MAX, pfnMapUnmap);
-}
-
-/**
  * Registers a I/O port region for the default PCI device.
  *
@@ -7062,5 +6681,6 @@
     if (RT_SUCCESS(rc))
         rc = pDevIns->pHlpR3->pfnPCIIORegionRegister(pDevIns, pDevIns->apPciDevs[0], iPciRegion, cbRegion, enmType,
-                                                     PDMPCIDEV_IORGN_F_MMIO2_HANDLE, *phRegion, NULL /*pfnCallback*/);
+                                                     PDMPCIDEV_IORGN_F_MMIO2_HANDLE | PDMPCIDEV_IORGN_F_NEW_STYLE,
+                                                     *phRegion, NULL /*pfnCallback*/);
     return rc;
 }
@@ -7097,5 +6717,6 @@
     if (RT_SUCCESS(rc))
         rc = pDevIns->pHlpR3->pfnPCIIORegionRegister(pDevIns, pDevIns->apPciDevs[0], iPciRegion, cbRegion, enmType,
-                                                     PDMPCIDEV_IORGN_F_MMIO2_HANDLE, *phRegion, pfnMapUnmap);
+                                                     PDMPCIDEV_IORGN_F_MMIO2_HANDLE | PDMPCIDEV_IORGN_F_NEW_STYLE,
+                                                     *phRegion, pfnMapUnmap);
     return rc;
 }
Index: /trunk/src/VBox/VMM/VMMAll/IOMAll.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMAll/IOMAll.cpp	(revision 82310)
+++ /trunk/src/VBox/VMM/VMMAll/IOMAll.cpp	(revision 82311)
@@ -142,128 +142,7 @@
 
     /*
-     * Old code
-     * Old code
-     * Old code
-     */
-
-#ifdef VBOX_WITH_STATISTICS
-    /*
-     * Get the statistics record.
-     */
-    PIOMIOPORTSTATS  pStats = pVCpu->iom.s.CTX_SUFF(pStatsLastRead);
-    if (!pStats || pStats->Core.Key != Port)
-    {
-        pStats = (PIOMIOPORTSTATS)RTAvloIOPortGet(&pVM->iom.s.CTX_SUFF(pTrees)->IOPortStatTree, Port);
-        if (pStats)
-            pVCpu->iom.s.CTX_SUFF(pStatsLastRead) = pStats;
-    }
-#endif
-
-    /*
-     * Get handler for current context.
-     */
-    CTX_SUFF(PIOMIOPORTRANGE) pRange = pVCpu->iom.s.CTX_SUFF(pRangeLastRead);
-    if (    !pRange
-        ||   (unsigned)Port - (unsigned)pRange->Port >= (unsigned)pRange->cPorts)
-    {
-        pRange = iomIOPortGetRange(pVM, Port);
-        if (pRange)
-            pVCpu->iom.s.CTX_SUFF(pRangeLastRead) = pRange;
-    }
-    MMHYPER_RC_ASSERT_RCPTR(pVM, pRange);
-    if (pRange)
-    {
-        /*
-         * Found a range, get the data in case we leave the IOM lock.
-         */
-        PFNIOMIOPORTIN  pfnInCallback = pRange->pfnInCallback;
-#ifndef IN_RING3
-        if (pfnInCallback)
-        { /* likely */ }
-        else
-        {
-            STAM_STATS({ if (pStats) STAM_COUNTER_INC(&pStats->InRZToR3); });
-            IOM_UNLOCK_SHARED(pVM);
-            return VINF_IOM_R3_IOPORT_READ;
-        }
-#endif
-        void           *pvUser    = pRange->pvUser;
-        PPDMDEVINS      pDevIns   = pRange->pDevIns;
-        IOM_UNLOCK_SHARED(pVM);
-
-        /*
-         * Call the device.
-         */
-        VBOXSTRICTRC rcStrict = PDMCritSectEnter(pDevIns->CTX_SUFF(pCritSectRo), VINF_IOM_R3_IOPORT_READ);
-        if (rcStrict == VINF_SUCCESS)
-        { /* likely */ }
-        else
-        {
-            STAM_STATS({ if (pStats) STAM_COUNTER_INC(&pStats->InRZToR3); });
-            return rcStrict;
-        }
-#ifdef VBOX_WITH_STATISTICS
-        if (pStats)
-        {
-            STAM_PROFILE_START(&pStats->CTX_SUFF_Z(ProfIn), a);
-            rcStrict = pfnInCallback(pDevIns, pvUser, Port, pu32Value, (unsigned)cbValue);
-            STAM_PROFILE_STOP(&pStats->CTX_SUFF_Z(ProfIn), a);
-        }
-        else
-#endif
-            rcStrict = pfnInCallback(pDevIns, pvUser, Port, pu32Value, (unsigned)cbValue);
-        PDMCritSectLeave(pDevIns->CTX_SUFF(pCritSectRo));
-
-#ifdef VBOX_WITH_STATISTICS
-        if (rcStrict == VINF_SUCCESS && pStats)
-            STAM_COUNTER_INC(&pStats->CTX_SUFF_Z(In));
-# ifndef IN_RING3
-        else if (rcStrict == VINF_IOM_R3_IOPORT_READ && pStats)
-            STAM_COUNTER_INC(&pStats->InRZToR3);
-# endif
-#endif
-        if (rcStrict == VERR_IOM_IOPORT_UNUSED)
-        {
-            /* make return value */
-            rcStrict = VINF_SUCCESS;
-            switch (cbValue)
-            {
-                case 1: *(uint8_t  *)pu32Value = 0xff; break;
-                case 2: *(uint16_t *)pu32Value = 0xffff; break;
-                case 4: *(uint32_t *)pu32Value = UINT32_C(0xffffffff); break;
-                default:
-                    AssertMsgFailed(("Invalid I/O port size %d. Port=%d\n", cbValue, Port));
-                    return VERR_IOM_INVALID_IOPORT_SIZE;
-            }
-        }
-        Log3(("IOMIOPortRead: Port=%RTiop *pu32=%08RX32 cb=%d rc=%Rrc\n", Port, *pu32Value, cbValue, VBOXSTRICTRC_VAL(rcStrict)));
-        return rcStrict;
-    }
-
-#ifndef IN_RING3
-    /*
-     * Handler in ring-3?
-     */
-    PIOMIOPORTRANGER3 pRangeR3 = iomIOPortGetRangeR3(pVM, Port);
-    if (pRangeR3)
-    {
-# ifdef VBOX_WITH_STATISTICS
-        if (pStats)
-            STAM_COUNTER_INC(&pStats->InRZToR3);
-# endif
-        IOM_UNLOCK_SHARED(pVM);
-        return VINF_IOM_R3_IOPORT_READ;
-    }
-#endif
-
-    /*
      * Ok, no handler for this port.
      */
-#ifdef VBOX_WITH_STATISTICS
-    if (pStats)
-        STAM_COUNTER_INC(&pStats->CTX_SUFF_Z(In));
-#endif
-
-    /* make return value */
+    IOM_UNLOCK_SHARED(pVM);
     switch (cbValue)
     {
@@ -272,10 +151,7 @@
         case 4: *(uint32_t *)pu32Value = UINT32_C(0xffffffff); break;
         default:
-            AssertMsgFailed(("Invalid I/O port size %d. Port=%d\n", cbValue, Port));
-            IOM_UNLOCK_SHARED(pVM);
-            return VERR_IOM_INVALID_IOPORT_SIZE;
+            AssertMsgFailedReturn(("Invalid I/O port size %d. Port=%d\n", cbValue, Port), VERR_IOM_INVALID_IOPORT_SIZE);
     }
     Log3(("IOMIOPortRead: Port=%RTiop *pu32=%08RX32 cb=%d rc=VINF_SUCCESS\n", Port, *pu32Value, cbValue));
-    IOM_UNLOCK_SHARED(pVM);
     return VINF_SUCCESS;
 }
@@ -421,166 +297,11 @@
 
     /*
-     * Old code
-     * Old code
-     * Old code
-     */
-
-#ifdef VBOX_WITH_STATISTICS
-    /*
-     * Get the statistics record.
-     */
-    PIOMIOPORTSTATS pStats = pVCpu->iom.s.CTX_SUFF(pStatsLastRead);
-    if (!pStats || pStats->Core.Key != uPort)
-    {
-        pStats = (PIOMIOPORTSTATS)RTAvloIOPortGet(&pVM->iom.s.CTX_SUFF(pTrees)->IOPortStatTree, uPort);
-        if (pStats)
-            pVCpu->iom.s.CTX_SUFF(pStatsLastRead) = pStats;
-    }
-#endif
-
-    /*
-     * Get handler for current context.
-     */
-    CTX_SUFF(PIOMIOPORTRANGE) pRange = pVCpu->iom.s.CTX_SUFF(pRangeLastRead);
-    if (    !pRange
-        ||   (unsigned)uPort - (unsigned)pRange->Port >= (unsigned)pRange->cPorts)
-    {
-        pRange = iomIOPortGetRange(pVM, uPort);
-        if (pRange)
-            pVCpu->iom.s.CTX_SUFF(pRangeLastRead) = pRange;
-    }
-    MMHYPER_RC_ASSERT_RCPTR(pVM, pRange);
-    if (pRange)
-    {
-        /*
-         * Found a range.
-         */
-        PFNIOMIOPORTINSTRING pfnInStrCallback = pRange->pfnInStrCallback;
-        PFNIOMIOPORTIN       pfnInCallback    = pRange->pfnInCallback;
-#ifndef IN_RING3
-        if (pfnInStrCallback || pfnInCallback)
-        { /* likely */ }
-        else
-        {
-            STAM_STATS({ if (pStats) STAM_COUNTER_INC(&pStats->InRZToR3); });
-            IOM_UNLOCK_SHARED(pVM);
-            return VINF_IOM_R3_IOPORT_READ;
-        }
-#endif
-        void           *pvUser    = pRange->pvUser;
-        PPDMDEVINS      pDevIns   = pRange->pDevIns;
-        IOM_UNLOCK_SHARED(pVM);
-
-        /*
-         * Call the device.
-         */
-        VBOXSTRICTRC rcStrict = PDMCritSectEnter(pDevIns->CTX_SUFF(pCritSectRo), VINF_IOM_R3_IOPORT_READ);
-        if (rcStrict == VINF_SUCCESS)
-        { /* likely */ }
-        else
-        {
-            STAM_STATS({ if (pStats) STAM_COUNTER_INC(&pStats->InRZToR3); });
-            return rcStrict;
-        }
-
-        /*
-         * First using the string I/O callback.
-         */
-        if (pfnInStrCallback)
-        {
-#ifdef VBOX_WITH_STATISTICS
-            if (pStats)
-            {
-                STAM_PROFILE_START(&pStats->CTX_SUFF_Z(ProfIn), a);
-                rcStrict = pfnInStrCallback(pDevIns, pvUser, uPort, (uint8_t *)pvDst, pcTransfers, cb);
-                STAM_PROFILE_STOP(&pStats->CTX_SUFF_Z(ProfIn), a);
-            }
-            else
-#endif
-                rcStrict = pfnInStrCallback(pDevIns, pvUser, uPort, (uint8_t *)pvDst, pcTransfers, cb);
-        }
-
-        /*
-         * Then doing the single I/O fallback.
-         */
-        if (   *pcTransfers > 0
-            && rcStrict == VINF_SUCCESS)
-        {
-            pvDst = (uint8_t *)pvDst + (cRequestedTransfers - *pcTransfers) * cb;
-            do
-            {
-                uint32_t u32Value = 0;
-#ifdef VBOX_WITH_STATISTICS
-                if (pStats)
-                {
-                    STAM_PROFILE_START(&pStats->CTX_SUFF_Z(ProfIn), a);
-                    rcStrict = pfnInCallback(pDevIns, pvUser, uPort, &u32Value, cb);
-                    STAM_PROFILE_STOP(&pStats->CTX_SUFF_Z(ProfIn), a);
-                }
-                else
-#endif
-                    rcStrict = pfnInCallback(pDevIns, pvUser, uPort, &u32Value, cb);
-                if (rcStrict == VERR_IOM_IOPORT_UNUSED)
-                {
-                    u32Value = UINT32_MAX;
-                    rcStrict = VINF_SUCCESS;
-                }
-                if (IOM_SUCCESS(rcStrict))
-                {
-                    switch (cb)
-                    {
-                        case 4: *(uint32_t *)pvDst =           u32Value; pvDst = (uint8_t *)pvDst + 4; break;
-                        case 2: *(uint16_t *)pvDst = (uint16_t)u32Value; pvDst = (uint8_t *)pvDst + 2; break;
-                        case 1: *(uint8_t  *)pvDst = (uint8_t )u32Value; pvDst = (uint8_t *)pvDst + 1; break;
-                        default: AssertFailed();
-                    }
-                    *pcTransfers -= 1;
-                }
-            } while (   *pcTransfers > 0
-                     && rcStrict == VINF_SUCCESS);
-        }
-        PDMCritSectLeave(pDevIns->CTX_SUFF(pCritSectRo));
-
-#ifdef VBOX_WITH_STATISTICS
-        if (rcStrict == VINF_SUCCESS && pStats)
-            STAM_COUNTER_INC(&pStats->CTX_SUFF_Z(In));
-# ifndef IN_RING3
-        else if (rcStrict == VINF_IOM_R3_IOPORT_READ && pStats)
-            STAM_COUNTER_INC(&pStats->InRZToR3);
-# endif
-#endif
-        Log3(("IOMIOPortReadStr: uPort=%RTiop pvDst=%p pcTransfer=%p:{%#x->%#x} cb=%d rc=%Rrc\n",
-              uPort, pvDst, pcTransfers, cRequestedTransfers, *pcTransfers, cb, VBOXSTRICTRC_VAL(rcStrict)));
-        return rcStrict;
-    }
-
-#ifndef IN_RING3
-    /*
-     * Handler in ring-3?
-     */
-    PIOMIOPORTRANGER3 pRangeR3 = iomIOPortGetRangeR3(pVM, uPort);
-    if (pRangeR3)
-    {
-# ifdef VBOX_WITH_STATISTICS
-        if (pStats)
-            STAM_COUNTER_INC(&pStats->InRZToR3);
-# endif
-        IOM_UNLOCK_SHARED(pVM);
-        return VINF_IOM_R3_IOPORT_READ;
-    }
-#endif
-
-    /*
      * Ok, no handler for this port.
      */
+    IOM_UNLOCK_SHARED(pVM);
     *pcTransfers = 0;
     memset(pvDst, 0xff, cRequestedTransfers * cb);
-#ifdef VBOX_WITH_STATISTICS
-    if (pStats)
-        STAM_COUNTER_INC(&pStats->CTX_SUFF_Z(In));
-#endif
     Log3(("IOMIOPortReadStr: uPort=%RTiop (unused) pvDst=%p pcTransfer=%p:{%#x->%#x} cb=%d rc=VINF_SUCCESS\n",
           uPort, pvDst, pcTransfers, cRequestedTransfers, *pcTransfers, cb));
-    IOM_UNLOCK_SHARED(pVM);
     return VINF_SUCCESS;
 }
@@ -703,123 +424,8 @@
 
     /*
-     * Old code
-     * Old code
-     * Old code
-     */
-
-#ifdef VBOX_WITH_STATISTICS
-    /*
-     * Find the statistics record.
-     */
-    PIOMIOPORTSTATS pStats = pVCpu->iom.s.CTX_SUFF(pStatsLastWrite);
-    if (!pStats || pStats->Core.Key != Port)
-    {
-        pStats = (PIOMIOPORTSTATS)RTAvloIOPortGet(&pVM->iom.s.CTX_SUFF(pTrees)->IOPortStatTree, Port);
-        if (pStats)
-            pVCpu->iom.s.CTX_SUFF(pStatsLastWrite) = pStats;
-    }
-#endif
-
-    /*
-     * Get handler for current context.
-     */
-    CTX_SUFF(PIOMIOPORTRANGE) pRange = pVCpu->iom.s.CTX_SUFF(pRangeLastWrite);
-    if (    !pRange
-        ||   (unsigned)Port - (unsigned)pRange->Port >= (unsigned)pRange->cPorts)
-    {
-        pRange = iomIOPortGetRange(pVM, Port);
-        if (pRange)
-            pVCpu->iom.s.CTX_SUFF(pRangeLastWrite) = pRange;
-    }
-    MMHYPER_RC_ASSERT_RCPTR(pVM, pRange);
-    if (pRange)
-    {
-        /*
-         * Found a range.
-         */
-        PFNIOMIOPORTOUT pfnOutCallback = pRange->pfnOutCallback;
-#ifndef IN_RING3
-        if (pfnOutCallback)
-        { /* likely */ }
-        else
-        {
-            STAM_STATS({ if (pStats) STAM_COUNTER_INC(&pStats->OutRZToR3); });
-            IOM_UNLOCK_SHARED(pVM);
-            return iomIOPortRing3WritePending(pVCpu, Port, u32Value, cbValue);
-        }
-#endif
-        void           *pvUser    = pRange->pvUser;
-        PPDMDEVINS      pDevIns   = pRange->pDevIns;
-        IOM_UNLOCK_SHARED(pVM);
-
-        /*
-         * Call the device.
-         */
-        VBOXSTRICTRC rcStrict = PDMCritSectEnter(pDevIns->CTX_SUFF(pCritSectRo), VINF_IOM_R3_IOPORT_WRITE);
-        if (rcStrict == VINF_SUCCESS)
-        { /* likely */ }
-        else
-        {
-            STAM_STATS({ if (pStats) STAM_COUNTER_INC(&pStats->OutRZToR3); });
-#ifndef IN_RING3
-            if (RT_LIKELY(rcStrict == VINF_IOM_R3_IOPORT_WRITE))
-                return iomIOPortRing3WritePending(pVCpu, Port, u32Value, cbValue);
-#endif
-            return rcStrict;
-        }
-#ifdef VBOX_WITH_STATISTICS
-        if (pStats)
-        {
-            STAM_PROFILE_START(&pStats->CTX_SUFF_Z(ProfOut), a);
-            rcStrict = pfnOutCallback(pDevIns, pvUser, Port, u32Value, (unsigned)cbValue);
-            STAM_PROFILE_STOP(&pStats->CTX_SUFF_Z(ProfOut), a);
-        }
-        else
-#endif
-            rcStrict = pfnOutCallback(pDevIns, pvUser, Port, u32Value, (unsigned)cbValue);
-        PDMCritSectLeave(pDevIns->CTX_SUFF(pCritSectRo));
-
-#ifdef VBOX_WITH_STATISTICS
-        if (rcStrict == VINF_SUCCESS && pStats)
-            STAM_COUNTER_INC(&pStats->CTX_SUFF_Z(Out));
-# ifndef IN_RING3
-        else if (rcStrict == VINF_IOM_R3_IOPORT_WRITE && pStats)
-            STAM_COUNTER_INC(&pStats->OutRZToR3);
-# endif
-#endif
-        Log3(("IOMIOPortWrite: Port=%RTiop u32=%08RX32 cb=%d rc=%Rrc\n", Port, u32Value, cbValue, VBOXSTRICTRC_VAL(rcStrict)));
-#ifndef IN_RING3
-        if (rcStrict == VINF_IOM_R3_IOPORT_WRITE)
-            return iomIOPortRing3WritePending(pVCpu, Port, u32Value, cbValue);
-#endif
-        return rcStrict;
-    }
-
-#ifndef IN_RING3
-    /*
-     * Handler in ring-3?
-     */
-    PIOMIOPORTRANGER3 pRangeR3 = iomIOPortGetRangeR3(pVM, Port);
-    if (pRangeR3)
-    {
-# ifdef VBOX_WITH_STATISTICS
-        if (pStats)
-            STAM_COUNTER_INC(&pStats->OutRZToR3);
-# endif
-        IOM_UNLOCK_SHARED(pVM);
-        return iomIOPortRing3WritePending(pVCpu, Port, u32Value, cbValue);
-    }
-#endif
-
-    /*
      * Ok, no handler for that port.
      */
-#ifdef VBOX_WITH_STATISTICS
-    /* statistics. */
-    if (pStats)
-        STAM_COUNTER_INC(&pStats->CTX_SUFF_Z(Out));
-#endif
+    IOM_UNLOCK_SHARED(pVM);
     Log3(("IOMIOPortWrite: Port=%RTiop u32=%08RX32 cb=%d nop\n", Port, u32Value, cbValue));
-    IOM_UNLOCK_SHARED(pVM);
     return VINF_SUCCESS;
 }
@@ -961,159 +567,10 @@
 
     /*
-     * Old code.
-     * Old code.
-     * Old code.
-     */
-
-#ifdef VBOX_WITH_STATISTICS
-    /*
-     * Get the statistics record.
-     */
-    PIOMIOPORTSTATS     pStats = pVCpu->iom.s.CTX_SUFF(pStatsLastWrite);
-    if (!pStats || pStats->Core.Key != uPort)
-    {
-        pStats = (PIOMIOPORTSTATS)RTAvloIOPortGet(&pVM->iom.s.CTX_SUFF(pTrees)->IOPortStatTree, uPort);
-        if (pStats)
-            pVCpu->iom.s.CTX_SUFF(pStatsLastWrite) = pStats;
-    }
-#endif
-
-    /*
-     * Get handler for current context.
-     */
-    CTX_SUFF(PIOMIOPORTRANGE) pRange = pVCpu->iom.s.CTX_SUFF(pRangeLastWrite);
-    if (    !pRange
-        ||   (unsigned)uPort - (unsigned)pRange->Port >= (unsigned)pRange->cPorts)
-    {
-        pRange = iomIOPortGetRange(pVM, uPort);
-        if (pRange)
-            pVCpu->iom.s.CTX_SUFF(pRangeLastWrite) = pRange;
-    }
-    MMHYPER_RC_ASSERT_RCPTR(pVM, pRange);
-    if (pRange)
-    {
-        /*
-         * Found a range.
-         */
-        PFNIOMIOPORTOUTSTRING   pfnOutStrCallback = pRange->pfnOutStrCallback;
-        PFNIOMIOPORTOUT         pfnOutCallback    = pRange->pfnOutCallback;
-#ifndef IN_RING3
-        if (pfnOutStrCallback || pfnOutCallback)
-        { /* likely */ }
-        else
-        {
-            STAM_STATS({ if (pStats) STAM_COUNTER_INC(&pStats->OutRZToR3); });
-            IOM_UNLOCK_SHARED(pVM);
-            return VINF_IOM_R3_IOPORT_WRITE;
-        }
-#endif
-        void           *pvUser    = pRange->pvUser;
-        PPDMDEVINS      pDevIns   = pRange->pDevIns;
-        IOM_UNLOCK_SHARED(pVM);
-
-        /*
-         * Call the device.
-         */
-        VBOXSTRICTRC rcStrict = PDMCritSectEnter(pDevIns->CTX_SUFF(pCritSectRo), VINF_IOM_R3_IOPORT_WRITE);
-        if (rcStrict == VINF_SUCCESS)
-        { /* likely */ }
-        else
-        {
-            STAM_STATS({ if (pStats) STAM_COUNTER_INC(&pStats->OutRZToR3); });
-            return rcStrict;
-        }
-
-        /*
-         * First using string I/O if possible.
-         */
-        if (pfnOutStrCallback)
-        {
-#ifdef VBOX_WITH_STATISTICS
-            if (pStats)
-            {
-                STAM_PROFILE_START(&pStats->CTX_SUFF_Z(ProfOut), a);
-                rcStrict = pfnOutStrCallback(pDevIns, pvUser, uPort, (uint8_t const *)pvSrc, pcTransfers, cb);
-                STAM_PROFILE_STOP(&pStats->CTX_SUFF_Z(ProfOut), a);
-            }
-            else
-#endif
-                rcStrict = pfnOutStrCallback(pDevIns, pvUser, uPort, (uint8_t const *)pvSrc, pcTransfers, cb);
-        }
-
-        /*
-         * Then doing the single I/O fallback.
-         */
-        if (   *pcTransfers > 0
-            && rcStrict == VINF_SUCCESS)
-        {
-            pvSrc = (uint8_t *)pvSrc + (cRequestedTransfers - *pcTransfers) * cb;
-            do
-            {
-                uint32_t u32Value;
-                switch (cb)
-                {
-                    case 4: u32Value = *(uint32_t *)pvSrc; pvSrc = (uint8_t const *)pvSrc + 4; break;
-                    case 2: u32Value = *(uint16_t *)pvSrc; pvSrc = (uint8_t const *)pvSrc + 2; break;
-                    case 1: u32Value = *(uint8_t  *)pvSrc; pvSrc = (uint8_t const *)pvSrc + 1; break;
-                    default: AssertFailed(); u32Value = UINT32_MAX;
-                }
-#ifdef VBOX_WITH_STATISTICS
-                if (pStats)
-                {
-                    STAM_PROFILE_START(&pStats->CTX_SUFF_Z(ProfOut), a);
-                    rcStrict = pfnOutCallback(pDevIns, pvUser, uPort, u32Value, cb);
-                    STAM_PROFILE_STOP(&pStats->CTX_SUFF_Z(ProfOut), a);
-                }
-                else
-#endif
-                    rcStrict = pfnOutCallback(pDevIns, pvUser, uPort, u32Value, cb);
-                if (IOM_SUCCESS(rcStrict))
-                    *pcTransfers -= 1;
-            } while (   *pcTransfers > 0
-                     && rcStrict == VINF_SUCCESS);
-        }
-
-        PDMCritSectLeave(pDevIns->CTX_SUFF(pCritSectRo));
-
-#ifdef VBOX_WITH_STATISTICS
-        if (rcStrict == VINF_SUCCESS && pStats)
-            STAM_COUNTER_INC(&pStats->CTX_SUFF_Z(Out));
-# ifndef IN_RING3
-        else if (rcStrict == VINF_IOM_R3_IOPORT_WRITE && pStats)
-            STAM_COUNTER_INC(&pStats->OutRZToR3);
-# endif
-#endif
-        Log3(("IOMIOPortWriteStr: uPort=%RTiop pvSrc=%p pcTransfer=%p:{%#x->%#x} cb=%d rcStrict=%Rrc\n",
-              uPort, pvSrc, pcTransfers, cRequestedTransfers, *pcTransfers, cb, VBOXSTRICTRC_VAL(rcStrict)));
-        return rcStrict;
-    }
-
-#ifndef IN_RING3
-    /*
-     * Handler in ring-3?
-     */
-    PIOMIOPORTRANGER3 pRangeR3 = iomIOPortGetRangeR3(pVM, uPort);
-    if (pRangeR3)
-    {
-# ifdef VBOX_WITH_STATISTICS
-        if (pStats)
-            STAM_COUNTER_INC(&pStats->OutRZToR3);
-# endif
-        IOM_UNLOCK_SHARED(pVM);
-        return VINF_IOM_R3_IOPORT_WRITE;
-    }
-#endif
-
-    /*
      * Ok, no handler for this port.
      */
+    IOM_UNLOCK_SHARED(pVM);
     *pcTransfers = 0;
-#ifdef VBOX_WITH_STATISTICS
-    if (pStats)
-        STAM_COUNTER_INC(&pStats->CTX_SUFF_Z(Out));
-#endif
     Log3(("IOMIOPortWriteStr: uPort=%RTiop (unused) pvSrc=%p pcTransfer=%p:{%#x->%#x} cb=%d rc=VINF_SUCCESS\n",
           uPort, pvSrc, pcTransfers, cRequestedTransfers, *pcTransfers, cb));
-    IOM_UNLOCK_SHARED(pVM);
     return VINF_SUCCESS;
 }
Index: /trunk/src/VBox/VMM/VMMR3/IOM.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMR3/IOM.cpp	(revision 82310)
+++ /trunk/src/VBox/VMM/VMMR3/IOM.cpp	(revision 82311)
@@ -134,12 +134,4 @@
 *********************************************************************************************************************************/
 static void iomR3FlushCache(PVM pVM);
-#if 0
-static DECLCALLBACK(int) iomR3RelocateIOPortCallback(PAVLROIOPORTNODECORE pNode, void *pvUser);
-static DECLCALLBACK(int) iomR3RelocateMMIOCallback(PAVLROGCPHYSNODECORE pNode, void *pvUser);
-#endif
-static FNIOMIOPORTIN        iomR3IOPortDummyIn;
-static FNIOMIOPORTOUT       iomR3IOPortDummyOut;
-static FNIOMIOPORTINSTRING  iomR3IOPortDummyInStr;
-static FNIOMIOPORTOUTSTRING iomR3IOPortDummyOutStr;
 
 #ifdef VBOX_WITH_STATISTICS
@@ -302,15 +294,7 @@
     {
         PVMCPU pVCpu = pVM->apCpusR3[idCpu];
-        pVCpu->iom.s.pRangeLastReadR0  = NIL_RTR0PTR;
-        pVCpu->iom.s.pRangeLastWriteR0 = NIL_RTR0PTR;
-        pVCpu->iom.s.pStatsLastReadR0  = NIL_RTR0PTR;
-        pVCpu->iom.s.pStatsLastWriteR0 = NIL_RTR0PTR;
         pVCpu->iom.s.pMMIORangeLastR0  = NIL_RTR0PTR;
         pVCpu->iom.s.pMMIOStatsLastR0  = NIL_RTR0PTR;
 
-        pVCpu->iom.s.pRangeLastReadR3  = NULL;
-        pVCpu->iom.s.pRangeLastWriteR3 = NULL;
-        pVCpu->iom.s.pStatsLastReadR3  = NULL;
-        pVCpu->iom.s.pStatsLastWriteR3 = NULL;
         pVCpu->iom.s.pMMIORangeLastR3  = NULL;
         pVCpu->iom.s.pMMIOStatsLastR3  = NULL;
@@ -344,92 +328,6 @@
 VMMR3_INT_DECL(void) IOMR3Relocate(PVM pVM, RTGCINTPTR offDelta)
 {
-#if 0
-    LogFlow(("IOMR3Relocate: offDelta=%d\n", offDelta));
-
-    /*
-     * Apply relocations to the GC callbacks.
-     */
-    pVM->iom.s.pTreesRC = MMHyperR3ToRC(pVM, pVM->iom.s.pTreesR3);
-    RTAvlroIOPortDoWithAll(&pVM->iom.s.pTreesR3->IOPortTreeRC, true, iomR3RelocateIOPortCallback, &offDelta);
-    RTAvlroGCPhysDoWithAll(&pVM->iom.s.pTreesR3->MMIOTree,     true, iomR3RelocateMMIOCallback,   &offDelta);
-
-    /*
-     * Reset the raw-mode cache (don't bother relocating it).
-     */
-    VMCPUID idCpu = pVM->cCpus;
-    while (idCpu-- > 0)
-    {
-        PVMCPU pVCpu = pVM->apCpusR3[idCpu];
-        pVCpu->iom.s.pRangeLastReadRC  = NIL_RTRCPTR;
-        pVCpu->iom.s.pRangeLastWriteRC = NIL_RTRCPTR;
-        pVCpu->iom.s.pStatsLastReadRC  = NIL_RTRCPTR;
-        pVCpu->iom.s.pStatsLastWriteRC = NIL_RTRCPTR;
-        pVCpu->iom.s.pMMIORangeLastRC  = NIL_RTRCPTR;
-        pVCpu->iom.s.pMMIOStatsLastRC  = NIL_RTRCPTR;
-    }
-#else
     RT_NOREF(pVM, offDelta);
-#endif
-}
-
-#if 0
-
-/**
- * Callback function for relocating a I/O port range.
- *
- * @returns 0 (continue enum)
- * @param   pNode       Pointer to a IOMIOPORTRANGERC node.
- * @param   pvUser      Pointer to the offDelta. This is a pointer to the delta since we're
- *                      not certain the delta will fit in a void pointer for all possible configs.
- */
-static DECLCALLBACK(int) iomR3RelocateIOPortCallback(PAVLROIOPORTNODECORE pNode, void *pvUser)
-{
-    PIOMIOPORTRANGERC pRange = (PIOMIOPORTRANGERC)pNode;
-    RTGCINTPTR      offDelta = *(PRTGCINTPTR)pvUser;
-
-    Assert(pRange->pDevIns);
-    pRange->pDevIns                 += offDelta;
-    if (pRange->pfnOutCallback)
-        pRange->pfnOutCallback      += offDelta;
-    if (pRange->pfnInCallback)
-        pRange->pfnInCallback       += offDelta;
-    if (pRange->pfnOutStrCallback)
-        pRange->pfnOutStrCallback   += offDelta;
-    if (pRange->pfnInStrCallback)
-        pRange->pfnInStrCallback    += offDelta;
-    if (pRange->pvUser > _64K)
-        pRange->pvUser              += offDelta;
-    return 0;
-}
-
-
-/**
- * Callback function for relocating a MMIO range.
- *
- * @returns 0 (continue enum)
- * @param   pNode       Pointer to a IOMMMIORANGE node.
- * @param   pvUser      Pointer to the offDelta. This is a pointer to the delta since we're
- *                      not certain the delta will fit in a void pointer for all possible configs.
- */
-static DECLCALLBACK(int) iomR3RelocateMMIOCallback(PAVLROGCPHYSNODECORE pNode, void *pvUser)
-{
-    PIOMMMIORANGE pRange = (PIOMMMIORANGE)pNode;
-    RTGCINTPTR    offDelta = *(PRTGCINTPTR)pvUser;
-
-    if (pRange->pDevInsRC)
-        pRange->pDevInsRC           += offDelta;
-    if (pRange->pfnWriteCallbackRC)
-        pRange->pfnWriteCallbackRC  += offDelta;
-    if (pRange->pfnReadCallbackRC)
-        pRange->pfnReadCallbackRC   += offDelta;
-    if (pRange->pfnFillCallbackRC)
-        pRange->pfnFillCallbackRC   += offDelta;
-    if (pRange->pvUserRC > _64K)
-        pRange->pvUserRC            += offDelta;
-
-    return 0;
-}
-
-#endif
+}
 
 /**
@@ -454,65 +352,4 @@
 
 #ifdef VBOX_WITH_STATISTICS
-
-/**
- * Create the statistics node for an I/O port.
- *
- * @returns Pointer to new stats node.
- *
- * @param   pVM         The cross context VM structure.
- * @param   Port        Port.
- * @param   pszDesc     Description.
- */
-static PIOMIOPORTSTATS iomR3IOPortStatsCreate(PVM pVM, RTIOPORT Port, const char *pszDesc)
-{
-    IOM_LOCK_EXCL(pVM);
-
-    /* check if it already exists. */
-    PIOMIOPORTSTATS pPort = (PIOMIOPORTSTATS)RTAvloIOPortGet(&pVM->iom.s.pTreesR3->IOPortStatTree, Port);
-    if (pPort)
-    {
-        IOM_UNLOCK_EXCL(pVM);
-        return pPort;
-    }
-
-    /* allocate stats node. */
-    int rc = MMHyperAlloc(pVM, sizeof(*pPort), 0, MM_TAG_IOM_STATS, (void **)&pPort);
-    AssertRC(rc);
-    if (RT_SUCCESS(rc))
-    {
-        /* insert into the tree. */
-        pPort->Core.Key = Port;
-        if (RTAvloIOPortInsert(&pVM->iom.s.pTreesR3->IOPortStatTree, &pPort->Core))
-        {
-            IOM_UNLOCK_EXCL(pVM);
-
-            /* put a name on common ports. */
-            if (!pszDesc)
-                pszDesc = iomR3IOPortGetStandardName(Port);
-
-            /* register the statistics counters. */
-            rc = STAMR3RegisterF(pVM, &pPort->InR3,     STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_OCCURENCES, pszDesc,    "/IOM/Ports/%04x-In-R3", Port); AssertRC(rc);
-            rc = STAMR3RegisterF(pVM, &pPort->OutR3,    STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_OCCURENCES, pszDesc,    "/IOM/Ports/%04x-Out-R3", Port); AssertRC(rc);
-            rc = STAMR3RegisterF(pVM, &pPort->InRZ,     STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_OCCURENCES, pszDesc,    "/IOM/Ports/%04x-In-RZ", Port); AssertRC(rc);
-            rc = STAMR3RegisterF(pVM, &pPort->OutRZ,    STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_OCCURENCES, pszDesc,    "/IOM/Ports/%04x-Out-RZ", Port); AssertRC(rc);
-            rc = STAMR3RegisterF(pVM, &pPort->InRZToR3, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_OCCURENCES, pszDesc,    "/IOM/Ports/%04x-In-RZtoR3", Port); AssertRC(rc);
-            rc = STAMR3RegisterF(pVM, &pPort->OutRZToR3,STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_OCCURENCES, pszDesc,    "/IOM/Ports/%04x-Out-RZtoR3", Port); AssertRC(rc);
-
-            /* Profiling */
-            rc = STAMR3RegisterF(pVM, &pPort->ProfInR3, STAMTYPE_PROFILE, STAMVISIBILITY_USED, STAMUNIT_TICKS_PER_CALL, pszDesc,"/IOM/Ports/%04x-In-R3/Prof", Port); AssertRC(rc);
-            rc = STAMR3RegisterF(pVM, &pPort->ProfOutR3,STAMTYPE_PROFILE, STAMVISIBILITY_USED, STAMUNIT_TICKS_PER_CALL, pszDesc,"/IOM/Ports/%04x-Out-R3/Prof", Port); AssertRC(rc);
-            rc = STAMR3RegisterF(pVM, &pPort->ProfInRZ, STAMTYPE_PROFILE, STAMVISIBILITY_USED, STAMUNIT_TICKS_PER_CALL, pszDesc,"/IOM/Ports/%04x-In-RZ/Prof", Port); AssertRC(rc);
-            rc = STAMR3RegisterF(pVM, &pPort->ProfOutRZ,STAMTYPE_PROFILE, STAMVISIBILITY_USED, STAMUNIT_TICKS_PER_CALL, pszDesc,"/IOM/Ports/%04x-Out-RZ/Prof", Port); AssertRC(rc);
-
-            return pPort;
-        }
-
-        AssertMsgFailed(("what! Port=%d\n", Port));
-        MMHyperFree(pVM, pPort);
-    }
-    IOM_UNLOCK_EXCL(pVM);
-    return NULL;
-}
-
 
 /**
@@ -566,719 +403,4 @@
 
 #endif /* VBOX_WITH_STATISTICS */
-
-/**
- * Registers a I/O port ring-3 handler.
- *
- * This API is called by PDM on behalf of a device. Devices must first register
- * ring-3 ranges before any GC and R0 ranges can be registered using IOMR3IOPortRegisterRC()
- * and IOMR3IOPortRegisterR0().
- *
- *
- * @returns VBox status code.
- *
- * @param   pVM                 The cross context VM structure.
- * @param   pDevIns             PDM device instance owning the port range.
- * @param   PortStart           First port number in the range.
- * @param   cPorts              Number of ports to register.
- * @param   pvUser              User argument for the callbacks.
- * @param   pfnOutCallback      Pointer to function which is gonna handle OUT operations in R3.
- * @param   pfnInCallback       Pointer to function which is gonna handle IN operations in R3.
- * @param   pfnOutStrCallback   Pointer to function which is gonna handle string OUT operations in R3.
- * @param   pfnInStrCallback    Pointer to function which is gonna handle string IN operations in R3.
- * @param   pszDesc             Pointer to description string. This must not be freed.
- */
-VMMR3_INT_DECL(int) IOMR3IOPortRegisterR3(PVM pVM, PPDMDEVINS pDevIns, RTIOPORT PortStart, RTUINT cPorts, RTHCPTR pvUser,
-                                          R3PTRTYPE(PFNIOMIOPORTOUT) pfnOutCallback, R3PTRTYPE(PFNIOMIOPORTIN) pfnInCallback,
-                                          R3PTRTYPE(PFNIOMIOPORTOUTSTRING) pfnOutStrCallback, R3PTRTYPE(PFNIOMIOPORTINSTRING) pfnInStrCallback, const char *pszDesc)
-{
-    LogFlow(("IOMR3IOPortRegisterR3: pDevIns=%p PortStart=%#x cPorts=%#x pvUser=%RHv pfnOutCallback=%#x pfnInCallback=%#x pfnOutStrCallback=%#x pfnInStrCallback=%#x pszDesc=%s\n",
-             pDevIns, PortStart, cPorts, pvUser, pfnOutCallback, pfnInCallback, pfnOutStrCallback, pfnInStrCallback, pszDesc));
-
-    /*
-     * Validate input.
-     */
-    if (    (RTUINT)PortStart + cPorts <= (RTUINT)PortStart
-        ||  (RTUINT)PortStart + cPorts > 0x10000)
-    {
-        AssertMsgFailed(("Invalid port range %#x-%#x (inclusive)! (%s)\n", PortStart, (RTUINT)PortStart + (cPorts - 1), pszDesc));
-        return VERR_IOM_INVALID_IOPORT_RANGE;
-    }
-    if (!pfnOutCallback && !pfnInCallback)
-    {
-        AssertMsgFailed(("no handlers specfied for %#x-%#x (inclusive)! (%s)\n", PortStart, (RTUINT)PortStart + (cPorts - 1), pszDesc));
-        return VERR_INVALID_PARAMETER;
-    }
-    if (!pfnOutCallback)
-        pfnOutCallback = iomR3IOPortDummyOut;
-    if (!pfnInCallback)
-        pfnInCallback = iomR3IOPortDummyIn;
-    if (!pfnOutStrCallback)
-        pfnOutStrCallback = iomR3IOPortDummyOutStr;
-    if (!pfnInStrCallback)
-        pfnInStrCallback = iomR3IOPortDummyInStr;
-
-    /* Flush the IO port lookup cache */
-    iomR3FlushCache(pVM);
-
-    /*
-     * Allocate new range record and initialize it.
-     */
-    PIOMIOPORTRANGER3 pRange;
-    int rc = MMHyperAlloc(pVM, sizeof(*pRange), 0, MM_TAG_IOM, (void **)&pRange);
-    if (RT_SUCCESS(rc))
-    {
-        pRange->Core.Key        = PortStart;
-        pRange->Core.KeyLast    = PortStart + (cPorts - 1);
-        pRange->Port            = PortStart;
-        pRange->cPorts          = cPorts;
-        pRange->pvUser          = pvUser;
-        pRange->pDevIns         = pDevIns;
-        pRange->pfnOutCallback  = pfnOutCallback;
-        pRange->pfnInCallback   = pfnInCallback;
-        pRange->pfnOutStrCallback = pfnOutStrCallback;
-        pRange->pfnInStrCallback = pfnInStrCallback;
-        pRange->pszDesc         = pszDesc;
-
-        /*
-         * Try Insert it.
-         */
-        IOM_LOCK_EXCL(pVM);
-        if (RTAvlroIOPortInsert(&pVM->iom.s.pTreesR3->IOPortTreeR3, &pRange->Core))
-        {
-#ifdef VBOX_WITH_STATISTICS
-            for (unsigned iPort = 0; iPort < cPorts; iPort++)
-                iomR3IOPortStatsCreate(pVM, PortStart + iPort, pszDesc);
-#endif
-            IOM_UNLOCK_EXCL(pVM);
-            return VINF_SUCCESS;
-        }
-        IOM_UNLOCK_EXCL(pVM);
-
-        /* conflict. */
-        DBGFR3Info(pVM->pUVM, "ioport", NULL, NULL);
-        AssertMsgFailed(("Port range %#x-%#x (%s) conflicts with existing range(s)!\n", PortStart, (unsigned)PortStart + cPorts - 1, pszDesc));
-        MMHyperFree(pVM, pRange);
-        rc = VERR_IOM_IOPORT_RANGE_CONFLICT;
-    }
-
-    return rc;
-}
-
-
-#if 0
-/**
- * Registers a I/O port RC handler.
- *
- * This API is called by PDM on behalf of a device. Devices must first register ring-3 ranges
- * using IOMIOPortRegisterR3() before calling this function.
- *
- *
- * @returns VBox status code.
- *
- * @param   pVM                 The cross context VM structure.
- * @param   pDevIns             PDM device instance owning the port range.
- * @param   PortStart           First port number in the range.
- * @param   cPorts              Number of ports to register.
- * @param   pvUser              User argument for the callbacks.
- * @param   pfnOutCallback      Pointer to function which is gonna handle OUT operations in GC.
- * @param   pfnInCallback       Pointer to function which is gonna handle IN operations in GC.
- * @param   pfnOutStrCallback   Pointer to function which is gonna handle string OUT operations in GC.
- * @param   pfnInStrCallback    Pointer to function which is gonna handle string IN operations in GC.
- * @param   pszDesc             Pointer to description string. This must not be freed.
- */
-VMMR3_INT_DECL(int) IOMR3IOPortRegisterRC(PVM pVM, PPDMDEVINS pDevIns, RTIOPORT PortStart, RTUINT cPorts, RTRCPTR pvUser,
-                                          RCPTRTYPE(PFNIOMIOPORTOUT) pfnOutCallback, RCPTRTYPE(PFNIOMIOPORTIN) pfnInCallback,
-                                          RCPTRTYPE(PFNIOMIOPORTOUTSTRING) pfnOutStrCallback, RCPTRTYPE(PFNIOMIOPORTINSTRING) pfnInStrCallback, const char *pszDesc)
-{
-    LogFlow(("IOMR3IOPortRegisterRC: pDevIns=%p PortStart=%#x cPorts=%#x pvUser=%RRv pfnOutCallback=%RRv pfnInCallback=%RRv pfnOutStrCallback=%RRv pfnInStrCallback=%RRv pszDesc=%s\n",
-             pDevIns, PortStart, cPorts, pvUser, pfnOutCallback, pfnInCallback, pfnOutStrCallback, pfnInStrCallback, pszDesc));
-    AssertReturn(VM_IS_RAW_MODE_ENABLED(pVM), VERR_IOM_HM_IPE);
-
-    /*
-     * Validate input.
-     */
-    if (    (RTUINT)PortStart + cPorts <= (RTUINT)PortStart
-        ||  (RTUINT)PortStart + cPorts > 0x10000)
-    {
-        AssertMsgFailed(("Invalid port range %#x-%#x! (%s)\n", PortStart, (RTUINT)PortStart + (cPorts - 1), pszDesc));
-        return VERR_IOM_INVALID_IOPORT_RANGE;
-    }
-    RTIOPORT PortLast = PortStart + (cPorts - 1);
-    if (!pfnOutCallback && !pfnInCallback)
-    {
-        AssertMsgFailed(("Invalid port range %#x-%#x! No callbacks! (%s)\n", PortStart, PortLast, pszDesc));
-        return VERR_INVALID_PARAMETER;
-    }
-
-    IOM_LOCK_EXCL(pVM);
-
-    /*
-     * Validate that there are ring-3 ranges for the ports.
-     */
-    RTIOPORT Port = PortStart;
-    while (Port <= PortLast && Port >= PortStart)
-    {
-        PIOMIOPORTRANGER3 pRange = (PIOMIOPORTRANGER3)RTAvlroIOPortRangeGet(&pVM->iom.s.CTX_SUFF(pTrees)->IOPortTreeR3, Port);
-        if (!pRange)
-        {
-            AssertMsgFailed(("No R3! Port=%#x %#x-%#x! (%s)\n", Port, PortStart, (unsigned)PortStart + cPorts - 1, pszDesc));
-            IOM_UNLOCK_EXCL(pVM);
-            return VERR_IOM_NO_R3_IOPORT_RANGE;
-        }
-#ifndef IOM_NO_PDMINS_CHECKS
-        if (pRange->pDevIns != pDevIns)
-        {
-            AssertMsgFailed(("Not owner! Port=%#x %#x-%#x! (%s)\n", Port, PortStart, (unsigned)PortStart + cPorts - 1, pszDesc));
-            IOM_UNLOCK_EXCL(pVM);
-            return VERR_IOM_NOT_IOPORT_RANGE_OWNER;
-        }
-#endif
-        Port = pRange->Core.KeyLast + 1;
-    }
-
-    /* Flush the IO port lookup cache */
-    iomR3FlushCache(pVM);
-
-    /*
-     * Allocate new range record and initialize it.
-     */
-    PIOMIOPORTRANGERC pRange;
-    int rc = MMHyperAlloc(pVM, sizeof(*pRange), 0, MM_TAG_IOM, (void **)&pRange);
-    if (RT_SUCCESS(rc))
-    {
-        pRange->Core.Key        = PortStart;
-        pRange->Core.KeyLast    = PortLast;
-        pRange->Port            = PortStart;
-        pRange->cPorts          = cPorts;
-        pRange->pvUser          = pvUser;
-        pRange->pfnOutCallback  = pfnOutCallback;
-        pRange->pfnInCallback   = pfnInCallback;
-        pRange->pfnOutStrCallback = pfnOutStrCallback;
-        pRange->pfnInStrCallback = pfnInStrCallback;
-        pRange->pDevIns         = pDevIns->pDevInsForRC;
-        pRange->pszDesc         = pszDesc;
-
-        /*
-         * Insert it.
-         */
-        if (RTAvlroIOPortInsert(&pVM->iom.s.CTX_SUFF(pTrees)->IOPortTreeRC, &pRange->Core))
-        {
-            IOM_UNLOCK_EXCL(pVM);
-            return VINF_SUCCESS;
-        }
-
-        /* conflict. */
-        AssertMsgFailed(("Port range %#x-%#x (%s) conflicts with existing range(s)!\n", PortStart, (unsigned)PortStart + cPorts - 1, pszDesc));
-        MMHyperFree(pVM, pRange);
-        rc = VERR_IOM_IOPORT_RANGE_CONFLICT;
-    }
-    IOM_UNLOCK_EXCL(pVM);
-    return rc;
-}
-#endif
-
-
-/**
- * Registers a Port IO R0 handler.
- *
- * This API is called by PDM on behalf of a device. Devices must first register ring-3 ranges
- * using IOMR3IOPortRegisterR3() before calling this function.
- *
- *
- * @returns VBox status code.
- *
- * @param   pVM                 The cross context VM structure.
- * @param   pDevIns             PDM device instance owning the port range.
- * @param   PortStart           First port number in the range.
- * @param   cPorts              Number of ports to register.
- * @param   pvUser              User argument for the callbacks.
- * @param   pfnOutCallback      Pointer to function which is gonna handle OUT operations in GC.
- * @param   pfnInCallback       Pointer to function which is gonna handle IN operations in GC.
- * @param   pfnOutStrCallback   Pointer to function which is gonna handle OUT operations in GC.
- * @param   pfnInStrCallback    Pointer to function which is gonna handle IN operations in GC.
- * @param   pszDesc             Pointer to description string. This must not be freed.
- */
-VMMR3_INT_DECL(int) IOMR3IOPortRegisterR0(PVM pVM, PPDMDEVINS pDevIns, RTIOPORT PortStart, RTUINT cPorts, RTR0PTR pvUser,
-                                          R0PTRTYPE(PFNIOMIOPORTOUT) pfnOutCallback, R0PTRTYPE(PFNIOMIOPORTIN) pfnInCallback,
-                                          R0PTRTYPE(PFNIOMIOPORTOUTSTRING) pfnOutStrCallback, R0PTRTYPE(PFNIOMIOPORTINSTRING) pfnInStrCallback,
-                                          const char *pszDesc)
-{
-    LogFlow(("IOMR3IOPortRegisterR0: pDevIns=%p PortStart=%#x cPorts=%#x pvUser=%RHv pfnOutCallback=%RHv pfnInCallback=%RHv pfnOutStrCallback=%RHv  pfnInStrCallback=%RHv pszDesc=%s\n",
-             pDevIns, PortStart, cPorts, pvUser, pfnOutCallback, pfnInCallback, pfnOutStrCallback, pfnInStrCallback, pszDesc));
-
-    /*
-     * Validate input.
-     */
-    if (    (RTUINT)PortStart + cPorts <= (RTUINT)PortStart
-        ||  (RTUINT)PortStart + cPorts > 0x10000)
-    {
-        AssertMsgFailed(("Invalid port range %#x-%#x! (%s)\n", PortStart, (RTUINT)PortStart + (cPorts - 1), pszDesc));
-        return VERR_IOM_INVALID_IOPORT_RANGE;
-    }
-    RTIOPORT PortLast = PortStart + (cPorts - 1);
-    if (!pfnOutCallback && !pfnInCallback)
-    {
-        AssertMsgFailed(("Invalid port range %#x-%#x! No callbacks! (%s)\n", PortStart, PortLast, pszDesc));
-        return VERR_INVALID_PARAMETER;
-    }
-
-    IOM_LOCK_EXCL(pVM);
-
-    /*
-     * Validate that there are ring-3 ranges for the ports.
-     */
-    RTIOPORT Port = PortStart;
-    while (Port <= PortLast && Port >= PortStart)
-    {
-        PIOMIOPORTRANGER3 pRange = (PIOMIOPORTRANGER3)RTAvlroIOPortRangeGet(&pVM->iom.s.CTX_SUFF(pTrees)->IOPortTreeR3, Port);
-        if (!pRange)
-        {
-            AssertMsgFailed(("No R3! Port=%#x %#x-%#x! (%s)\n", Port, PortStart, (unsigned)PortStart + cPorts - 1, pszDesc));
-            IOM_UNLOCK_EXCL(pVM);
-            return VERR_IOM_NO_R3_IOPORT_RANGE;
-        }
-#ifndef IOM_NO_PDMINS_CHECKS
-        if (pRange->pDevIns != pDevIns)
-        {
-            AssertMsgFailed(("Not owner! Port=%#x %#x-%#x! (%s)\n", Port, PortStart, (unsigned)PortStart + cPorts - 1, pszDesc));
-            IOM_UNLOCK_EXCL(pVM);
-            return VERR_IOM_NOT_IOPORT_RANGE_OWNER;
-        }
-#endif
-        Port = pRange->Core.KeyLast + 1;
-    }
-
-    /* Flush the IO port lookup cache */
-    iomR3FlushCache(pVM);
-
-    /*
-     * Allocate new range record and initialize it.
-     */
-    PIOMIOPORTRANGER0 pRange;
-    int rc = MMHyperAlloc(pVM, sizeof(*pRange), 0, MM_TAG_IOM, (void **)&pRange);
-    if (RT_SUCCESS(rc))
-    {
-        pRange->Core.Key        = PortStart;
-        pRange->Core.KeyLast    = PortLast;
-        pRange->Port            = PortStart;
-        pRange->cPorts          = cPorts;
-        pRange->pvUser          = pvUser;
-        pRange->pfnOutCallback  = pfnOutCallback;
-        pRange->pfnInCallback   = pfnInCallback;
-        pRange->pfnOutStrCallback = pfnOutStrCallback;
-        pRange->pfnInStrCallback = pfnInStrCallback;
-        pRange->pDevIns         = PDMDEVINS_2_R0PTR(pDevIns);
-        pRange->pszDesc         = pszDesc;
-
-        /*
-         * Insert it.
-         */
-        if (RTAvlroIOPortInsert(&pVM->iom.s.CTX_SUFF(pTrees)->IOPortTreeR0, &pRange->Core))
-        {
-            IOM_UNLOCK_EXCL(pVM);
-            return VINF_SUCCESS;
-        }
-
-        /* conflict. */
-        AssertMsgFailed(("Port range %#x-%#x (%s) conflicts with existing range(s)!\n", PortStart, (unsigned)PortStart + cPorts - 1, pszDesc));
-        MMHyperFree(pVM, pRange);
-        rc = VERR_IOM_IOPORT_RANGE_CONFLICT;
-    }
-    IOM_UNLOCK_EXCL(pVM);
-    return rc;
-}
-
-
-/**
- * Deregisters a I/O Port range.
- *
- * The specified range must be registered using IOMR3IOPortRegister previous to
- * this call. The range does can be a smaller part of the range specified to
- * IOMR3IOPortRegister, but it can never be larger.
- *
- * This function will remove GC, R0 and R3 context port handlers for this range.
- *
- * @returns VBox status code.
- *
- * @param   pVM                 The cross context VM structure.
- * @param   pDevIns             The device instance associated with the range.
- * @param   PortStart           First port number in the range.
- * @param   cPorts              Number of ports to remove starting at PortStart.
- *
- * @remark  This function mainly for PCI PnP Config and will not do
- *          all the checks you might expect it to do.
- */
-VMMR3_INT_DECL(int) IOMR3IOPortDeregister(PVM pVM, PPDMDEVINS pDevIns, RTIOPORT PortStart, RTUINT cPorts)
-{
-    LogFlow(("IOMR3IOPortDeregister: pDevIns=%p PortStart=%#x cPorts=%#x\n", pDevIns, PortStart, cPorts));
-
-    /*
-     * Validate input.
-     */
-    if (    (RTUINT)PortStart + cPorts < (RTUINT)PortStart
-        ||  (RTUINT)PortStart + cPorts > 0x10000)
-    {
-        AssertMsgFailed(("Invalid port range %#x-%#x!\n", PortStart, (unsigned)PortStart + cPorts - 1));
-        return VERR_IOM_INVALID_IOPORT_RANGE;
-    }
-
-    IOM_LOCK_EXCL(pVM);
-
-    /* Flush the IO port lookup cache */
-    iomR3FlushCache(pVM);
-
-    /*
-     * Check ownership.
-     */
-    RTIOPORT PortLast = PortStart + (cPorts - 1);
-    RTIOPORT Port = PortStart;
-    while (Port <= PortLast && Port >= PortStart)
-    {
-        PIOMIOPORTRANGER3 pRange = (PIOMIOPORTRANGER3)RTAvlroIOPortRangeGet(&pVM->iom.s.pTreesR3->IOPortTreeR3, Port);
-        if (pRange)
-        {
-            Assert(Port <= pRange->Core.KeyLast);
-#ifndef IOM_NO_PDMINS_CHECKS
-            if (pRange->pDevIns != pDevIns)
-            {
-                AssertMsgFailed(("Removal of ports in range %#x-%#x rejected because not owner of %#x-%#x (%s)\n",
-                                 PortStart, PortLast, pRange->Core.Key, pRange->Core.KeyLast, pRange->pszDesc));
-                IOM_UNLOCK_EXCL(pVM);
-                return VERR_IOM_NOT_IOPORT_RANGE_OWNER;
-            }
-#else  /* IOM_NO_PDMINS_CHECKS */
-            RT_NOREF_PV(pDevIns);
-#endif /* IOM_NO_PDMINS_CHECKS */
-            Port = pRange->Core.KeyLast;
-        }
-        Port++;
-    }
-
-#if 0
-    /*
-     * Remove any RC ranges first.
-     */
-    int     rc = VINF_SUCCESS;
-    Port = PortStart;
-    while (Port <= PortLast && Port >= PortStart)
-    {
-        /*
-         * Try find range.
-         */
-        PIOMIOPORTRANGERC pRange = (PIOMIOPORTRANGERC)RTAvlroIOPortRangeGet(&pVM->iom.s.pTreesR3->IOPortTreeRC, Port);
-        if (pRange)
-        {
-            if (   pRange->Core.Key     == Port
-                && pRange->Core.KeyLast <= PortLast)
-            {
-                /*
-                 * Kick out the entire range.
-                 */
-                void *pv = RTAvlroIOPortRemove(&pVM->iom.s.pTreesR3->IOPortTreeRC, Port);
-                Assert(pv == (void *)pRange); NOREF(pv);
-                Port += pRange->cPorts;
-                MMHyperFree(pVM, pRange);
-            }
-            else if (pRange->Core.Key == Port)
-            {
-                /*
-                 * Cut of the head of the range, done.
-                 */
-                pRange->cPorts  -= Port - pRange->Port;
-                pRange->Core.Key = Port;
-                pRange->Port     = Port;
-                break;
-            }
-            else if (pRange->Core.KeyLast <= PortLast)
-            {
-                /*
-                 * Just cut of the tail.
-                 */
-                unsigned c = pRange->Core.KeyLast - Port + 1;
-                pRange->Core.KeyLast -= c;
-                pRange->cPorts -= c;
-                Port += c;
-            }
-            else
-            {
-                /*
-                 * Split the range, done.
-                 */
-                Assert(pRange->Core.KeyLast > PortLast && pRange->Core.Key < Port);
-                /* create tail. */
-                PIOMIOPORTRANGERC pRangeNew;
-                int rc2 = MMHyperAlloc(pVM, sizeof(*pRangeNew), 0, MM_TAG_IOM, (void **)&pRangeNew);
-                if (RT_FAILURE(rc2))
-                {
-                    IOM_UNLOCK_EXCL(pVM);
-                    return rc2;
-                }
-                *pRangeNew = *pRange;
-                pRangeNew->Core.Key     = PortLast;
-                pRangeNew->Port         = PortLast;
-                pRangeNew->cPorts       = pRangeNew->Core.KeyLast - PortLast + 1;
-
-                LogFlow(("IOMR3IOPortDeregister (rc): split the range; new %x\n", pRangeNew->Core.Key));
-
-                /* adjust head */
-                pRange->Core.KeyLast  = Port - 1;
-                pRange->cPorts        = Port - pRange->Port;
-
-                /* insert */
-                if (!RTAvlroIOPortInsert(&pVM->iom.s.pTreesR3->IOPortTreeRC, &pRangeNew->Core))
-                {
-                    AssertMsgFailed(("This cannot happen!\n"));
-                    MMHyperFree(pVM, pRangeNew);
-                    rc = VERR_IOM_IOPORT_IPE_1;
-                }
-                break;
-            }
-        }
-        else /* next port */
-            Port++;
-    } /* for all ports - RC. */
-#else
-    int rc = VINF_SUCCESS;
-#endif
-
-    /*
-     * Remove any R0 ranges.
-     */
-    Port = PortStart;
-    while (Port <= PortLast && Port >= PortStart)
-    {
-        /*
-         * Try find range.
-         */
-        PIOMIOPORTRANGER0 pRange = (PIOMIOPORTRANGER0)RTAvlroIOPortRangeGet(&pVM->iom.s.pTreesR3->IOPortTreeR0, Port);
-        if (pRange)
-        {
-            if (   pRange->Core.Key     == Port
-                && pRange->Core.KeyLast <= PortLast)
-            {
-                /*
-                 * Kick out the entire range.
-                 */
-                void *pv = RTAvlroIOPortRemove(&pVM->iom.s.pTreesR3->IOPortTreeR0, Port);
-                Assert(pv == (void *)pRange); NOREF(pv);
-                Port += pRange->cPorts;
-                MMHyperFree(pVM, pRange);
-            }
-            else if (pRange->Core.Key == Port)
-            {
-                /*
-                 * Cut of the head of the range, done.
-                 */
-                pRange->cPorts  -= Port - pRange->Port;
-                pRange->Core.Key = Port;
-                pRange->Port     = Port;
-                break;
-            }
-            else if (pRange->Core.KeyLast <= PortLast)
-            {
-                /*
-                 * Just cut of the tail.
-                 */
-                unsigned c = pRange->Core.KeyLast - Port + 1;
-                pRange->Core.KeyLast -= c;
-                pRange->cPorts -= c;
-                Port += c;
-            }
-            else
-            {
-                /*
-                 * Split the range, done.
-                 */
-                Assert(pRange->Core.KeyLast > PortLast && pRange->Core.Key < Port);
-                /* create tail. */
-                PIOMIOPORTRANGER0 pRangeNew;
-                int rc2 = MMHyperAlloc(pVM, sizeof(*pRangeNew), 0, MM_TAG_IOM, (void **)&pRangeNew);
-                if (RT_FAILURE(rc2))
-                {
-                    IOM_UNLOCK_EXCL(pVM);
-                    return rc2;
-                }
-                *pRangeNew = *pRange;
-                pRangeNew->Core.Key     = PortLast;
-                pRangeNew->Port         = PortLast;
-                pRangeNew->cPorts       = pRangeNew->Core.KeyLast - PortLast + 1;
-
-                LogFlow(("IOMR3IOPortDeregister (r0): split the range; new %x\n", pRangeNew->Core.Key));
-
-                /* adjust head */
-                pRange->Core.KeyLast  = Port - 1;
-                pRange->cPorts        = Port - pRange->Port;
-
-                /* insert */
-                if (!RTAvlroIOPortInsert(&pVM->iom.s.pTreesR3->IOPortTreeR0, &pRangeNew->Core))
-                {
-                    AssertMsgFailed(("This cannot happen!\n"));
-                    MMHyperFree(pVM, pRangeNew);
-                    rc = VERR_IOM_IOPORT_IPE_1;
-                }
-                break;
-            }
-        }
-        else /* next port */
-            Port++;
-    } /* for all ports - R0. */
-
-    /*
-     * And the same procedure for ring-3 ranges.
-     */
-    Port = PortStart;
-    while (Port <= PortLast && Port >= PortStart)
-    {
-        /*
-         * Try find range.
-         */
-        PIOMIOPORTRANGER3 pRange = (PIOMIOPORTRANGER3)RTAvlroIOPortRangeGet(&pVM->iom.s.pTreesR3->IOPortTreeR3, Port);
-        if (pRange)
-        {
-            if (   pRange->Core.Key     == Port
-                && pRange->Core.KeyLast <= PortLast)
-            {
-                /*
-                 * Kick out the entire range.
-                 */
-                void *pv = RTAvlroIOPortRemove(&pVM->iom.s.pTreesR3->IOPortTreeR3, Port);
-                Assert(pv == (void *)pRange); NOREF(pv);
-                Port += pRange->cPorts;
-                MMHyperFree(pVM, pRange);
-            }
-            else if (pRange->Core.Key == Port)
-            {
-                /*
-                 * Cut of the head of the range, done.
-                 */
-                pRange->cPorts  -= Port - pRange->Port;
-                pRange->Core.Key = Port;
-                pRange->Port     = Port;
-                break;
-            }
-            else if (pRange->Core.KeyLast <= PortLast)
-            {
-                /*
-                 * Just cut of the tail.
-                 */
-                unsigned c = pRange->Core.KeyLast - Port + 1;
-                pRange->Core.KeyLast -= c;
-                pRange->cPorts -= c;
-                Port += c;
-            }
-            else
-            {
-                /*
-                 * Split the range, done.
-                 */
-                Assert(pRange->Core.KeyLast > PortLast && pRange->Core.Key < Port);
-                /* create tail. */
-                PIOMIOPORTRANGER3 pRangeNew;
-                int rc2 = MMHyperAlloc(pVM, sizeof(*pRangeNew), 0, MM_TAG_IOM, (void **)&pRangeNew);
-                if (RT_FAILURE(rc2))
-                {
-                    IOM_UNLOCK_EXCL(pVM);
-                    return rc2;
-                }
-                *pRangeNew = *pRange;
-                pRangeNew->Core.Key     = PortLast;
-                pRangeNew->Port         = PortLast;
-                pRangeNew->cPorts       = pRangeNew->Core.KeyLast - PortLast + 1;
-
-                LogFlow(("IOMR3IOPortDeregister (r3): split the range; new %x\n", pRangeNew->Core.Key));
-
-                /* adjust head */
-                pRange->Core.KeyLast  = Port - 1;
-                pRange->cPorts        = Port - pRange->Port;
-
-                /* insert */
-                if (!RTAvlroIOPortInsert(&pVM->iom.s.pTreesR3->IOPortTreeR3, &pRangeNew->Core))
-                {
-                    AssertMsgFailed(("This cannot happen!\n"));
-                    MMHyperFree(pVM, pRangeNew);
-                    rc = VERR_IOM_IOPORT_IPE_1;
-                }
-                break;
-            }
-        }
-        else /* next port */
-            Port++;
-    } /* for all ports - ring-3. */
-
-    /* done */
-    IOM_UNLOCK_EXCL(pVM);
-    return rc;
-}
-
-
-/**
- * Dummy Port I/O Handler for IN operations.
- *
- * @returns VBox status code.
- *
- * @param   pDevIns     The device instance.
- * @param   pvUser      User argument.
- * @param   Port        Port number used for the IN operation.
- * @param   pu32        Where to store the result.
- * @param   cb          Number of bytes read.
- */
-static DECLCALLBACK(int) iomR3IOPortDummyIn(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t *pu32, unsigned cb)
-{
-    NOREF(pDevIns); NOREF(pvUser); NOREF(Port);
-    switch (cb)
-    {
-        case 1: *pu32 = 0xff; break;
-        case 2: *pu32 = 0xffff; break;
-        case 4: *pu32 = UINT32_C(0xffffffff); break;
-        default:
-            AssertReleaseMsgFailed(("cb=%d\n", cb));
-            return VERR_IOM_IOPORT_IPE_2;
-    }
-    return VINF_SUCCESS;
-}
-
-
-/**
- * @callback_method_impl{FNIOMIOPORTINSTRING,
- *      Dummy Port I/O Handler for string IN operations.}
- */
-static DECLCALLBACK(int) iomR3IOPortDummyInStr(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint8_t *pbDst,
-                                               uint32_t *pcTransfer, unsigned cb)
-{
-    NOREF(pDevIns); NOREF(pvUser); NOREF(Port); NOREF(pbDst); NOREF(pcTransfer); NOREF(cb);
-    return VINF_SUCCESS;
-}
-
-
-/**
- * Dummy Port I/O Handler for OUT operations.
- *
- * @returns VBox status code.
- *
- * @param   pDevIns     The device instance.
- * @param   pvUser      User argument.
- * @param   Port        Port number used for the OUT operation.
- * @param   u32         The value to output.
- * @param   cb          The value size in bytes.
- */
-static DECLCALLBACK(int) iomR3IOPortDummyOut(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t u32, unsigned cb)
-{
-    NOREF(pDevIns); NOREF(pvUser); NOREF(Port); NOREF(u32); NOREF(cb);
-    return VINF_SUCCESS;
-}
-
-
-/**
- * @callback_method_impl{FNIOMIOPORTOUTSTRING,
- *      Dummy Port I/O Handler for string OUT operations.}
- */
-static DECLCALLBACK(int) iomR3IOPortDummyOutStr(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint8_t const *pbSrc,
-                                                uint32_t *pcTransfer, unsigned cb)
-{
-    NOREF(pDevIns); NOREF(pvUser); NOREF(Port); NOREF(pbSrc); NOREF(pcTransfer); NOREF(cb);
-    return VINF_SUCCESS;
-}
-
-
 
 /**
Index: /trunk/src/VBox/VMM/VMMR3/IOMR3IoPort.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMR3/IOMR3IoPort.cpp	(revision 82310)
+++ /trunk/src/VBox/VMM/VMMR3/IOMR3IoPort.cpp	(revision 82311)
@@ -592,28 +592,4 @@
 
 /**
- * Display a single I/O port ring-3 range.
- *
- * @returns 0
- * @param   pNode   Pointer to I/O port HC range.
- * @param   pvUser  Pointer to info output callback structure.
- */
-static DECLCALLBACK(int) iomR3IOPortInfoOneR3(PAVLROIOPORTNODECORE pNode, void *pvUser)
-{
-    PIOMIOPORTRANGER3 pRange = (PIOMIOPORTRANGER3)pNode;
-    PCDBGFINFOHLP pHlp = (PCDBGFINFOHLP)pvUser;
-    pHlp->pfnPrintf(pHlp,
-                    "%04x-%04x %p %p %p %p %s\n",
-                    pRange->Core.Key,
-                    pRange->Core.KeyLast,
-                    pRange->pDevIns,
-                    pRange->pfnInCallback,
-                    pRange->pfnOutCallback,
-                    pRange->pvUser,
-                    pRange->pszDesc);
-    return 0;
-}
-
-
-/**
  * Display all registered I/O port ranges.
  *
@@ -624,4 +600,6 @@
 DECLCALLBACK(void) iomR3IoPortInfo(PVM pVM, PCDBGFINFOHLP pHlp, const char *pszArgs)
 {
+    RT_NOREF(pszArgs);
+
     /* No locking needed here as registerations are only happening during VMSTATE_CREATING. */
     pHlp->pfnPrintf(pHlp,
@@ -648,30 +626,4 @@
                             paRegs[i].idxSelf, pszRing, paRegs[i].cPorts, paRegs[i].pszDesc);
     }
-
-    /* Legacy registration: */
-    NOREF(pszArgs);
-    pHlp->pfnPrintf(pHlp,
-                    "I/O Port R3 ranges (pVM=%p)\n"
-                    "Range     %.*s %.*s %.*s %.*s Description\n",
-                    pVM,
-                    sizeof(RTHCPTR) * 2,      "pDevIns         ",
-                    sizeof(RTHCPTR) * 2,      "In              ",
-                    sizeof(RTHCPTR) * 2,      "Out             ",
-                    sizeof(RTHCPTR) * 2,      "pvUser          ");
-    IOM_LOCK_SHARED(pVM);
-    RTAvlroIOPortDoWithAll(&pVM->iom.s.pTreesR3->IOPortTreeR3, true, iomR3IOPortInfoOneR3, (void *)pHlp);
-    IOM_UNLOCK_SHARED(pVM);
-
-    pHlp->pfnPrintf(pHlp,
-                    "I/O Port R0 ranges (pVM=%p)\n"
-                    "Range     %.*s %.*s %.*s %.*s Description\n",
-                    pVM,
-                    sizeof(RTHCPTR) * 2,      "pDevIns         ",
-                    sizeof(RTHCPTR) * 2,      "In              ",
-                    sizeof(RTHCPTR) * 2,      "Out             ",
-                    sizeof(RTHCPTR) * 2,      "pvUser          ");
-    IOM_LOCK_SHARED(pVM);
-    RTAvlroIOPortDoWithAll(&pVM->iom.s.pTreesR3->IOPortTreeR0, true, iomR3IOPortInfoOneR3, (void *)pHlp);
-    IOM_UNLOCK_SHARED(pVM);
-}
-
+}
+
Index: /trunk/src/VBox/VMM/VMMR3/PDMDevHlp.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMR3/PDMDevHlp.cpp	(revision 82310)
+++ /trunk/src/VBox/VMM/VMMR3/PDMDevHlp.cpp	(revision 82311)
@@ -139,188 +139,4 @@
     LogFlow(("pdmR3DevHlp_IoPortGetMappingAddress: caller='%s'/%d: returns %#RX32\n", pDevIns->pReg->szName, pDevIns->iInstance, uAddress));
     return uAddress;
-}
-
-
-/** @interface_method_impl{PDMDEVHLPR3,pfnIOPortRegister} */
-static DECLCALLBACK(int) pdmR3DevHlp_IOPortRegister(PPDMDEVINS pDevIns, RTIOPORT Port, RTIOPORT cPorts, RTHCPTR pvUser, PFNIOMIOPORTOUT pfnOut, PFNIOMIOPORTIN pfnIn,
-                                                    PFNIOMIOPORTOUTSTRING pfnOutStr, PFNIOMIOPORTINSTRING pfnInStr, const char *pszDesc)
-{
-    PDMDEV_ASSERT_DEVINS(pDevIns);
-    LogFlow(("pdmR3DevHlp_IOPortRegister: caller='%s'/%d: Port=%#x cPorts=%#x pvUser=%p pfnOut=%p pfnIn=%p pfnOutStr=%p pfnInStr=%p pszDesc=%p:{%s}\n", pDevIns->pReg->szName, pDevIns->iInstance,
-             Port, cPorts, pvUser, pfnOut, pfnIn, pfnOutStr, pfnInStr, pszDesc, pszDesc));
-    VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
-
-#if 0 /** @todo needs a real string cache for this */
-    if (pDevIns->iInstance > 0)
-    {
-         char *pszDesc2 = MMR3HeapAPrintf(pVM, MM_TAG_PDM_DEVICE_DESC, "%s [%u]", pszDesc, pDevIns->iInstance);
-         if (pszDesc2)
-             pszDesc = pszDesc2;
-    }
-#endif
-
-    int rc = IOMR3IOPortRegisterR3(pDevIns->Internal.s.pVMR3, pDevIns, Port, cPorts, pvUser,
-                                   pfnOut, pfnIn, pfnOutStr, pfnInStr, pszDesc);
-
-    LogFlow(("pdmR3DevHlp_IOPortRegister: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
-    return rc;
-}
-
-
-/** @interface_method_impl{PDMDEVHLPR3,pfnIOPortRegisterRC} */
-static DECLCALLBACK(int) pdmR3DevHlp_IOPortRegisterRC(PPDMDEVINS pDevIns, RTIOPORT Port, RTIOPORT cPorts, RTRCPTR pvUser,
-                                                      const char *pszOut, const char *pszIn,
-                                                      const char *pszOutStr, const char *pszInStr, const char *pszDesc)
-{
-    PDMDEV_ASSERT_DEVINS(pDevIns);
-    Assert(pDevIns->pReg->pszRCMod[0]);
-    Assert(pDevIns->pReg->fFlags & PDM_DEVREG_FLAGS_RC);
-    LogFlow(("pdmR3DevHlp_IOPortRegisterRC: 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->pReg->szName, pDevIns->iInstance,
-             Port, cPorts, pvUser, pszOut, pszOut, pszIn, pszIn, pszOutStr, pszOutStr, pszInStr, pszInStr, pszDesc, pszDesc));
-
-#if 0
-    /*
-     * Resolve the functions (one of the can be NULL).
-     */
-    PVM pVM = pDevIns->Internal.s.pVMR3;
-    VM_ASSERT_EMT(pVM);
-    int rc = VINF_SUCCESS;
-    if (   pDevIns->pReg->pszRCMod[0]
-        && (pDevIns->pReg->fFlags & PDM_DEVREG_FLAGS_RC)
-        && VM_IS_RAW_MODE_ENABLED(pVM))
-    {
-        RTRCPTR RCPtrIn = NIL_RTRCPTR;
-        if (pszIn)
-        {
-            rc = pdmR3DevGetSymbolRCLazy(pDevIns, pszIn, &RCPtrIn);
-            AssertMsgRC(rc, ("Failed to resolve %s.%s (pszIn)\n", pDevIns->pReg->pszRCMod, pszIn));
-        }
-        RTRCPTR RCPtrOut = NIL_RTRCPTR;
-        if (pszOut && RT_SUCCESS(rc))
-        {
-            rc = pdmR3DevGetSymbolRCLazy(pDevIns, pszOut, &RCPtrOut);
-            AssertMsgRC(rc, ("Failed to resolve %s.%s (pszOut)\n", pDevIns->pReg->pszRCMod, pszOut));
-        }
-        RTRCPTR RCPtrInStr = NIL_RTRCPTR;
-        if (pszInStr && RT_SUCCESS(rc))
-        {
-            rc = pdmR3DevGetSymbolRCLazy(pDevIns, pszInStr, &RCPtrInStr);
-            AssertMsgRC(rc, ("Failed to resolve %s.%s (pszInStr)\n", pDevIns->pReg->pszRCMod, pszInStr));
-        }
-        RTRCPTR RCPtrOutStr = NIL_RTRCPTR;
-        if (pszOutStr && RT_SUCCESS(rc))
-        {
-            rc = pdmR3DevGetSymbolRCLazy(pDevIns, pszOutStr, &RCPtrOutStr);
-            AssertMsgRC(rc, ("Failed to resolve %s.%s (pszOutStr)\n", pDevIns->pReg->pszRCMod, pszOutStr));
-        }
-
-        if (RT_SUCCESS(rc))
-        {
-#if 0 /** @todo needs a real string cache for this */
-            if (pDevIns->iInstance > 0)
-            {
-                 char *pszDesc2 = MMR3HeapAPrintf(pVM, MM_TAG_PDM_DEVICE_DESC, "%s [%u]", pszDesc, pDevIns->iInstance);
-                 if (pszDesc2)
-                     pszDesc = pszDesc2;
-            }
-#endif
-
-            rc = IOMR3IOPortRegisterRC(pVM, pDevIns, Port, cPorts, pvUser, RCPtrOut, RCPtrIn, RCPtrOutStr, RCPtrInStr, pszDesc);
-        }
-    }
-    else if (VM_IS_RAW_MODE_ENABLED(pVM))
-    {
-        AssertMsgFailed(("No RC module for this driver!\n"));
-        rc = VERR_INVALID_PARAMETER;
-    }
-#else
-    RT_NOREF(pDevIns, Port, cPorts, pvUser, pszOut, pszIn, pszOutStr, pszInStr, pszDesc);
-    int rc = VINF_SUCCESS;
-#endif
-
-    LogFlow(("pdmR3DevHlp_IOPortRegisterRC: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
-    return rc;
-}
-
-
-/** @interface_method_impl{PDMDEVHLPR3,pfnIOPortRegisterR0} */
-static DECLCALLBACK(int) pdmR3DevHlp_IOPortRegisterR0(PPDMDEVINS pDevIns, RTIOPORT Port, RTIOPORT cPorts, RTR0PTR pvUser,
-                                                      const char *pszOut, const char *pszIn,
-                                                      const char *pszOutStr, const char *pszInStr, const char *pszDesc)
-{
-    PDMDEV_ASSERT_DEVINS(pDevIns);
-    VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
-    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->pReg->szName, pDevIns->iInstance,
-             Port, cPorts, pvUser, pszOut, pszOut, pszIn, pszIn, pszOutStr, pszOutStr, pszInStr, pszInStr, pszDesc, pszDesc));
-
-    /*
-     * Resolve the functions (one of the can be NULL).
-     */
-    int rc = VINF_SUCCESS;
-    if (    pDevIns->pReg->pszR0Mod[0]
-        &&  (pDevIns->pReg->fFlags & PDM_DEVREG_FLAGS_R0))
-    {
-        R0PTRTYPE(PFNIOMIOPORTIN) pfnR0PtrIn = 0;
-        if (pszIn)
-        {
-            rc = pdmR3DevGetSymbolR0Lazy(pDevIns, pszIn, &pfnR0PtrIn);
-            AssertMsgRC(rc, ("Failed to resolve %s.%s (pszIn)\n", pDevIns->pReg->pszR0Mod, pszIn));
-        }
-        R0PTRTYPE(PFNIOMIOPORTOUT) pfnR0PtrOut = 0;
-        if (pszOut && RT_SUCCESS(rc))
-        {
-            rc = pdmR3DevGetSymbolR0Lazy(pDevIns, pszOut, &pfnR0PtrOut);
-            AssertMsgRC(rc, ("Failed to resolve %s.%s (pszOut)\n", pDevIns->pReg->pszR0Mod, pszOut));
-        }
-        R0PTRTYPE(PFNIOMIOPORTINSTRING) pfnR0PtrInStr = 0;
-        if (pszInStr && RT_SUCCESS(rc))
-        {
-            rc = pdmR3DevGetSymbolR0Lazy(pDevIns, pszInStr, &pfnR0PtrInStr);
-            AssertMsgRC(rc, ("Failed to resolve %s.%s (pszInStr)\n", pDevIns->pReg->pszR0Mod, pszInStr));
-        }
-        R0PTRTYPE(PFNIOMIOPORTOUTSTRING) pfnR0PtrOutStr = 0;
-        if (pszOutStr && RT_SUCCESS(rc))
-        {
-            rc = pdmR3DevGetSymbolR0Lazy(pDevIns, pszOutStr, &pfnR0PtrOutStr);
-            AssertMsgRC(rc, ("Failed to resolve %s.%s (pszOutStr)\n", pDevIns->pReg->pszR0Mod, pszOutStr));
-        }
-
-        if (RT_SUCCESS(rc))
-        {
-#if 0 /** @todo needs a real string cache for this */
-            if (pDevIns->iInstance > 0)
-            {
-                 char *pszDesc2 = MMR3HeapAPrintf(pVM, MM_TAG_PDM_DEVICE_DESC, "%s [%u]", pszDesc, pDevIns->iInstance);
-                 if (pszDesc2)
-                     pszDesc = pszDesc2;
-            }
-#endif
-
-            rc = IOMR3IOPortRegisterR0(pDevIns->Internal.s.pVMR3, pDevIns, Port, cPorts, pvUser, pfnR0PtrOut, pfnR0PtrIn, pfnR0PtrOutStr, pfnR0PtrInStr, pszDesc);
-        }
-    }
-    else
-    {
-        AssertMsgFailed(("No R0 module for this driver!\n"));
-        rc = VERR_INVALID_PARAMETER;
-    }
-
-    LogFlow(("pdmR3DevHlp_IOPortRegisterR0: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
-    return rc;
-}
-
-
-/** @interface_method_impl{PDMDEVHLPR3,pfnIOPortDeregister} */
-static DECLCALLBACK(int) pdmR3DevHlp_IOPortDeregister(PPDMDEVINS pDevIns, RTIOPORT Port, RTIOPORT cPorts)
-{
-    PDMDEV_ASSERT_DEVINS(pDevIns);
-    VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
-    LogFlow(("pdmR3DevHlp_IOPortDeregister: caller='%s'/%d: Port=%#x cPorts=%#x\n", pDevIns->pReg->szName, pDevIns->iInstance,
-             Port, cPorts));
-
-    int rc = IOMR3IOPortDeregister(pDevIns->Internal.s.pVMR3, pDevIns, Port, cPorts);
-
-    LogFlow(("pdmR3DevHlp_IOPortDeregister: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
-    return rc;
 }
 
@@ -697,186 +513,4 @@
 
     LogFlow(("pdmR3DevHlp_Mmio2ChangeRegionNo: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
-    return rc;
-}
-
-
-/**
- * @copydoc PDMDEVHLPR3::pfnMMIO2Register
- */
-static DECLCALLBACK(int) pdmR3DevHlp_MMIO2Register(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iRegion, RTGCPHYS cb,
-                                                   uint32_t fFlags, void **ppv, const char *pszDesc)
-{
-    PDMDEV_ASSERT_DEVINS(pDevIns);
-    VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
-    LogFlow(("pdmR3DevHlp_MMIO2Register: caller='%s'/%d: pPciDev=%p (%#x) iRegion=%#x cb=%#RGp fFlags=%RX32 ppv=%p pszDescp=%p:{%s}\n",
-             pDevIns->pReg->szName, pDevIns->iInstance, pPciDev, pPciDev ? pPciDev->uDevFn : UINT32_MAX, iRegion,
-             cb, fFlags, ppv, pszDesc, pszDesc));
-    AssertReturn(!pPciDev || pPciDev->Int.s.pDevInsR3 == pDevIns, VERR_INVALID_PARAMETER);
-
-/** @todo PGMR3PhysMMIO2Register mangles the description, move it here and
- *        use a real string cache. */
-    int rc = PGMR3PhysMMIO2Register(pDevIns->Internal.s.pVMR3, pDevIns, pPciDev ? pPciDev->Int.s.idxDevCfg : 254, iRegion,
-                                    cb, fFlags, pszDesc, ppv, NULL);
-
-    LogFlow(("pdmR3DevHlp_MMIO2Register: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
-    return rc;
-}
-
-
-/**
- * @copydoc PDMDEVHLPR3::pfnMMIOExDeregister
- */
-static DECLCALLBACK(int) pdmR3DevHlp_MMIOExDeregister(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iRegion)
-{
-    PDMDEV_ASSERT_DEVINS(pDevIns);
-    VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
-    LogFlow(("pdmR3DevHlp_MMIOExDeregister: caller='%s'/%d: pPciDev=%p:{%#x} iRegion=%#x\n",
-             pDevIns->pReg->szName, pDevIns->iInstance, pPciDev, pPciDev ? pPciDev->uDevFn : UINT32_MAX, iRegion));
-
-    AssertReturn(iRegion <= UINT8_MAX || iRegion == UINT32_MAX, VERR_INVALID_PARAMETER);
-    AssertReturn(!pPciDev || pPciDev->Int.s.pDevInsR3 == pDevIns, VERR_INVALID_PARAMETER);
-
-    int rc = PGMR3PhysMMIOExDeregister(pDevIns->Internal.s.pVMR3, pDevIns, pPciDev ? pPciDev->Int.s.idxDevCfg : 254,
-                                       iRegion, NIL_PGMMMIO2HANDLE);
-
-    LogFlow(("pdmR3DevHlp_MMIOExDeregister: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
-    return rc;
-}
-
-
-/**
- * @copydoc PDMDEVHLPR3::pfnMMIOExMap
- */
-static DECLCALLBACK(int) pdmR3DevHlp_MMIOExMap(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iRegion, RTGCPHYS GCPhys)
-{
-    PDMDEV_ASSERT_DEVINS(pDevIns);
-    VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
-    LogFlow(("pdmR3DevHlp_MMIOExMap: caller='%s'/%d: pPciDev=%p:{%#x} iRegion=%#x GCPhys=%#RGp\n",
-             pDevIns->pReg->szName, pDevIns->iInstance, pPciDev, pPciDev ? pPciDev->uDevFn : UINT32_MAX, iRegion, GCPhys));
-    AssertReturn(!pPciDev || pPciDev->Int.s.pDevInsR3 != NULL, VERR_INVALID_PARAMETER);
-
-    int rc = PGMR3PhysMMIOExMap(pDevIns->Internal.s.pVMR3, pDevIns, pPciDev ? pPciDev->Int.s.idxDevCfg : 254, iRegion,
-                                NIL_PGMMMIO2HANDLE, GCPhys);
-
-    LogFlow(("pdmR3DevHlp_MMIOExMap: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
-    return rc;
-}
-
-
-/**
- * @copydoc PDMDEVHLPR3::pfnMMIOExUnmap
- */
-static DECLCALLBACK(int) pdmR3DevHlp_MMIOExUnmap(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iRegion, RTGCPHYS GCPhys)
-{
-    PDMDEV_ASSERT_DEVINS(pDevIns);
-    VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
-    LogFlow(("pdmR3DevHlp_MMIOExUnmap: caller='%s'/%d: pPciDev=%p:{%#x} iRegion=%#x GCPhys=%#RGp\n",
-             pDevIns->pReg->szName, pDevIns->iInstance, pPciDev, pPciDev ? pPciDev->uDevFn : UINT32_MAX, iRegion, GCPhys));
-    AssertReturn(!pPciDev || pPciDev->Int.s.pDevInsR3 != NULL, VERR_INVALID_PARAMETER);
-
-    int rc = PGMR3PhysMMIOExUnmap(pDevIns->Internal.s.pVMR3, pDevIns, pPciDev ? pPciDev->Int.s.idxDevCfg : 254, iRegion,
-                                  NIL_PGMMMIO2HANDLE, GCPhys);
-
-    LogFlow(("pdmR3DevHlp_MMIOExUnmap: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
-    return rc;
-}
-
-
-/**
- * @copydoc PDMDEVHLPR3::pfnMMIOExReduce
- */
-static DECLCALLBACK(int) pdmR3DevHlp_MMIOExReduce(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iRegion, RTGCPHYS cbRegion)
-{
-    PDMDEV_ASSERT_DEVINS(pDevIns);
-    VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
-    LogFlow(("pdmR3DevHlp_MMIOExReduce: caller='%s'/%d: pPciDev=%p:{%#x} iRegion=%#x cbRegion=%RGp\n",
-             pDevIns->pReg->szName, pDevIns->iInstance, pPciDev, pPciDev ? pPciDev->uDevFn : UINT32_MAX, iRegion, cbRegion));
-    AssertReturn(!pPciDev || pPciDev->Int.s.pDevInsR3 != NULL, VERR_INVALID_PARAMETER);
-
-    int rc = PGMR3PhysMMIOExReduce(pDevIns->Internal.s.pVMR3, pDevIns, pPciDev ? pPciDev->Int.s.idxDevCfg : 254, iRegion,
-                                   NIL_PGMMMIO2HANDLE, cbRegion);
-
-    LogFlow(("pdmR3DevHlp_MMIOExReduce: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
-    return rc;
-}
-
-
-/**
- * @copydoc PDMDEVHLPR3::pfnMMHyperMapMMIO2
- */
-static DECLCALLBACK(int) pdmR3DevHlp_MMHyperMapMMIO2(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iRegion, RTGCPHYS off,
-                                                     RTGCPHYS cb, const char *pszDesc, PRTRCPTR pRCPtr)
-{
-    PDMDEV_ASSERT_DEVINS(pDevIns);
-#ifndef PGM_WITHOUT_MAPPINGS
-    PVM pVM = pDevIns->Internal.s.pVMR3;
-    VM_ASSERT_EMT(pVM);
-    LogFlow(("pdmR3DevHlp_MMHyperMapMMIO2: caller='%s'/%d: pPciDev=%p:{%#x} iRegion=%#x off=%RGp cb=%RGp pszDesc=%p:{%s} pRCPtr=%p\n",
-             pDevIns->pReg->szName, pDevIns->iInstance, pPciDev, pPciDev ? pPciDev->uDevFn : UINT32_MAX, iRegion, off, cb, pszDesc, pszDesc, pRCPtr));
-    AssertReturn(!pPciDev || pPciDev->Int.s.pDevInsR3 == pDevIns, VERR_INVALID_PARAMETER);
-
-    if (pDevIns->iInstance > 0)
-    {
-         char *pszDesc2 = MMR3HeapAPrintf(pVM, MM_TAG_PDM_DEVICE_DESC, "%s [%u]", pszDesc, pDevIns->iInstance);
-         if (pszDesc2)
-             pszDesc = pszDesc2;
-    }
-
-    int rc = MMR3HyperMapMMIO2(pVM, pDevIns, pPciDev ? pPciDev->Int.s.idxDevCfg : 254, iRegion, off, cb, pszDesc, pRCPtr);
-
-#else
-    RT_NOREF(pDevIns, pPciDev, iRegion, off, cb, pszDesc, pRCPtr);
-    AssertFailed();
-    int rc = VERR_RAW_MODE_NOT_SUPPORTED;
-#endif
-    LogFlow(("pdmR3DevHlp_MMHyperMapMMIO2: caller='%s'/%d: returns %Rrc *pRCPtr=%RRv\n", pDevIns->pReg->szName, pDevIns->iInstance, rc, *pRCPtr));
-    return rc;
-}
-
-
-/**
- * @copydoc PDMDEVHLPR3::pfnMMIO2MapKernel
- */
-static DECLCALLBACK(int) pdmR3DevHlp_MMIO2MapKernel(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iRegion, RTGCPHYS off,
-                                                    RTGCPHYS cb,const char *pszDesc, PRTR0PTR pR0Ptr)
-{
-    PDMDEV_ASSERT_DEVINS(pDevIns);
-    PVM pVM = pDevIns->Internal.s.pVMR3;
-    VM_ASSERT_EMT(pVM);
-    LogFlow(("pdmR3DevHlp_MMIO2MapKernel: caller='%s'/%d: pPciDev=%p:{%#x} iRegion=%#x off=%RGp cb=%RGp pszDesc=%p:{%s} pR0Ptr=%p\n",
-             pDevIns->pReg->szName, pDevIns->iInstance, pPciDev, pPciDev ? pPciDev->uDevFn : UINT32_MAX, iRegion, off, cb, pszDesc, pszDesc, pR0Ptr));
-    AssertReturn(!pPciDev || pPciDev->Int.s.pDevInsR3 == pDevIns, VERR_INVALID_PARAMETER);
-
-    if (pDevIns->iInstance > 0)
-    {
-         char *pszDesc2 = MMR3HeapAPrintf(pVM, MM_TAG_PDM_DEVICE_DESC, "%s [%u]", pszDesc, pDevIns->iInstance);
-         if (pszDesc2)
-             pszDesc = pszDesc2;
-    }
-
-    int rc = PGMR3PhysMMIO2MapKernel(pVM, pDevIns, pPciDev ? pPciDev->Int.s.idxDevCfg : 254, iRegion, off, cb, pszDesc, pR0Ptr);
-
-    LogFlow(("pdmR3DevHlp_MMIO2MapKernel: caller='%s'/%d: returns %Rrc *pR0Ptr=%RHv\n", pDevIns->pReg->szName, pDevIns->iInstance, rc, *pR0Ptr));
-    return rc;
-}
-
-
-/**
- * @copydoc PDMDEVHLPR3::pfnMMIOExChangeRegionNo
- */
-static DECLCALLBACK(int) pdmR3DevHlp_MMIOExChangeRegionNo(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iRegion,
-                                                          uint32_t iNewRegion)
-{
-    PDMDEV_ASSERT_DEVINS(pDevIns);
-    PVM pVM = pDevIns->Internal.s.pVMR3;
-    VM_ASSERT_EMT(pVM);
-    LogFlow(("pdmR3DevHlp_MMIOExChangeRegionNo: caller='%s'/%d: pPciDev=%p:{%#x} iRegion=%#x iNewRegion=%#x\n",
-             pDevIns->pReg->szName, pDevIns->iInstance, pPciDev, pPciDev ? pPciDev->uDevFn : UINT32_MAX, iRegion, iNewRegion));
-    AssertReturn(!pPciDev || pPciDev->Int.s.pDevInsR3 == pDevIns, VERR_INVALID_PARAMETER);
-
-    int rc = PGMR3PhysMMIOExChangeRegionNo(pVM, pDevIns, pPciDev ? pPciDev->Int.s.idxDevCfg : 254, iRegion,
-                                           NIL_PGMMMIO2HANDLE, iNewRegion);
-
-    LogFlow(("pdmR3DevHlp_MMIOExChangeRegionNo: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
     return rc;
 }
@@ -2096,4 +1730,9 @@
     }
 
+    /* This flag is required now. */
+    AssertLogRelMsgReturn(fFlags & PDMPCIDEV_IORGN_F_NEW_STYLE,
+                          ("'%s'/%d: Invalid flags: %#x\n", pDevIns->pReg->szName, pDevIns->iInstance, fFlags),
+                          VERR_INVALID_FLAGS);
+
     /*
      * We're currently restricted to page aligned MMIO regions.
@@ -4345,8 +3984,4 @@
     pdmR3DevHlp_IoPortUnmap,
     pdmR3DevHlp_IoPortGetMappingAddress,
-    pdmR3DevHlp_IOPortRegister,
-    pdmR3DevHlp_IOPortRegisterRC,
-    pdmR3DevHlp_IOPortRegisterR0,
-    pdmR3DevHlp_IOPortDeregister,
     pdmR3DevHlp_MmioCreateEx,
     pdmR3DevHlp_MmioMap,
@@ -4365,11 +4000,4 @@
     pdmR3DevHlp_Mmio2GetMappingAddress,
     pdmR3DevHlp_Mmio2ChangeRegionNo,
-    pdmR3DevHlp_MMIO2Register,
-    pdmR3DevHlp_MMIOExDeregister,
-    pdmR3DevHlp_MMIOExMap,
-    pdmR3DevHlp_MMIOExUnmap,
-    pdmR3DevHlp_MMIOExReduce,
-    pdmR3DevHlp_MMHyperMapMMIO2,
-    pdmR3DevHlp_MMIO2MapKernel,
     pdmR3DevHlp_ROMRegister,
     pdmR3DevHlp_ROMProtectShadow,
@@ -4658,5 +4286,4 @@
     pdmR3DevHlp_PhysBulkGCPhys2CCPtrReadOnly,
     pdmR3DevHlp_PhysBulkReleasePageMappingLocks,
-    pdmR3DevHlp_MMIOExChangeRegionNo,
     0,
     0,
@@ -4843,8 +4470,4 @@
     pdmR3DevHlp_IoPortUnmap,
     pdmR3DevHlp_IoPortGetMappingAddress,
-    pdmR3DevHlp_IOPortRegister,
-    pdmR3DevHlp_IOPortRegisterRC,
-    pdmR3DevHlp_IOPortRegisterR0,
-    pdmR3DevHlp_IOPortDeregister,
     pdmR3DevHlp_MmioCreateEx,
     pdmR3DevHlp_MmioMap,
@@ -4863,11 +4486,4 @@
     pdmR3DevHlp_Mmio2GetMappingAddress,
     pdmR3DevHlp_Mmio2ChangeRegionNo,
-    pdmR3DevHlp_MMIO2Register,
-    pdmR3DevHlp_MMIOExDeregister,
-    pdmR3DevHlp_MMIOExMap,
-    pdmR3DevHlp_MMIOExUnmap,
-    pdmR3DevHlp_MMIOExReduce,
-    pdmR3DevHlp_MMHyperMapMMIO2,
-    pdmR3DevHlp_MMIO2MapKernel,
     pdmR3DevHlp_ROMRegister,
     pdmR3DevHlp_ROMProtectShadow,
@@ -5156,5 +4772,4 @@
     pdmR3DevHlp_PhysBulkGCPhys2CCPtrReadOnly,
     pdmR3DevHlp_PhysBulkReleasePageMappingLocks,
-    pdmR3DevHlp_MMIOExChangeRegionNo,
     0,
     0,
Index: /trunk/src/VBox/VMM/include/IOMInline.h
===================================================================
--- /trunk/src/VBox/VMM/include/IOMInline.h	(revision 82310)
+++ /trunk/src/VBox/VMM/include/IOMInline.h	(revision 82311)
@@ -257,36 +257,4 @@
 
 /**
- * Gets the I/O port range for the specified I/O port in the current context.
- *
- * @returns Pointer to I/O port range.
- * @returns NULL if no port registered.
- *
- * @param   pVM     The cross context VM structure.
- * @param   Port    The I/O port lookup.
- */
-DECLINLINE(CTX_SUFF(PIOMIOPORTRANGE)) iomIOPortGetRange(PVM pVM, RTIOPORT Port)
-{
-    Assert(IOM_IS_SHARED_LOCK_OWNER(pVM));
-    return (CTX_SUFF(PIOMIOPORTRANGE))RTAvlroIOPortRangeGet(&pVM->iom.s.CTX_SUFF(pTrees)->CTX_SUFF(IOPortTree), Port);
-}
-
-
-/**
- * Gets the I/O port range for the specified I/O port in the HC.
- *
- * @returns Pointer to I/O port range.
- * @returns NULL if no port registered.
- *
- * @param   pVM     The cross context VM structure.
- * @param   Port    The I/O port to lookup.
- */
-DECLINLINE(PIOMIOPORTRANGER3) iomIOPortGetRangeR3(PVM pVM, RTIOPORT Port)
-{
-    Assert(IOM_IS_SHARED_LOCK_OWNER(pVM));
-    return (PIOMIOPORTRANGER3)RTAvlroIOPortRangeGet(&pVM->iom.s.CTX_SUFF(pTrees)->IOPortTreeR3, Port);
-}
-
-
-/**
  * Gets the MMIO range for the specified physical address in the current context.
  *
Index: /trunk/src/VBox/VMM/include/IOMInternal.h
===================================================================
--- /trunk/src/VBox/VMM/include/IOMInternal.h	(revision 82310)
+++ /trunk/src/VBox/VMM/include/IOMInternal.h	(revision 82311)
@@ -407,142 +407,4 @@
 
 /**
- * I/O port range descriptor, R3 version.
- */
-typedef struct IOMIOPORTRANGER3
-{
-    /** Avl node core with Port as Key and Port + cPorts - 1 as KeyLast. */
-    AVLROIOPORTNODECORE         Core;
-#if HC_ARCH_BITS == 64 && !defined(RT_OS_WINDOWS)
-    uint32_t                    u32Alignment; /**< The sizeof(Core) differs. */
-#endif
-    /** Start I/O port address. */
-    RTIOPORT                    Port;
-    /** Size of the range. */
-    uint16_t                    cPorts;
-    /** Pointer to user argument. */
-    RTR3PTR                     pvUser;
-    /** Pointer to the associated device instance. */
-    R3PTRTYPE(PPDMDEVINS)       pDevIns;
-    /** Pointer to OUT callback function. */
-    R3PTRTYPE(PFNIOMIOPORTOUT)  pfnOutCallback;
-    /** Pointer to IN callback function. */
-    R3PTRTYPE(PFNIOMIOPORTIN)   pfnInCallback;
-    /** Pointer to string OUT callback function. */
-    R3PTRTYPE(PFNIOMIOPORTOUTSTRING) pfnOutStrCallback;
-    /** Pointer to string IN callback function. */
-    R3PTRTYPE(PFNIOMIOPORTINSTRING) pfnInStrCallback;
-    /** Description / Name. For easing debugging. */
-    R3PTRTYPE(const char *)     pszDesc;
-} IOMIOPORTRANGER3;
-/** Pointer to I/O port range descriptor, R3 version. */
-typedef IOMIOPORTRANGER3 *PIOMIOPORTRANGER3;
-
-/**
- * I/O port range descriptor, R0 version.
- */
-typedef struct IOMIOPORTRANGER0
-{
-    /** Avl node core with Port as Key and Port + cPorts - 1 as KeyLast. */
-    AVLROIOPORTNODECORE         Core;
-#if HC_ARCH_BITS == 64 && !defined(RT_OS_WINDOWS)
-    uint32_t                    u32Alignment; /**< The sizeof(Core) differs. */
-#endif
-    /** Start I/O port address. */
-    RTIOPORT                    Port;
-    /** Size of the range. */
-    uint16_t                    cPorts;
-    /** Pointer to user argument. */
-    RTR0PTR                     pvUser;
-    /** Pointer to the associated device instance. */
-    R0PTRTYPE(PPDMDEVINS)       pDevIns;
-    /** Pointer to OUT callback function. */
-    R0PTRTYPE(PFNIOMIOPORTOUT)  pfnOutCallback;
-    /** Pointer to IN callback function. */
-    R0PTRTYPE(PFNIOMIOPORTIN)   pfnInCallback;
-    /** Pointer to string OUT callback function. */
-    R0PTRTYPE(PFNIOMIOPORTOUTSTRING) pfnOutStrCallback;
-    /** Pointer to string IN callback function. */
-    R0PTRTYPE(PFNIOMIOPORTINSTRING) pfnInStrCallback;
-    /** Description / Name. For easing debugging. */
-    R3PTRTYPE(const char *)     pszDesc;
-} IOMIOPORTRANGER0;
-/** Pointer to I/O port range descriptor, R0 version. */
-typedef IOMIOPORTRANGER0 *PIOMIOPORTRANGER0;
-
-/**
- * I/O port range descriptor, RC version.
- */
-typedef struct IOMIOPORTRANGERC
-{
-    /** Avl node core with Port as Key and Port + cPorts - 1 as KeyLast. */
-    AVLROIOPORTNODECORE         Core;
-    /** Start I/O port address. */
-    RTIOPORT                    Port;
-    /** Size of the range. */
-    uint16_t                    cPorts;
-    /** Pointer to user argument. */
-    RTRCPTR                     pvUser;
-    /** Pointer to the associated device instance. */
-    RCPTRTYPE(PPDMDEVINS)       pDevIns;
-    /** Pointer to OUT callback function. */
-    RCPTRTYPE(PFNIOMIOPORTOUT)  pfnOutCallback;
-    /** Pointer to IN callback function. */
-    RCPTRTYPE(PFNIOMIOPORTIN)   pfnInCallback;
-    /** Pointer to string OUT callback function. */
-    RCPTRTYPE(PFNIOMIOPORTOUTSTRING) pfnOutStrCallback;
-    /** Pointer to string IN callback function. */
-    RCPTRTYPE(PFNIOMIOPORTINSTRING) pfnInStrCallback;
-#if HC_ARCH_BITS == 64
-    RTRCPTR                     RCPtrAlignment; /**< pszDesc is 8 byte aligned. */
-#endif
-    /** Description / Name. For easing debugging. */
-    R3PTRTYPE(const char *)     pszDesc;
-} IOMIOPORTRANGERC;
-/** Pointer to I/O port range descriptor, RC version. */
-typedef IOMIOPORTRANGERC *PIOMIOPORTRANGERC;
-
-
-/**
- * I/O port statistics. (one I/O port)
- *
- * This is a simple way of making on demand statistics, however it's a
- * bit free with the hypervisor heap memory.
- */
-typedef struct IOMIOPORTSTATS
-{
-    /** Avl node core with the port as Key. */
-    AVLOIOPORTNODECORE          Core;
-#if HC_ARCH_BITS != 64 || !defined(RT_OS_WINDOWS)
-    uint32_t                    u32Alignment; /**< The sizeof(Core) differs. */
-#endif
-    /** Number of INs to this port from R3. */
-    STAMCOUNTER                 InR3;
-    /** Profiling IN handler overhead in R3. */
-    STAMPROFILE                 ProfInR3;
-    /** Number of OUTs to this port from R3. */
-    STAMCOUNTER                 OutR3;
-    /** Profiling OUT handler overhead in R3. */
-    STAMPROFILE                 ProfOutR3;
-
-    /** Number of INs to this port from R0/RC. */
-    STAMCOUNTER                 InRZ;
-    /** Profiling IN handler overhead in R0/RC. */
-    STAMPROFILE                 ProfInRZ;
-    /** Number of INs to this port from R0/RC which was serviced in R3. */
-    STAMCOUNTER                 InRZToR3;
-
-    /** Number of OUTs to this port from R0/RC. */
-    STAMCOUNTER                 OutRZ;
-    /** Profiling OUT handler overhead in R0/RC. */
-    STAMPROFILE                 ProfOutRZ;
-    /** Number of OUTs to this port from R0/RC which was serviced in R3. */
-    STAMCOUNTER                 OutRZToR3;
-} IOMIOPORTSTATS;
-AssertCompileMemberAlignment(IOMIOPORTSTATS, InR3, 8);
-/** Pointer to I/O port statistics. */
-typedef IOMIOPORTSTATS *PIOMIOPORTSTATS;
-
-
-/**
  * The IOM trees.
  *
@@ -553,18 +415,6 @@
 typedef struct IOMTREES
 {
-    /** Tree containing I/O port range descriptors registered for HC (IOMIOPORTRANGEHC). */
-    AVLROIOPORTTREE         IOPortTreeR3;
-    /** Tree containing I/O port range descriptors registered for R0 (IOMIOPORTRANGER0). */
-    AVLROIOPORTTREE         IOPortTreeR0;
-#if 0
-    /** Tree containing I/O port range descriptors registered for RC (IOMIOPORTRANGERC). */
-    AVLROIOPORTTREE         IOPortTreeRC;
-#endif
-
     /** Tree containing the MMIO range descriptors (IOMMMIORANGE). */
     AVLROGCPHYSTREE         MMIOTree;
-
-    /** Tree containing I/O port statistics (IOMIOPORTSTATS). */
-    AVLOIOPORTTREE          IOPortStatTree;
     /** Tree containing MMIO statistics (IOMMMIOSTATS). */
     AVLOGCPHYSTREE          MmioStatTree;
@@ -639,15 +489,7 @@
     uint16_t                            u16Padding;
 
-    R3PTRTYPE(PIOMIOPORTRANGER3)    pRangeLastReadR3;
-    R3PTRTYPE(PIOMIOPORTRANGER3)    pRangeLastWriteR3;
-    R3PTRTYPE(PIOMIOPORTSTATS)      pStatsLastReadR3;
-    R3PTRTYPE(PIOMIOPORTSTATS)      pStatsLastWriteR3;
     R3PTRTYPE(PIOMMMIORANGE)        pMMIORangeLastR3;
     R3PTRTYPE(PIOMMMIOSTATS)        pMMIOStatsLastR3;
 
-    R0PTRTYPE(PIOMIOPORTRANGER0)    pRangeLastReadR0;
-    R0PTRTYPE(PIOMIOPORTRANGER0)    pRangeLastWriteR0;
-    R0PTRTYPE(PIOMIOPORTSTATS)      pStatsLastReadR0;
-    R0PTRTYPE(PIOMIOPORTSTATS)      pStatsLastWriteR0;
     R0PTRTYPE(PIOMMMIORANGE)        pMMIORangeLastR0;
     R0PTRTYPE(PIOMMMIOSTATS)        pMMIOStatsLastR0;
