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-4.4/arch/x86/mm/init.c

    r28606 r31885  
    629629 * is valid. The argument is a physical page number.
    630630 *
    631  *
    632  * On x86, access has to be given to the first megabyte of ram because that area
    633  * contains BIOS code and data regions used by X and dosemu and similar apps.
    634  * Access has to be given to non-kernel-ram areas as well, these contain the PCI
    635  * mmio resources as well as potential bios/acpi data regions.
     631 * On x86, access has to be given to the first megabyte of RAM because that
     632 * area traditionally contains BIOS code and data regions used by X, dosemu,
     633 * and similar apps. Since they map the entire memory range, the whole range
     634 * must be allowed (for mapping), but any areas that would otherwise be
     635 * disallowed are flagged as being "zero filled" instead of rejected.
     636 * Access has to be given to non-kernel-ram areas as well, these contain the
     637 * PCI mmio resources as well as potential bios/acpi data regions.
    636638 */
    637639int devmem_is_allowed(unsigned long pagenr)
    638640{
    639         if (pagenr < 256)
    640                 return 1;
    641         if (iomem_is_exclusive(pagenr << PAGE_SHIFT))
     641        if (page_is_ram(pagenr)) {
     642                /*
     643                 * For disallowed memory regions in the low 1MB range,
     644                 * request that the page be shown as all zeros.
     645                 */
     646                if (pagenr < 256)
     647                        return 2;
     648
    642649                return 0;
    643         if (!page_is_ram(pagenr))
    644                 return 1;
    645         return 0;
     650        }
     651
     652        /*
     653         * This must follow RAM test, since System RAM is considered a
     654         * restricted resource under CONFIG_STRICT_IOMEM.
     655         */
     656        if (iomem_is_exclusive(pagenr << PAGE_SHIFT)) {
     657                /* Low 1MB bypasses iomem restrictions. */
     658                if (pagenr < 256)
     659                        return 1;
     660
     661                return 0;
     662        }
     663
     664        return 1;
    646665}
    647666
Note: See TracChangeset for help on using the changeset viewer.