VirtualBox

Changeset 50876 in vbox


Ignore:
Timestamp:
Mar 26, 2014 12:43:08 AM (11 years ago)
Author:
vboxsync
Message:

DevSerial.cpp: Added missing bits of state info to the saved state. Was causing windbg to be horribly slow when attaching after restoring a snapshot. (guest w8)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Serial/DevSerial.cpp

    r45025 r50876  
    6868*******************************************************************************/
    6969#define SERIAL_SAVED_STATE_VERSION_16450        3
    70 #define SERIAL_SAVED_STATE_VERSION              4
     70#define SERIAL_SAVED_STATE_VERSION_MISSING_BITS 4
     71#define SERIAL_SAVED_STATE_VERSION              5
    7172
    7273#define UART_LCR_DLAB       0x80        /* Divisor latch access bit */
     
    930931    SSMR3PutBool(pSSM, pThis->msr_changed);
    931932
     933    /* Version 5, safe everything that might be of importance.  Much better than
     934       missing relevant bits! */
     935    SSMR3PutU8(pSSM, pThis->thr);
     936    SSMR3PutU8(pSSM, pThis->tsr);
     937    SSMR3PutU8(pSSM, pThis->iir);
     938    SSMR3PutS32(pSSM, pThis->timeout_ipending);
     939    TMR3TimerSave(pThis->fifo_timeout_timer, pSSM);
     940    TMR3TimerSave(pThis->transmit_timerR3, pSSM);
     941    SSMR3PutU8(pSSM, pThis->recv_fifo.itl);
     942    SSMR3PutU8(pSSM, pThis->xmit_fifo.itl);
     943
    932944    /* Don't store:
    933945     *  - the content of the FIFO
     
    944956static DECLCALLBACK(int) serialLoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass)
    945957{
    946     PDEVSERIAL pThis = PDMINS_2_DATA(pDevIns, PDEVSERIAL);
    947 
    948     if (uVersion == SERIAL_SAVED_STATE_VERSION_16450)
    949     {
    950         pThis->f16550AEnabled = false;
    951         LogRel(("Serial#%d: falling back to 16450 mode from load state\n", pDevIns->iInstance));
     958    PDEVSERIAL  pThis = PDMINS_2_DATA(pDevIns, PDEVSERIAL);
     959    int32_t     iIrq;
     960    uint32_t    IOBase;
     961
     962    AssertMsgReturn(uVersion >= SERIAL_SAVED_STATE_VERSION_16450, ("%d\n", uVersion), VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION);
     963
     964    if (uPass != SSM_PASS_FINAL)
     965    {
     966        SSMR3GetS32(pSSM, &iIrq);
     967        int rc = SSMR3GetU32(pSSM, &IOBase);
     968        AssertRCReturn(rc, rc);
    952969    }
    953970    else
    954         AssertMsgReturn(uVersion == SERIAL_SAVED_STATE_VERSION, ("%d\n", uVersion), VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION);
    955 
    956     if (uPass == SSM_PASS_FINAL)
    957     {
     971    {
     972        if (uVersion == SERIAL_SAVED_STATE_VERSION_16450)
     973        {
     974            pThis->f16550AEnabled = false;
     975            LogRel(("Serial#%d: falling back to 16450 mode from load state\n", pDevIns->iInstance));
     976        }
     977
    958978        SSMR3GetU16(pSSM, &pThis->divider);
    959979        SSMR3GetU8(pSSM, &pThis->rbr);
     
    965985        SSMR3GetU8(pSSM, &pThis->scr);
    966986        if (uVersion > SERIAL_SAVED_STATE_VERSION_16450)
     987            SSMR3GetU8(pSSM, &pThis->fcr);
     988        SSMR3GetS32(pSSM, &pThis->thr_ipending);
     989        SSMR3GetS32(pSSM, &iIrq);
     990        SSMR3GetS32(pSSM, &pThis->last_break_enable);
     991        SSMR3GetU32(pSSM, &IOBase);
     992        SSMR3GetBool(pSSM, &pThis->msr_changed);
     993
     994        if (uVersion > SERIAL_SAVED_STATE_VERSION_MISSING_BITS)
    967995        {
    968             SSMR3GetU8(pSSM, &pThis->fcr);
    969         }
    970         SSMR3GetS32(pSSM, &pThis->thr_ipending);
    971     }
    972 
    973     int32_t  iIrq;
    974     SSMR3GetS32(pSSM, &iIrq);
    975 
    976     if (uPass == SSM_PASS_FINAL)
    977         SSMR3GetS32(pSSM, &pThis->last_break_enable);
    978 
    979     uint32_t IOBase;
    980     int rc = SSMR3GetU32(pSSM, &IOBase);
    981     AssertRCReturn(rc, rc);
    982 
    983     if (    pThis->irq  != iIrq
    984         ||  pThis->base != IOBase)
    985         return SSMR3SetCfgError(pSSM, RT_SRC_POS,
    986                                 N_("Config mismatch - saved irq=%#x iobase=%#x; configured irq=%#x iobase=%#x"),
    987                                 iIrq, IOBase, pThis->irq, pThis->base);
    988 
    989     if (uPass == SSM_PASS_FINAL)
    990     {
    991         SSMR3GetBool(pSSM, &pThis->msr_changed);
    992 
     996            SSMR3GetU8(pSSM, &pThis->thr);
     997            SSMR3GetU8(pSSM, &pThis->tsr);
     998            SSMR3GetU8(pSSM, &pThis->iir);
     999            SSMR3GetS32(pSSM, &pThis->timeout_ipending);
     1000            TMR3TimerLoad(pThis->fifo_timeout_timer, pSSM);
     1001            TMR3TimerLoad(pThis->transmit_timerR3, pSSM);
     1002            SSMR3GetU8(pSSM, &pThis->recv_fifo.itl);
     1003            SSMR3GetU8(pSSM, &pThis->xmit_fifo.itl);
     1004        }
     1005
     1006        /* the marker. */
    9931007        uint32_t u32;
    994         rc = SSMR3GetU32(pSSM, &u32);
     1008        int rc = SSMR3GetU32(pSSM, &u32);
    9951009        if (RT_FAILURE(rc))
    9961010            return rc;
     
    10101024        pThis->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns);
    10111025    }
     1026
     1027    /*
     1028     * Check the config.
     1029     */
     1030    if (    pThis->irq  != iIrq
     1031        ||  pThis->base != IOBase)
     1032        return SSMR3SetCfgError(pSSM, RT_SRC_POS,
     1033                                N_("Config mismatch - saved irq=%#x iobase=%#x; configured irq=%#x iobase=%#x"),
     1034                                iIrq, IOBase, pThis->irq, pThis->base);
    10121035
    10131036    return VINF_SUCCESS;
Note: See TracChangeset for help on using the changeset viewer.

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