VirtualBox

Changeset 55465 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Apr 28, 2015 12:09:47 AM (10 years ago)
Author:
vboxsync
Message:

SSM: Extended the SSMFIELD structure with a first-introduced-in-version member so we won't have to duplicate the descriptors. Currently only added one macro for specifying it called SSMFIELD_ENTRY_VER, more can be added as needed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR3/SSM.cpp

    r55063 r55465  
    37143714     */
    37153715    rc = VINF_SUCCESS;
    3716     uint32_t    off          = 0;
     3716    uint32_t off = 0;
    37173717    for (PCSSMFIELD pCur = paFields;
    37183718         pCur->cb != UINT32_MAX && pCur->off != UINT32_MAX;
     
    65456545         pCur++)
    65466546    {
    6547         uint8_t *pbField = (uint8_t *)pvStruct + pCur->off;
    6548         switch ((uintptr_t)pCur->pfnGetPutOrTransformer)
    6549         {
    6550             case SSMFIELDTRANS_NO_TRANSFORMATION:
    6551                 rc = ssmR3DataRead(pSSM, pbField, pCur->cb);
    6552                 break;
    6553 
    6554             case SSMFIELDTRANS_GCPTR:
    6555                 AssertMsgBreakStmt(pCur->cb == sizeof(RTGCPTR), ("%#x (%s)\n", pCur->cb, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
    6556                 rc = SSMR3GetGCPtr(pSSM, (PRTGCPTR)pbField);
    6557                 break;
    6558 
    6559             case SSMFIELDTRANS_GCPHYS:
    6560                 AssertMsgBreakStmt(pCur->cb == sizeof(RTGCPHYS), ("%#x (%s)\n", pCur->cb, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
    6561                 rc = SSMR3GetGCPhys(pSSM, (PRTGCPHYS)pbField);
    6562                 break;
    6563 
    6564             case SSMFIELDTRANS_RCPTR:
    6565                 AssertMsgBreakStmt(pCur->cb == sizeof(RTRCPTR), ("%#x (%s)\n", pCur->cb, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
    6566                 rc = SSMR3GetRCPtr(pSSM, (PRTRCPTR)pbField);
    6567                 break;
    6568 
    6569             case SSMFIELDTRANS_RCPTR_ARRAY:
     6547        if (pCur->uFirstVer <= pSSM->u.Read.uCurUnitVer)
     6548        {
     6549            uint8_t *pbField = (uint8_t *)pvStruct + pCur->off;
     6550            switch ((uintptr_t)pCur->pfnGetPutOrTransformer)
    65706551            {
    6571                 uint32_t const cEntries = pCur->cb / sizeof(RTRCPTR);
    6572                 AssertMsgBreakStmt(pCur->cb == cEntries * sizeof(RTRCPTR) && cEntries, ("%#x (%s)\n", pCur->cb, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
    6573                 rc = VINF_SUCCESS;
    6574                 for (uint32_t i = 0; i < cEntries && RT_SUCCESS(rc); i++)
    6575                     rc = SSMR3GetRCPtr(pSSM, &((PRTRCPTR)pbField)[i]);
    6576                 break;
     6552                case SSMFIELDTRANS_NO_TRANSFORMATION:
     6553                    rc = ssmR3DataRead(pSSM, pbField, pCur->cb);
     6554                    break;
     6555
     6556                case SSMFIELDTRANS_GCPTR:
     6557                    AssertMsgBreakStmt(pCur->cb == sizeof(RTGCPTR), ("%#x (%s)\n", pCur->cb, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
     6558                    rc = SSMR3GetGCPtr(pSSM, (PRTGCPTR)pbField);
     6559                    break;
     6560
     6561                case SSMFIELDTRANS_GCPHYS:
     6562                    AssertMsgBreakStmt(pCur->cb == sizeof(RTGCPHYS), ("%#x (%s)\n", pCur->cb, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
     6563                    rc = SSMR3GetGCPhys(pSSM, (PRTGCPHYS)pbField);
     6564                    break;
     6565
     6566                case SSMFIELDTRANS_RCPTR:
     6567                    AssertMsgBreakStmt(pCur->cb == sizeof(RTRCPTR), ("%#x (%s)\n", pCur->cb, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
     6568                    rc = SSMR3GetRCPtr(pSSM, (PRTRCPTR)pbField);
     6569                    break;
     6570
     6571                case SSMFIELDTRANS_RCPTR_ARRAY:
     6572                {
     6573                    uint32_t const cEntries = pCur->cb / sizeof(RTRCPTR);
     6574                    AssertMsgBreakStmt(pCur->cb == cEntries * sizeof(RTRCPTR) && cEntries, ("%#x (%s)\n", pCur->cb, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
     6575                    rc = VINF_SUCCESS;
     6576                    for (uint32_t i = 0; i < cEntries && RT_SUCCESS(rc); i++)
     6577                        rc = SSMR3GetRCPtr(pSSM, &((PRTRCPTR)pbField)[i]);
     6578                    break;
     6579                }
     6580
     6581                default:
     6582                    AssertMsgFailedBreakStmt(("%#x\n", pCur->pfnGetPutOrTransformer), rc = VERR_SSM_FIELD_COMPLEX);
    65776583            }
    6578 
    6579             default:
    6580                 AssertMsgFailedBreakStmt(("%#x\n", pCur->pfnGetPutOrTransformer), rc = VERR_SSM_FIELD_COMPLEX);
    6581         }
    6582         if (RT_FAILURE(rc))
    6583         {
    6584             if (RT_SUCCESS(pSSM->rc))
    6585                 pSSM->rc = rc;
    6586             return rc;
     6584            if (RT_FAILURE(rc))
     6585            {
     6586                if (RT_SUCCESS(pSSM->rc))
     6587                    pSSM->rc = rc;
     6588                return rc;
     6589            }
    65876590        }
    65886591    }
     
    67086711                        pSSM->rc = VERR_SSM_FIELD_NOT_CONSECUTIVE);
    67096712
    6710         rc = VINF_SUCCESS;
    6711         uint8_t       *pbField  = (uint8_t *)pvStruct + offField;
    6712         switch ((uintptr_t)pCur->pfnGetPutOrTransformer)
    6713         {
    6714             case SSMFIELDTRANS_NO_TRANSFORMATION:
    6715                 rc = ssmR3DataRead(pSSM, pbField, cbField);
     6713        if (pCur->uFirstVer <= pSSM->u.Read.uCurUnitVer)
     6714        {
     6715            rc = VINF_SUCCESS;
     6716            uint8_t       *pbField  = (uint8_t *)pvStruct + offField;
     6717            switch ((uintptr_t)pCur->pfnGetPutOrTransformer)
     6718            {
     6719                case SSMFIELDTRANS_NO_TRANSFORMATION:
     6720                    rc = ssmR3DataRead(pSSM, pbField, cbField);
     6721                    break;
     6722
     6723                case SSMFIELDTRANS_GCPHYS:
     6724                    AssertMsgBreakStmt(cbField == sizeof(RTGCPHYS), ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
     6725                    rc = SSMR3GetGCPhys(pSSM, (PRTGCPHYS)pbField);
     6726                    break;
     6727
     6728                case SSMFIELDTRANS_GCPTR:
     6729                    AssertMsgBreakStmt(cbField == sizeof(RTGCPTR), ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
     6730                    rc = SSMR3GetGCPtr(pSSM, (PRTGCPTR)pbField);
     6731                    break;
     6732
     6733                case SSMFIELDTRANS_RCPTR:
     6734                    AssertMsgBreakStmt(cbField == sizeof(RTRCPTR), ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
     6735                    rc = SSMR3GetRCPtr(pSSM, (PRTRCPTR)pbField);
     6736                    break;
     6737
     6738                case SSMFIELDTRANS_RCPTR_ARRAY:
     6739                {
     6740                    uint32_t const cEntries = cbField / sizeof(RTRCPTR);
     6741                    AssertMsgBreakStmt(cbField == cEntries * sizeof(RTRCPTR) && cEntries, ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
     6742                    rc = VINF_SUCCESS;
     6743                    for (uint32_t i = 0; i < cEntries && RT_SUCCESS(rc); i++)
     6744                        rc = SSMR3GetRCPtr(pSSM, &((PRTRCPTR)pbField)[i]);
     6745                    break;
     6746                }
     6747
     6748                case SSMFIELDTRANS_HCPTR_NI:
     6749                    AssertMsgBreakStmt(cbField == sizeof(void *), ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
     6750                    rc = ssmR3GetHCPtrNI(pSSM, (void **)pbField, fFlags);
     6751                    break;
     6752
     6753                case SSMFIELDTRANS_HCPTR_NI_ARRAY:
     6754                {
     6755                    uint32_t const cEntries = cbField / sizeof(void *);
     6756                    AssertMsgBreakStmt(cbField == cEntries * sizeof(void *) && cEntries, ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
     6757                    rc = VINF_SUCCESS;
     6758                    for (uint32_t i = 0; i < cEntries && RT_SUCCESS(rc); i++)
     6759                        rc = ssmR3GetHCPtrNI(pSSM, &((void **)pbField)[i], fFlags);
     6760                    break;
     6761                }
     6762
     6763                case SSMFIELDTRANS_HCPTR_HACK_U32:
     6764                    AssertMsgBreakStmt(cbField == sizeof(void *), ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
     6765                    *(uintptr_t *)pbField = 0;
     6766                    rc = ssmR3DataRead(pSSM, pbField, sizeof(uint32_t));
     6767                    if ((fFlags & SSMSTRUCT_FLAGS_DONT_IGNORE) && ssmR3GetHostBits(pSSM) == 64)
     6768                    {
     6769                        uint32_t u32;
     6770                        rc = ssmR3DataRead(pSSM, &u32, sizeof(uint32_t));
     6771                        AssertMsgBreakStmt(RT_FAILURE(rc) || u32 == 0 || (fFlags & SSMSTRUCT_FLAGS_SAVED_AS_MEM),
     6772                                           ("high=%#x low=%#x (%s)\n", u32, *(uint32_t *)pbField, pCur->pszName),
     6773                                           rc = VERR_SSM_FIELD_INVALID_VALUE);
     6774                    }
     6775                    break;
     6776
     6777                case SSMFIELDTRANS_U32_ZX_U64:
     6778                    AssertMsgBreakStmt(cbField == sizeof(uint64_t), ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
     6779                    ((uint32_t *)pbField)[1] = 0;
     6780                    rc = SSMR3GetU32(pSSM, (uint32_t *)pbField);
     6781                    break;
     6782
     6783
     6784                case SSMFIELDTRANS_IGNORE:
     6785                    if (fFlags & SSMSTRUCT_FLAGS_DONT_IGNORE)
     6786                        rc = SSMR3Skip(pSSM, cbField);
     6787                    break;
     6788
     6789                case SSMFIELDTRANS_IGN_GCPHYS:
     6790                    AssertMsgBreakStmt(cbField == sizeof(RTGCPHYS), ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
     6791                    if (fFlags & SSMSTRUCT_FLAGS_DONT_IGNORE)
     6792                        rc = SSMR3Skip(pSSM, pSSM->u.Read.cbGCPhys);
     6793                    break;
     6794
     6795                case SSMFIELDTRANS_IGN_GCPTR:
     6796                    AssertMsgBreakStmt(cbField == sizeof(RTGCPTR), ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
     6797                    if (fFlags & SSMSTRUCT_FLAGS_DONT_IGNORE)
     6798                        rc = SSMR3Skip(pSSM, pSSM->u.Read.cbGCPtr);
     6799                    break;
     6800
     6801                case SSMFIELDTRANS_IGN_RCPTR:
     6802                    AssertMsgBreakStmt(cbField == sizeof(RTRCPTR), ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
     6803                    if (fFlags & SSMSTRUCT_FLAGS_DONT_IGNORE)
     6804                        rc = SSMR3Skip(pSSM, sizeof(RTRCPTR));
     6805                    break;
     6806
     6807                case SSMFIELDTRANS_IGN_HCPTR:
     6808                    AssertMsgBreakStmt(cbField == sizeof(void *), ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
     6809                    if (fFlags & SSMSTRUCT_FLAGS_DONT_IGNORE)
     6810                        rc = SSMR3Skip(pSSM, ssmR3GetHostBits(pSSM) / 8);
     6811                    break;
     6812
     6813
     6814                case SSMFIELDTRANS_OLD:
     6815                    AssertMsgBreakStmt(pCur->off == UINT32_MAX / 2, ("%#x %#x (%s)\n", pCur->cb, pCur->off, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
     6816                    rc = SSMR3Skip(pSSM, pCur->cb);
     6817                    break;
     6818
     6819                case SSMFIELDTRANS_OLD_GCPHYS:
     6820                    AssertMsgBreakStmt(pCur->cb == sizeof(RTGCPHYS) && pCur->off == UINT32_MAX / 2, ("%#x %#x (%s)\n", pCur->cb, pCur->off, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
     6821                    rc = SSMR3Skip(pSSM, pSSM->u.Read.cbGCPhys);
     6822                    break;
     6823
     6824                case SSMFIELDTRANS_OLD_GCPTR:
     6825                    AssertMsgBreakStmt(pCur->cb == sizeof(RTGCPTR) && pCur->off == UINT32_MAX / 2, ("%#x %#x (%s)\n", pCur->cb, pCur->off, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
     6826                    rc = SSMR3Skip(pSSM, pSSM->u.Read.cbGCPtr);
     6827                    break;
     6828
     6829                case SSMFIELDTRANS_OLD_RCPTR:
     6830                    AssertMsgBreakStmt(pCur->cb == sizeof(RTRCPTR) && pCur->off == UINT32_MAX / 2, ("%#x %#x (%s)\n", pCur->cb, pCur->off, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
     6831                    rc = SSMR3Skip(pSSM, sizeof(RTRCPTR));
     6832                    break;
     6833
     6834                case SSMFIELDTRANS_OLD_HCPTR:
     6835                    AssertMsgBreakStmt(pCur->cb == sizeof(void *) && pCur->off == UINT32_MAX / 2, ("%#x %#x (%s)\n", pCur->cb, pCur->off, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
     6836                    rc = SSMR3Skip(pSSM, ssmR3GetHostBits(pSSM) / 8);
     6837                    break;
     6838
     6839                case SSMFIELDTRANS_OLD_PAD_HC:
     6840                    AssertMsgBreakStmt(pCur->off == UINT32_MAX / 2, ("%#x %#x (%s)\n", pCur->cb, pCur->off, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
     6841                    rc = SSMR3Skip(pSSM, ssmR3GetHostBits(pSSM) == 64 ? RT_HIWORD(pCur->cb) : RT_LOWORD(pCur->cb));
     6842                    break;
     6843
     6844                case SSMFIELDTRANS_OLD_PAD_MSC32:
     6845                    AssertMsgBreakStmt(pCur->off == UINT32_MAX / 2, ("%#x %#x (%s)\n", pCur->cb, pCur->off, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
     6846                    if (ssmR3IsHostMsc32(pSSM))
     6847                        rc = SSMR3Skip(pSSM, pCur->cb);
     6848                    break;
     6849
     6850
     6851                case SSMFIELDTRANS_PAD_HC:
     6852                case SSMFIELDTRANS_PAD_HC32:
     6853                case SSMFIELDTRANS_PAD_HC64:
     6854                case SSMFIELDTRANS_PAD_HC_AUTO:
     6855                case SSMFIELDTRANS_PAD_MSC32_AUTO:
     6856                {
     6857                    uint32_t cb32    = RT_BYTE1(pCur->cb);
     6858                    uint32_t cb64    = RT_BYTE2(pCur->cb);
     6859                    uint32_t cbCtx   =    HC_ARCH_BITS == 64
     6860                                       || (   (uintptr_t)pCur->pfnGetPutOrTransformer == SSMFIELDTRANS_PAD_MSC32_AUTO
     6861                                           && !SSM_HOST_IS_MSC_32)
     6862                                     ? cb64 : cb32;
     6863                    uint32_t cbSaved =    ssmR3GetHostBits(pSSM) == 64
     6864                                       || (   (uintptr_t)pCur->pfnGetPutOrTransformer == SSMFIELDTRANS_PAD_MSC32_AUTO
     6865                                           && !ssmR3IsHostMsc32(pSSM))
     6866                                     ? cb64 : cb32;
     6867                    AssertMsgBreakStmt(    cbField == cbCtx
     6868                                       &&  (   (   pCur->off == UINT32_MAX / 2
     6869                                                && (   cbField == 0
     6870                                                    || (uintptr_t)pCur->pfnGetPutOrTransformer == SSMFIELDTRANS_PAD_HC_AUTO
     6871                                                    || (uintptr_t)pCur->pfnGetPutOrTransformer == SSMFIELDTRANS_PAD_MSC32_AUTO
     6872                                                   )
     6873                                               )
     6874                                            || (pCur->off != UINT32_MAX / 2 && cbField != 0)
     6875                                            )
     6876                                       , ("cbField=%#x cb32=%#x cb64=%#x HC_ARCH_BITS=%u cbCtx=%#x cbSaved=%#x off=%#x\n",
     6877                                          cbField, cb32, cb64, HC_ARCH_BITS, cbCtx, cbSaved, pCur->off),
     6878                                       rc = VERR_SSM_FIELD_INVALID_PADDING_SIZE);
     6879                    if (fFlags & SSMSTRUCT_FLAGS_DONT_IGNORE)
     6880                        rc = SSMR3Skip(pSSM, cbSaved);
     6881                    break;
     6882                }
     6883
     6884                default:
     6885                    AssertBreakStmt(pCur->pfnGetPutOrTransformer, rc = VERR_SSM_FIELD_INVALID_CALLBACK);
     6886                    rc = pCur->pfnGetPutOrTransformer(pSSM, pCur, pvStruct, fFlags, true /*fGetOrPut*/, pvUser);
     6887                    break;
     6888            }
     6889            if (RT_FAILURE(rc))
    67166890                break;
    6717 
    6718             case SSMFIELDTRANS_GCPHYS:
    6719                 AssertMsgBreakStmt(cbField == sizeof(RTGCPHYS), ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
    6720                 rc = SSMR3GetGCPhys(pSSM, (PRTGCPHYS)pbField);
    6721                 break;
    6722 
    6723             case SSMFIELDTRANS_GCPTR:
    6724                 AssertMsgBreakStmt(cbField == sizeof(RTGCPTR), ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
    6725                 rc = SSMR3GetGCPtr(pSSM, (PRTGCPTR)pbField);
    6726                 break;
    6727 
    6728             case SSMFIELDTRANS_RCPTR:
    6729                 AssertMsgBreakStmt(cbField == sizeof(RTRCPTR), ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
    6730                 rc = SSMR3GetRCPtr(pSSM, (PRTRCPTR)pbField);
    6731                 break;
    6732 
    6733             case SSMFIELDTRANS_RCPTR_ARRAY:
    6734             {
    6735                 uint32_t const cEntries = cbField / sizeof(RTRCPTR);
    6736                 AssertMsgBreakStmt(cbField == cEntries * sizeof(RTRCPTR) && cEntries, ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
    6737                 rc = VINF_SUCCESS;
    6738                 for (uint32_t i = 0; i < cEntries && RT_SUCCESS(rc); i++)
    6739                     rc = SSMR3GetRCPtr(pSSM, &((PRTRCPTR)pbField)[i]);
    6740                 break;
    6741             }
    6742 
    6743             case SSMFIELDTRANS_HCPTR_NI:
    6744                 AssertMsgBreakStmt(cbField == sizeof(void *), ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
    6745                 rc = ssmR3GetHCPtrNI(pSSM, (void **)pbField, fFlags);
    6746                 break;
    6747 
    6748             case SSMFIELDTRANS_HCPTR_NI_ARRAY:
    6749             {
    6750                 uint32_t const cEntries = cbField / sizeof(void *);
    6751                 AssertMsgBreakStmt(cbField == cEntries * sizeof(void *) && cEntries, ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
    6752                 rc = VINF_SUCCESS;
    6753                 for (uint32_t i = 0; i < cEntries && RT_SUCCESS(rc); i++)
    6754                     rc = ssmR3GetHCPtrNI(pSSM, &((void **)pbField)[i], fFlags);
    6755                 break;
    6756             }
    6757 
    6758             case SSMFIELDTRANS_HCPTR_HACK_U32:
    6759                 AssertMsgBreakStmt(cbField == sizeof(void *), ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
    6760                 *(uintptr_t *)pbField = 0;
    6761                 rc = ssmR3DataRead(pSSM, pbField, sizeof(uint32_t));
    6762                 if ((fFlags & SSMSTRUCT_FLAGS_DONT_IGNORE) && ssmR3GetHostBits(pSSM) == 64)
    6763                 {
    6764                     uint32_t u32;
    6765                     rc = ssmR3DataRead(pSSM, &u32, sizeof(uint32_t));
    6766                     AssertMsgBreakStmt(RT_FAILURE(rc) || u32 == 0 || (fFlags & SSMSTRUCT_FLAGS_SAVED_AS_MEM),
    6767                                        ("high=%#x low=%#x (%s)\n", u32, *(uint32_t *)pbField, pCur->pszName),
    6768                                        rc = VERR_SSM_FIELD_INVALID_VALUE);
    6769                 }
    6770                 break;
    6771 
    6772             case SSMFIELDTRANS_U32_ZX_U64:
    6773                 AssertMsgBreakStmt(cbField == sizeof(uint64_t), ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
    6774                 ((uint32_t *)pbField)[1] = 0;
    6775                 rc = SSMR3GetU32(pSSM, (uint32_t *)pbField);
    6776                 break;
    6777 
    6778 
    6779             case SSMFIELDTRANS_IGNORE:
    6780                 if (fFlags & SSMSTRUCT_FLAGS_DONT_IGNORE)
    6781                     rc = SSMR3Skip(pSSM, cbField);
    6782                 break;
    6783 
    6784             case SSMFIELDTRANS_IGN_GCPHYS:
    6785                 AssertMsgBreakStmt(cbField == sizeof(RTGCPHYS), ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
    6786                 if (fFlags & SSMSTRUCT_FLAGS_DONT_IGNORE)
    6787                     rc = SSMR3Skip(pSSM, pSSM->u.Read.cbGCPhys);
    6788                 break;
    6789 
    6790             case SSMFIELDTRANS_IGN_GCPTR:
    6791                 AssertMsgBreakStmt(cbField == sizeof(RTGCPTR), ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
    6792                 if (fFlags & SSMSTRUCT_FLAGS_DONT_IGNORE)
    6793                     rc = SSMR3Skip(pSSM, pSSM->u.Read.cbGCPtr);
    6794                 break;
    6795 
    6796             case SSMFIELDTRANS_IGN_RCPTR:
    6797                 AssertMsgBreakStmt(cbField == sizeof(RTRCPTR), ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
    6798                 if (fFlags & SSMSTRUCT_FLAGS_DONT_IGNORE)
    6799                     rc = SSMR3Skip(pSSM, sizeof(RTRCPTR));
    6800                 break;
    6801 
    6802             case SSMFIELDTRANS_IGN_HCPTR:
    6803                 AssertMsgBreakStmt(cbField == sizeof(void *), ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
    6804                 if (fFlags & SSMSTRUCT_FLAGS_DONT_IGNORE)
    6805                     rc = SSMR3Skip(pSSM, ssmR3GetHostBits(pSSM) / 8);
    6806                 break;
    6807 
    6808 
    6809             case SSMFIELDTRANS_OLD:
    6810                 AssertMsgBreakStmt(pCur->off == UINT32_MAX / 2, ("%#x %#x (%s)\n", pCur->cb, pCur->off, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
    6811                 rc = SSMR3Skip(pSSM, pCur->cb);
    6812                 break;
    6813 
    6814             case SSMFIELDTRANS_OLD_GCPHYS:
    6815                 AssertMsgBreakStmt(pCur->cb == sizeof(RTGCPHYS) && pCur->off == UINT32_MAX / 2, ("%#x %#x (%s)\n", pCur->cb, pCur->off, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
    6816                 rc = SSMR3Skip(pSSM, pSSM->u.Read.cbGCPhys);
    6817                 break;
    6818 
    6819             case SSMFIELDTRANS_OLD_GCPTR:
    6820                 AssertMsgBreakStmt(pCur->cb == sizeof(RTGCPTR) && pCur->off == UINT32_MAX / 2, ("%#x %#x (%s)\n", pCur->cb, pCur->off, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
    6821                 rc = SSMR3Skip(pSSM, pSSM->u.Read.cbGCPtr);
    6822                 break;
    6823 
    6824             case SSMFIELDTRANS_OLD_RCPTR:
    6825                 AssertMsgBreakStmt(pCur->cb == sizeof(RTRCPTR) && pCur->off == UINT32_MAX / 2, ("%#x %#x (%s)\n", pCur->cb, pCur->off, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
    6826                 rc = SSMR3Skip(pSSM, sizeof(RTRCPTR));
    6827                 break;
    6828 
    6829             case SSMFIELDTRANS_OLD_HCPTR:
    6830                 AssertMsgBreakStmt(pCur->cb == sizeof(void *) && pCur->off == UINT32_MAX / 2, ("%#x %#x (%s)\n", pCur->cb, pCur->off, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
    6831                 rc = SSMR3Skip(pSSM, ssmR3GetHostBits(pSSM) / 8);
    6832                 break;
    6833 
    6834             case SSMFIELDTRANS_OLD_PAD_HC:
    6835                 AssertMsgBreakStmt(pCur->off == UINT32_MAX / 2, ("%#x %#x (%s)\n", pCur->cb, pCur->off, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
    6836                 rc = SSMR3Skip(pSSM, ssmR3GetHostBits(pSSM) == 64 ? RT_HIWORD(pCur->cb) : RT_LOWORD(pCur->cb));
    6837                 break;
    6838 
    6839             case SSMFIELDTRANS_OLD_PAD_MSC32:
    6840                 AssertMsgBreakStmt(pCur->off == UINT32_MAX / 2, ("%#x %#x (%s)\n", pCur->cb, pCur->off, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
    6841                 if (ssmR3IsHostMsc32(pSSM))
    6842                     rc = SSMR3Skip(pSSM, pCur->cb);
    6843                 break;
    6844 
    6845 
    6846             case SSMFIELDTRANS_PAD_HC:
    6847             case SSMFIELDTRANS_PAD_HC32:
    6848             case SSMFIELDTRANS_PAD_HC64:
    6849             case SSMFIELDTRANS_PAD_HC_AUTO:
    6850             case SSMFIELDTRANS_PAD_MSC32_AUTO:
    6851             {
    6852                 uint32_t cb32    = RT_BYTE1(pCur->cb);
    6853                 uint32_t cb64    = RT_BYTE2(pCur->cb);
    6854                 uint32_t cbCtx   =    HC_ARCH_BITS == 64
    6855                                    || (   (uintptr_t)pCur->pfnGetPutOrTransformer == SSMFIELDTRANS_PAD_MSC32_AUTO
    6856                                        && !SSM_HOST_IS_MSC_32)
    6857                                  ? cb64 : cb32;
    6858                 uint32_t cbSaved =    ssmR3GetHostBits(pSSM) == 64
    6859                                    || (   (uintptr_t)pCur->pfnGetPutOrTransformer == SSMFIELDTRANS_PAD_MSC32_AUTO
    6860                                        && !ssmR3IsHostMsc32(pSSM))
    6861                                  ? cb64 : cb32;
    6862                 AssertMsgBreakStmt(    cbField == cbCtx
    6863                                    &&  (   (   pCur->off == UINT32_MAX / 2
    6864                                             && (   cbField == 0
    6865                                                 || (uintptr_t)pCur->pfnGetPutOrTransformer == SSMFIELDTRANS_PAD_HC_AUTO
    6866                                                 || (uintptr_t)pCur->pfnGetPutOrTransformer == SSMFIELDTRANS_PAD_MSC32_AUTO
    6867                                                )
    6868                                            )
    6869                                         || (pCur->off != UINT32_MAX / 2 && cbField != 0)
    6870                                         )
    6871                                    , ("cbField=%#x cb32=%#x cb64=%#x HC_ARCH_BITS=%u cbCtx=%#x cbSaved=%#x off=%#x\n",
    6872                                       cbField, cb32, cb64, HC_ARCH_BITS, cbCtx, cbSaved, pCur->off),
    6873                                    rc = VERR_SSM_FIELD_INVALID_PADDING_SIZE);
    6874                 if (fFlags & SSMSTRUCT_FLAGS_DONT_IGNORE)
    6875                     rc = SSMR3Skip(pSSM, cbSaved);
    6876                 break;
    6877             }
    6878 
    6879             default:
    6880                 AssertBreakStmt(pCur->pfnGetPutOrTransformer, rc = VERR_SSM_FIELD_INVALID_CALLBACK);
    6881                 rc = pCur->pfnGetPutOrTransformer(pSSM, pCur, pvStruct, fFlags, true /*fGetOrPut*/, pvUser);
    6882                 break;
    6883         }
    6884         if (RT_FAILURE(rc))
    6885             break;
     6891        }
    68866892
    68876893        off = offField + cbField;
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