diff options
Diffstat (limited to 'arch/x86/mm/init_64.c')
-rw-r--r-- | arch/x86/mm/init_64.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c index b798e7b92b17..0cca62663037 100644 --- a/arch/x86/mm/init_64.c +++ b/arch/x86/mm/init_64.c | |||
@@ -663,6 +663,26 @@ EXPORT_SYMBOL_GPL(memory_add_physaddr_to_nid); | |||
663 | 663 | ||
664 | #endif /* CONFIG_MEMORY_HOTPLUG */ | 664 | #endif /* CONFIG_MEMORY_HOTPLUG */ |
665 | 665 | ||
666 | /* | ||
667 | * devmem_is_allowed() checks to see if /dev/mem access to a certain address | ||
668 | * is valid. The argument is a physical page number. | ||
669 | * | ||
670 | * | ||
671 | * On x86, access has to be given to the first megabyte of ram because that area | ||
672 | * contains bios code and data regions used by X and dosemu and similar apps. | ||
673 | * Access has to be given to non-kernel-ram areas as well, these contain the PCI | ||
674 | * mmio resources as well as potential bios/acpi data regions. | ||
675 | */ | ||
676 | int devmem_is_allowed(unsigned long pagenr) | ||
677 | { | ||
678 | if (pagenr <= 256) | ||
679 | return 1; | ||
680 | if (!page_is_ram(pagenr)) | ||
681 | return 1; | ||
682 | return 0; | ||
683 | } | ||
684 | |||
685 | |||
666 | static struct kcore_list kcore_mem, kcore_vmalloc, kcore_kernel, | 686 | static struct kcore_list kcore_mem, kcore_vmalloc, kcore_kernel, |
667 | kcore_modules, kcore_vsyscall; | 687 | kcore_modules, kcore_vsyscall; |
668 | 688 | ||