Changeset 20092 in vbox for trunk/src/VBox/Devices/PC/DevAPIC.cpp
- Timestamp:
- May 27, 2009 3:19:32 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 47839
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/PC/DevAPIC.cpp
r20087 r20092 59 59 /** @def APIC_LOCK 60 60 * Acquires the PDM lock. */ 61 #define APIC_LOCK(pThis, rc ) \61 #define APIC_LOCK(pThis, rcBusy) \ 62 62 do { \ 63 int rc2 = (pThis)->CTX_SUFF(pApicHlp)->pfnLock((pThis)->CTX_SUFF(pDevIns), rc); \63 int rc2 = PDMCritSectEnter((pThis)->CTX_SUFF(pCritSect), (rcBusy)); \ 64 64 if (rc2 != VINF_SUCCESS) \ 65 65 return rc2; \ … … 68 68 /** @def APIC_LOCK_VOID 69 69 * Acquires the PDM lock and does not expect failure (i.e. ring-3 only!). */ 70 #define APIC_LOCK_VOID(pThis, rc ) \70 #define APIC_LOCK_VOID(pThis, rcBusy) \ 71 71 do { \ 72 int rc2 = (pThis)->CTX_SUFF(pApicHlp)->pfnLock((pThis)->CTX_SUFF(pDevIns), rc); \72 int rc2 = PDMCritSectEnter((pThis)->CTX_SUFF(pCritSect), (rcBusy)); \ 73 73 AssertLogRelRCReturnVoid(rc2); \ 74 74 } while (0) … … 77 77 * Releases the PDM lock. */ 78 78 #define APIC_UNLOCK(pThis) \ 79 (pThis)->CTX_SUFF(pApicHlp)->pfnUnlock((pThis)->CTX_SUFF(pDevIns))79 PDMCritSectLeave((pThis)->CTX_SUFF(pCritSect)) 80 80 81 81 /** @def IOAPIC_LOCK … … 281 281 { 282 282 /** The device instance - R3 Ptr. */ 283 PPDMDEVINSR3 pDevInsR3;283 PPDMDEVINSR3 pDevInsR3; 284 284 /** The APIC helpers - R3 Ptr. */ 285 PCPDMAPICHLPR3 pApicHlpR3;285 PCPDMAPICHLPR3 pApicHlpR3; 286 286 /** LAPICs states - R3 Ptr */ 287 RTR3PTR pLapicsR3; 287 RTR3PTR pLapicsR3; 288 /** The critical section - R3 Ptr. */ 289 R3PTRTYPE(PPDMCRITSECT) pCritSectR3; 288 290 289 291 /** The device instance - R0 Ptr. */ 290 PPDMDEVINSR0 pDevInsR0;292 PPDMDEVINSR0 pDevInsR0; 291 293 /** The APIC helpers - R0 Ptr. */ 292 PCPDMAPICHLPR0 pApicHlpR0;294 PCPDMAPICHLPR0 pApicHlpR0; 293 295 /** LAPICs states - R0 Ptr */ 294 RTR0PTR pLapicsR0; 296 RTR0PTR pLapicsR0; 297 /** The critical section - R3 Ptr. */ 298 R0PTRTYPE(PPDMCRITSECT) pCritSectR0; 295 299 296 300 /** The device instance - RC Ptr. */ 297 PPDMDEVINSRC pDevInsRC;301 PPDMDEVINSRC pDevInsRC; 298 302 /** The APIC helpers - RC Ptr. */ 299 PCPDMAPICHLPRC pApicHlpRC;303 PCPDMAPICHLPRC pApicHlpRC; 300 304 /** LAPICs states - RC Ptr */ 301 RTRCPTR pLapicsRC; 305 RTRCPTR pLapicsRC; 306 /** The critical section - R3 Ptr. */ 307 RCPTRTYPE(PPDMCRITSECT) pCritSectRC; 308 RTRCPTR Padding0; 302 309 303 310 /** APIC specification version in this virtual hardware configuration. */ 304 PDMAPICVERSION enmVersion;311 PDMAPICVERSION enmVersion; 305 312 306 313 /** Number of attempts made to optimize TPR accesses. */ 307 uint32_t ulTPRPatchAttempts;314 uint32_t cTPRPatchAttempts; 308 315 309 316 /** Number of CPUs on the system (same as LAPIC count). */ 310 uint32_t cCpus;317 uint32_t cCpus; 311 318 312 319 # ifdef VBOX_WITH_STATISTICS … … 1306 1313 APICState *s = (APICState *)pvUser; 1307 1314 Assert(s->pTimerR3 == pTimer); 1308 1309 APIC_LOCK_VOID(dev, VERR_INTERNAL_ERROR);1310 1315 # endif /* VBOX */ 1311 1316 … … 1315 1320 } 1316 1321 apic_timer_update(dev, s, s->next_time); 1317 1318 # ifdef VBOX1319 APIC_UNLOCK(dev);1320 # endif1321 1322 } 1322 1323 #endif /* IN_RING3 */ … … 2057 2058 2058 2059 if ( index == 0x08 /* TPR */ 2059 && ++s-> ulTPRPatchAttempts < APIC_MAX_PATCH_ATTEMPTS)2060 && ++s->cTPRPatchAttempts < APIC_MAX_PATCH_ATTEMPTS) 2060 2061 { 2061 2062 #ifdef IN_RC … … 2178 2179 static DECLCALLBACK(void) apicRelocate(PPDMDEVINS pDevIns, RTGCINTPTR offDelta) 2179 2180 { 2180 APICDeviceInfo *dev = PDMINS_2_DATA(pDevIns, APICDeviceInfo *); 2181 dev->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns); 2182 dev->pApicHlpRC = dev->pApicHlpR3->pfnGetRCHelpers(pDevIns); 2183 dev->pLapicsRC = MMHyperR3ToRC(PDMDevHlpGetVM(pDevIns), dev->pLapicsR3); 2184 foreach_apic(dev, 0xffffffff, 2181 APICDeviceInfo *pThis = PDMINS_2_DATA(pDevIns, APICDeviceInfo *); 2182 pThis->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns); 2183 pThis->pApicHlpRC = pThis->pApicHlpR3->pfnGetRCHelpers(pDevIns); 2184 pThis->pLapicsRC = MMHyperR3ToRC(PDMDevHlpGetVM(pDevIns), pThis->pLapicsR3); 2185 pThis->pCritSectRC = pThis->pApicHlpR3->pfnGetRCCritSect(pDevIns); 2186 foreach_apic(pThis, 0xffffffff, 2185 2187 apic->pTimerRC = TMTimerRCPtr(apic->CTX_SUFF(pTimer))); 2186 2188 } … … 2346 2348 return rc; 2347 2349 } 2350 pThis->pCritSectR3 = pThis->pApicHlpR3->pfnGetR3CritSect(pDevIns); 2348 2351 2349 2352 /* … … 2376 2379 2377 2380 if (fGCEnabled) { 2378 pThis->pApicHlpRC = pThis->pApicHlpR3->pfnGetRCHelpers(pDevIns); 2381 pThis->pApicHlpRC = pThis->pApicHlpR3->pfnGetRCHelpers(pDevIns); 2382 pThis->pCritSectRC = pThis->pApicHlpR3->pfnGetRCCritSect(pDevIns); 2379 2383 2380 2384 rc = PDMDevHlpMMIORegisterGC(pDevIns, LAPIC_BASE(pThis)->apicbase & ~0xfff, 0x1000, 0, … … 2385 2389 2386 2390 if (fR0Enabled) { 2387 pThis->pApicHlpR0 = pThis->pApicHlpR3->pfnGetR0Helpers(pDevIns); 2391 pThis->pApicHlpR0 = pThis->pApicHlpR3->pfnGetR0Helpers(pDevIns); 2392 pThis->pCritSectR0 = pThis->pApicHlpR3->pfnGetR0CritSect(pDevIns); 2388 2393 2389 2394 rc = PDMDevHlpMMIORegisterR0(pDevIns, LAPIC_BASE(pThis)->apicbase & ~0xfff, 0x1000, 0, … … 2404 2409 apic->pTimerR0 = TMTimerR0Ptr(apic->pTimerR3); 2405 2410 apic->pTimerRC = TMTimerRCPtr(apic->pTimerR3); 2406 /// @todo TMTimerSetCritSect(apic->pTimerR3, pThis->pApicHlpR3->pfnGetCritSect(..));2411 TMR3TimerSetCritSect(apic->pTimerR3, pThis->pCritSectR3); 2407 2412 apic++; 2408 2413 }
Note:
See TracChangeset
for help on using the changeset viewer.