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

update

File:
1 edited

Legend:

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

    r31574 r31885  
    644644 * is valid. The argument is a physical page number.
    645645 *
    646  *
    647  * On x86, access has to be given to the first megabyte of ram because that area
    648  * contains BIOS code and data regions used by X and dosemu and similar apps.
    649  * Access has to be given to non-kernel-ram areas as well, these contain the PCI
    650  * mmio resources as well as potential bios/acpi data regions.
     646 * On x86, access has to be given to the first megabyte of RAM because that
     647 * area traditionally contains BIOS code and data regions used by X, dosemu,
     648 * and similar apps. Since they map the entire memory range, the whole range
     649 * must be allowed (for mapping), but any areas that would otherwise be
     650 * disallowed are flagged as being "zero filled" instead of rejected.
     651 * Access has to be given to non-kernel-ram areas as well, these contain the
     652 * PCI mmio resources as well as potential bios/acpi data regions.
    651653 */
    652654int devmem_is_allowed(unsigned long pagenr)
    653655{
    654         if (pagenr < 256)
    655                 return 1;
    656         if (iomem_is_exclusive(pagenr << PAGE_SHIFT))
     656        if (page_is_ram(pagenr)) {
     657                /*
     658                 * For disallowed memory regions in the low 1MB range,
     659                 * request that the page be shown as all zeros.
     660                 */
     661                if (pagenr < 256)
     662                        return 2;
     663
    657664                return 0;
    658         if (!page_is_ram(pagenr))
    659                 return 1;
    660         return 0;
     665        }
     666
     667        /*
     668         * This must follow RAM test, since System RAM is considered a
     669         * restricted resource under CONFIG_STRICT_IOMEM.
     670         */
     671        if (iomem_is_exclusive(pagenr << PAGE_SHIFT)) {
     672                /* Low 1MB bypasses iomem restrictions. */
     673                if (pagenr < 256)
     674                        return 1;
     675
     676                return 0;
     677        }
     678
     679        return 1;
    661680}
    662681
Note: See TracChangeset for help on using the changeset viewer.