summaryrefslogtreecommitdiffstats
path: root/src/VBox/Devices/Graphics/DevVGA.cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-16 22:55:46 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-16 22:55:46 +0000
commit96647a898d62d699808316238dfb933d960413f2 (patch)
tree0138491ada40b7b3fcb80d4b219fa7922ae8f512 /src/VBox/Devices/Graphics/DevVGA.cpp
parentAdding debian version 7.0.14-dfsg-4. (diff)
downloadvirtualbox-96647a898d62d699808316238dfb933d960413f2.tar.xz
virtualbox-96647a898d62d699808316238dfb933d960413f2.zip
Merging upstream version 7.0.16-dfsg.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/VBox/Devices/Graphics/DevVGA.cpp')
-rw-r--r--src/VBox/Devices/Graphics/DevVGA.cpp36
1 files changed, 20 insertions, 16 deletions
diff --git a/src/VBox/Devices/Graphics/DevVGA.cpp b/src/VBox/Devices/Graphics/DevVGA.cpp
index a2ce3b39..e1060783 100644
--- a/src/VBox/Devices/Graphics/DevVGA.cpp
+++ b/src/VBox/Devices/Graphics/DevVGA.cpp
@@ -387,9 +387,9 @@ DECLINLINE(bool) vgaR3IsDirty(PVGASTATE pThis, RTGCPHYS offVRAM)
*/
DECLINLINE(void) vgaR3ResetDirty(PVGASTATE pThis, RTGCPHYS offVRAMStart, RTGCPHYS offVRAMEnd)
{
- Assert(offVRAMStart < pThis->vram_size);
- Assert(offVRAMEnd <= pThis->vram_size);
- Assert(offVRAMStart < offVRAMEnd);
+ AssertReturnVoid(offVRAMStart < pThis->vram_size);
+ AssertReturnVoid(offVRAMEnd <= pThis->vram_size);
+ AssertReturnVoid(offVRAMStart < offVRAMEnd);
ASMBitClearRange(&pThis->bmDirtyBitmap[0], offVRAMStart >> GUEST_PAGE_SHIFT, offVRAMEnd >> GUEST_PAGE_SHIFT);
}
@@ -962,9 +962,9 @@ static void recalculate_data(PVGASTATE pThis)
offStart += offX >> 1;
else
offStart += offX * ((cBPP + 7) >> 3);
- offStart >>= 2;
+
pThis->vbe_line_offset = RT_MIN(cbLinePitch, pThis->vram_size);
- pThis->vbe_start_addr = RT_MIN(offStart, pThis->vram_size);
+ pThis->vbe_start_addr = RT_MIN(offStart, pThis->vram_size) >> 2;
/* The VBE_DISPI_INDEX_VIRT_HEIGHT is used to prevent setting resolution bigger than
* the VRAM size permits. It is used instead of VBE_DISPI_INDEX_YRES *only* in case
@@ -985,10 +985,14 @@ static VBOXSTRICTRC vbe_ioport_write_data(PPDMDEVINS pDevIns, PVGASTATE pThis, P
uint32_t max_bank;
RT_NOREF(pThisCC, addr);
- if (pThis->vbe_index <= VBE_DISPI_INDEX_NB) {
+ uint16_t const idxVbe = pThis->vbe_index;
+ if (idxVbe <= VBE_DISPI_INDEX_NB)
+ {
+ RT_UNTRUSTED_VALIDATED_FENCE();
+
bool fRecalculate = false;
- Log(("VBE: write index=0x%x val=0x%x\n", pThis->vbe_index, val));
- switch(pThis->vbe_index) {
+ Log(("VBE: write index=0x%x val=0x%x\n", idxVbe, val));
+ switch(idxVbe) {
case VBE_DISPI_INDEX_ID:
if (val == VBE_DISPI_ID0 ||
val == VBE_DISPI_ID1 ||
@@ -1003,27 +1007,27 @@ static VBOXSTRICTRC vbe_ioport_write_data(PPDMDEVINS pDevIns, PVGASTATE pThis, P
# endif
val == VBE_DISPI_ID_CFG)
{
- pThis->vbe_regs[pThis->vbe_index] = val;
+ pThis->vbe_regs[VBE_DISPI_INDEX_ID] = val;
}
break;
case VBE_DISPI_INDEX_XRES:
if (val <= VBE_DISPI_MAX_XRES)
{
- pThis->vbe_regs[pThis->vbe_index] = val;
+ pThis->vbe_regs[VBE_DISPI_INDEX_XRES] = val;
pThis->vbe_regs[VBE_DISPI_INDEX_VIRT_WIDTH] = val;
fRecalculate = true;
}
break;
case VBE_DISPI_INDEX_YRES:
if (val <= VBE_DISPI_MAX_YRES)
- pThis->vbe_regs[pThis->vbe_index] = val;
+ pThis->vbe_regs[VBE_DISPI_INDEX_YRES] = val;
break;
case VBE_DISPI_INDEX_BPP:
if (val == 0)
val = 8;
if (val == 4 || val == 8 || val == 15 ||
val == 16 || val == 24 || val == 32) {
- pThis->vbe_regs[pThis->vbe_index] = val;
+ pThis->vbe_regs[VBE_DISPI_INDEX_BPP] = val;
fRecalculate = true;
}
break;
@@ -1039,7 +1043,7 @@ static VBOXSTRICTRC vbe_ioport_write_data(PPDMDEVINS pDevIns, PVGASTATE pThis, P
val &= 0xff;
if (val > max_bank)
val = max_bank;
- pThis->vbe_regs[pThis->vbe_index] = val;
+ pThis->vbe_regs[VBE_DISPI_INDEX_BANK] = val;
pThis->bank_offset = (val << 16);
# ifndef IN_RC
@@ -1143,7 +1147,7 @@ static VBOXSTRICTRC vbe_ioport_write_data(PPDMDEVINS pDevIns, PVGASTATE pThis, P
*/
pThis->bank_offset = 0;
}
- pThis->vbe_regs[pThis->vbe_index] = val;
+ pThis->vbe_regs[VBE_DISPI_INDEX_ENABLE] = val;
/*
* LFB video mode is either disabled or changed. Notify the display
* and reset VBVA.
@@ -1167,7 +1171,7 @@ static VBOXSTRICTRC vbe_ioport_write_data(PPDMDEVINS pDevIns, PVGASTATE pThis, P
case VBE_DISPI_INDEX_X_OFFSET:
case VBE_DISPI_INDEX_Y_OFFSET:
{
- pThis->vbe_regs[pThis->vbe_index] = val;
+ pThis->vbe_regs[idxVbe] = val;
fRecalculate = true;
}
break;
@@ -1185,7 +1189,7 @@ static VBOXSTRICTRC vbe_ioport_write_data(PPDMDEVINS pDevIns, PVGASTATE pThis, P
# endif /* IN_RING3 */
break;
case VBE_DISPI_INDEX_CFG:
- pThis->vbe_regs[pThis->vbe_index] = val;
+ pThis->vbe_regs[VBE_DISPI_INDEX_CFG] = val;
break;
default:
break;