Index: trunk/src/VBox/Devices/Audio/DevSB16.cpp
===================================================================
--- trunk/src/VBox/Devices/Audio/DevSB16.cpp	(revision 55354)
+++ trunk/src/VBox/Devices/Audio/DevSB16.cpp	(revision 55355)
@@ -52,5 +52,5 @@
 #include <VBox/vmm/pdmaudioifs.h>
 
-#include "vl_vbox.h"
+#include "VBoxDD.h"
 
 #ifdef LOG_GROUP
@@ -68,19 +68,9 @@
 #endif
 
-#ifndef VBOX
-#define LENOFA(a) ((int) (sizeof(a)/sizeof(a[0])))
-#else /* VBOX */
 /** Current saved state version. */
 #define SB16_SAVE_STATE_VERSION         2
 /** The version used in VirtualBox version 3.0 and earlier. This didn't include the config dump. */
 #define SB16_SAVE_STATE_VERSION_VBOX_30 1
-#endif /* VBOX */
-
-#ifndef VBOX
-#define IO_READ_PROTO(name)                             \
-    uint32_t name (void *opaque, uint32_t nport)
-#define IO_WRITE_PROTO(name)                                    \
-    void name (void *opaque, uint32_t nport, uint32_t val)
-#else  /* VBOX */
+
 #define IO_READ_PROTO(name)                                             \
     DECLCALLBACK(int) name (PPDMDEVINS pDevIns, void *opaque,       \
@@ -90,19 +80,6 @@
     DECLCALLBACK(int) name (PPDMDEVINS pDevIns, void *opaque,       \
                             RTIOPORT nport, uint32_t val, unsigned cb)
-#endif /* VBOX */
 
 static const char e3[] = "COPYRIGHT (C) CREATIVE TECHNOLOGY LTD, 1992.";
-
-#ifndef VBOX
-static struct
-{
-    int ver_lo;
-    int ver_hi;
-    int irq;
-    int dma;
-    int hdma;
-    int port;
-} conf = {5, 4, 5, 1, 5, 0x220};
-#endif /* !VBOX */
 
 #ifdef VBOX_WITH_PDM_AUDIO_DRIVER
@@ -391,16 +368,4 @@
     LogFlowFunc(("hold %d high %d dma %d\n", hold, pThis->use_hdma, dma));
 
-#ifndef VBOX
-    if (hold)
-    {
-        DMA_hold_DREQ(dma);
-        AUD_set_active_out(pThis->voice, 1);
-    }
-    else
-    {
-        DMA_release_DREQ(dma);
-        AUD_set_active_out(pThis->voice, 0);
-    }
-#else  /* VBOX */
 # ifdef VBOX_WITH_PDM_AUDIO_DRIVER
     PSB16DRIVER pDrv;
@@ -429,15 +394,6 @@
 # endif
     }
-#endif /* VBOX */
-}
-
-#ifndef VBOX
-static void aux_timer (void *opaque)
-{
-    PSB16STATE pThis = opaque;
-    pThis->can_write = 1;
-    qemu_irq_raise (pThis->pic[pThis->irq]);
-}
-#else  /* VBOX */
+}
+
 static DECLCALLBACK(void) sb16TimerIRQ(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvThis)
 {
@@ -446,5 +402,4 @@
     PDMDevHlpISASetIrq(pThis->pDevIns, pThis->irq, 1);
 }
-#endif /* VBOX */
 
 #define DMA8_AUTO 1
@@ -873,9 +828,5 @@
                 dsp_out_data(pThis, 0xaa);
                 pThis->mixer_regs[0x82] |= (cmd == 0xf2) ? 1 : 2;
-#ifndef VBOX
-                qemu_irq_raise (pThis->pic[pThis->irq]);
-#else
                 PDMDevHlpISASetIrq(pThis->pDevIns, pThis->irq, 1);
-#endif
                 break;
 
@@ -1048,19 +999,4 @@
             samples = dsp_get_lohi (pThis) + 1;
             bytes = samples << pThis->fmt_stereo << ((pThis->fmt_bits == 16) ? 1 : 0);
