VirtualBox

Ignore:
Timestamp:
Oct 28, 2018 7:14:47 PM (6 years ago)
Author:
vboxsync
Message:

DevSerial,UartCore: Attempt and getting old states to load. Needs proper testing that includes live saved states/migration.

File:
1 edited

Legend:

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

    r74754 r75134  
    184184{
    185185    PDEVSERIAL pThis = PDMINS_2_DATA(pDevIns, PDEVSERIAL);
    186     uint8_t    uIrq;
     186    uint8_t    bIrq;
    187187    RTIOPORT   PortBase;
    188188    UARTTYPE   enmType;
     189    int rc;
    189190
    190191    AssertMsgReturn(uVersion >= UART_SAVED_STATE_VERSION_16450, ("%d\n", uVersion), VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION);
    191 
    192     if (uPass != SSM_PASS_FINAL)
    193     {
    194         SSMR3GetU8(pSSM, &uIrq);
     192    if (uVersion > UART_SAVED_STATE_VERSION_LEGACY_CODE)
     193    {
     194        SSMR3GetU8(    pSSM, &bIrq);
    195195        SSMR3GetIOPort(pSSM, &PortBase);
    196         int rc = SSMR3GetU32(pSSM, (uint32_t *)&enmType);
     196        rc = SSMR3GetU32(   pSSM, (uint32_t *)&enmType);
    197197        AssertRCReturn(rc, rc);
     198        if (uPass == SSM_PASS_FINAL)
     199        {
     200            rc = uartR3LoadExec(&pThis->UartCore, pSSM, uVersion, uPass, NULL, NULL);
     201            AssertRCReturn(rc, rc);
     202        }
    198203    }
    199204    else
    200205    {
    201         int rc = VINF_SUCCESS;
    202 
    203         if (uVersion > UART_SAVED_STATE_VERSION_LEGACY_CODE)
     206        enmType = uVersion > UART_SAVED_STATE_VERSION_16450 ? UARTTYPE_16550A : UARTTYPE_16450;
     207        if (uPass != SSM_PASS_FINAL)
    204208        {
    205             SSMR3GetU8(    pSSM, &uIrq);
    206             SSMR3GetIOPort(pSSM, &PortBase);
    207             SSMR3GetU32(   pSSM, (uint32_t *)&enmType);
    208             rc = uartR3LoadExec(&pThis->UartCore, pSSM, uVersion, uPass, NULL, NULL);
     209            int32_t iIrqTmp;
     210            SSMR3GetS32(pSSM, &iIrqTmp);
     211            uint32_t uPortBaseTmp;
     212            rc = SSMR3GetU32(pSSM, &uPortBaseTmp);
     213            AssertRCReturn(rc, rc);
     214
     215            bIrq     = (uint8_t)iIrqTmp;
     216            PortBase = (uint32_t)uPortBaseTmp;
    209217        }
    210218        else
    211219        {
    212             if (uVersion > UART_SAVED_STATE_VERSION_16450)
    213                 enmType = UARTTYPE_16550A;
    214             else
    215                 enmType = UARTTYPE_16450;
    216             rc = uartR3LoadExec(&pThis->UartCore, pSSM, uVersion, uPass, &uIrq, &PortBase);
     220            rc = uartR3LoadExec(&pThis->UartCore, pSSM, uVersion, uPass, &bIrq, &PortBase);
     221            AssertRCReturn(rc, rc);
    217222        }
    218         if (RT_SUCCESS(rc))
    219         {
    220             /* The marker. */
    221             uint32_t u32;
    222             rc = SSMR3GetU32(pSSM, &u32);
    223             if (RT_FAILURE(rc))
    224                 return rc;
    225             AssertMsgReturn(u32 == UINT32_MAX, ("%#x\n", u32), VERR_SSM_DATA_UNIT_FORMAT_CHANGED);
    226         }
     223    }
     224
     225    if (uPass == SSM_PASS_FINAL)
     226    {
     227        /* The marker. */
     228        uint32_t u32;
     229        rc = SSMR3GetU32(pSSM, &u32);
     230        AssertRCReturn(rc, rc);
     231        AssertMsgReturn(u32 == UINT32_MAX, ("%#x\n", u32), VERR_SSM_DATA_UNIT_FORMAT_CHANGED);
    227232    }
    228233
     
    230235     * Check the config.
    231236     */
    232     if (    pThis->uIrq     != uIrq
     237    if (    pThis->uIrq     != bIrq
    233238        ||  pThis->PortBase != PortBase
    234239        ||  pThis->UartCore.enmType != enmType)
    235240        return SSMR3SetCfgError(pSSM, RT_SRC_POS,
    236241                                N_("Config mismatch - saved IRQ=%#x PortBase=%#x Type=%d; configured IRQ=%#x PortBase=%#x Type=%d"),
    237                                 uIrq, PortBase, enmType, pThis->uIrq, pThis->PortBase, pThis->UartCore.enmType);
     242                                bIrq, PortBase, enmType, pThis->uIrq, pThis->PortBase, pThis->UartCore.enmType);
    238243
    239244    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