aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mm/mmap.c
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /arch/arm/mm/mmap.c
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'arch/arm/mm/mmap.c')
-rw-r--r--arch/arm/mm/mmap.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/arch/arm/mm/mmap.c b/arch/arm/mm/mmap.c
index 4f5b39687df5..74be05f3e03a 100644
--- a/arch/arm/mm/mmap.c
+++ b/arch/arm/mm/mmap.c
@@ -7,6 +7,7 @@
7#include <linux/shm.h> 7#include <linux/shm.h>
8#include <linux/sched.h> 8#include <linux/sched.h>
9#include <linux/io.h> 9#include <linux/io.h>
10#include <linux/personality.h>
10#include <linux/random.h> 11#include <linux/random.h>
11#include <asm/cputype.h> 12#include <asm/cputype.h>
12#include <asm/system.h> 13#include <asm/system.h>
@@ -31,7 +32,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
31 struct mm_struct *mm = current->mm; 32 struct mm_struct *mm = current->mm;
32 struct vm_area_struct *vma; 33 struct vm_area_struct *vma;
33 unsigned long start_addr; 34 unsigned long start_addr;
34#ifdef CONFIG_CPU_V6 35#if defined(CONFIG_CPU_V6) || defined(CONFIG_CPU_V6K)
35 unsigned int cache_type; 36 unsigned int cache_type;
36 int do_align = 0, aliasing = 0; 37 int do_align = 0, aliasing = 0;
37 38
@@ -82,7 +83,8 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
82 mm->cached_hole_size = 0; 83 mm->cached_hole_size = 0;
83 } 84 }
84 /* 8 bits of randomness in 20 address space bits */ 85 /* 8 bits of randomness in 20 address space bits */
85 if (current->flags & PF_RANDOMIZE) 86 if ((current->flags & PF_RANDOMIZE) &&
87 !(current->personality & ADDR_NO_RANDOMIZE))
86 addr += (get_random_int() % (1 << 8)) << PAGE_SHIFT; 88 addr += (get_random_int() % (1 << 8)) << PAGE_SHIFT;
87 89
88full_search: 90full_search:
@@ -144,3 +146,25 @@ int valid_mmap_phys_addr_range(unsigned long pfn, size_t size)
144{ 146{
145 return !(pfn + (size >> PAGE_SHIFT) > 0x00100000); 147 return !(pfn + (size >> PAGE_SHIFT) > 0x00100000);
146} 148}
149
150#ifdef CONFIG_STRICT_DEVMEM
151
152#include <linux/ioport.h>
153
154/*
155 * devmem_is_allowed() checks to see if /dev/mem access to a certain
156 * address is valid. The argument is a physical page number.
157 * We mimic x86 here by disallowing access to system RAM as well as
158 * device-exclusive MMIO regions. This effectively disable read()/write()
159 * on /dev/mem.
160 */
161int devmem_is_allowed(unsigned long pfn)
162{
163 if (iomem_is_exclusive(pfn << PAGE_SHIFT))
164 return 0;
165 if (!page_is_ram(pfn))
166 return 1;
167 return 0;
168}
169
170#endif