-#ifndef VBOX
-            ticks = (bytes * ticks_per_sec) / freq;
-            if (ticks < ticks_per_sec / 1024) {
-                qemu_irq_raise (pThis->pic[pThis->irq]);
-            }
-            else {
-                if (pThis->aux_ts) {
-                    qemu_mod_timer (
-                        pThis->aux_ts,
-                        qemu_get_clock (vm_clock) + ticks
-                        );
-                }
-            }
-            LogFlowFunc(("mix silence %d %d %" PRId64 "\n", samples, bytes, ticks));
-#else  /* VBOX */
             ticks = (bytes * TMTimerGetFreq(pThis->pTimerIRQ)) / freq;
             if (ticks < TMTimerGetFreq(pThis->pTimerIRQ) / 1024)
@@ -1069,6 +1005,4 @@
                 TMTimerSet(pThis->pTimerIRQ, TMTimerGet(pThis->pTimerIRQ) + ticks);
             LogFlowFunc(("mix silence %d %d % %RU64\n", samples, bytes, ticks));
-#endif /* VBOX */
-
             break;
         }
@@ -1161,11 +1095,4 @@
 static void sb16Reset(PSB16STATE pThis)
 {
-#ifndef VBOX
-    qemu_irq_lower (pThis->pic[pThis->irq]);
-    if (pThis->dma_auto) {
-        qemu_irq_raise (pThis->pic[pThis->irq]);
-        qemu_irq_lower (pThis->pic[pThis->irq]);
-    }
-#else  /* VBOX */
     PDMDevHlpISASetIrq(pThis->pDevIns, pThis->irq, 0);
     if (pThis->dma_auto)
@@ -1174,5 +1101,4 @@
         PDMDevHlpISASetIrq(pThis->pDevIns, pThis->irq, 0);
     }
-#endif /* VBOX */
 
     pThis->mixer_regs[0x82] = 0;
@@ -1212,9 +1138,5 @@
                         {
                             pThis->highspeed = 0;
-#ifndef VBOX
-                            qemu_irq_lower (pThis->pic[pThis->irq]);
-#else
                             PDMDevHlpISASetIrq(pThis->pDevIns, pThis->irq, 0);
-#endif
                             sb16Control(pThis, 0);
                         }
@@ -1291,7 +1213,5 @@
     }
 
-#ifdef VBOX
     return VINF_SUCCESS;
-#endif
 }
 
@@ -1302,8 +1222,7 @@
 
     iport = nport - pThis->port;
-#ifdef VBOX
+
     /** @todo reject non-byte access?
      *  The spec does not mention a non-byte access so we should check how real hardware behaves. */
-#endif
 
     switch (iport)
@@ -1343,9 +1262,5 @@
                 ack = 1;
                 pThis->mixer_regs[0x82] &= ~1;
-#ifndef VBOX
-                qemu_irq_lower (pThis->pic[pThis->irq]);
-#else
                 PDMDevHlpISASetIrq(pThis->pDevIns, pThis->irq, 0);
-#endif
             }
             break;
@@ -1357,9 +1272,5 @@
                 ack = 1;
                 pThis->mixer_regs[0x82] &= ~2;
-#ifndef VBOX
-               qemu_irq_lower (pThis->pic[pThis->irq]);
-#else
                PDMDevHlpISASetIrq(pThis->pDevIns, pThis->irq, 0);
-#endif
             }
             break;
@@ -1372,18 +1283,10 @@
         LogFlowFunc(("read %#x -> %#x\n", nport, retval));
 
-#ifndef VBOX
-    return retval;
-#else
     *pu32 = retval;
     return VINF_SUCCESS;
-#endif
 
  error:
     LogFlowFunc(("warning: dsp_read %#x error\n", nport));
-#ifndef VBOX
-    return 0xff;
-#else
     return VERR_IOM_IOPORT_UNUSED;
-#endif
 }
 
@@ -1457,7 +1360,5 @@
     pThis->mixer_nreg = val;
 
-#ifdef VBOX
     return VINF_SUCCESS;
-#endif
 }
 
@@ -1562,7 +1463,5 @@
         case 0x82:
             LogFlowFunc(("attempt to write into IRQ status register (val=%#x)\n", val));
-#ifdef VBOX
             return VINF_SUCCESS;
-#endif
 
         default:
