Changeset 23584 in vbox for trunk/src/VBox/VMM
- Timestamp:
- Oct 6, 2009 3:54:44 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 53250
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/PDM.cpp
r23329 r23584 660 660 SSMR3PutU32(pSSM, pDevIns->iInstance); 661 661 } 662 return SSMR3PutU32(pSSM, ~0); /* terminator */662 return SSMR3PutU32(pSSM, UINT32_MAX); /* terminator */ 663 663 } 664 664 … … 819 819 /* 820 820 * Load the list of devices and verify that they are all there. 821 * 822 * We boldly ASSUME that the order is fixed and that it's a good, this 823 * makes it way easier to validate... 824 */ 825 uint32_t i = 0; 826 PPDMDEVINS pDevIns = pVM->pdm.s.pDevInstances; 827 for (;; pDevIns = pDevIns->Internal.s.pNextR3, i++) 828 { 829 /* Get the separator / terminator. */ 821 */ 822 for (PPDMDEVINS pDevIns = pVM->pdm.s.pDevInstances; pDevIns; pDevIns = pDevIns->Internal.s.pNextR3) 823 pDevIns->Internal.s.fIntFlags &= PDMDEVINSINT_FLAGS_FOUND; 824 825 for (uint32_t i = 0; ; i++) 826 { 827 /* Get the sequence number / terminator. */ 830 828 uint32_t u32Sep; 831 829 int rc = SSMR3GetU32(pSSM, &u32Sep); 832 830 if (RT_FAILURE(rc)) 833 831 return rc; 834 if (u32Sep == (uint32_t)~0)832 if (u32Sep == UINT32_MAX) 835 833 break; 836 834 if (u32Sep != i) 837 835 AssertMsgFailedReturn(("Out of seqence. u32Sep=%#x i=%#x\n", u32Sep, i), VERR_SSM_DATA_UNIT_FORMAT_CHANGED); 838 836 839 /* get the name and instance number. */840 char szDeviceName[ sizeof(pDevIns->pDevReg->szDeviceName)];837 /* Get the name and instance number. */ 838 char szDeviceName[RT_SIZEOFMEMB(PDMDEVREG, szDeviceName)]; 841 839 rc = SSMR3GetStrZ(pSSM, szDeviceName, sizeof(szDeviceName)); 842 840 if (RT_FAILURE(rc)) … … 847 845 return rc; 848 846 849 /* compare */ 847 /* Try locate it. */ 848 PPDMDEVINS pDevIns; 849 for (pDevIns = pVM->pdm.s.pDevInstances; pDevIns; pDevIns = pDevIns->Internal.s.pNextR3) 850 if ( !strcmp(szDeviceName, pDevIns->pDevReg->szDeviceName) 851 && pDevIns->iInstance == iInstance) 852 { 853 AssertLogRelReturn(!(pDevIns->Internal.s.fIntFlags & PDMDEVINSINT_FLAGS_FOUND), VERR_SSM_DATA_UNIT_FORMAT_CHANGED); 854 pDevIns->Internal.s.fIntFlags |= PDMDEVINSINT_FLAGS_FOUND; 855 break; 856 } 850 857 if (!pDevIns) 851 858 { … … 853 860 if (SSMR3HandleGetAfter(pSSM) != SSMAFTER_DEBUG_IT) 854 861 AssertFailedReturn(VERR_SSM_LOAD_CONFIG_MISMATCH); 855 break; 856 } 857 if ( strcmp(szDeviceName, pDevIns->pDevReg->szDeviceName) 858 || pDevIns->iInstance != iInstance) 859 { 860 LogRel(("u32Sep=%d loaded '%s'/%d configured '%s'/%d\n", 861 u32Sep, szDeviceName, iInstance, pDevIns->pDevReg->szDeviceName, pDevIns->iInstance)); 862 } 863 } 864 865 /* 866 * Check that no additional devices were configured. 867 */ 868 for (PPDMDEVINS pDevIns = pVM->pdm.s.pDevInstances; pDevIns; pDevIns = pDevIns->Internal.s.pNextR3) 869 if (!(pDevIns->Internal.s.fIntFlags & PDMDEVINSINT_FLAGS_FOUND)) 870 { 871 LogRel(("Device '%s'/%d not found in the saved state\n", pDevIns->pDevReg->szDeviceName, pDevIns->iInstance)); 862 872 if (SSMR3HandleGetAfter(pSSM) != SSMAFTER_DEBUG_IT) 863 873 AssertFailedReturn(VERR_SSM_LOAD_CONFIG_MISMATCH); 864 874 } 865 }866 867 /*868 * Too many devices?869 */870 if (pDevIns)871 {872 LogRel(("Device '%s'/%d not found in saved state\n", pDevIns->pDevReg->szDeviceName, pDevIns->iInstance));873 if (SSMR3HandleGetAfter(pSSM) != SSMAFTER_DEBUG_IT)874 AssertFailedReturn(VERR_SSM_LOAD_CONFIG_MISMATCH);875 }876 875 877 876 return VINF_SUCCESS; -
trunk/src/VBox/VMM/PDMInternal.h
r22924 r23584 126 126 /** RC pointer to associated PCI bus structure. */ 127 127 RCPTRTYPE(PPDMPCIBUS) pPciBusRC; 128 /** Alignment padding. */ 129 RTRCPTR Alignment1; 128 129 /** Flags, see PDMDEVINSINT_FLAGS_XXX. */ 130 uint32_t fIntFlags; 130 131 } PDMDEVINSINT; 132 133 /** @name PDMDEVINSINT::fIntFlags 134 * @{ */ 135 /** Used by pdmR3Load to mark device instances it found in the saved state. */ 136 #define PDMDEVINSINT_FLAGS_FOUND RT_BIT_32(0) 137 /** @} */ 131 138 132 139
Note:
See TracChangeset
for help on using the changeset viewer.