Changeset 95461 in vbox for trunk/src/VBox/Devices/Graphics
- Timestamp:
- Jun 30, 2022 12:56:31 PM (3 years ago)
- Location:
- trunk/src/VBox/Devices/Graphics
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Graphics/DevVGA.cpp
r95292 r95461 301 301 302 302 /** 303 * Mark a page in VGA A0000-AFFFF range as remapped. 304 * 305 * @param pThis VGA instance data. 306 * @param offVGAMem The offset within VGA memory. 307 */ 308 DECLINLINE(void) vgaMarkRemapped(PVGASTATE pThis, RTGCPHYS offVGAMem) 309 { 310 AssertMsg(offVGAMem < _64K, ("offVGAMem = %p > 64K\n", offVGAMem)); 311 ASMBitSet(&pThis->bmPageMapBitmap, offVGAMem >> GUEST_PAGE_SHIFT); 312 pThis->fRemappedVGA = true; 313 } 314 315 /** 316 * Checks if a page in VGA A0000-AFFFF range is remapped. 317 * 318 * @returns true if remapped. 319 * @returns false if not remapped (accesses will trap). 320 * @param pThis VGA instance data. 321 * @param offVGAMem The offset within VGA memory. 322 */ 323 DECLINLINE(bool) vgaIsRemapped(PVGASTATE pThis, RTGCPHYS offVGAMem) 324 { 325 AssertMsg(offVGAMem < _64K, ("offVGAMem = %p > 64K\n", offVGAMem)); 326 return ASMBitTest(&pThis->bmPageMapBitmap, offVGAMem >> GUEST_PAGE_SHIFT); 327 } 328 329 /** 330 * Reset page remap tracking bits. 331 * 332 * @param pThis VGA instance data. 333 */ 334 DECLINLINE(void) vgaResetRemapped(PVGASTATE pThis) 335 { 336 pThis->fRemappedVGA = false; 337 ASMBitClearRange(&pThis->bmPageMapBitmap, 0, _64K >> GUEST_PAGE_SHIFT); 338 } 339 340 /** 303 341 * Set a VRAM page dirty. 304 342 * … … 699 737 { 700 738 PDMDevHlpMmioResetRegion(pDevIns, pThis->hMmioLegacy); 701 pThis->fRemappedVGA = false;739 vgaResetRemapped(pThis); 702 740 } 703 741 } … … 738 776 { 739 777 PDMDevHlpMmioResetRegion(pDevIns, pThis->hMmioLegacy); 740 pThis->fRemappedVGA = false;778 vgaResetRemapped(pThis); 741 779 } 742 780 } … … 996 1034 { 997 1035 PDMDevHlpMmioResetRegion(pDevIns, pThis->hMmioLegacy); 998 pThis->fRemappedVGA = false;1036 vgaResetRemapped(pThis); 999 1037 } 1000 1038 # endif … … 1105 1143 { 1106 1144 PDMDevHlpMmioResetRegion(pDevIns, pThis->hMmioLegacy); 1107 pThis->fRemappedVGA = false;1145 vgaResetRemapped(pThis); 1108 1146 } 1109 1147 break; … … 1200 1238 /* If all planes are accessible, then map the page to the frame buffer and make it writable. */ 1201 1239 if ( (pThis->sr[2] & 3) == 3 1202 && !vgaIs Dirty(pThis, addr)1240 && !vgaIsRemapped(pThis, GCPhys - 0xa0000) 1203 1241 && pThis->GCPhysVRAM) 1204 1242 { … … 1209 1247 /* Set as dirty as write accesses won't be noticed now. */ 1210 1248 vgaR3MarkDirty(pThis, addr); 1211 pThis->fRemappedVGA = true;1249 vgaMarkRemapped(pThis, GCPhys - 0xa0000); 1212 1250 } 1213 1251 #endif /* !IN_RC */ … … 1309 1347 /* If all planes are accessible, then map the page to the frame buffer and make it writable. */ 1310 1348 if ( (pThis->sr[2] & 3) == 3 1311 && !vgaIs Dirty(pThis, addr)1349 && !vgaIsRemapped(pThis, GCPhys - 0xa0000) 1312 1350 && pThis->GCPhysVRAM) 1313 1351 { … … 1315 1353 PDMDevHlpMmioMapMmio2Page(pDevIns, pThis->hMmioLegacy, GCPhys - 0xa0000, 1316 1354 pThis->hMmio2VRam, addr, X86_PTE_RW | X86_PTE_P); 1317 pThis->fRemappedVGA = true;1355 vgaMarkRemapped(pThis, GCPhys - 0xa0000); 1318 1356 } 1319 1357 #endif /* !IN_RC */ … … 4655 4693 pHlp->pfnPrintf(pHlp, " Linear display start : 0x%04x\n", pThis->vbe_start_addr); 4656 4694 pHlp->pfnPrintf(pHlp, " Selected bank: 0x%04x\n", pThis->vbe_regs[VBE_DISPI_INDEX_BANK]); 4695 pHlp->pfnPrintf(pHlp, " DAC: %d-bit\n", pThis->vbe_regs[VBE_DISPI_INDEX_ENABLE] & VBE_DISPI_8BIT_DAC ? 8 : 6); 4657 4696 } 4658 4697 } … … 4808 4847 { 4809 4848 PDMDevHlpMmioResetRegion(pDevIns, pThis->hMmioLegacy); 4810 pThis->fRemappedVGA = false;4849 vgaResetRemapped(pThis); 4811 4850 } 4812 4851 … … 4836 4875 { 4837 4876 PDMDevHlpMmioResetRegion(pDevIns, pThis->hMmioLegacy); 4838 pThis->fRemappedVGA = false;4877 vgaResetRemapped(pThis); 4839 4878 } 4840 4879 … … 6057 6096 { 6058 6097 PDMDevHlpMmioResetRegion(pDevIns, pThis->hMmioLegacy); 6059 pThis->fRemappedVGA = false;6098 vgaResetRemapped(pThis); 6060 6099 } 6061 6100 -
trunk/src/VBox/Devices/Graphics/DevVGA.h
r93944 r95461 352 352 /** Bitmap tracking dirty pages. */ 353 353 uint64_t bmDirtyBitmap[VGA_VRAM_MAX / GUEST_PAGE_SIZE / 64]; 354 /** Bitmap tracking remapped pages (only needs 16 bits). */ 355 uint64_t bmPageMapBitmap; 354 356 355 357 /** Flag indicating that there are dirty bits. This is used to optimize the handler resetting. */ … … 526 528 AssertCompileMemberAlignment(VGASTATE, last_ch_attr, 8); 527 529 AssertCompileMemberAlignment(VGASTATE, u32Marker, 8); 530 AssertCompile(sizeof(uint64_t)/*bmPageMapBitmap*/ >= (_64K / GUEST_PAGE_SIZE / 8)); 528 531 #endif 529 532
Note:
See TracChangeset
for help on using the changeset viewer.