Changeset 71698 in vbox
- Timestamp:
- Apr 6, 2018 10:18:48 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Graphics/DevVGA.cpp
r71687 r71698 69 69 # define VERIFY_VRAM_WRITE_OFF_RETURN(pThis, off) \ 70 70 do { \ 71 if ((off) >= VGA_MAPPING_SIZE) \ 71 if ((off) < VGA_MAPPING_SIZE) \ 72 RT_UNTRUSTED_VALIDATED_FENCE(); \ 73 else \ 72 74 { \ 73 75 AssertMsgReturn((off) < (pThis)->vram_size, ("%RX32 !< %RX32\n", (uint32_t)(off), (pThis)->vram_size), VINF_SUCCESS); \ … … 78 80 #else 79 81 # define VERIFY_VRAM_WRITE_OFF_RETURN(pThis, off) \ 80 AssertMsgReturn((off) < (pThis)->vram_size, ("%RX32 !< %RX32\n", (uint32_t)(off), (pThis)->vram_size), VINF_SUCCESS) 82 do { \ 83 AssertMsgReturn((off) < (pThis)->vram_size, ("%RX32 !< %RX32\n", (uint32_t)(off), (pThis)->vram_size), VINF_SUCCESS); \ 84 RT_UNTRUSTED_VALIDATED_FENCE(); \ 85 } while (0) 81 86 #endif 82 87 … … 85 90 # define VERIFY_VRAM_READ_OFF_RETURN(pThis, off, rcVar) \ 86 91 do { \ 87 if ((off) >= VGA_MAPPING_SIZE) \ 92 if ((off) < VGA_MAPPING_SIZE) \ 93 RT_UNTRUSTED_VALIDATED_FENCE(); \ 94 else \ 88 95 { \ 89 96 AssertMsgReturn((off) < (pThis)->vram_size, ("%RX32 !< %RX32\n", (uint32_t)(off), (pThis)->vram_size), 0xff); \ … … 97 104 do { \ 98 105 AssertMsgReturn((off) < (pThis)->vram_size, ("%RX32 !< %RX32\n", (uint32_t)(off), (pThis)->vram_size), 0xff); \ 106 RT_UNTRUSTED_VALIDATED_FENCE(); \ 99 107 NOREF(rcVar); \ 100 108 } while (0) … … 645 653 break; 646 654 case 0x3c9: 655 Assert(pThis->dac_sub_index < 3); 647 656 val = pThis->palette[pThis->dac_read_index * 3 + pThis->dac_sub_index]; 648 657 if (++pThis->dac_sub_index == 3) { … … 777 786 break; 778 787 case 0x3c9: 788 Assert(pThis->dac_sub_index < 3); 779 789 pThis->dac_cache[pThis->dac_sub_index] = val; 780 790 if (++pThis->dac_sub_index == 3) { … … 789 799 case 0x3cf: 790 800 Log2(("vga: write GR%x = 0x%02x\n", pThis->gr_index, val)); 801 Assert(pThis->gr_index < RT_ELEMENTS(gr_mask)); 791 802 pThis->gr[pThis->gr_index] = val & gr_mask[pThis->gr_index]; 792 803 … … 880 891 NOREF(addr); 881 892 882 if (pThis->vbe_index < VBE_DISPI_INDEX_NB) { 883 if (pThis->vbe_regs[VBE_DISPI_INDEX_ENABLE] & VBE_DISPI_GETCAPS) { 884 switch(pThis->vbe_index) { 893 uint16_t const idxVbe = pThis->vbe_index; 894 if (idxVbe < VBE_DISPI_INDEX_NB) 895 { 896 RT_UNTRUSTED_VALIDATED_FENCE(); 897 if (pThis->vbe_regs[VBE_DISPI_INDEX_ENABLE] & VBE_DISPI_GETCAPS) 898 { 899 switch (idxVbe) 900 { 885 901 /* XXX: do not hardcode ? */ 886 case VBE_DISPI_INDEX_XRES: 887 val = VBE_DISPI_MAX_XRES; 888 break; 889 case VBE_DISPI_INDEX_YRES: 890 val = VBE_DISPI_MAX_YRES; 891 break; 892 case VBE_DISPI_INDEX_BPP: 893 val = VBE_DISPI_MAX_BPP; 894 break; 895 default: 896 Assert(pThis->vbe_index < VBE_DISPI_INDEX_NB); 897 val = pThis->vbe_regs[pThis->vbe_index]; 898 break; 899 } 900 } else { 901 switch(pThis->vbe_index) { 902 case VBE_DISPI_INDEX_VBOX_VIDEO: 903 /* Reading from the port means that the old additions are requesting the number of monitors. */ 904 val = 1; 905 break; 906 case VBE_DISPI_INDEX_CFG: 907 val = vbe_read_cfg(pThis); 908 break; 909 default: 910 Assert(pThis->vbe_index < VBE_DISPI_INDEX_NB); 911 val = pThis->vbe_regs[pThis->vbe_index]; 912 break; 913 } 914 } 915 } else { 902 case VBE_DISPI_INDEX_XRES: 903 val = VBE_DISPI_MAX_XRES; 904 break; 905 case VBE_DISPI_INDEX_YRES: 906 val = VBE_DISPI_MAX_YRES; 907 break; 908 case VBE_DISPI_INDEX_BPP: 909 val = VBE_DISPI_MAX_BPP; 910 break; 911 default: 912 Assert(idxVbe < VBE_DISPI_INDEX_NB); 913 val = pThis->vbe_regs[idxVbe]; 914 break; 915 } 916 } 917 else 918 { 919 switch (idxVbe) 920 { 921 case VBE_DISPI_INDEX_VBOX_VIDEO: 922 /* Reading from the port means that the old additions are requesting the number of monitors. */ 923 val = 1; 924 break; 925 case VBE_DISPI_INDEX_CFG: 926 val = vbe_read_cfg(pThis); 927 break; 928 default: 929 Assert(idxVbe < VBE_DISPI_INDEX_NB); 930 val = pThis->vbe_regs[idxVbe]; 931 break; 932 } 933 } 934 } 935 else 916 936 val = 0; 917 } 918 Log(("VBE: read index=0x%x val=0x%x\n", pThis->vbe_index, val)); 937 Log(("VBE: read index=0x%x val=0x%x\n", idxVbe, val)); 919 938 return val; 920 939 } … … 3781 3800 pThis->u16VBEExtraAddress, pThis->u16VBEExtraAddress, pThis->cbVBEExtraData, pThis->cbVBEExtraData)); 3782 3801 } 3783 else if (cb == 1)3784 {3785 *pu32 = pThis->pbVBEExtraData[pThis->u16VBEExtraAddress] & 0xFF;3786 3787 Log(("vbeIOPortReadVBEExtra: cb=%#x %.*Rhxs\n", cb, cb, pu32));3788 }3789 else if (cb == 2)3790 {3791 *pu32 = pThis->pbVBEExtraData[pThis->u16VBEExtraAddress]3792 | (uint32_t)pThis->pbVBEExtraData[pThis->u16VBEExtraAddress + 1] << 8;3793 3794 Log(("vbeIOPortReadVBEExtra: cb=%#x %.*Rhxs\n", cb, cb, pu32));3795 }3796 3802 else 3797 3803 { 3798 Log(("vbeIOPortReadVBEExtra: Invalid cb=%d read from the VBE Extra port!!!\n", cb)); 3799 rc = VERR_IOM_IOPORT_UNUSED; 3804 RT_UNTRUSTED_VALIDATED_FENCE(); 3805 if (cb == 1) 3806 { 3807 *pu32 = pThis->pbVBEExtraData[pThis->u16VBEExtraAddress] & 0xFF; 3808 3809 Log(("vbeIOPortReadVBEExtra: cb=%#x %.*Rhxs\n", cb, cb, pu32)); 3810 } 3811 else if (cb == 2) 3812 { 3813 *pu32 = pThis->pbVBEExtraData[pThis->u16VBEExtraAddress] 3814 | (uint32_t)pThis->pbVBEExtraData[pThis->u16VBEExtraAddress + 1] << 8; 3815 3816 Log(("vbeIOPortReadVBEExtra: cb=%#x %.*Rhxs\n", cb, cb, pu32)); 3817 } 3818 else 3819 { 3820 Log(("vbeIOPortReadVBEExtra: Invalid cb=%d read from the VBE Extra port!!!\n", cb)); 3821 rc = VERR_IOM_IOPORT_UNUSED; 3822 } 3800 3823 } 3801 3824 … … 4182 4205 NOREF(Port); 4183 4206 4184 4185 4207 if (pThis->offLogoData + cb > pThis->cbLogo) 4186 4208 { … … 4189 4211 return VINF_SUCCESS; 4190 4212 } 4213 RT_UNTRUSTED_VALIDATED_FENCE(); 4191 4214 4192 4215 PCRTUINT64U p = (PCRTUINT64U)&pThis->pbLogo[pThis->offLogoData]; … … 4895 4918 * @see PDMIDISPLAYPORT::pfnTakeScreenshot() for details. 4896 4919 */ 4897 static DECLCALLBACK(int) vgaPortTakeScreenshot(PPDMIDISPLAYPORT pInterface, uint8_t **ppbData, size_t *pcbData, uint32_t *pcx, uint32_t *pcy) 4920 static DECLCALLBACK(int) vgaPortTakeScreenshot(PPDMIDISPLAYPORT pInterface, uint8_t **ppbData, size_t *pcbData, 4921 uint32_t *pcx, uint32_t *pcy) 4898 4922 { 4899 4923 PVGASTATE pThis = IDISPLAYPORT_2_VGASTATE(pInterface); … … 5021 5045 * @see PDMIDISPLAYPORT::pfnDisplayBlt() for details. 5022 5046 */ 5023 static DECLCALLBACK(int) vgaPortDisplayBlt(PPDMIDISPLAYPORT pInterface, const void *pvData, uint32_t x, uint32_t y, uint32_t cx, uint32_t cy) 5047 static DECLCALLBACK(int) vgaPortDisplayBlt(PPDMIDISPLAYPORT pInterface, const void *pvData, uint32_t x, uint32_t y, 5048 uint32_t cx, uint32_t cy) 5024 5049 { 5025 5050 PVGASTATE pThis = IDISPLAYPORT_2_VGASTATE(pInterface);
Note:
See TracChangeset
for help on using the changeset viewer.