@@ -1574,5 +1473,4 @@
     pThis->mixer_regs[pThis->mixer_nreg] = val;
 
-#ifdef VBOX
     /* Update the master (mixer) volume. */
     if (fUpdateMaster)
@@ -1604,17 +1502,10 @@
 #endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
     }
-#endif /* VBOX */
-
-#ifdef VBOX
+
     return VINF_SUCCESS;
-#endif
 }
 
 static IO_WRITE_PROTO(mixer_write)
 {
-#ifndef VBOX
-    mixer_write_indexb (opaque, nport, val & 0xff);
-    mixer_write_datab (opaque, nport, (val >> 8) & 0xff);
-#else  /* VBOX */
     PSB16STATE pThis = (PSB16STATE)opaque;
     int iport = nport - pThis->port;
@@ -1641,5 +1532,4 @@
     }
     return VINF_SUCCESS;
-#endif /* VBOX */
 }
 
@@ -1658,10 +1548,6 @@
             pThis->mixer_nreg, pThis->mixer_regs[pThis->mixer_nreg]));
 #endif
-#ifndef VBOX
-    return pThis->mixer_regs[pThis->mixer_nreg];
-#else
     *pu32 = pThis->mixer_regs[pThis->mixer_nreg];
     return VINF_SUCCESS;
-#endif
 }
 
@@ -1675,22 +1561,14 @@
     while (cbToWrite)
     {
-#ifndef VBOX
-        size_t cbToRead;
-        int cbRead;
-#else
         uint32_t cbWrittenMin = UINT32_MAX;
         uint32_t cbToRead;
         uint32_t cbRead;
-#endif
+
         cbToRead = RT_MIN(dma_len - dma_pos, cbToWrite);
         if (cbToRead > sizeof(tmpbuf))
             cbToRead = sizeof(tmpbuf);
 
-#ifndef VBOX
-        cbRead = DMA_read_memory (nchan, tmpbuf, dma_pos, cbToRead);
-#else
         int rc = PDMDevHlpDMAReadMemory(pThis->pDevIns, nchan, tmpbuf, dma_pos, cbToRead, &cbRead);
         AssertMsgRC(rc, ("DMAReadMemory -> %Rrc\n", rc));
-#endif
 
 #ifdef VBOX_WITH_PDM_AUDIO_DRIVER
@@ -1727,9 +1605,5 @@
 }
 
-#ifndef VBOX
-static int sb16DMARead(void *opaque, int nchan, int dma_pos, int dma_len)
-#else
 static DECLCALLBACK(uint32_t) sb16DMARead(PPDMDEVINS pDevIns, void *opaque, unsigned nchan, uint32_t dma_pos, uint32_t dma_len)
