Changeset 33174 in vbox
- Timestamp:
- Oct 16, 2010 6:10:47 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 66710
- Location:
- trunk/src/VBox/Devices/Graphics
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Graphics/DevVGA.cpp
r33146 r33174 4851 4851 4852 4852 /** 4853 * Info handler, device version. Dumps VGA Graphics Controller registers. 4854 * 4855 * @param pDevIns Device instance which registered the info. 4856 * @param pHlp Callback functions for doing output. 4857 * @param pszArgs Argument string. Optional and specific to the handler. 4858 */ 4859 static DECLCALLBACK(void) vgaInfoGR(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs) 4860 { 4861 PVGASTATE s = PDMINS_2_DATA(pDevIns, PVGASTATE); 4862 unsigned i; 4863 4864 pHlp->pfnPrintf(pHlp, "VGA Graphics Controller (3CF): GR index 3CE:%02X\n", s->gr_index); 4865 Assert(sizeof(s->gr) >= 9); 4866 for (i = 0; i < 9; ++i) 4867 { 4868 pHlp->pfnPrintf(pHlp, " GR%02X:%02X", i, s->gr[i]); 4869 } 4870 pHlp->pfnPrintf(pHlp, "\n"); 4871 } 4872 4873 /** 4853 4874 * Info handler, device version. Dumps VGA Sequencer registers. 4854 4875 * … … 6191 6212 } 6192 6213 #endif 6214 if (pThis->pu8VgaBios) 6215 { 6216 MMR3HeapFree(pThis->pu8VgaBios); 6217 pThis->pu8VgaBios = NULL; 6218 } 6219 6220 if (pThis->pszVgaBiosFile) 6221 { 6222 MMR3HeapFree(pThis->pszVgaBiosFile); 6223 pThis->pszVgaBiosFile = NULL; 6224 } 6193 6225 6194 6226 if (pThis->pszLogoFile) … … 6273 6305 "LogoFile\0" 6274 6306 "ShowBootMenu\0" 6307 "BiosRom\0" 6275 6308 "CustomVideoModes\0" 6276 6309 "HeightReduction\0" … … 6550 6583 } 6551 6584 6585 /* 6586 * Get the VGA BIOS ROM file name. 6587 */ 6588 rc = CFGMR3QueryStringAlloc(pCfg, "BiosRom", &pThis->pszVgaBiosFile); 6589 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 6590 { 6591 pThis->pszVgaBiosFile = NULL; 6592 rc = VINF_SUCCESS; 6593 } 6594 else if (RT_FAILURE(rc)) 6595 return PDMDEV_SET_ERROR(pDevIns, rc, 6596 N_("Configuration error: Querying \"BiosRom\" as a string failed")); 6597 else if (!*pThis->pszVgaBiosFile) 6598 { 6599 MMR3HeapFree(pThis->pszVgaBiosFile); 6600 pThis->pszVgaBiosFile = NULL; 6601 } 6602 6603 const uint8_t *pu8VgaBiosBinary = NULL; 6604 uint64_t cbVgaBiosBinary; 6605 /* 6606 * Determine the VGA BIOS ROM size, open specified ROM file in the process. 6607 */ 6608 RTFILE FileVgaBios = NIL_RTFILE; 6609 if (pThis->pszVgaBiosFile) 6610 { 6611 rc = RTFileOpen(&FileVgaBios, pThis->pszVgaBiosFile, 6612 RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_WRITE); 6613 if (RT_SUCCESS(rc)) 6614 { 6615 rc = RTFileGetSize(FileVgaBios, &pThis->cbVgaBios); 6616 if (RT_SUCCESS(rc)) 6617 { 6618 if ( RT_ALIGN(pThis->cbVgaBios, _4K) != pThis->cbVgaBios 6619 || pThis->cbVgaBios > _64K 6620 || pThis->cbVgaBios < 16 * _1K) 6621 rc = VERR_TOO_MUCH_DATA; 6622 } 6623 } 6624 if (RT_FAILURE(rc)) 6625 { 6626 /* 6627 * In case of failure simply fall back to the built-in VGA BIOS ROM. 6628 */ 6629 Log(("vgaConstruct: Failed to open VGA BIOS ROM file '%s', rc=%Rrc!\n", pThis->pszVgaBiosFile, rc)); 6630 RTFileClose(FileVgaBios); 6631 FileVgaBios = NIL_RTFILE; 6632 MMR3HeapFree(pThis->pszVgaBiosFile); 6633 pThis->pszVgaBiosFile = NULL; 6634 } 6635 } 6636 6637 /* 6638 * Attempt to get the VGA BIOS ROM data from file. 6639 */ 6640 if (pThis->pszVgaBiosFile) 6641 { 6642 /* 6643 * Allocate buffer for the VGA BIOS ROM data. 6644 */ 6645 pThis->pu8VgaBios = (uint8_t *)PDMDevHlpMMHeapAlloc(pDevIns, pThis->cbVgaBios); 6646 if (pThis->pu8VgaBios) 6647 { 6648 rc = RTFileRead(FileVgaBios, pThis->pu8VgaBios, pThis->cbVgaBios, NULL); 6649 if (RT_FAILURE(rc)) 6650 { 6651 AssertMsgFailed(("RTFileRead(,,%d,NULL) -> %Rrc\n", pThis->cbVgaBios, rc)); 6652 MMR3HeapFree(pThis->pu8VgaBios); 6653 pThis->pu8VgaBios = NULL; 6654 } 6655 rc = VINF_SUCCESS; 6656 } 6657 else 6658 rc = VERR_NO_MEMORY; 6659 } 6660 else 6661 pThis->pu8VgaBios = NULL; 6662 6663 /* cleanup */ 6664 if (FileVgaBios != NIL_RTFILE) 6665 RTFileClose(FileVgaBios); 6666 6667 /* If we were unable to get the data from file for whatever reason, fall 6668 back to the built-in ROM image. */ 6669 uint32_t fFlags = 0; 6670 if (pThis->pu8VgaBios == NULL) 6671 { 6672 pu8VgaBiosBinary = g_abVgaBiosBinary; 6673 cbVgaBiosBinary = g_cbVgaBiosBinary; 6674 fFlags = PGMPHYS_ROM_FLAGS_PERMANENT_BINARY; 6675 } 6676 else 6677 { 6678 pu8VgaBiosBinary = pThis->pu8VgaBios; 6679 cbVgaBiosBinary = pThis->cbVgaBios; 6680 } 6681 6552 6682 AssertReleaseMsg(g_cbVgaBiosBinary <= _64K && g_cbVgaBiosBinary >= 32*_1K, ("g_cbVgaBiosBinary=%#x\n", g_cbVgaBiosBinary)); 6553 6683 AssertReleaseMsg(RT_ALIGN_Z(g_cbVgaBiosBinary, PAGE_SIZE) == g_cbVgaBiosBinary, ("g_cbVgaBiosBinary=%#x\n", g_cbVgaBiosBinary)); 6554 rc = PDMDevHlpROMRegister(pDevIns, 0x000c0000, g_cbVgaBiosBinary, &g_abVgaBiosBinary[0],6555 PGMPHYS_ROM_FLAGS_PERMANENT_BINARY, "VGA BIOS");6684 rc = PDMDevHlpROMRegister(pDevIns, 0x000c0000, cbVgaBiosBinary, pu8VgaBiosBinary, 6685 fFlags, "VGA BIOS"); 6556 6686 if (RT_FAILURE(rc)) 6557 6687 return rc; … … 6800 6930 PDMDevHlpDBGFInfoRegister(pDevIns, "vgatext", "Display VGA memory formatted as text.", vgaInfoText); 6801 6931 PDMDevHlpDBGFInfoRegister(pDevIns, "vgacr", "Dump VGA CRTC registers.", vgaInfoCR); 6932 PDMDevHlpDBGFInfoRegister(pDevIns, "vgagr", "Dump VGA Graphics Controller registers.", vgaInfoGR); 6802 6933 PDMDevHlpDBGFInfoRegister(pDevIns, "vgasr", "Dump VGA Sequencer registers.", vgaInfoSR); 6803 6934 PDMDevHlpDBGFInfoRegister(pDevIns, "vgaar", "Dump VGA Attribute Controller registers.", vgaInfoAR); -
trunk/src/VBox/Devices/Graphics/DevVGA.h
r33146 r33174 406 406 /** Palette data. */ 407 407 uint32_t au32LogoPalette[256]; 408 /** The VGA BIOS ROM data. */ 409 uint8_t *pu8VgaBios; 410 /** The size of the VGA BIOS ROM. */ 411 uint64_t cbVgaBios; 412 /** The name of the VGA BIOS ROM file. */ 413 char *pszVgaBiosFile; 408 414 #endif /* VBOX */ 409 415 #ifdef VBOX_WITH_HGSMI
Note:
See TracChangeset
for help on using the changeset viewer.