Changeset 34163 in vbox for trunk/src/VBox/VMM
- Timestamp:
- Nov 18, 2010 12:16:43 PM (14 years ago)
- svn:sync-xref-src-repo-rev:
- 67884
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
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.