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