vbox的更動 7635 路徑 trunk/src/VBox/Devices/Graphics
- 時間撮記:
- 2008-3-28 下午05:15:38 (17 年 以前)
- 檔案:
-
- 修改 1 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/Devices/Graphics/DevVGA.cpp
r7259 r7635 1999 1999 for(y = 0; y < height; y++) { 2000 2000 addr = addr1; 2001 /* CGA/MDA compatibility. Note that these addresses are all 2001 /* CGA/MDA compatibility. Note that these addresses are all 2002 2002 * shifted left by two compared to VGA specs. 2003 2003 */ … … 4108 4108 4109 4109 /** 4110 * Callback function for mapping an PCI I/O region.4110 * Callback function for unmapping and/or mapping the VRAM MMIO2 region (called by the PCI bus). 4111 4111 * 4112 4112 * @return VBox status code. … … 4121 4121 { 4122 4122 int rc; 4123 PVGASTATE pData = PDMINS2DATA(pPciDev->pDevIns, PVGASTATE); 4123 PPDMDEVINS pDevIns = pPciDev->pDevIns; 4124 PVGASTATE pData = PDMINS2DATA(pDevIns, PVGASTATE); 4124 4125 LogFlow(("vgaR3IORegionMap: iRegion=%d GCPhysAddress=%VGp cb=%#x enmType=%d\n", iRegion, GCPhysAddress, cb, enmType)); 4125 4126 /* 4127 * VRam mapping. 4128 */ 4129 if (iRegion == 0 && enmType == PCI_ADDRESS_SPACE_MEM_PREFETCH) 4126 AssertReturn(iRegion == 0 && enmType == PCI_ADDRESS_SPACE_MEM_PREFETCH, VERR_INTERNAL_ERROR); 4127 4128 if (GCPhysAddress != NIL_RTGCPHYS) 4130 4129 { 4131 4130 /* 4132 * Register and lock the VRAM. 4133 * 4134 * Windows usually re-initializes the PCI devices, so we have to check whether the memory was 4135 * already registered before trying to do that all over again. 4131 * Mapping the VRAM. 4136 4132 */ 4137 PVM pVM = PDMDevHlpGetVM(pPciDev->pDevIns); 4138 if (pData->GCPhysVRAM) 4133 rc = PDMDevHlpMMIO2Map(pDevIns, iRegion, GCPhysAddress); 4134 AssertRC(rc); 4135 if (RT_SUCCESS(rc)) 4139 4136 { 4140 AssertMsg(pData->GCPhysVRAM == GCPhysAddress, 4141 ("The Guest OS relocated our LFB! old GCPhysVRAM=%VGp new GCPhysAddress=%VGp\n", 4142 pData->GCPhysVRAM, GCPhysAddress)); 4143 rc = VINF_SUCCESS; 4144 } 4145 else 4146 { 4147 /* 4148 * Register and lock the VRAM. 4149 */ 4150 rc = MMR3PhysRegister(pVM, pData->vram_ptrHC, GCPhysAddress, pData->vram_size, MM_RAM_FLAGS_MMIO2, "VRam"); 4151 if (VBOX_SUCCESS(rc)) 4152 { 4153 if (!pData->GCPhysVRAM) 4154 rc = PGMR3HandlerPhysicalRegister(pVM, PGMPHYSHANDLERTYPE_PHYSICAL_WRITE, 4155 GCPhysAddress, GCPhysAddress + (pData->vram_size - 1), 4156 vgaR3LFBAccessHandler, pData, 4157 g_DeviceVga.szR0Mod, "vgaR0LFBAccessHandler", pData->pDevInsHC->pvInstanceDataR0, 4158 g_DeviceVga.szGCMod, "vgaGCLFBAccessHandler", pData->pDevInsHC->pvInstanceDataGC, 4159 "VGA LFB"); 4160 if (VBOX_SUCCESS(rc)) 4161 { 4162 /* 4163 * Map the first 256KB of the VRAM into GC for GC VGA support. 4164 */ 4165 RTGCPTR GCPtr; 4166 rc = MMR3HyperMapGCPhys(pVM, GCPhysAddress, VGA_MAPPING_SIZE, "VGA VRam", &GCPtr); 4167 if (VBOX_SUCCESS(rc)) 4168 { 4169 MMR3HyperReserve(pVM, PAGE_SIZE, "fence", NULL); 4170 4171 pData->vram_ptrGC = GCPtr; 4172 pData->GCPhysVRAM = GCPhysAddress; 4173 return VINF_SUCCESS; 4174 } 4175 AssertMsgFailed(("MMR3HyperMapGCPhys failed, rc=%Vrc\n", rc)); 4176 } 4177 else 4178 AssertMsgFailed(("Failed to register write handler for VRAM! rc=%Vrc\n", rc)); 4179 } 4180 else 4181 AssertReleaseMsgFailed(("Failed to register VRAM! rc=%Vra\n", rc)); 4182 } 4183 return rc; 4137 rc = PGMR3HandlerPhysicalRegister(PDMDevHlpGetVM(pDevIns), 4138 PGMPHYSHANDLERTYPE_PHYSICAL_WRITE, 4139 GCPhysAddress, GCPhysAddress + (pData->vram_size - 1), 4140 vgaR3LFBAccessHandler, pData, 4141 g_DeviceVga.szR0Mod, "vgaR0LFBAccessHandler", pDevIns->pvInstanceDataR0, 4142 g_DeviceVga.szGCMod, "vgaGCLFBAccessHandler", pDevIns->pvInstanceDataGC, 4143 "VGA LFB"); 4144 AssertRC(rc); 4145 if (RT_SUCCESS(rc)) 4146 pData->GCPhysVRAM = GCPhysAddress; 4147 } 4184 4148 } 4185 4149 else 4186 AssertReleaseMsgFailed(("Huh!?! iRegion=%d enmType=%d\n", iRegion, enmType)); 4187 return VERR_INTERNAL_ERROR; 4150 { 4151 /* 4152 * Unmapping of the VRAM in progress. 4153 * Deregister the access handler so PGM doesn't get upset. 4154 */ 4155 Assert(pData->GCPhysVRAM); 4156 rc = PGMHandlerPhysicalDeregister(PDMDevHlpGetVM(pDevIns), pData->GCPhysVRAM); 4157 AssertRC(rc); 4158 pData->GCPhysVRAM = 0; 4159 } 4160 return rc; 4188 4161 } 4189 4162 … … 4619 4592 4620 4593 /* 4594 * Allocate the VRAM and map the first 256KB of it into GC so we can speed up VGA support. 4595 */ 4596 rc = PDMDevHlpMMIO2Register(pDevIns, 0 /* iRegion */, pData->vram_size, (void **)&pData->vram_ptrHC, "VRam"); 4597 AssertMsgRC(rc, ("PDMDevHlpMMIO2Register(%#x,) -> %Rrc\n", pData->vram_size, rc)); 4598 4599 rc = PDMDevHlpMMHyperMapMMIO2(pDevIns, 0 /* iRegion */, 0 /* off */, VGA_MAPPING_SIZE, "VGA VRam", &pData->vram_ptrGC); 4600 AssertMsgRC(rc, ("MMR3HyperMapGCPhys(%#x,) -> %Rrc\n", pData->vram_size, rc)); 4601 4602 /* 4621 4603 * Register I/O ports, ROM and save state. 4622 4604 */ … … 4762 4744 AssertReleaseMsg(g_cbVgaBiosBinary <= _64K && g_cbVgaBiosBinary >= 32*_1K, ("g_cbVgaBiosBinary=%#x\n", g_cbVgaBiosBinary)); 4763 4745 AssertReleaseMsg(RT_ALIGN_Z(g_cbVgaBiosBinary, PAGE_SIZE) == g_cbVgaBiosBinary, ("g_cbVgaBiosBinary=%#x\n", g_cbVgaBiosBinary)); 4764 rc = PDMDevHlpROMRegister(pDevIns, 0x000c0000, g_cbVgaBiosBinary, &g_abVgaBiosBinary[0], 4746 rc = PDMDevHlpROMRegister(pDevIns, 0x000c0000, g_cbVgaBiosBinary, &g_abVgaBiosBinary[0], 4765 4747 false /* fShadow */, "VGA BIOS"); 4766 4748 if (VBOX_FAILURE(rc)) … … 4781 4763 if (pData->Dev.devfn != 16 && iInstance == 0) 4782 4764 Log(("!!WARNING!!: pData->dev.devfn=%d (ignore if testcase or no started by Main)\n", pData->Dev.devfn)); 4783 rc = PDMDevHlpPCIIORegionRegister(pDevIns, 0, pData->vram_size, PCI_ADDRESS_SPACE_MEM_PREFETCH, vgaR3IORegionMap); 4765 4766 rc = PDMDevHlpPCIIORegionRegister(pDevIns, 0 /* iRegion */, pData->vram_size, PCI_ADDRESS_SPACE_MEM_PREFETCH, vgaR3IORegionMap); 4784 4767 if (VBOX_FAILURE(rc)) 4785 4768 return rc; … … 4798 4781 if (VBOX_FAILURE(rc)) 4799 4782 return rc; 4800 4801 /*4802 * Allocate the VRAM.4803 */4804 rc = SUPPageAlloc(pData->vram_size >> PAGE_SHIFT, (void **)&pData->vram_ptrHC);4805 if (VBOX_FAILURE(rc))4806 {4807 AssertMsgFailed(("SUPPageAlloc(%#x,) -> %d\n", pData->vram_size, rc));4808 return rc;4809 }4810 4783 4811 4784 #ifdef VBE_NEW_DYN_LIST
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器