VirtualBox

Changeset 70182 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Dec 17, 2017 1:49:51 PM (7 years ago)
Author:
vboxsync
Message:

devpciR3UpdateMappings: Made PCI MMIO work again with NT 3.51 after some certifiable paranoia broke it in r102718. Not logging the rejection of due to this paranoia attack is something so infuriatingly careless I'm beyond words. Wasted many hours of my time.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Bus/DevPciIch9.cpp

    r70181 r70182  
    17881788                /* Align starting address to region size. */
    17891789                uNew = (uNew + cbRegSize64 - 1) & ~(cbRegSize64 - 1);
    1790                 /* Unconditionally exclude I/O-APIC/HPET/ROM. Pessimistic, but better than causing a mess. */
     1790                /* Unconditionally exclude I/O-APIC/HPET/ROM. Pessimistic, but better than causing a mess. Okay for BIOS. */
    17911791                if (   !uNew
    17921792                    || (uNew <= UINT32_C(0xffffffff) && uNew + cbRegSize64 - 1 >= UINT32_C(0xfec00000))
    17931793                    || uNew >= _4G)
    17941794                {
     1795                    Log2Func(("region #%u: Rejecting address range: %#x LB %#RX64\n", iRegion, uNew, cbRegSize64));
    17951796                    Assert(fDryrun);
    17961797                    return true;
     
    22742275    /* safe, only needs to go to the config space array */
    22752276    uint16_t const u16Cmd = PDMPciDevGetWord(pPciDev, VBOX_PCI_COMMAND);
     2277    Log4(("devpciR3UpdateMappings: dev %u/%u (%s): u16Cmd=%#x\n",
     2278          pPciDev->uDevFn >> VBOX_PCI_DEVFN_DEV_SHIFT, pPciDev->uDevFn & VBOX_PCI_DEVFN_FUN_MASK, pPciDev->pszNameR3, u16Cmd));
    22762279    for (unsigned iRegion = 0; iRegion < VBOX_PCI_NUM_REGIONS; iRegion++)
    22772280    {
     
    23042307                        && uIoBase > 0)
    23052308                        uNew = uIoBase;
     2309                    else
     2310                        Log4(("devpciR3UpdateMappings: dev %u/%u (%s): region #%u: Disregarding invalid I/O port range: %#RX32..%#RX64\n",
     2311                              pPciDev->uDevFn >> VBOX_PCI_DEVFN_DEV_SHIFT, pPciDev->uDevFn & VBOX_PCI_DEVFN_FUN_MASK,
     2312                              pPciDev->pszNameR3, iRegion, uIoBase, uLast));
    23062313                }
    23072314            }
     
    23142321             *       catch silly OSes which probe 64-bit BARs without disabling the
    23152322             *       corresponding transactions.
     2323             *
     2324             * Update: The pure paranoia above broke NT 3.51, so it was changed to only
     2325             *         exclude the 64KB BIOS mapping at the top.  NT 3.51 excludes the
     2326             *         top 256KB, btw.
    23162327             */
     2328            /** @todo Query upper boundrary from CPUM and PGMPhysRom instead of making
     2329             *        incorrect assumptions. */
    23172330            else if (u16Cmd & VBOX_PCI_COMMAND_MEMORY)
    23182331            {
     
    23322345                    uint64_t uLast = uMemBase + cbRegion - 1;
    23332346                    if (   uMemBase < uLast
    2334                         && uMemBase > 0
    2335                         && !(   uMemBase <= UINT32_C(0xffffffff)
    2336                              && uLast    >= UINT32_C(0xfec00000))
     2347                        && uMemBase > 0)
     2348                    {
     2349                        if (   (   uMemBase > UINT32_C(0xffffffff)
     2350                                || uLast    < UINT32_C(0xffff0000) ) /* UINT32_C(0xfec00000) - breaks NT3.51! */
    23372351                            && uMemBase < UINT64_C(0xffffffff00000000) )
    23382352                            uNew = uMemBase;
     2353                        else
     2354                            Log(("devpciR3UpdateMappings: dev %u/%u (%s): region #%u: Rejecting address range: %#RX64..%#RX64!\n",
     2355                                 pPciDev->uDevFn >> VBOX_PCI_DEVFN_DEV_SHIFT, pPciDev->uDevFn & VBOX_PCI_DEVFN_FUN_MASK,
     2356                                 pPciDev->pszNameR3, iRegion, uMemBase, uLast));
     2357                    }
     2358                    else
     2359                        Log2(("devpciR3UpdateMappings: dev %u/%u (%s): region #%u: Disregarding invalid address range: %#RX64..%#RX64\n",
     2360                              pPciDev->uDevFn >> VBOX_PCI_DEVFN_DEV_SHIFT, pPciDev->uDevFn & VBOX_PCI_DEVFN_FUN_MASK,
     2361                              pPciDev->pszNameR3, iRegion, uMemBase, uLast));
    23392362                }
    23402363            }
     
    23432366             * Do real unmapping and/or mapping if the address change.
    23442367             */
     2368            Log4(("devpciR3UpdateMappings: dev %u/%u (%s): iRegion=%u addr=%#RX64 uNew=%#RX64\n",
     2369                  pPciDev->uDevFn >> VBOX_PCI_DEVFN_DEV_SHIFT, pPciDev->uDevFn & VBOX_PCI_DEVFN_FUN_MASK, pPciDev->pszNameR3,
     2370                  iRegion, pRegion->addr, uNew));
    23452371            if (uNew != pRegion->addr)
    23462372            {
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