- Timestamp:
- Nov 18, 2010 12:16:43 PM (14 years ago)
- svn:sync-xref-src-repo-rev:
- 67884
- Location:
- trunk/src/VBox
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/EFI/DevEFI.cpp
r33540 r34163 801 801 cbQuart, 802 802 pThis->pu8EfiRom, 803 cbQuart, 803 804 PGMPHYS_ROM_FLAGS_SHADOWED | PGMPHYS_ROM_FLAGS_PERMANENT_BINARY, 804 805 "EFI Firmware Volume"); … … 809 810 cbQuart, 810 811 pThis->pu8EfiRom + cbQuart, 812 cbQuart, 811 813 PGMPHYS_ROM_FLAGS_SHADOWED | PGMPHYS_ROM_FLAGS_PERMANENT_BINARY, 812 814 "EFI Firmware Volume (Part 2)"); … … 817 819 cbQuart, 818 820 pThis->pu8EfiRom + cbQuart * 2, 821 cbQuart, 819 822 PGMPHYS_ROM_FLAGS_SHADOWED | PGMPHYS_ROM_FLAGS_PERMANENT_BINARY, 820 823 "EFI Firmware Volume (Part 3)"); … … 825 828 pThis->cbEfiRom - cbQuart * 3, 826 829 pThis->pu8EfiRom + cbQuart * 3, 830 pThis->cbEfiRom - cbQuart * 3, 827 831 PGMPHYS_ROM_FLAGS_SHADOWED | PGMPHYS_ROM_FLAGS_PERMANENT_BINARY, 828 832 "EFI Firmware Volume (Part 4)"); … … 887 891 /* Register the page as a ROM (data will be copied). */ 888 892 rc = PDMDevHlpROMRegister(pThis->pDevIns, UINT32_C(0xfffff000), PAGE_SIZE, 889 pThis->pu8EfiThunk, 893 pThis->pu8EfiThunk, PAGE_SIZE, 890 894 PGMPHYS_ROM_FLAGS_PERMANENT_BINARY, "EFI Thunk"); 891 895 if (RT_FAILURE(rc)) … … 902 906 */ 903 907 rc = PDMDevHlpROMRegister(pThis->pDevIns, 0xff000, PAGE_SIZE, 904 pThis->pu8EfiThunk, 908 pThis->pu8EfiThunk, PAGE_SIZE, 905 909 PGMPHYS_ROM_FLAGS_PERMANENT_BINARY, "EFI Thunk (2)"); 906 910 if (RT_FAILURE(rc)) … … 1205 1209 _4K - VBOX_DMI_TABLE_SIZE, 1206 1210 pThis->cCpus); 1207 rc = PDMDevHlpROMRegister(pDevIns, VBOX_DMI_TABLE_BASE, _4K, pThis->au8DMIPage, 1211 rc = PDMDevHlpROMRegister(pDevIns, VBOX_DMI_TABLE_BASE, _4K, pThis->au8DMIPage, _4K, 1208 1212 PGMPHYS_ROM_FLAGS_PERMANENT_BINARY, "DMI tables"); 1209 1213 -
trunk/src/VBox/Devices/Graphics/DevVGA.cpp
r34129 r34163 6007 6007 AssertReleaseMsg(g_cbVgaBiosBinary <= _64K && g_cbVgaBiosBinary >= 32*_1K, ("g_cbVgaBiosBinary=%#x\n", g_cbVgaBiosBinary)); 6008 6008 AssertReleaseMsg(RT_ALIGN_Z(g_cbVgaBiosBinary, PAGE_SIZE) == g_cbVgaBiosBinary, ("g_cbVgaBiosBinary=%#x\n", g_cbVgaBiosBinary)); 6009 rc = PDMDevHlpROMRegister(pDevIns, 0x000c0000, cbVgaBiosBinary, pu8VgaBiosBinary, 6009 rc = PDMDevHlpROMRegister(pDevIns, 0x000c0000, cbVgaBiosBinary, pu8VgaBiosBinary, cbVgaBiosBinary, 6010 6010 fFlags, "VGA BIOS"); 6011 6011 if (RT_FAILURE(rc)) -
trunk/src/VBox/Devices/PC/DevACPI.cpp
r34035 r34163 2781 2781 return rc; 2782 2782 2783 rc = PDMDevHlpROMRegister(pDevIns, GCPhysRsdp, 0x1000, s->au8RSDPPage, 2783 rc = PDMDevHlpROMRegister(pDevIns, GCPhysRsdp, 0x1000, s->au8RSDPPage, 0x1000, 2784 2784 PGMPHYS_ROM_FLAGS_PERMANENT_BINARY, "ACPI RSDP"); 2785 2785 if (RT_FAILURE(rc)) -
trunk/src/VBox/Devices/PC/DevPcBios.cpp
r34081 r34163 1069 1069 _4K - VBOX_DMI_TABLE_SIZE, pThis->cCpus); 1070 1070 1071 rc = PDMDevHlpROMRegister(pDevIns, VBOX_DMI_TABLE_BASE, _4K, pThis->au8DMIPage, 1071 rc = PDMDevHlpROMRegister(pDevIns, VBOX_DMI_TABLE_BASE, _4K, pThis->au8DMIPage, _4K, 1072 1072 PGMPHYS_ROM_FLAGS_PERMANENT_BINARY, "DMI tables"); 1073 1073 if (RT_FAILURE(rc)) … … 1255 1255 ("cbPcBiosBinary=%#x\n", cbPcBiosBinary)); 1256 1256 cb = RT_MIN(cbPcBiosBinary, 128 * _1K); /* Effectively either 64 or 128K. */ 1257 rc = PDMDevHlpROMRegister(pDevIns, 0x00100000 - cb, cb, &pu8PcBiosBinary[cbPcBiosBinary - cb], 1257 rc = PDMDevHlpROMRegister(pDevIns, 0x00100000 - cb, cb, &pu8PcBiosBinary[cbPcBiosBinary - cb], cb, 1258 1258 fFlags, "PC BIOS - 0xfffff"); 1259 1259 if (RT_FAILURE(rc)) 1260 1260 return rc; 1261 rc = PDMDevHlpROMRegister(pDevIns, (uint32_t)-(int32_t)cbPcBiosBinary, cbPcBiosBinary, pu8PcBiosBinary, 1261 rc = PDMDevHlpROMRegister(pDevIns, (uint32_t)-(int32_t)cbPcBiosBinary, cbPcBiosBinary, pu8PcBiosBinary, cbPcBiosBinary, 1262 1262 fFlags, "PC BIOS - 0xffffffff"); 1263 1263 if (RT_FAILURE(rc)) … … 1370 1370 pThis->cbLanBoot = cbLanBootBinary; 1371 1371 1372 rc = PDMDevHlpROMRegister(pDevIns, VBOX_LANBOOT_SEG << 4, cbLanBootBinary, pu8LanBootBinary, 1372 rc = PDMDevHlpROMRegister(pDevIns, VBOX_LANBOOT_SEG << 4, cbLanBootBinary, pu8LanBootBinary, cbLanBootBinary, 1373 1373 PGMPHYS_ROM_FLAGS_SHADOWED, "Net Boot ROM"); 1374 1374 AssertRCReturn(rc, rc); -
trunk/src/VBox/VMM/PDMDevHlp.cpp
r33799 r34163 506 506 507 507 /** @interface_method_impl{PDMDEVHLPR3,pfnROMRegister} */ 508 static DECLCALLBACK(int) pdmR3DevHlp_ROMRegister(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTUINT cbRange, const void *pvBinary, uint32_t fFlags, const char *pszDesc) 508 static DECLCALLBACK(int) pdmR3DevHlp_ROMRegister(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTUINT cbRange, 509 const void *pvBinary, uint32_t cbBinary, uint32_t fFlags, const char *pszDesc) 509 510 { 510 511 PDMDEV_ASSERT_DEVINS(pDevIns); 511 512 VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3); 512 LogFlow(("pdmR3DevHlp_ROMRegister: caller='%s'/%d: GCPhysStart=%RGp cbRange=%#x pvBinary=%p fFlags=%#RX32 pszDesc=%p:{%s}\n",513 pDevIns->pReg->szName, pDevIns->iInstance, GCPhysStart, cbRange, pvBinary, fFlags, pszDesc, pszDesc));513 LogFlow(("pdmR3DevHlp_ROMRegister: caller='%s'/%d: GCPhysStart=%RGp cbRange=%#x pvBinary=%p cbBinary=%#x fFlags=%#RX32 pszDesc=%p:{%s}\n", 514 pDevIns->pReg->szName, pDevIns->iInstance, GCPhysStart, cbRange, pvBinary, cbBinary, fFlags, pszDesc, pszDesc)); 514 515 515 516 /** @todo can we mangle pszDesc? */ 516 int rc = PGMR3PhysRomRegister(pDevIns->Internal.s.pVMR3, pDevIns, GCPhysStart, cbRange, pvBinary, fFlags, pszDesc);517 int rc = PGMR3PhysRomRegister(pDevIns->Internal.s.pVMR3, pDevIns, GCPhysStart, cbRange, pvBinary, cbBinary, fFlags, pszDesc); 517 518 518 519 LogFlow(("pdmR3DevHlp_ROMRegister: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc)); -
trunk/src/VBox/VMM/PGMInternal.h
r34149 r34163 1389 1389 uint8_t au8Alignment[3]; 1390 1390 /** Alignment padding ensuring that aPages is sizeof(PGMROMPAGE) aligned. */ 1391 uint32_t au32Alignemnt[HC_ARCH_BITS == 32 ? 6 : 2]; 1391 uint32_t au32Alignemnt[HC_ARCH_BITS == 32 ? 5 : 1]; 1392 /** The size bits pvOriginal points to. */ 1393 uint32_t cbOriginal; 1392 1394 /** Pointer to the original bits when PGMPHYS_ROM_FLAGS_PERMANENT_BINARY was specified. 1393 1395 * This is used for strictness checks. */ -
trunk/src/VBox/VMM/PGMPhys.cpp
r33780 r34163 2768 2768 * @param GCPhys First physical address in the range. 2769 2769 * Must be page aligned! 2770 * @param cb RangeThe size of the range (in bytes).2770 * @param cb The size of the range (in bytes). 2771 2771 * Must be page aligned! 2772 2772 * @param pvBinary Pointer to the binary data backing the ROM image. 2773 * This must be exactly \a cbRange in size. 2773 * @param cbBinary The size of the binary data pvBinary points to. 2774 * This must be less or equal to @a cb. 2774 2775 * @param fFlags Mask of flags. PGMPHYS_ROM_FLAGS_SHADOWED 2775 2776 * and/or PGMPHYS_ROM_FLAGS_PERMANENT_BINARY. … … 2781 2782 */ 2782 2783 VMMR3DECL(int) PGMR3PhysRomRegister(PVM pVM, PPDMDEVINS pDevIns, RTGCPHYS GCPhys, RTGCPHYS cb, 2783 const void *pvBinary, uint32_t fFlags, const char *pszDesc)2784 { 2785 Log(("PGMR3PhysRomRegister: pDevIns=%p GCPhys=%RGp(-%RGp) cb=%RGp pvBinary=%p fFlags=%#x pszDesc=%s\n",2786 pDevIns, GCPhys, GCPhys + cb, cb, pvBinary, fFlags, pszDesc));2784 const void *pvBinary, uint32_t cbBinary, uint32_t fFlags, const char *pszDesc) 2785 { 2786 Log(("PGMR3PhysRomRegister: pDevIns=%p GCPhys=%RGp(-%RGp) cb=%RGp pvBinary=%p cbBinary=%#x fFlags=%#x pszDesc=%s\n", 2787 pDevIns, GCPhys, GCPhys + cb, cb, pvBinary, cbBinary, fFlags, pszDesc)); 2787 2788 2788 2789 /* … … 3016 3017 * This must be done after linking in the RAM range. 3017 3018 */ 3018 PPGMPAGE pRamPage = &pRamNew->aPages[(GCPhys - pRamNew->GCPhys) >> PAGE_SHIFT]; 3019 size_t cbBinaryLeft = cbBinary; 3020 PPGMPAGE pRamPage = &pRamNew->aPages[(GCPhys - pRamNew->GCPhys) >> PAGE_SHIFT]; 3019 3021 for (uint32_t iPage = 0; iPage < cPages; iPage++, pRamPage++) 3020 3022 { … … 3026 3028 break; 3027 3029 } 3028 memcpy(pvDstPage, (const uint8_t *)pvBinary + (iPage << PAGE_SHIFT), PAGE_SIZE); 3030 if (cbBinary >= PAGE_SIZE) 3031 { 3032 memcpy(pvDstPage, (uint8_t const *)pvBinary + ((size_t)iPage << PAGE_SHIFT), PAGE_SIZE); 3033 cbBinaryLeft -= PAGE_SIZE; 3034 } 3035 else 3036 { 3037 ASMMemZeroPage(pvDstPage); /* (shouldn't be necessary, but can't hurt either) */ 3038 if (cbBinaryLeft > 0) 3039 { 3040 memcpy(pvDstPage, (uint8_t const *)pvBinary + ((size_t)iPage << PAGE_SHIFT), cbBinaryLeft); 3041 cbBinaryLeft = 0; 3042 } 3043 } 3029 3044 } 3030 3045 if (RT_SUCCESS(rc)) … … 3034 3049 * Note that the Virgin member of the pages has already been initialized above. 3035 3050 */ 3036 pRomNew->GCPhys = GCPhys;3051 pRomNew->GCPhys = GCPhys; 3037 3052 pRomNew->GCPhysLast = GCPhysLast; 3038 pRomNew->cb = cb;3039 pRomNew->fFlags = fFlags;3053 pRomNew->cb = cb; 3054 pRomNew->fFlags = fFlags; 3040 3055 pRomNew->idSavedState = UINT8_MAX; 3056 pRomNew->cbOriginal = cbBinary; 3041 3057 #ifdef VBOX_STRICT 3042 3058 pRomNew->pvOriginal = fFlags & PGMPHYS_ROM_FLAGS_PERMANENT_BINARY 3043 ? pvBinary : RTMemDup(pvBinary, c Pages * PAGE_SIZE);3059 ? pvBinary : RTMemDup(pvBinary, cbBinary); 3044 3060 #else 3045 3061 pRomNew->pvOriginal = fFlags & PGMPHYS_ROM_FLAGS_PERMANENT_BINARY ? pvBinary : NULL; 3046 3062 #endif 3047 pRomNew->pszDesc = pszDesc;3063 pRomNew->pszDesc = pszDesc; 3048 3064 3049 3065 for (unsigned iPage = 0; iPage < cPages; iPage++) … … 3291 3307 if (pRom->pvOriginal) 3292 3308 { 3309 size_t cbSrcLeft = pRom->cbOriginal; 3293 3310 uint8_t const *pbSrcPage = (uint8_t const *)pRom->pvOriginal; 3294 for (uint32_t iPage = 0; iPage < cPages ; iPage++, pbSrcPage += PAGE_SIZE)3311 for (uint32_t iPage = 0; iPage < cPages && cbSrcLeft > 0; iPage++, pbSrcPage += PAGE_SIZE) 3295 3312 { 3296 3313 const RTGCPHYS GCPhys = pRom->GCPhys + (iPage << PAGE_SHIFT); … … 3299 3316 if (RT_FAILURE(rc)) 3300 3317 break; 3301 if (memcmp(pvDstPage, pbSrcPage, PAGE_SIZE)) 3318 3319 if (memcmp(pvDstPage, pbSrcPage, RT_MIN(cbSrcLeft, PAGE_SIZE))) 3302 3320 LogRel(("pgmR3PhysRomReset: %RGp rom page changed (%s) - loaded saved state?\n", 3303 3321 GCPhys, pRom->pszDesc)); 3322 cbSrcLeft -= RT_MIN(cbSrcLeft, PAGE_SIZE); 3304 3323 } 3305 3324 } -
trunk/src/VBox/VMM/testcase/tstVMStructRC.cpp
r32489 r34163 694 694 GEN_CHECK_OFF(PGMROMRANGE, cb); 695 695 GEN_CHECK_OFF(PGMROMRANGE, fFlags); 696 GEN_CHECK_OFF(PGMROMRANGE, cbOriginal); 696 697 GEN_CHECK_OFF(PGMROMRANGE, pvOriginal); 697 698 GEN_CHECK_OFF(PGMROMRANGE, pszDesc);
Note:
See TracChangeset
for help on using the changeset viewer.