-#endif
 {
     PSB16STATE pThis = (PSB16STATE)opaque;
@@ -1808,9 +1682,5 @@
     {
         pThis->mixer_regs[0x82] |= (nchan & 4) ? 2 : 1;
-#ifndef VBOX
-        qemu_irq_raise (pThis->pic[pThis->irq]);
-#else
         PDMDevHlpISASetIrq(pThis->pDevIns, pThis->irq, 1);
-#endif
         if (0 == pThis->dma_auto)
         {
@@ -1838,8 +1708,6 @@
     AssertPtrReturnVoid(pState);
     pState->audio_free = cbFree;
-#ifdef VBOX
     /* New space available, see if we can transfer more. There is no cyclic DMA timer in VBox. */
     PDMDevHlpDMASchedule(pState->pDevIns);
-#endif
 }
 #else
@@ -1912,120 +1780,109 @@
 #endif /* !VBOX_WITH_PDM_AUDIO_DRIVER */
 
-static void SB_save (QEMUFile *f, void *opaque)
-{
-#ifndef VBOX
-    PSB16STATE pThis = opaque;
-#else
-    PSB16STATE pThis = (PSB16STATE)opaque;
-#endif
-
-    qemu_put_be32 (f, pThis->irq);
-    qemu_put_be32 (f, pThis->dma);
-    qemu_put_be32 (f, pThis->hdma);
-    qemu_put_be32 (f, pThis->port);
-    qemu_put_be32 (f, pThis->ver);
-    qemu_put_be32 (f, pThis->in_index);
-    qemu_put_be32 (f, pThis->out_data_len);
-    qemu_put_be32 (f, pThis->fmt_stereo);
-    qemu_put_be32 (f, pThis->fmt_signed);
-    qemu_put_be32 (f, pThis->fmt_bits);
-    qemu_put_be32s (f, &pThis->fmt);
-    qemu_put_be32 (f, pThis->dma_auto);
-    qemu_put_be32 (f, pThis->block_size);
-    qemu_put_be32 (f, pThis->fifo);
-    qemu_put_be32 (f, pThis->freq);
-    qemu_put_be32 (f, pThis->time_const);
-    qemu_put_be32 (f, pThis->speaker);
-    qemu_put_be32 (f, pThis->needed_bytes);
-    qemu_put_be32 (f, pThis->cmd);
-    qemu_put_be32 (f, pThis->use_hdma);
-    qemu_put_be32 (f, pThis->highspeed);
-    qemu_put_be32 (f, pThis->can_write);
-    qemu_put_be32 (f, pThis->v2x6);
-
-    qemu_put_8s (f, &pThis->csp_param);
-    qemu_put_8s (f, &pThis->csp_value);
-    qemu_put_8s (f, &pThis->csp_mode);
-    qemu_put_8s (f, &pThis->csp_param);
-    qemu_put_buffer (f, pThis->csp_regs, 256);
-    qemu_put_8s (f, &pThis->csp_index);
-    qemu_put_buffer (f, pThis->csp_reg83, 4);
-    qemu_put_be32 (f, pThis->csp_reg83r);
-    qemu_put_be32 (f, pThis->csp_reg83w);
-
-    qemu_put_buffer (f, pThis->in2_data, sizeof (pThis->in2_data));
-    qemu_put_buffer (f, pThis->out_data, sizeof (pThis->out_data));
-    qemu_put_8s (f, &pThis->test_reg);
-    qemu_put_8s (f, &pThis->last_read_byte);
-
-    qemu_put_be32 (f, pThis->nzero);
-    qemu_put_be32 (f, pThis->left_till_irq);
-    qemu_put_be32 (f, pThis->dma_running);
-    qemu_put_be32 (f, pThis->bytes_per_second);
-    qemu_put_be32 (f, pThis->align);
-
-    qemu_put_be32 (f, pThis->mixer_nreg);
-    qemu_put_buffer (f, pThis->mixer_regs, 256);
-}
-
-static int SB_load (QEMUFile *f, void *opaque, int version_id)
-{
-#ifndef VBOX
-    PSB16STATE pThis = opaque;
-
-    if (version_id != 1) {
-        return -EINVAL;
-    }
-#else
-    PSB16STATE pThis = (PSB16STATE)opaque;
-#endif
-
-    pThis->irq=qemu_get_be32 (f);
-    pThis->dma=qemu_get_be32 (f);
-    pThis->hdma=qemu_get_be32 (f);
-    pThis->port=qemu_get_be32 (f);
-    pThis->ver=qemu_get_be32 (f);
-    pThis->in_index=qemu_get_be32 (f);
-    pThis->out_data_len=qemu_get_be32 (f);
-    pThis->fmt_stereo=qemu_get_be32 (f);
-    pThis->fmt_signed=qemu_get_be32 (f);
-    pThis->fmt_bits=qemu_get_be32 (f);
-    qemu_get_be32s (f, (uint32_t*)&pThis->fmt);
-    pThis->dma_auto=qemu_get_be32 (f);
-    pThis->block_size=qemu_get_be32 (f);
-    pThis->fifo=qemu_get_be32 (f);
-    pThis->freq=qemu_get_be32 (f);
-    pThis->time_const=qemu_get_be32 (f);
-    pThis->speaker=qemu_get_be32 (f);
-    pThis->needed_bytes=qemu_get_be32 (f);
-    pThis->cmd=qemu_get_be32 (f);
-    pThis->use_hdma=qemu_get_be32 (f);
-    pThis->highspeed=qemu_get_be32 (f);
-    pThis->can_write=qemu_get_be32 (f);
-    pThis->v2x6=qemu_get_be32 (f);
-
-    qemu_get_8s (f, &pThis->csp_param);
-    qemu_get_8s (f, &pThis->csp_value);
-    qemu_get_8s (f, &pThis->csp_mode);
-    qemu_get_8s (f, &pThis->csp_param);
-    qemu_get_buffer (f, pThis->csp_regs, 256);
-    qemu_get_8s (f, &pThis->csp_index);
-    qemu_get_buffer (f, pThis->csp_reg83, 4);
-    pThis->csp_reg83r=qemu_get_be32 (f);
-    pThis->csp_reg83w=qemu_get_be32 (f);
-
-    qemu_get_buffer (f, pThis->in2_data, sizeof (pThis->in2_data));
-    qemu_get_buffer (f, pThis->out_data, sizeof (pThis->out_data));
-    qemu_get_8s (f, &pThis->test_reg);
-    qemu_get_8s (f, &pThis->last_read_byte);
-
-    pThis->nzero=qemu_get_be32 (f);
-    pThis->left_till_irq=qemu_get_be32 (f);
-    pThis->dma_running=qemu_get_be32 (f);
-    pThis->bytes_per_second=qemu_get_be32 (f);
-    pThis->align=qemu_get_be32 (f);
-
-    pThis->mixer_nreg=qemu_get_be32 (f);
-    qemu_get_buffer (f, pThis->mixer_regs, 256);
+static void sb16Save(PSSMHANDLE pSSM, PSB16STATE pThis)
+{
+    SSMR3PutS32(pSSM, pThis->irq);
+    SSMR3PutS32(pSSM, pThis->dma);
+    SSMR3PutS32(pSSM, pThis->hdma);
+    SSMR3PutS32(pSSM, pThis->port);
+    SSMR3PutS32(pSSM, pThis->ver);
+    SSMR3PutS32(pSSM, pThis->in_index);
+    SSMR3PutS32(pSSM, pThis->out_data_len);
+    SSMR3PutS32(pSSM, pThis->fmt_stereo);
+    SSMR3PutS32(pSSM, pThis->fmt_signed);
+    SSMR3PutS32(pSSM, pThis->fmt_bits);
+
+    SSMR3PutU32(pSSM, pThis->fmt);
+
+    SSMR3PutS32(pSSM, pThis->dma_auto);
+    SSMR3PutS32(pSSM, pThis->block_size);
+    SSMR3PutS32(pSSM, pThis->fifo);
+    SSMR3PutS32(pSSM, pThis->freq);
+    SSMR3PutS32(pSSM, pThis->time_const);
+    SSMR3PutS32(pSSM, pThis->speaker);
+    SSMR3PutS32(pSSM, pThis->needed_bytes);
+    SSMR3PutS32(pSSM, pThis->cmd);
+    SSMR3PutS32(pSSM, pThis->use_hdma);
+    SSMR3PutS32(pSSM, pThis->highspeed);
+    SSMR3PutS32(pSSM, pThis->can_write);
+    SSMR3PutS32(pSSM, pThis->v2x6);
+
+    SSMR3PutU8 (pSSM, pThis->csp_param);
+    SSMR3PutU8 (pSSM, pThis->csp_value);
+    SSMR3PutU8 (pSSM, pThis->csp_mode);
+    SSMR3PutU8 (pSSM, pThis->csp_param); /* Bug compatible! */
+    SSMR3PutMem(pSSM, pThis->csp_regs, 256);
+    SSMR3PutU8 (pSSM, pThis->csp_index);
+    SSMR3PutMem(pSSM, pThis->csp_reg83, 4);
+    SSMR3PutS32(pSSM, pThis->csp_reg83r);
+    SSMR3PutS32(pSSM, pThis->csp_reg83w);
+
+    SSMR3PutMem(pSSM, pThis->in2_data, sizeof (pThis->in2_data));
+    SSMR3PutMem(pSSM, pThis->out_data, sizeof (pThis->out_data));
+    SSMR3PutU8 (pSSM, pThis->test_reg);
+    SSMR3PutU8 (pSSM, pThis->last_read_byte);
+
+    SSMR3PutS32(pSSM, pThis->nzero);
+    SSMR3PutS32(pSSM, pThis->left_till_irq);
+    SSMR3PutS32(pSSM, pThis->dma_running);
+    SSMR3PutS32(pSSM, pThis->bytes_per_second);
+    SSMR3PutS32(pSSM, pThis->align);
+
+    SSMR3PutS32(pSSM, pThis->mixer_nreg);
+    SSMR3PutMem(pSSM, pThis->mixer_regs, 256);
+
+}
+
+static int sb16Load(PSSMHANDLE pSSM, PSB16STATE pThis, int version_id)
+{
+    SSMR3GetS32(pSSM, &pThis->irq);
+    SSMR3GetS32(pSSM, &pThis->dma);
+    SSMR3GetS32(pSSM, &pThis->hdma);
+    SSMR3GetS32(pSSM, &pThis->port);
+    SSMR3GetS32(pSSM, &pThis->ver);
+    SSMR3GetS32(pSSM, &pThis->in_index);
+    SSMR3GetS32(pSSM, &pThis->out_data_len);
+    SSMR3GetS32(pSSM, &pThis->fmt_stereo);
+    SSMR3GetS32(pSSM, &pThis->fmt_signed);
+    SSMR3GetS32(pSSM, &pThis->fmt_bits);
+
+    SSMR3GetU32(pSSM, (uint32_t *)&pThis->fmt);
+
+    SSMR3GetS32(pSSM, &pThis->dma_auto);
+    SSMR3GetS32(pSSM, &pThis->block_size);
+    SSMR3GetS32(pSSM, &pThis->fifo);
+    SSMR3GetS32(pSSM, &pThis->freq);
+    SSMR3GetS32(pSSM, &pThis->time_const);
+    SSMR3GetS32(pSSM, &pThis->speaker);
+    SSMR3GetS32(pSSM, &pThis->needed_bytes);
+    SSMR3GetS32(pSSM, &pThis->cmd);
+    SSMR3GetS32(pSSM, &pThis->use_hdma);
+    SSMR3GetS32(pSSM, &pThis->highspeed);
+    SSMR3GetS32(pSSM, &pThis->can_write);
+    SSMR3GetS32(pSSM, &pThis->v2x6);
+
+    SSMR3GetU8 (pSSM, &pThis->csp_param);
+    SSMR3GetU8 (pSSM, &pThis->csp_value);
+    SSMR3GetU8 (pSSM, &pThis->csp_mode);
+    SSMR3GetU8 (pSSM, &pThis->csp_param);   /* Bug compatible! */
+    SSMR3GetMem(pSSM, pThis->csp_regs, 256);
+    SSMR3GetU8 (pSSM, &pThis->csp_index);
+    SSMR3GetMem(pSSM, pThis->csp_reg83, 4);
+    SSMR3GetS32(pSSM, &pThis->csp_reg83r);
+    SSMR3GetS32(pSSM, &pThis->csp_reg83w);
+
+    SSMR3GetMem(pSSM, pThis->in2_data, sizeof (pThis->in2_data));
+    SSMR3GetMem(pSSM, pThis->out_data, sizeof (pThis->out_data));
+    SSMR3GetU8 (pSSM, &pThis->test_reg);
+    SSMR3GetU8 (pSSM, &pThis->last_read_byte);
+
+    SSMR3GetS32(pSSM, &pThis->nzero);
+    SSMR3GetS32(pSSM, &pThis->left_till_irq);
+    SSMR3GetS32(pSSM, &pThis->dma_running);
+    SSMR3GetS32(pSSM, &pThis->bytes_per_second);
+    SSMR3GetS32(pSSM, &pThis->align);
+
+    SSMR3GetS32(pSSM, &pThis->mixer_nreg);
+    SSMR3GetMem(pSSM, pThis->mixer_regs, 256);
 
 #ifdef VBOX_WITH_PDM_AUDIO_DRIVER
@@ -2080,73 +1937,6 @@
     }
 
-#ifdef VBOX
     return VINF_SUCCESS;
-#endif
-}
-
-#ifndef VBOX
-int SB16_init (AudioState *audio, qemu_irq *pic)
-{
-    PSB16STATE pThis;
-    int i;
-    static const uint8_t dsp_write_ports[] = {0x6, 0xc};
-    static const uint8_t dsp_read_ports[] = {0x6, 0xa, 0xc, 0xd, 0xe, 0xf};
-
-    if (!audio) {
-        LogFlowFunc(("No audio state\n"));
-        return -1;
-    }
-
-    s = qemu_mallocz (sizeof (*s));
-    if (!s) {
-        LogFlowFunc(("Could not allocate memory for SB16 (%zu bytes)\n",
-               sizeof (*s));
-        return -1;
-    }
-
-    pThis->cmd = -1;
-    pThis->pic = pic;
-    pThis->irq = conf.irq;
-    pThis->dma = conf.dma;
-    pThis->hdma = conf.hdma;
-    pThis->port = conf.port;
-    pThis->ver = conf.ver_lo | (conf.ver_hi << 8);
-
-    pThis->mixer_regs[0x80] = magic_of_irq (pThis->irq);
-    pThis->mixer_regs[0x81] = (1 << pThis->dma) | (1 << pThis->hdma);
-    pThis->mixer_regs[0x82] = 2 << 5;
-
-    pThis->csp_regs[5] = 1;
-    pThis->csp_regs[9] = 0xf8;
-
-    sb16MixerReset(pThis);
-    pThis->aux_ts = qemu_new_timer (vm_clock, aux_timer, s);
-    if (!pThis->aux_ts) {
-        LogFlowFunc(("warning: Could not create auxiliary timer\n"));
-    }
-
-    for (i = 0; i < LENOFA (dsp_write_ports); i++) {
-        register_ioport_write (pThis->port + dsp_write_ports[i], 1, 1, dsp_write, s);
-    }
-
-    for (i = 0; i < LENOFA (dsp_read_ports); i++) {
-        register_ioport_read (pThis->port + dsp_read_ports[i], 1, 1, dsp_read, s);
-    }
-
-    register_ioport_write (pThis->port + 0x4, 1, 1, mixer_write_indexb, s);
-    register_ioport_write (pThis->port + 0x4, 1, 2, mixer_write_indexw, s);
-    register_ioport_read (pThis->port + 0x5, 1, 1, mixer_read, s);
-    register_ioport_write (pThis->port + 0x5, 1, 1, mixer_write_datab, s);
-
-    DMA_register_channel (pThis->hdma, sb16DMARead, s);
-    DMA_register_channel (pThis->dma, sb16DMARead, s);
-    pThis->can_write = 1;
-
-    register_savevm ("sb16", 0, 1, SB_save, SB_load, s);
-    AUD_register_card (audio, "sb16", &pThis->card);
-    return 0;
-}
-
-#else /* VBOX */
+}
 
 static DECLCALLBACK(int) sb16LiveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uPass)
@@ -2166,6 +1956,6 @@
     PSB16STATE pThis = PDMINS_2_DATA(pDevIns, PSB16STATE);
 
-    sb16LiveExec (pDevIns, pSSM, 0);
-    SB_save (pSSM, pThis);
+    sb16LiveExec(pDevIns, pSSM, 0);
+    sb16Save(pSSM, pThis);
     return VINF_SUCCESS;
 }
@@ -2212,5 +2002,5 @@
         return VINF_SUCCESS;
 
-    SB_load(pSSM, pThis, uVersion);
+    sb16Load(pSSM, pThis, uVersion);
     return VINF_SUCCESS;
 }
@@ -2566,4 +2356,2 @@
     PDM_DEVREG_VERSION
 };
-#endif /* VBOX */
-
Index: trunk/src/VBox/Devices/Audio/DrvAudio.cpp
===================================================================
--- trunk/src/VBox/Devices/Audio/DrvAudio.cpp	(revision 55354)
+++ trunk/src/VBox/Devices/Audio/DrvAudio.cpp	(revision 55355)
@@ -63,5 +63,4 @@
 
 #include "VBoxDD.h"
-#include "vl_vbox.h"
 
 #include <ctype.h>
@@ -342,5 +341,5 @@
 
                 if (pPCMInfo->fSwapEndian)
-                    s = bswap16(s);
+                    s = RT_BSWAP_U16(s);
 
                 for (i = 0; i < len << shift; i++)
@@ -357,5 +356,5 @@
 
                 if (pPCMInfo->fSwapEndian)
-                    s = bswap32(s);
+                    s = RT_BSWAP_U32(s);
 
                 for (i = 0; i < len << shift; i++)
