Ignore:
Timestamp:
Apr 21, 2017, 4:28:29 AM (5 weeks ago)
Author:
brainslayer
Message:

update

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/linux/universal/linux-3.18/arch/x86/mm/init.c

    r27463 r31885  
    582582 *
    583583 *
    584  * On x86, access has to be given to the first megabyte of ram because that area
    585  * contains bios code and data regions used by X and dosemu and similar apps.
    586  * Access has to be given to non-kernel-ram areas as well, these contain the PCI
    587  * mmio resources as well as potential bios/acpi data regions.
     584 * On x86, access has to be given to the first megabyte of RAM because that
     585 * area traditionally contains BIOS code and data regions used by X, dosemu,
     586 * and similar apps. Since they map the entire memory range, the whole range
     587 * must be allowed (for mapping), but any areas that would otherwise be
     588 * disallowed are flagged as being "zero filled" instead of rejected.
     589 * Access has to be given to non-kernel-ram areas as well, these contain the
     590 * PCI mmio resources as well as potential bios/acpi data regions.
    588591 */
    589592int devmem_is_allowed(unsigned long pagenr)
    590593{
    591         if (pagenr < 256)
    592                 return 1;
    593         if (iomem_is_exclusive(pagenr << PAGE_SHIFT))
     594        if (page_is_ram(pagenr)) {
     595                /*
     596                 * For disallowed memory regions in the low 1MB range,
     597                 * request that the page be shown as all zeros.
     598                 */
     599                if (pagenr < 256)
     600                        return 2;
     601
    594602                return 0;
    595         if (!page_is_ram(pagenr))
    596                 return 1;
    597         return 0;
     603        }
     604
     605        /*
     606         * This must follow RAM test, since System RAM is considered a
     607         * restricted resource under CONFIG_STRICT_IOMEM.
     608         */
     609        if (iomem_is_exclusive(pagenr << PAGE_SHIFT)) {
     610                /* Low 1MB bypasses iomem restrictions. */
     611                if (pagenr < 256)
     612                        return 1;
     613
     614                return 0;
     615        }
     616
     617        return 1;
    598618}
    599619
Note: See TracChangeset for help on using the changeset viewer.