VirtualBox

Changeset 4670 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Sep 10, 2007 2:39:23 PM (17 years ago)
Author:
vboxsync
Message:

Eliminated one MMPhysGCPhys2HCVirt user.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/PC/DevPcBios.cpp

    r4485 r4670  
    2929#include <iprt/string.h>
    3030#include <VBox/err.h>
     31#include <VBox/param.h>
    3132
    3233#include "Builtins.h"
     
    938939     * Paranoia: Check that the BIOS ROM hasn't changed.
    939940     */
    940     PVM pVM = PDMDevHlpGetVM(pDevIns);
     941    uint8_t abBuf[PAGE_SIZE];
     942
    941943    /* the low ROM mapping. */
    942944    unsigned cb = RT_MIN(g_cbPcBiosBinary, 128 * _1K);
    943     const uint8_t *pb1 = (uint8_t *)MMPhysGCPhys2HCVirt(pVM, 0x00100000 - cb, cb);
    944     AssertRelease(pb1);
    945     const uint8_t *pb2 = &g_abPcBiosBinary[g_cbPcBiosBinary - cb];
    946     if (memcmp(pb1, pb2, cb))
    947     {
    948         AssertMsg2("low ROM mismatch! cb=%#x\n", cb);
    949         for (unsigned off = 0; off < cb; off++)
    950             if (pb1[off] != pb2[off])
    951                 AssertMsg2("%05x: %02x expected %02x\n", off, pb1[off], pb2[off]);
    952         AssertReleaseFailed();
     945    RTGCPHYS GCPhys = 0x00100000 - cb;
     946    const uint8_t *pbVirgin = &g_abPcBiosBinary[g_cbPcBiosBinary - cb];
     947    while (GCPhys < 0x00100000)
     948    {
     949        PDMDevHlpPhysRead(pDevIns, GCPhys, abBuf, PAGE_SIZE);
     950        if (memcmp(abBuf, pbVirgin, PAGE_SIZE))
     951        {
     952            LogRel(("low ROM mismatch! GCPhys=%VGp - Ignore if you've loaded an old saved state with an different VirtualBox version.\n", GCPhys));
     953            for (unsigned off = 0; off < PAGE_SIZE; off++)
     954                if (abBuf[off] != pbVirgin[off])
     955                    LogRel(("%VGp: %02x expected %02x\n", GCPhys + off, abBuf[off], pbVirgin[off]));
     956            AssertFailed();
     957        }
     958
     959        /* next page */
     960        GCPhys += PAGE_SIZE;
     961        pbVirgin += PAGE_SIZE;
    953962    }
    954963
    955964    /* the high ROM mapping. */
    956     pb1 = (uint8_t *)MMPhysGCPhys2HCVirt(pVM, (uint32_t)-g_cbPcBiosBinary, g_cbPcBiosBinary);
    957     AssertRelease(pb1);
    958     pb2 = &g_abPcBiosBinary[0];
    959     if (memcmp(pb1, pb2, g_cbPcBiosBinary))
    960     {
    961         AssertMsg2("high ROM mismatch! g_cbPcBiosBinary=%#x\n", g_cbPcBiosBinary);
    962         for (unsigned off = 0; off < g_cbPcBiosBinary; off++)
    963             if (pb1[off] != pb2[off])
    964                 AssertMsg2("%05x: %02x expected %02x\n", off, pb1[off], pb2[off]);
    965         AssertReleaseFailed();
     965    GCPhys = UINT32_C(0xffffffff) - (g_cbPcBiosBinary - 1);
     966    pbVirgin = &g_abPcBiosBinary[0];
     967    while (pbVirgin < &g_abPcBiosBinary[g_cbPcBiosBinary])
     968    {
     969        PDMDevHlpPhysRead(pDevIns, GCPhys, abBuf, PAGE_SIZE);
     970        if (memcmp(abBuf, pbVirgin, PAGE_SIZE))
     971        {
     972            LogRel(("high ROM mismatch! GCPhys=%VGp - Ignore if you've loaded an old saved state with an different VirtualBox version.\n", GCPhys));
     973            for (unsigned off = 0; off < PAGE_SIZE; off++)
     974                if (abBuf[off] != pbVirgin[off])
     975                    LogRel(("%VGp: %02x expected %02x\n", GCPhys + off, abBuf[off], pbVirgin[off]));
     976            AssertFailed();
     977        }
     978
     979        /* next page */
     980        GCPhys += PAGE_SIZE;
     981        pbVirgin += PAGE_SIZE;
    966982    }
    967983#endif
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette