Index: trunk/src/VBox/Devices/Storage/DevATA.cpp
===================================================================
--- trunk/src/VBox/Devices/Storage/DevATA.cpp	(revision 81839)
+++ trunk/src/VBox/Devices/Storage/DevATA.cpp	(revision 81842)
@@ -183,4 +183,8 @@
 typedef struct ATADevState
 {
+    /** The I/O buffer.
+     * @note Page aligned in case it helps.  */
+    uint8_t                             abIOBuffer[ATA_MAX_IO_BUFFER_SIZE];
+
     /** Flag indicating whether the current command uses LBA48 mode. */
     bool                                fLBA48;
@@ -285,10 +289,4 @@
     /** Size of I/O buffer. */
     uint32_t                            cbIOBuffer;
-    /** Pointer to the I/O buffer. */
-    R3PTRTYPE(uint8_t *)                pbIOBufferR3;
-    /** Pointer to the I/O buffer. */
-    R0PTRTYPE(uint8_t *)                pbIOBufferR0;
-    /** Pointer to the I/O buffer. */
-    RCPTRTYPE(uint8_t *)                pbIOBufferRC;
 
     /*
@@ -391,5 +389,5 @@
     R3PTRTYPE(PTRACKLIST)               pTrackList;
 
-    uint8_t                             abAlignment4[HC_ARCH_BITS == 64 ? 7 : 3];
+    uint8_t                             abAlignment4[HC_ARCH_BITS == 64 ? 7 + 3432 : 3 + 3432 + 13*4];
 } ATADevState;
 AssertCompileMemberAlignment(ATADevState, cTotalSectors, 8);
@@ -398,5 +396,5 @@
 AssertCompileMemberAlignment(ATADevState, pDevInsR3, 8);
 AssertCompileMemberAlignment(ATADevState, szSerialNumber, 8);
-AssertCompileSizeAlignment(ATADevState, 8);
+AssertCompileSizeAlignment(ATADevState, 4096); /* To align the buffer on a page boundrary. */
 
 
@@ -475,4 +473,7 @@
 typedef struct ATACONTROLLER
 {
+    /** The ATA/ATAPI interfaces of this controller. */
+    ATADevState         aIfs[2];
+
     /** The base of the first I/O Port range. */
     RTIOPORT            IOPortBase1;
@@ -511,7 +512,4 @@
     uint32_t            cbRedoDMABuffer;
 
-    /** The ATA/ATAPI interfaces of this controller. */
-    ATADevState         aIfs[2];
-
     /** Pointer to device instance. */
     PPDMDEVINSR3        pDevInsR3;
@@ -553,4 +551,5 @@
     STAMPROFILEADV      StatAsyncTime;
     STAMPROFILE         StatLockWait;
+    uint8_t             abAlignment4[3440];
 } ATACONTROLLER, *PATACONTROLLER;
 AssertCompileMemberAlignment(ATACONTROLLER, lock, 8);
@@ -560,4 +559,6 @@
 AssertCompileMemberAlignment(ATACONTROLLER, AsyncIORequestLock, 8);
 AssertCompileSizeAlignment(ATACONTROLLER, 8);
+AssertCompileSizeAlignment(ATACONTROLLER, 4096); /* To align the controllers, devices and I/O buffers on page boundaries. */
+
 
 typedef enum CHIPSET
@@ -1303,5 +1304,5 @@
     Assert(s->cbElementaryTransfer == 512);
 
-    p = (uint16_t *)s->CTX_SUFF(pbIOBuffer);
+    p = (uint16_t *)&s->abIOBuffer[0];
     memset(p, 0, 512);
     p[0] = RT_H2LE_U16(0x0040);
@@ -1436,5 +1437,5 @@
     Assert(s->cbElementaryTransfer == 512);
 
-    p = (uint16_t *)s->CTX_SUFF(pbIOBuffer);
+    p = (uint16_t *)&s->abIOBuffer[0];
     memset(p, 0, 512);
     /* Removable CDROM, 3ms response, 12 byte packets */
@@ -1736,5 +1737,5 @@
     iLBA = ataR3GetSector(s);
     Log(("%s: %d sectors at LBA %d\n", __FUNCTION__, cSectors, iLBA));
-    rc = ataR3ReadSectors(s, iLBA, s->CTX_SUFF(pbIOBuffer), cSectors, &fRedo);
+    rc = ataR3ReadSectors(s, iLBA, s->abIOBuffer, cSectors, &fRedo);
     if (RT_SUCCESS(rc))
     {
@@ -1775,5 +1776,5 @@
     iLBA = ataR3GetSector(s);
     Log(("%s: %d sectors at LBA %d\n", __FUNCTION__, cSectors, iLBA));
-    rc = ataR3WriteSectors(s, iLBA, s->CTX_SUFF(pbIOBuffer), cSectors, &fRedo);
+    rc = ataR3WriteSectors(s, iLBA, s->abIOBuffer, cSectors, &fRedo);
     if (RT_SUCCESS(rc))
     {
@@ -1893,5 +1894,5 @@
         if (cbBlockRegion == s->cbATAPISector)
             rc = s->pDrvMedia->pfnRead(s->pDrvMedia, (uint64_t)s->iATAPILBA * s->cbATAPISector,
-                                       s->CTX_SUFF(pbIOBuffer), s->cbATAPISector * cSectors);
+                                       s->abIOBuffer, s->cbATAPISector * cSectors);
         else
         {
@@ -1899,5 +1900,5 @@
             {
                 /* Generate the sync bytes. */
-                uint8_t *pbBuf = s->CTX_SUFF(pbIOBuffer);
+                uint8_t *pbBuf = s->abIOBuffer;
 
                 for (uint32_t i = s->iATAPILBA; i < s->iATAPILBA + cSectors; i++)
@@ -1930,5 +1931,5 @@
             {
                 /* Read only the user data portion. */
-                uint8_t *pbBuf = s->CTX_SUFF(pbIOBuffer);
+                uint8_t *pbBuf = s->abIOBuffer;
 
                 for (uint32_t i = s->iATAPILBA; i < s->iATAPILBA + cSectors; i++)
@@ -1997,5 +1998,5 @@
 
     if (s->uTxDir == PDMMEDIATXDIR_TO_DEVICE)
-        Log3(("ATAPI PT data write (%d): %.*Rhxs\n", cbTransfer, cbTransfer, s->CTX_SUFF(pbIOBuffer)));
+        Log3(("ATAPI PT data write (%d): %.*Rhxs\n", cbTransfer, cbTransfer, s->abIOBuffer));
 
     /* Simple heuristics: if there is at least one sector of data
@@ -2026,8 +2027,8 @@
         case SCSI_MODE_SELECT_10:
         {
-            size_t cbBlkDescLength = scsiBE2H_U16(&s->CTX_SUFF(pbIOBuffer)[6]);
+            size_t cbBlkDescLength = scsiBE2H_U16(&s->abIOBuffer[6]);
 
             SCSILogModePage(szBuf, sizeof(szBuf) - 1,
-                            s->CTX_SUFF(pbIOBuffer) + 8 + cbBlkDescLength,
+                            s->abIOBuffer + 8 + cbBlkDescLength,
                             cbTransfer - 8 - cbBlkDescLength);
             break;
@@ -2036,5 +2037,5 @@
         {
             SCSILogCueSheet(szBuf, sizeof(szBuf) - 1,
-                            s->CTX_SUFF(pbIOBuffer), cbTransfer);
+                            s->abIOBuffer, cbTransfer);
             break;
         }
@@ -2060,5 +2061,5 @@
         uint8_t aATAPICmd[ATAPI_PACKET_SIZE];
         uint32_t iATAPILBA, cSectors, cReqSectors, cbCurrTX;
-        uint8_t *pbBuf = s->CTX_SUFF(pbIOBuffer);
+        uint8_t *pbBuf = s->abIOBuffer;
         uint32_t cSectorsMax; /**< Maximum amount of sectors to read without exceeding the I/O buffer. */
 
@@ -2170,5 +2171,5 @@
     else
         rc = s->pDrvMedia->pfnSendCmd(s->pDrvMedia, s->aATAPICmd, ATAPI_PACKET_SIZE, (PDMMEDIATXDIR)s->uTxDir,
-                                      s->CTX_SUFF(pbIOBuffer), &cbTransfer, abATAPISense, sizeof(abATAPISense), 30000 /**< @todo timeout */);
+                                      s->abIOBuffer, &cbTransfer, abATAPISense, sizeof(abATAPISense), 30000 /**< @todo timeout */);
     if (pProf) { STAM_PROFILE_ADV_STOP(pProf, b); }
 
@@ -2202,5 +2203,5 @@
 
                 if (RT_SUCCESS(rc))
-                    rc = ATAPIPassthroughTrackListUpdate(s->pTrackList, s->aATAPICmd, s->CTX_SUFF(pbIOBuffer));
+                    rc = ATAPIPassthroughTrackListUpdate(s->pTrackList, s->aATAPICmd, s->abIOBuffer);
 
                 if (   RT_FAILURE(rc)
@@ -2233,12 +2234,12 @@
                  * Motivation: changing the VM configuration should be as
                  *             invisible as possible to the guest. */
-                Log3(("ATAPI PT inquiry data before (%d): %.*Rhxs\n", cbTransfer, cbTransfer, s->CTX_SUFF(pbIOBuffer)));
-                scsiPadStr(s->CTX_SUFF(pbIOBuffer) + 8, "VBOX", 8);
-                scsiPadStr(s->CTX_SUFF(pbIOBuffer) + 16, "CD-ROM", 16);
-                scsiPadStr(s->CTX_SUFF(pbIOBuffer) + 32, "1.0", 4);
+                Log3(("ATAPI PT inquiry data before (%d): %.*Rhxs\n", cbTransfer, cbTransfer, s->abIOBuffer));
+                scsiPadStr(&s->abIOBuffer[8], "VBOX", 8);
+                scsiPadStr(&s->abIOBuffer[16], "CD-ROM", 16);
+                scsiPadStr(&s->abIOBuffer[32], "1.0", 4);
             }
 
             if (cbTransfer)
-                Log3(("ATAPI PT data read (%d):\n%.*Rhxd\n", cbTransfer, cbTransfer, s->CTX_SUFF(pbIOBuffer)));
+                Log3(("ATAPI PT data read (%d):\n%.*Rhxd\n", cbTransfer, cbTransfer, s->abIOBuffer));
         }
 
@@ -2282,5 +2283,5 @@
 static bool atapiR3ReadDVDStructureSS(ATADevState *s)
 {
-    uint8_t *buf = s->CTX_SUFF(pbIOBuffer);
+    uint8_t *buf = s->abIOBuffer;
     int media = s->aATAPICmd[1];
     int format = s->aATAPICmd[7];
@@ -2450,5 +2451,5 @@
 static bool atapiR3ReadCapacitySS(ATADevState *s)
 {
-    uint8_t *pbBuf = s->CTX_SUFF(pbIOBuffer);
+    uint8_t *pbBuf = s->abIOBuffer;
 
     Assert(s->uTxDir == PDMMEDIATXDIR_FROM_DEVICE);
@@ -2464,5 +2465,5 @@
 static bool atapiR3ReadDiscInformationSS(ATADevState *s)
 {
-    uint8_t *pbBuf = s->CTX_SUFF(pbIOBuffer);
+    uint8_t *pbBuf = s->abIOBuffer;
 
     Assert(s->uTxDir == PDMMEDIATXDIR_FROM_DEVICE);
@@ -2490,5 +2491,5 @@
 static bool atapiR3ReadTrackInformationSS(ATADevState *s)
 {
-    uint8_t *pbBuf = s->CTX_SUFF(pbIOBuffer);
+    uint8_t *pbBuf = s->abIOBuffer;
     uint32_t u32LogAddr = scsiBE2H_U32(&s->aATAPICmd[2]);
     uint8_t u8LogAddrType = s->aATAPICmd[1] & 0x03;
@@ -2745,5 +2746,5 @@
 {
     uint32_t const cbIOBuffer = RT_MIN(s->cbIOBuffer, ATA_MAX_IO_BUFFER_SIZE);
-    uint8_t *pbBuf = s->CTX_SUFF(pbIOBuffer);
+    uint8_t *pbBuf = s->abIOBuffer;
     uint32_t cbBuf = cbIOBuffer;
     uint32_t cbCopied = 0;
@@ -2796,5 +2797,5 @@
 
     /* Set data length now - the field is not included in the final length. */
-    scsiH2BE_U32(s->CTX_SUFF(pbIOBuffer), cbIOBuffer - cbBuf - 4);
+    scsiH2BE_U32(s->abIOBuffer, cbIOBuffer - cbBuf - 4);
 
     /* Other profiles we might want to add in the future: 0x40 (BD-ROM) and 0x50 (HDDVD-ROM) */
@@ -2807,5 +2808,5 @@
 static bool atapiR3GetEventStatusNotificationSS(ATADevState *s)
 {
-    uint8_t *pbBuf = s->CTX_SUFF(pbIOBuffer);
+    uint8_t *pbBuf = s->abIOBuffer;
 
     Assert(s->uTxDir == PDMMEDIATXDIR_FROM_DEVICE);
@@ -2882,5 +2883,5 @@
 static bool atapiR3InquirySS(ATADevState *s)
 {
-    uint8_t *pbBuf = s->CTX_SUFF(pbIOBuffer);
+    uint8_t *pbBuf = s->abIOBuffer;
 
     Assert(s->uTxDir == PDMMEDIATXDIR_FROM_DEVICE);
@@ -2910,5 +2911,5 @@
 static bool atapiR3ModeSenseErrorRecoverySS(ATADevState *s)
 {
-    uint8_t *pbBuf = s->CTX_SUFF(pbIOBuffer);
+    uint8_t *pbBuf = s->abIOBuffer;
 
     Assert(s->uTxDir == PDMMEDIATXDIR_FROM_DEVICE);
@@ -2938,5 +2939,5 @@
 static bool atapiR3ModeSenseCDStatusSS(ATADevState *s)
 {
-    uint8_t *pbBuf = s->CTX_SUFF(pbIOBuffer);
+    uint8_t *pbBuf = s->abIOBuffer;
 
     Assert(s->uTxDir == PDMMEDIATXDIR_FROM_DEVICE);
@@ -2986,5 +2987,5 @@
 static bool atapiR3RequestSenseSS(ATADevState *s)
 {
-    uint8_t *pbBuf = s->CTX_SUFF(pbIOBuffer);
+    uint8_t *pbBuf = s->abIOBuffer;
 
     Assert(s->uTxDir == PDMMEDIATXDIR_FROM_DEVICE);
@@ -2999,5 +3000,5 @@
 static bool atapiR3MechanismStatusSS(ATADevState *s)
 {
-    uint8_t *pbBuf = s->CTX_SUFF(pbIOBuffer);
+    uint8_t *pbBuf = s->abIOBuffer;
 
     Assert(s->uTxDir == PDMMEDIATXDIR_FROM_DEVICE);
@@ -3018,5 +3019,7 @@
 static bool atapiR3ReadTOCNormalSS(ATADevState *s)
 {
-    uint8_t *pbBuf = s->CTX_SUFF(pbIOBuffer), *q, iStartTrack;
+    uint8_t *pbBuf = s->abIOBuffer;
+    uint8_t *q;
+    uint8_t iStartTrack;
     bool fMSF;
     uint32_t cbSize;
@@ -3106,5 +3109,5 @@
 static bool atapiR3ReadTOCMultiSS(ATADevState *s)
 {
-    uint8_t *pbBuf = s->CTX_SUFF(pbIOBuffer);
+    uint8_t *pbBuf = s->abIOBuffer;
     bool fMSF;
 
@@ -3150,5 +3153,7 @@
 static bool atapiR3ReadTOCRawSS(ATADevState *s)
 {
-    uint8_t *pbBuf = s->CTX_SUFF(pbIOBuffer), *q, iStartTrack;
+    uint8_t *pbBuf = s->abIOBuffer;
+    uint8_t *q;
+    uint8_t iStartTrack;
     bool fMSF;
     uint32_t cbSize;
@@ -3237,11 +3242,8 @@
 static void atapiR3ParseCmdVirtualATAPI(ATADevState *s)
 {
-    const uint8_t *pbPacket;
-    uint8_t *pbBuf;
+    const uint8_t *pbPacket = s->aATAPICmd;
     uint32_t cbMax;
     uint32_t cSectors, iATAPILBA;
 
-    pbPacket = s->aATAPICmd;
-    pbBuf = s->CTX_SUFF(pbIOBuffer);
     switch (pbPacket[0])
     {
@@ -3791,5 +3793,5 @@
 {
     s->fDMA = !!(s->uATARegFeature & 1);
-    memcpy(s->aATAPICmd, s->CTX_SUFF(pbIOBuffer), ATAPI_PACKET_SIZE);
+    memcpy(s->aATAPICmd, s->abIOBuffer, ATAPI_PACKET_SIZE);
     s->uTxDir = PDMMEDIATXDIR_NONE;
     s->cbTotalTransfer = 0;
@@ -4014,5 +4016,5 @@
     int rc = VERR_GENERAL_FAILURE;
     uint32_t cRangesMax;
-    uint64_t *pu64Range = (uint64_t *)s->CTX_SUFF(pbIOBuffer);
+    uint64_t *pu64Range = (uint64_t *)&s->abIOBuffer[0];
     bool fRedo = false;
 
@@ -4932,5 +4934,5 @@
  *
  * The two buffers are either stack (32-bit aligned) or somewhere within
- * pIf->pbIOBuffer.
+ * pIf->abIOBuffer.
  *
  * @param   pIf         The device interface to work with.
@@ -4942,5 +4944,5 @@
 {
     /*
-     * Quick bounds checking can be done by checking that the pbIOBuffer offset
+     * Quick bounds checking can be done by checking that the abIOBuffer offset
      * (iIOBufferPIODataStart) is aligned at the transfer size (which is ASSUMED
      * to be 1, 2 or 4).  However, since we're paranoid and don't currently
@@ -4989,5 +4991,5 @@
         {
             Assert(s->uTxDir == PDMMEDIATXDIR_TO_DEVICE);
-            uint8_t       *pbDst = s->CTX_SUFF(pbIOBuffer) + s->iIOBufferPIODataStart;
+            uint8_t       *pbDst = &s->abIOBuffer[s->iIOBufferPIODataStart];
             uint8_t const *pbSrc = (uint8_t const *)&u32;
 
@@ -5062,5 +5064,5 @@
         {
             Assert(s->uTxDir == PDMMEDIATXDIR_FROM_DEVICE);
-            uint8_t const *pbSrc = s->CTX_SUFF(pbIOBuffer) + s->iIOBufferPIODataStart;
+            uint8_t const *pbSrc = &s->abIOBuffer[s->iIOBufferPIODataStart];
             uint8_t       *pbDst = (uint8_t *)pu32;
 
@@ -5167,5 +5169,5 @@
                      * Do the transfer.
                      */
-                    uint8_t const *pbSrc = s->CTX_SUFF(pbIOBuffer) + offStart;
+                    uint8_t const *pbSrc = &s->abIOBuffer[offStart];
                     memcpy(pbDst, pbSrc, cbTransfer);
                     Log3(("%s: addr=%#x cb=%#x cbTransfer=%#x val=%.*Rhxd\n",
@@ -5256,5 +5258,5 @@
                      * Do the transfer.
                      */
-                    void *pvDst = s->CTX_SUFF(pbIOBuffer) + offStart;
+                    void *pvDst = &s->abIOBuffer[offStart];
                     memcpy(pvDst, pbSrc, cbTransfer);
                     Log3(("%s: addr=%#x val=%.*Rhxs\n", __FUNCTION__, Port, cbTransfer, pvDst));
@@ -5379,7 +5381,7 @@
 
                 if (uTxDir == PDMMEDIATXDIR_FROM_DEVICE)
-                    PDMDevHlpPCIPhysWrite(pDevIns, GCPhysBuffer, s->CTX_SUFF(pbIOBuffer) + iIOBufferCur, cbXfer);
+                    PDMDevHlpPCIPhysWrite(pDevIns, GCPhysBuffer, &s->abIOBuffer[iIOBufferCur], cbXfer);
                 else
-                    PDMDevHlpPCIPhysRead(pDevIns, GCPhysBuffer, s->CTX_SUFF(pbIOBuffer) + iIOBufferCur, cbXfer);
+                    PDMDevHlpPCIPhysRead(pDevIns, GCPhysBuffer, &s->abIOBuffer[iIOBufferCur], cbXfer);
 
                 iIOBufferCur    += cbXfer;
@@ -6496,12 +6498,4 @@
 #ifdef IN_RING3
 
-
-DECLINLINE(void) ataR3RelocBuffer(PPDMDEVINS pDevIns, ATADevState *s)
-{
-    if (s->pbIOBufferR3)
-        s->pbIOBufferRC = MMHyperR3ToRC(PDMDevHlpGetVM(pDevIns), s->pbIOBufferR3);
-}
-
-
 /**
  * Detach notification.
@@ -6550,9 +6544,6 @@
  * @param   pIf         The ATA unit state.
  */
-static int ataR3ConfigLun(PPDMDEVINS pDevIns, ATADevState *pIf)
-{
-    int             rc = VINF_SUCCESS;
-    PDMMEDIATYPE    enmType;
-
+static int ataR3ConfigLun(ATADevState *pIf)
+{
     /*
      * Query Block, Bios and Mount interfaces.
@@ -6570,5 +6561,5 @@
      * Validate type.
      */
-    enmType = pIf->pDrvMedia->pfnGetType(pIf->pDrvMedia);
+    PDMMEDIATYPE enmType = pIf->pDrvMedia->pfnGetType(pIf->pDrvMedia);
     if (    enmType != PDMMEDIATYPE_CDROM
         &&  enmType != PDMMEDIATYPE_DVD
@@ -6601,5 +6592,4 @@
     }
 
-    PVM pVM = PDMDevHlpGetVM(pDevIns);
     if (pIf->cbIOBuffer)
     {
@@ -6607,10 +6597,7 @@
          * because memory corruption can also overwrite pIf->cbIOBuffer. */
         if (pIf->fATAPI)
-            AssertReleaseReturn(pIf->cbIOBuffer == _128K, VERR_BUFFER_OVERFLOW);
+            AssertLogRelReturn(pIf->cbIOBuffer == _128K, VERR_BUFFER_OVERFLOW);
         else
-            AssertReleaseReturn(pIf->cbIOBuffer == ATA_MAX_MULT_SECTORS * pIf->cbSector, VERR_BUFFER_OVERFLOW);
-        Assert(pIf->pbIOBufferR3);
-        Assert(pIf->pbIOBufferR0 == MMHyperR3ToR0(pVM, pIf->pbIOBufferR3));
-        Assert(pIf->pbIOBufferRC == MMHyperR3ToRC(pVM, pIf->pbIOBufferR3));
+            AssertLogRelReturn(pIf->cbIOBuffer == ATA_MAX_MULT_SECTORS * pIf->cbSector, VERR_BUFFER_OVERFLOW);
     }
     else
@@ -6620,18 +6607,15 @@
         else
             pIf->cbIOBuffer = ATA_MAX_MULT_SECTORS * pIf->cbSector;
-        AssertLogRelMsgReturn(pIf->cbIOBuffer <= ATA_MAX_IO_BUFFER_SIZE,
-                              ("LUN#%u: cbIOBuffer=%#x (%u)\n", pIf->iLUN, pIf->cbIOBuffer, pIf->cbIOBuffer),
-                              VERR_BUFFER_OVERFLOW);
-        Assert(!pIf->pbIOBufferR3);
-        rc = MMR3HyperAllocOnceNoRel(pVM, pIf->cbIOBuffer, 0, MM_TAG_PDM_DEVICE_USER, (void **)&pIf->pbIOBufferR3);
-        if (RT_FAILURE(rc))
-            return VERR_NO_MEMORY;
-        pIf->pbIOBufferR0 = MMHyperR3ToR0(pVM, pIf->pbIOBufferR3);
-        pIf->pbIOBufferRC = MMHyperR3ToRC(pVM, pIf->pbIOBufferR3);
-    }
+    }
+    AssertCompile(_128K <= ATA_MAX_IO_BUFFER_SIZE);
+    AssertCompileSize(pIf->abIOBuffer, ATA_MAX_IO_BUFFER_SIZE);
+    AssertLogRelMsgReturn(pIf->cbIOBuffer <= ATA_MAX_IO_BUFFER_SIZE,
+                          ("LUN#%u: cbIOBuffer=%#x (%u)\n", pIf->iLUN, pIf->cbIOBuffer, pIf->cbIOBuffer),
+                          VERR_BUFFER_OVERFLOW);
 
     /*
      * Init geometry (only for non-CD/DVD media).
      */
+    int rc = VINF_SUCCESS;
     uint32_t cRegions = pIf->pDrvMedia->pfnGetRegionCount(pIf->pDrvMedia);
     pIf->cTotalSectors = 0;
@@ -6771,5 +6755,5 @@
     if (RT_SUCCESS(rc))
     {
-        rc = ataR3ConfigLun(pDevIns, pIf);
+        rc = ataR3ConfigLun(pIf);
         /*
          * In case there is a medium inserted.
@@ -6970,7 +6954,5 @@
             pHlp->pfnSSMPutU32(pSSM, pThis->aCts[i].aIfs[j].cbIOBuffer);
             if (pThis->aCts[i].aIfs[j].cbIOBuffer)
-                pHlp->pfnSSMPutMem(pSSM, pThis->aCts[i].aIfs[j].CTX_SUFF(pbIOBuffer), pThis->aCts[i].aIfs[j].cbIOBuffer);
-            else
-                Assert(pThis->aCts[i].aIfs[j].CTX_SUFF(pbIOBuffer) == NULL);
+                pHlp->pfnSSMPutMem(pSSM, pThis->aCts[i].aIfs[j].abIOBuffer, pThis->aCts[i].aIfs[j].cbIOBuffer);
         }
     }
@@ -7171,10 +7153,9 @@
             if (cbIOBuffer)
             {
-                if (   pThis->aCts[i].aIfs[j].CTX_SUFF(pbIOBuffer)
-                    && cbIOBuffer <= ATA_MAX_IO_BUFFER_SIZE
+                if (   cbIOBuffer <= ATA_MAX_IO_BUFFER_SIZE
                     && cbIOBuffer <= pThis->aCts[i].aIfs[j].cbIOBuffer)
                 {
                     pThis->aCts[i].aIfs[j].cbIOBuffer = cbIOBuffer;
-                    pHlp->pfnSSMGetMem(pSSM, pThis->aCts[i].aIfs[j].CTX_SUFF(pbIOBuffer), cbIOBuffer);
+                    pHlp->pfnSSMGetMem(pSSM, pThis->aCts[i].aIfs[j].abIOBuffer, cbIOBuffer);
                 }
                 else
@@ -7399,8 +7380,6 @@
         pThis->aCts[i].aIfs[0].pDevInsRC += offDelta;
         pThis->aCts[i].aIfs[0].pControllerRC += offDelta;
-        ataR3RelocBuffer(pDevIns, &pThis->aCts[i].aIfs[0]);
         pThis->aCts[i].aIfs[1].pDevInsRC += offDelta;
         pThis->aCts[i].aIfs[1].pControllerRC += offDelta;
-        ataR3RelocBuffer(pDevIns, &pThis->aCts[i].aIfs[1]);
     }
 }
@@ -7811,5 +7790,5 @@
             if (RT_SUCCESS(rc))
             {
-                rc = ataR3ConfigLun(pDevIns, pIf);
+                rc = ataR3ConfigLun(pIf);
                 if (RT_SUCCESS(rc))
                 {
@@ -7925,7 +7904,4 @@
                 pIf->pDrvMedia = NULL;
                 pIf->cbIOBuffer = 0;
-                pIf->pbIOBufferR3 = NULL;
-                pIf->pbIOBufferR0 = NIL_RTR0PTR;
-                pIf->pbIOBufferRC = NIL_RTGCPTR;
                 LogRel(("PIIX3 ATA: LUN#%d: no unit\n", pIf->iLUN));
             }
