- Timestamp:
- Oct 26, 2009 1:39:50 PM (15 years ago)
- Location:
- trunk/src/VBox/Devices/VMMDev
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/VMMDev/VMMDev.cpp
r23910 r24076 56 56 #define VMMDEVSTATE_2_DEVINS(pVMMDevState) ( (pVMMDevState)->pDevIns ) 57 57 58 #define VBOX_GUEST_ADDITIONS_VERSION_1_03(s) 59 ( (RT_HIWORD ((s)->guestInfo.additionsVersion) == 1) &&\60 (RT_LOWORD ((s)->guestInfo.additionsVersion) == 3))58 #define VBOX_GUEST_ADDITIONS_VERSION_1_03(s) \ 59 ( RT_HIWORD((s)->guestInfo.additionsVersion) == 1 \ 60 && RT_LOWORD((s)->guestInfo.additionsVersion) == 3 ) 61 61 62 62 #define VBOX_GUEST_ADDITIONS_VERSION_OK(additionsVersion) \ 63 ( RT_HIWORD(additionsVersion) == RT_HIWORD(VMMDEV_VERSION) \64 && RT_LOWORD(additionsVersion) <= RT_LOWORD(VMMDEV_VERSION))63 ( RT_HIWORD(additionsVersion) == RT_HIWORD(VMMDEV_VERSION) \ 64 && RT_LOWORD(additionsVersion) <= RT_LOWORD(VMMDEV_VERSION) ) 65 65 66 66 #define VBOX_GUEST_ADDITIONS_VERSION_OLD(additionsVersion) \ 67 ( (RT_HIWORD(additionsVersion) < RT_HIWORD(VMMDEV_VERSION) \68 || ((RT_HIWORD(additionsVersion) == RT_HIWORD(VMMDEV_VERSION) \69 && RT_LOWORD(additionsVersion) <= RT_LOWORD(VMMDEV_VERSION))67 ( (RT_HIWORD(additionsVersion) < RT_HIWORD(VMMDEV_VERSION) \ 68 || ( RT_HIWORD(additionsVersion) == RT_HIWORD(VMMDEV_VERSION) \ 69 && RT_LOWORD(additionsVersion) <= RT_LOWORD(VMMDEV_VERSION) ) ) 70 70 71 71 #define VBOX_GUEST_ADDITIONS_VERSION_TOO_OLD(additionsVersion) \ 72 ( RT_HIWORD(additionsVersion) < RT_HIWORD(VMMDEV_VERSION))72 ( RT_HIWORD(additionsVersion) < RT_HIWORD(VMMDEV_VERSION) ) 73 73 74 74 #define VBOX_GUEST_ADDITIONS_VERSION_NEW(additionsVersion) \ 75 ((RT_HIWORD(additionsVersion) > RT_HIWORD(VMMDEV_VERSION) \ 76 || ((RT_HIWORD(additionsVersion) == RT_HIWORD(VMMDEV_VERSION) \ 77 && RT_LOWORD(additionsVersion) > RT_LOWORD(VMMDEV_VERSION)) 75 ( RT_HIWORD(additionsVersion) > RT_HIWORD(VMMDEV_VERSION) \ 76 || ( RT_HIWORD(additionsVersion) == RT_HIWORD(VMMDEV_VERSION) \ 77 && RT_LOWORD(additionsVersion) > RT_LOWORD(VMMDEV_VERSION) ) ) 78 79 /** The saved state version. */ 80 #define VMMDEV_SAVED_STATE_VERSION 12 81 /** The saved state version used by VirtualBox 3.0. 82 * This doesn't have the config part. */ 83 #define VMMDEV_SAVED_STATE_VERSION_VBOX_30 11 84 78 85 79 86 #ifndef VBOX_DEVICE_STRUCT_TESTCASE … … 2103 2110 2104 2111 2105 /* -=-=-=-=-=- IHGCMPort -=-=-=-=-=- */ 2106 2107 /** Converts a VMMDev port interface pointer to a VMMDev state pointer. */ 2108 #define IHGCMPORT_2_VMMDEVSTATE(pInterface) ( (VMMDevState*)((uintptr_t)pInterface - RT_OFFSETOF(VMMDevState, HGCMPort)) ) 2109 2110 2111 2112 #define VMMDEV_SSM_VERSION 11 2112 /* -=-=-=-=-=- Saved State -=-=-=-=-=- */ 2113 2113 2114 2114 /** 2115 * Saves a state of the VMM device. 2116 * 2117 * @returns VBox status code. 2118 * @param pDevIns The device instance. 2119 * @param pSSMHandle The handle to save the state to. 2115 * @copydoc FNSSMDEVLIVEEXEC 2120 2116 */ 2121 static DECLCALLBACK(int) vmmdev SaveState(PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle)2117 static DECLCALLBACK(int) vmmdevLiveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uPass) 2122 2118 { 2123 2119 VMMDevState *pThis = PDMINS_2_DATA(pDevIns, VMMDevState*); 2124 SSMR3PutU32(pSSMHandle, pThis->hypervisorSize); 2125 SSMR3PutU32(pSSMHandle, pThis->mouseCapabilities); 2126 SSMR3PutU32(pSSMHandle, pThis->mouseXAbs); 2127 SSMR3PutU32(pSSMHandle, pThis->mouseYAbs); 2128 2129 SSMR3PutBool(pSSMHandle, pThis->fNewGuestFilterMask); 2130 SSMR3PutU32(pSSMHandle, pThis->u32NewGuestFilterMask); 2131 SSMR3PutU32(pSSMHandle, pThis->u32GuestFilterMask); 2132 SSMR3PutU32(pSSMHandle, pThis->u32HostEventFlags); 2133 // here be dragons (probably) 2134 // SSMR3PutBool(pSSMHandle, pThis->pVMMDevRAMR3->V.V1_04.fHaveEvents); 2135 SSMR3PutMem(pSSMHandle, &pThis->pVMMDevRAMR3->V, sizeof (pThis->pVMMDevRAMR3->V)); 2136 2137 SSMR3PutMem(pSSMHandle, &pThis->guestInfo, sizeof (pThis->guestInfo)); 2138 SSMR3PutU32(pSSMHandle, pThis->fu32AdditionsOk); 2139 SSMR3PutU32(pSSMHandle, pThis->u32VideoAccelEnabled); 2140 SSMR3PutBool(pSSMHandle, pThis->fGuestSentChangeEventAck); 2141 2142 SSMR3PutU32(pSSMHandle, pThis->guestCaps); 2120 2121 SSMR3PutBool(pSSM, pThis->fGetHostTimeDisabled); 2122 SSMR3PutBool(pSSM, pThis->fBackdoorLogDisabled); 2123 SSMR3PutBool(pSSM, pThis->fKeepCredentials); 2124 SSMR3PutBool(pSSM, pThis->fHeapEnabled); 2125 2126 return VINF_SSM_DONT_CALL_AGAIN; 2127 } 2128 2129 2130 /** 2131 * @copydoc FNSSMDEVSAVEEXEC 2132 * 2133 */ 2134 static DECLCALLBACK(int) vmmdevSaveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM) 2135 { 2136 VMMDevState *pThis = PDMINS_2_DATA(pDevIns, VMMDevState*); 2137 2138 vmmdevLiveExec(pDevIns, pSSM, SSM_PASS_FINAL); 2139 2140 SSMR3PutU32(pSSM, pThis->hypervisorSize); 2141 SSMR3PutU32(pSSM, pThis->mouseCapabilities); 2142 SSMR3PutU32(pSSM, pThis->mouseXAbs); 2143 SSMR3PutU32(pSSM, pThis->mouseYAbs); 2144 2145 SSMR3PutBool(pSSM, pThis->fNewGuestFilterMask); 2146 SSMR3PutU32(pSSM, pThis->u32NewGuestFilterMask); 2147 SSMR3PutU32(pSSM, pThis->u32GuestFilterMask); 2148 SSMR3PutU32(pSSM, pThis->u32HostEventFlags); 2149 /* The following is not strictly necessary as PGM restors MMIO2, keeping it for historical reasons. */ 2150 SSMR3PutMem(pSSM, &pThis->pVMMDevRAMR3->V, sizeof(pThis->pVMMDevRAMR3->V)); 2151 2152 SSMR3PutMem(pSSM, &pThis->guestInfo, sizeof (pThis->guestInfo)); 2153 SSMR3PutU32(pSSM, pThis->fu32AdditionsOk); 2154 SSMR3PutU32(pSSM, pThis->u32VideoAccelEnabled); 2155 SSMR3PutBool(pSSM, pThis->fGuestSentChangeEventAck); 2156 2157 SSMR3PutU32(pSSM, pThis->guestCaps); 2143 2158 2144 2159 #ifdef VBOX_WITH_HGCM 2145 vmmdevHGCMSaveState (pThis, pSSMHandle);2160 vmmdevHGCMSaveState(pThis, pSSM); 2146 2161 #endif /* VBOX_WITH_HGCM */ 2147 2162 2148 SSMR3PutU32(pSSM Handle, pThis->fHostCursorRequested);2163 SSMR3PutU32(pSSM, pThis->fHostCursorRequested); 2149 2164 2150 2165 return VINF_SUCCESS; … … 2152 2167 2153 2168 /** 2154 * Loads the saved VMM device state. 2155 * 2156 * @returns VBox status code. 2157 * @param pDevIns The device instance. 2158 * @param pSSMHandle The handle to the saved state. 2159 * @param uVersion The data unit version number. 2160 * @param uPass The data pass. 2169 * @copydoc FNSSMDEVLOADEXEC 2161 2170 */ 2162 static DECLCALLBACK(int) vmmdevLoad State(PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle, uint32_t uVersion, uint32_t uPass)2171 static DECLCALLBACK(int) vmmdevLoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass) 2163 2172 { 2164 2173 /** @todo The code load code is assuming we're always loaded into a freshly 2165 2174 * constructed VM. */ 2166 2175 VMMDevState *pThis = PDMINS_2_DATA(pDevIns, VMMDevState*); 2167 if ( SSM_VERSION_MAJOR_CHANGED(uVersion, VMMDEV_SSM_VERSION) 2168 || (SSM_VERSION_MINOR(uVersion) < 6)) 2176 int rc; 2177 2178 if ( uVersion > VMMDEV_SAVED_STATE_VERSION 2179 || uVersion < 6) 2169 2180 return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION; 2170 Assert(uPass == SSM_PASS_FINAL); NOREF(uPass); 2171 2172 SSMR3GetU32(pSSMHandle, &pThis->hypervisorSize); 2173 SSMR3GetU32(pSSMHandle, &pThis->mouseCapabilities); 2174 SSMR3GetU32(pSSMHandle, &pThis->mouseXAbs); 2175 SSMR3GetU32(pSSMHandle, &pThis->mouseYAbs); 2176 2177 SSMR3GetBool(pSSMHandle, &pThis->fNewGuestFilterMask); 2178 SSMR3GetU32(pSSMHandle, &pThis->u32NewGuestFilterMask); 2179 SSMR3GetU32(pSSMHandle, &pThis->u32GuestFilterMask); 2180 SSMR3GetU32(pSSMHandle, &pThis->u32HostEventFlags); 2181 // SSMR3GetBool(pSSMHandle, &pThis->pVMMDevRAMR3->fHaveEvents); 2181 2182 /* config */ 2183 if (uVersion > VMMDEV_SAVED_STATE_VERSION_VBOX_30) 2184 { 2185 bool f; 2186 rc = SSMR3GetBool(pSSM, &f); AssertRCReturn(rc, rc); 2187 if (pThis->fGetHostTimeDisabled != f) 2188 LogRel(("VMMDev: Config mismatch - fGetHostTimeDisabled: config=%RTbool saved=%RTbool\n", pThis->fGetHostTimeDisabled, f)); 2189 2190 rc = SSMR3GetBool(pSSM, &f); AssertRCReturn(rc, rc); 2191 if (pThis->fBackdoorLogDisabled != f) 2192 LogRel(("VMMDev: Config mismatch - fBackdoorLogDisabled: config=%RTbool saved=%RTbool\n", pThis->fBackdoorLogDisabled, f)); 2193 2194 rc = SSMR3GetBool(pSSM, &f); AssertRCReturn(rc, rc); 2195 if (pThis->fKeepCredentials != f) 2196 { 2197 LogRel(("VMMDev: Config mismatch - fKeepCredentials: config=%RTbool saved=%RTbool\n", pThis->fKeepCredentials, f)); 2198 return VERR_SSM_LOAD_CONFIG_MISMATCH; 2199 } 2200 rc = SSMR3GetBool(pSSM, &f); AssertRCReturn(rc, rc); 2201 if (pThis->fHeapEnabled != f) 2202 { 2203 LogRel(("VMMDev: Config mismatch - fHeapEnabled: config=%RTbool saved=%RTbool\n", pThis->fHeapEnabled, f)); 2204 return VERR_SSM_LOAD_CONFIG_MISMATCH; 2205 } 2206 } 2207 2208 if (uPass != SSM_PASS_FINAL) 2209 return VINF_SUCCESS; 2210 2211 /* state */ 2212 SSMR3GetU32(pSSM, &pThis->hypervisorSize); 2213 SSMR3GetU32(pSSM, &pThis->mouseCapabilities); 2214 SSMR3GetU32(pSSM, &pThis->mouseXAbs); 2215 SSMR3GetU32(pSSM, &pThis->mouseYAbs); 2216 2217 SSMR3GetBool(pSSM, &pThis->fNewGuestFilterMask); 2218 SSMR3GetU32(pSSM, &pThis->u32NewGuestFilterMask); 2219 SSMR3GetU32(pSSM, &pThis->u32GuestFilterMask); 2220 SSMR3GetU32(pSSM, &pThis->u32HostEventFlags); 2221 2222 // SSMR3GetBool(pSSM, &pThis->pVMMDevRAMR3->fHaveEvents); 2182 2223 // here be dragons (probably) 2183 SSMR3GetMem(pSSM Handle, &pThis->pVMMDevRAMR3->V, sizeof (pThis->pVMMDevRAMR3->V));2184 2185 SSMR3GetMem(pSSM Handle, &pThis->guestInfo, sizeof (pThis->guestInfo));2186 SSMR3GetU32(pSSM Handle, &pThis->fu32AdditionsOk);2187 SSMR3GetU32(pSSM Handle, &pThis->u32VideoAccelEnabled);2224 SSMR3GetMem(pSSM, &pThis->pVMMDevRAMR3->V, sizeof (pThis->pVMMDevRAMR3->V)); 2225 2226 SSMR3GetMem(pSSM, &pThis->guestInfo, sizeof (pThis->guestInfo)); 2227 SSMR3GetU32(pSSM, &pThis->fu32AdditionsOk); 2228 SSMR3GetU32(pSSM, &pThis->u32VideoAccelEnabled); 2188 2229 if (uVersion > 10) 2189 SSMR3GetBool(pSSM Handle, &pThis->fGuestSentChangeEventAck);2190 2191 SSMR3GetU32(pSSMHandle, &pThis->guestCaps);2230 SSMR3GetBool(pSSM, &pThis->fGuestSentChangeEventAck); 2231 2232 rc = SSMR3GetU32(pSSM, &pThis->guestCaps); 2192 2233 2193 2234 /* Attributes which were temporarily introduced in r30072 */ 2194 if ( SSM_VERSION_MAJOR(uVersion) == 0 2195 && SSM_VERSION_MINOR(uVersion) == 7) 2235 if (uVersion == 7) 2196 2236 { 2197 2237 uint32_t temp; 2198 SSMR3GetU32(pSSMHandle, &temp); 2199 SSMR3GetU32(pSSMHandle, &temp); 2200 } 2238 SSMR3GetU32(pSSM, &temp); 2239 rc = SSMR3GetU32(pSSM, &temp); 2240 } 2241 AssertRCReturn(rc, rc); 2201 2242 2202 2243 #ifdef VBOX_WITH_HGCM 2203 vmmdevHGCMLoadState (pThis, pSSMHandle, uVersion); 2244 rc = vmmdevHGCMLoadState(pThis, pSSM, uVersion); 2245 AssertRCReturn(rc, rc); 2204 2246 #endif /* VBOX_WITH_HGCM */ 2205 2247 2206 if ( SSM_VERSION_MAJOR(uVersion) == 02207 && SSM_VERSION_MINOR(uVersion) >= 10)2208 SSMR3GetU32(pSSMHandle, &pThis->fHostCursorRequested);2248 if (uVersion >= 10) 2249 rc = SSMR3GetU32(pSSM, &pThis->fHostCursorRequested); 2250 AssertRCReturn(rc, rc); 2209 2251 2210 2252 /* … … 2216 2258 { 2217 2259 pThis->pDrv->pfnUpdateMouseCapabilities(pThis->pDrv, pThis->mouseCapabilities); 2218 if ( SSM_VERSION_MAJOR(uVersion) == 0 2219 && SSM_VERSION_MINOR(uVersion) >= 10) 2220 pThis->pDrv->pfnUpdatePointerShape(pThis->pDrv, 2221 pThis->fHostCursorRequested, 2222 0, 2223 0, 0, 2224 0, 0, 2225 NULL); 2260 if (uVersion >= 10) 2261 pThis->pDrv->pfnUpdatePointerShape(pThis->pDrv, 2262 pThis->fHostCursorRequested, 2263 0, 2264 0, 0, 2265 0, 0, 2266 NULL); 2226 2267 } 2227 2268 … … 2252 2293 * @returns VBox status code. 2253 2294 * @param pDevIns The device instance. 2254 * @param pSSM HandleThe handle to the saved state.2295 * @param pSSM The handle to the saved state. 2255 2296 */ 2256 static DECLCALLBACK(int) vmmdevLoadStateDone(PPDMDEVINS pDevIns, PSSMHANDLE pSSM Handle)2297 static DECLCALLBACK(int) vmmdevLoadStateDone(PPDMDEVINS pDevIns, PSSMHANDLE pSSM) 2257 2298 { 2258 2299 VMMDevState *pThis = PDMINS_2_DATA(pDevIns, VMMDevState*); 2259 2300 2260 2301 #ifdef VBOX_WITH_HGCM 2261 vmmdevHGCMLoadStateDone (pThis, pSSMHandle); 2302 int rc = vmmdevHGCMLoadStateDone(pThis, pSSM); 2303 AssertLogRelRCReturn(rc, rc); 2262 2304 #endif /* VBOX_WITH_HGCM */ 2263 2305 2264 VMMDevNotifyGuest 2306 VMMDevNotifyGuest(pThis, VMMDEV_EVENT_RESTORED); 2265 2307 2266 2308 return VINF_SUCCESS; … … 2325 2367 N_("Configuration error: Failed querying \"KeepCredentials\" as a boolean")); 2326 2368 2327 bool fHeapEnabled; 2328 rc = CFGMR3QueryBoolDef(pCfgHandle, "HeapEnabled", &fHeapEnabled, true); 2369 rc = CFGMR3QueryBoolDef(pCfgHandle, "HeapEnabled", &pThis->fHeapEnabled, true); 2329 2370 if (RT_FAILURE(rc)) 2330 2371 return PDMDEV_SET_ERROR(pDevIns, rc, … … 2413 2454 vmmdevInitRam(pThis); 2414 2455 2415 if ( fHeapEnabled)2456 if (pThis->fHeapEnabled) 2416 2457 { 2417 2458 rc = PDMDevHlpMMIO2Register(pDevIns, 2 /*iRegion*/, VMMDEV_HEAP_SIZE, 0 /*fFlags*/, (void **)&pThis->pVMMDevHeapR3, "VMMDev Heap"); … … 2435 2476 if (RT_FAILURE(rc)) 2436 2477 return rc; 2437 if ( fHeapEnabled)2478 if (pThis->fHeapEnabled) 2438 2479 { 2439 2480 rc = PDMDevHlpPCIIORegionRegister(pDevIns, 2, VMMDEV_HEAP_SIZE, PCI_ADDRESS_SPACE_MEM_PREFETCH, vmmdevIORAMRegionMap); … … 2485 2526 * Register saved state and init the HGCM CmdList critsect. 2486 2527 */ 2487 rc = PDMDevHlpSSMRegisterEx(pDevIns, VMMDEV_S SM_VERSION, sizeof(*pThis), NULL,2488 NULL, NULL, NULL,2489 NULL, vmmdevSave State, NULL,2490 NULL, vmmdevLoad State, vmmdevLoadStateDone);2528 rc = PDMDevHlpSSMRegisterEx(pDevIns, VMMDEV_SAVED_STATE_VERSION, sizeof(*pThis), NULL, 2529 NULL, vmmdevLiveExec, NULL, 2530 NULL, vmmdevSaveExec, NULL, 2531 NULL, vmmdevLoadExec, vmmdevLoadStateDone); 2491 2532 AssertRCReturn(rc, rc); 2492 2533 -
trunk/src/VBox/Devices/VMMDev/VMMDevHGCM.cpp
r23016 r24076 2163 2163 2164 2164 /* @thread EMT */ 2165 int vmmdevHGCMLoadState(VMMDevState *pVMMDevState, PSSMHANDLE pSSM, uint32_t u 32Version)2165 int vmmdevHGCMLoadState(VMMDevState *pVMMDevState, PSSMHANDLE pSSM, uint32_t uVersion) 2166 2166 { 2167 2167 int rc = VINF_SUCCESS; … … 2176 2176 LogFlowFunc(("cCmds = %d\n", cCmds)); 2177 2177 2178 if ( SSM_VERSION_MAJOR(u32Version) == 0 2179 && SSM_VERSION_MINOR(u32Version) < 9) 2178 if (uVersion < 9) 2180 2179 { 2181 2180 /* Only the guest physical address is saved. */ -
trunk/src/VBox/Devices/VMMDev/VMMDevState.h
r23003 r24076 176 176 bool fKeepCredentials; 177 177 178 /** Heap enabled. */ 179 bool fHeapEnabled; 180 178 181 #ifdef VBOX_WITH_HGCM 179 182 /** List of pending HGCM requests, used for saving the HGCM state. */
Note:
See TracChangeset
for help on using the changeset viewer.